94254ee3fd
- 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
24 lines
633 B
TypeScript
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
|
|
}
|
|
})();
|
|
}, []);
|
|
}
|