refactor: clean up dead files, restructure nav, align QuickStartPage to monochrome
- Delete 6 unused files: ThemeToggle, themeStore, AppLayout-original, QuickStartPage-Enhanced, UpgradePrompt, SettingsPage - Restructure Account/Settings navigation: merge Settings into Account page, make AccountSettingsPage the /account index, remove orphaned /account-settings route - Remove "Settings" nav item (consolidated under Account) - Add export preferences and team categories link to AccountSettingsPage - Align QuickStartPage to monochrome design system: replace cyan/blue/violet accent colors with white opacity variants - Replace non-functional search button with search spinner indicator Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,53 +0,0 @@
|
||||
import { create } from 'zustand'
|
||||
import { persist } from 'zustand/middleware'
|
||||
|
||||
type Theme = 'light' | 'dark' | 'system'
|
||||
|
||||
interface ThemeState {
|
||||
theme: Theme
|
||||
resolvedTheme: 'light' | 'dark'
|
||||
setTheme: (theme: Theme) => void
|
||||
}
|
||||
|
||||
const getSystemTheme = (): 'light' | 'dark' => {
|
||||
if (typeof window === 'undefined') return 'light'
|
||||
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
|
||||
}
|
||||
|
||||
const applyTheme = (theme: Theme): 'light' | 'dark' => {
|
||||
const resolved = theme === 'system' ? getSystemTheme() : theme
|
||||
const root = document.documentElement
|
||||
|
||||
if (resolved === 'dark') {
|
||||
root.classList.add('dark')
|
||||
} else {
|
||||
root.classList.remove('dark')
|
||||
}
|
||||
|
||||
return resolved
|
||||
}
|
||||
|
||||
export const useThemeStore = create<ThemeState>()(
|
||||
persist(
|
||||
(set) => ({
|
||||
theme: 'system',
|
||||
resolvedTheme: getSystemTheme(),
|
||||
|
||||
setTheme: (theme: Theme) => {
|
||||
const resolvedTheme = applyTheme(theme)
|
||||
set({ theme, resolvedTheme })
|
||||
},
|
||||
}),
|
||||
{
|
||||
name: 'theme-storage',
|
||||
onRehydrateStorage: () => (state) => {
|
||||
// Apply theme on initial load after rehydration
|
||||
if (state) {
|
||||
applyTheme(state.theme)
|
||||
}
|
||||
},
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
export default useThemeStore
|
||||
Reference in New Issue
Block a user