diff --git a/stash-web/index.html b/stash-web/index.html index 0210b7f..49b8e73 100644 --- a/stash-web/index.html +++ b/stash-web/index.html @@ -4,7 +4,15 @@ - + + { - document.documentElement.dataset.scheme = effectiveTheme - }, [effectiveTheme]) - /** 当前实际是深色吗(auto 时按系统偏好算) */ const isDark = isDarkScheme(effectiveTheme) + const scheme = isDark ? 'dark' : 'light' + + useEffect(() => { + const root = document.documentElement + if (root.dataset.scheme === scheme) return + root.classList.add('theme-transition') + root.dataset.scheme = scheme + const timer = window.setTimeout(() => root.classList.remove('theme-transition'), 260) + return () => { + window.clearTimeout(timer) + root.classList.remove('theme-transition') + } + }, [scheme]) /** 页头的明暗切换:只写本机偏好,不需要登录;站点默认值在后台改 */ const toggleTheme = () => { @@ -663,6 +671,7 @@ export default function AppNext() { headerSpeed={site.header.speed} headerGap={site.header.gap} site={site.site} + ready={settings !== null} authenticated={session?.authenticated === true} username={session?.username ?? undefined} refreshing={refreshing} @@ -707,7 +716,7 @@ export default function AppNext() { onOpenApi={() => navigate('/interface')} /> )} - {settings !== null && site.sidebar.show_nav !== false && ( + {settings !== null && !loading && site.sidebar.show_nav !== false && (