From a0c1b8ba31bae253bc96413a7bbe1871944e6d32 Mon Sep 17 00:00:00 2001 From: miteruzo Date: Sun, 5 Jul 2026 20:18:16 +0900 Subject: [PATCH] #34 --- frontend/src/App.tsx | 39 +- frontend/src/components/TopNav.tsx | 29 +- frontend/src/index.css | 35 +- frontend/src/lib/settings.ts | 217 ++++++-- frontend/src/pages/users/SettingPage.tsx | 597 +++++++++++++---------- 5 files changed, 578 insertions(+), 339 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index a4cba2f..aa3688b 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -16,12 +16,9 @@ import { applyClientAppearance, fetchUserThemeSlots, fetchUserSettings, getClientThemeMode, - getClientActiveThemeSlot, hasStoredClientThemeSelection, - normaliseThemeSlotSelectionAgainstSlots, normaliseUserThemeSlots, setCachedUserThemeSlots, - setClientActiveThemeSlot, seedClientThemeMode } from '@/lib/settings' import { useClientBehaviourSettings } from '@/lib/useClientBehaviourSettings' @@ -182,30 +179,18 @@ const App: FC = () => { return void (async () => { - try - { - const [settings, themeSlots] = await Promise.all ([ - fetchUserSettings (), - fetchUserThemeSlots (), - ]) - const storedThemeSlots = normaliseUserThemeSlots (themeSlots) - const initialSelection = ( - hasStoredClientThemeSelection () - ? getClientActiveThemeSlot () - : (settings.theme === 'system' - ? 'system' - : `builtin:${ settings.theme }`) - ) - const nextSelection = normaliseThemeSlotSelectionAgainstSlots ( - initialSelection, - storedThemeSlots, - ) - setCachedUserThemeSlots (storedThemeSlots) - seedClientThemeMode (settings.theme) - if (nextSelection !== initialSelection) - setClientActiveThemeSlot (nextSelection) - applyClientAppearance () - } + try + { + const [settings, themeSlots] = await Promise.all ([ + fetchUserSettings (), + fetchUserThemeSlots (), + ]) + const storedThemeSlots = normaliseUserThemeSlots (themeSlots) + setCachedUserThemeSlots (storedThemeSlots) + if (!(hasStoredClientThemeSelection ())) + seedClientThemeMode (settings.theme) + applyClientAppearance () + } catch { return diff --git a/frontend/src/components/TopNav.tsx b/frontend/src/components/TopNav.tsx index 2b41409..4f1c0d5 100644 --- a/frontend/src/components/TopNav.tsx +++ b/frontend/src/components/TopNav.tsx @@ -208,12 +208,11 @@ const TopNav: FC = ({ user }) => { return ( <> -