Files
headquarter/apps/web/src/hooks/use-theme.ts
T
Fusion 94254ee3fd feat: complete user config management
- Add theme support with dark/light/system modes
- Add useTheme hook for applying user config theme
- Update router to use SettingsPage
- Update app-shell to apply theme on load
- Add CSS variables for dark theme
- Fix mypy errors in user_config.py
- Quality gates pass: ruff, mypy, typecheck, lint, build
2026-05-18 15:58:01 +02:00

24 lines
633 B
TypeScript

import { useEffect } from "react";
import { getUserConfig } from "../api/settings";
export function useTheme() {
useEffect(() => {
void (async () => {
try {
const config = await getUserConfig();
const theme = config.theme ?? "system";
if (theme === "system") {
// Remove any explicit theme class and let system decide
document.documentElement.removeAttribute("data-theme");
} else {
document.documentElement.setAttribute("data-theme", theme);
}
} catch {
// Silently fail - theme is not critical
}
})();
}, []);
}