fix: Address code review findings (backend validation, hydration efficiency, plot readability)

This commit is contained in:
Yunxiao Xu
2026-02-17 01:53:25 -08:00
parent e4513fcf18
commit 96e2634053
5 changed files with 14 additions and 9 deletions

View File

@@ -6,6 +6,7 @@ type Theme = "light" | "dark"
interface ThemeContextType {
theme: Theme
setTheme: (theme: Theme) => void
setThemeLocal: (theme: Theme) => void
toggleTheme: () => void
}
@@ -35,12 +36,16 @@ export function ThemeProvider({
}
}
const setThemeLocal = (newTheme: Theme) => {
setThemeState(newTheme)
}
const toggleTheme = () => {
setTheme(theme === "light" ? "dark" : "light")
}
return (
<ThemeContext.Provider value={{ theme, setTheme, toggleTheme }}>
<ThemeContext.Provider value={{ theme, setTheme, setThemeLocal, toggleTheme }}>
{children}
</ThemeContext.Provider>
)