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
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
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
|
||||
}
|
||||
})();
|
||||
}, []);
|
||||
}
|
||||
Reference in New Issue
Block a user