feat(09-05): ThemeSessionBridge + ThemeToggle write-through to /api/me/theme
- Create ThemeSessionBridge.tsx: useEffect compares session.user.theme to
next-themes value; calls setTheme(serverTheme) on mismatch; validates
against 3-string allowlist ('light'|'dark'|'system'); renders null
- Mount <ThemeSessionBridge /> as first child of <AuthProvider> in app/layout.tsx
- Modify ThemeToggle: writeTheme() calls setTheme() then fire-and-forget
PUT /api/me/theme; silent catch for network errors (best-effort desktop UX)
This commit is contained in:
parent
1b7c453c6d
commit
586c04ad2a
3 changed files with 58 additions and 3 deletions
|
|
@ -7,6 +7,7 @@ import { CommandPalette } from "@/components/navigation/command-palette";
|
|||
import { TaglineFooter } from "@/components/branding/tagline-footer";
|
||||
import { Toaster } from "sonner";
|
||||
import { AuthProvider } from "@/components/auth/auth-provider";
|
||||
import { ThemeSessionBridge } from "@/components/mobile/profile/ThemeSessionBridge";
|
||||
|
||||
// IBM Plex Sans replaces the brand-mandated Helvetica/Arial. The 2013
|
||||
// standards guide called for Helvetica Bold for headers and Helvetica
|
||||
|
|
@ -69,6 +70,7 @@ export default function RootLayout({
|
|||
disableTransitionOnChange
|
||||
>
|
||||
<AuthProvider>
|
||||
<ThemeSessionBridge />
|
||||
<div className="min-h-screen bg-background flex flex-col">
|
||||
<AppNavigation />
|
||||
<main className="flex-1">{children}</main>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue