| 8 | import { NotificationCenter } from "@/components/notifications/NotificationCenter"; |
| 9 | |
| 10 | export function Header() { |
| 11 | const { theme, setTheme } = useTheme(); |
| 12 | const { settings, updateSettings } = useChatStore(); |
| 13 | |
| 14 | const themeIcons = { |
| 15 | light: Sun, |
| 16 | dark: Moon, |
| 17 | system: Monitor, |
| 18 | } as const; |
| 19 | |
| 20 | const ThemeIcon = themeIcons[theme]; |
| 21 | const nextTheme = theme === "dark" ? "light" : theme === "light" ? "system" : "dark"; |
| 22 | |
| 23 | return ( |
| 24 | <header className="flex items-center justify-between px-4 py-2.5 border-b border-surface-800 bg-surface-900/50 backdrop-blur-sm"> |
| 25 | <div className="flex items-center gap-3"> |
| 26 | <h1 className="text-sm font-medium text-surface-100">Chat</h1> |
| 27 | </div> |
| 28 | |
| 29 | <div className="flex items-center gap-2"> |
| 30 | {/* Model selector */} |
| 31 | <label htmlFor="model-select" className="sr-only"> |
| 32 | Model |
| 33 | </label> |
| 34 | <select |
| 35 | id="model-select" |
| 36 | value={settings.model} |
| 37 | onChange={(e) => updateSettings({ model: e.target.value })} |
| 38 | className={cn( |
| 39 | "text-xs bg-surface-800 border border-surface-700 rounded-md px-2 py-1", |
| 40 | "text-surface-300 focus:outline-none focus:ring-1 focus:ring-brand-500" |
| 41 | )} |
| 42 | > |
| 43 | {MODELS.map((m) => ( |
| 44 | <option key={m.id} value={m.id}> |
| 45 | {m.label} |
| 46 | </option> |
| 47 | ))} |
| 48 | </select> |
| 49 | |
| 50 | {/* Notification center */} |
| 51 | <NotificationCenter /> |
| 52 | |
| 53 | {/* Theme toggle */} |
| 54 | <button |
| 55 | onClick={() => setTheme(nextTheme)} |
| 56 | aria-label={`Switch to ${nextTheme} theme`} |
| 57 | className="p-1.5 rounded-md text-surface-400 hover:text-surface-100 hover:bg-surface-800 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500" |
| 58 | > |
| 59 | <ThemeIcon className="w-4 h-4" aria-hidden="true" /> |
| 60 | </button> |
| 61 | </div> |
| 62 | </header> |
| 63 | ); |
| 64 | } |