'use client'; import * as React from 'react'; import { Check, Laptop, Moon, Sun } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; import { DarkVariant, LightVariant, useThemeStore } from '@/store/theme-store'; const LIGHT_VARIANTS: { id: LightVariant; label: string }[] = [ { id: 'pure-light', label: 'Pure Light' }, { id: 'light', label: 'Light' }, ]; const DARK_VARIANTS: { id: DarkVariant; label: string }[] = [ { id: 'dark', label: 'Dark' }, { id: 'magic-blue', label: 'Magic Blue' }, { id: 'classic-dark', label: 'Classic Dark' }, ]; /** * Sidebar theme switcher, wired to the theme store: Light and Dark open * submenus with their variants; System follows the OS appearance (the * fully custom theme is only reachable from Settings → Preferences). */ export function ThemeToggle() { const { mode, lightVariant, darkVariant, setMode, setLightVariant, setDarkVariant } = useThemeStore(); // Avoid hydration mismatches: the store is persisted in localStorage. const [mounted, setMounted] = React.useState(false); React.useEffect(() => { setMounted(true); }, []); if (!mounted) return null; return ( Light {mode === 'light' && } {LIGHT_VARIANTS.map((variant) => ( { setLightVariant(variant.id); setMode('light'); }} > {variant.label} {mode === 'light' && lightVariant === variant.id && ( )} ))} Dark {mode === 'dark' && } {DARK_VARIANTS.map((variant) => ( { setDarkVariant(variant.id); setMode('dark'); }} > {variant.label} {mode === 'dark' && darkVariant === variant.id && ( )} ))} setMode('system')}> System {mode === 'system' && } ); }