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 { Outlet } from 'react-router-dom';
|
||||||
|
|
||||||
import AppBody from 'components/AppBody';
|
import AppBody from 'components/AppBody';
|
||||||
import ThemeCss from 'components/ThemeCss';
|
|
||||||
import CustomCss from 'components/CustomCss';
|
import CustomCss from 'components/CustomCss';
|
||||||
|
import ThemeCss from 'components/ThemeCss';
|
||||||
|
|
||||||
export default function AppLayout() {
|
export default function AppLayout() {
|
||||||
return (
|
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 { useUserSettings } from 'hooks/useUserSettings';
|
||||||
|
import { useBrandingOptions } from 'apps/dashboard/features/branding/api/useBrandingOptions';
|
||||||
|
|
||||||
const CustomCss: FC = () => {
|
const CustomCss: FC = () => {
|
||||||
const { api } = useApi();
|
const { data: brandingOptions } = useBrandingOptions();
|
||||||
const { customCss: userCustomCss, disableCustomCss } = useUserSettings();
|
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 (
|
return (
|
||||||
<>
|
<>
|
||||||
{!disableCustomCss && brandingCssUrl && (
|
{!disableCustomCss && brandingOptions?.CustomCss && (
|
||||||
<link
|
<style>
|
||||||
rel='stylesheet'
|
{brandingOptions.CustomCss}
|
||||||
type='text/css'
|
</style>
|
||||||
href={brandingCssUrl}
|
|
||||||
/>
|
|
||||||
)}
|
)}
|
||||||
{userCustomCss && (
|
{userCustomCss && (
|
||||||
<style>
|
<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 { useUserTheme } from 'hooks/useUserTheme';
|
||||||
import { getDefaultTheme } from 'scripts/settings/webSettings';
|
import { getDefaultTheme } from 'scripts/settings/webSettings';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue