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:
parent
88b247596a
commit
a0ddea0bfc
3 changed files with 9 additions and 20 deletions
|
@ -2,8 +2,8 @@ import React from 'react';
|
|||
import { Outlet } from 'react-router-dom';
|
||||
|
||||
import AppBody from 'components/AppBody';
|
||||
import ThemeCss from 'components/ThemeCss';
|
||||
import CustomCss from 'components/CustomCss';
|
||||
import ThemeCss from 'components/ThemeCss';
|
||||
|
||||
export default function AppLayout() {
|
||||
return (
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue