Updates Apr3: new pages, components, and widespread UI/API improvements

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
belviskhoremk
2026-04-03 09:15:25 +00:00
parent d07111a4f2
commit 56ce9717aa
34 changed files with 6810 additions and 2291 deletions

32
src/store/themeStore.ts Normal file
View File

@@ -0,0 +1,32 @@
import { create } from 'zustand'
import { persist } from 'zustand/middleware'
interface ThemeState {
isDark: boolean
toggle: () => void
}
export const useThemeStore = create<ThemeState>()(
persist(
(set) => ({
isDark: false,
toggle: () => set((s) => {
const next = !s.isDark
document.documentElement.classList.toggle('dark', next)
return { isDark: next }
}),
}),
{ name: 'theme' }
)
)
/** Call once at app startup to apply persisted theme class */
export function initTheme() {
const raw = localStorage.getItem('theme')
if (raw) {
try {
const parsed = JSON.parse(raw) as { state?: { isDark?: boolean } }
document.documentElement.classList.toggle('dark', !!parsed.state?.isDark)
} catch { /* ignore */ }
}
}