diff --git a/web/src/layout/AppShell.tsx b/web/src/layout/AppShell.tsx index 4d36ae2..39eddd1 100644 --- a/web/src/layout/AppShell.tsx +++ b/web/src/layout/AppShell.tsx @@ -18,8 +18,11 @@ import { IconStethoscope, IconSettings, IconMenu2, + IconSun, + IconMoon, } from "@tabler/icons-react"; import type { CurrentUser } from "../api/client"; +import { getTheme, setTheme, type Theme } from "../utils/theme"; interface NavItem { to: string; @@ -51,10 +54,17 @@ const roleRank: Record = { viewer: 0, operator: 1, export default function AppShell({ user, children }: { user: CurrentUser; children: ReactNode }) { const [sidebarOpen, setSidebarOpen] = useState(false); + const [theme, setThemeState] = useState(() => getTheme()); const visibleItems = NAV_ITEMS.filter( (item) => !item.minRole || roleRank[user.role] >= roleRank[item.minRole], ); + function toggleTheme() { + const next: Theme = theme === "dark" ? "light" : "dark"; + setTheme(next); + setThemeState(next); + } + return (
- -
-
-
-

Theme

-
-
-

- A personal preference remembered on this browser only — it doesn't affect other signed-in - users. -

- -
-
-
);