1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Fix custom css requiring page refresh

This commit is contained in:
Bill Thornton 2025-03-24 13:11:25 -04:00
parent 88b247596a
commit a0ddea0bfc
3 changed files with 9 additions and 20 deletions

View file

@ -1,29 +1,18 @@
import React, { FC, useEffect, useState } from 'react';
import React, { type FC } from 'react';
import { useApi } from 'hooks/useApi';
import { useUserSettings } from 'hooks/useUserSettings';
import { useBrandingOptions } from 'apps/dashboard/features/branding/api/useBrandingOptions';
const CustomCss: FC = () => {
const { api } = useApi();
const { data: brandingOptions } = useBrandingOptions();
const { customCss: userCustomCss, disableCustomCss } = useUserSettings();
const [ brandingCssUrl, setBrandingCssUrl ] = useState<string>();
useEffect(() => {
if (!api) return;
setBrandingCssUrl(api.getUri('/Branding/Css.css'));
}, [ api ]);
if (!api) return null;
return (
<>
{!disableCustomCss && brandingCssUrl && (
<link
rel='stylesheet'
type='text/css'
href={brandingCssUrl}
/>
{!disableCustomCss && brandingOptions?.CustomCss && (
<style>
{brandingOptions.CustomCss}
</style>
)}
{userCustomCss && (
<style>

View file

@ -1,4 +1,4 @@
import React, { FC, useEffect, useState } from 'react';
import React, { type FC, useEffect, useState } from 'react';
import { useUserTheme } from 'hooks/useUserTheme';
import { getDefaultTheme } from 'scripts/settings/webSettings';