import { useState, type ReactNode } from 'react'; import { LOGIN_NAME, useHabitatAuth } from '../auth/habitatAuth'; import { WORKSPACE_DESCRIPTORS, type WorkspaceKind, } from '../workspaces/workspace'; import { Modal } from './Modal'; import { SettingsPaneLayout, SettingsPaneSection } from './SettingsPane'; import { HotkeysPane } from './HotkeysPane'; type SettingsModalProps = { open: boolean; onClose: () => void; theme: 'light' | 'dark'; onToggleTheme: () => void; workspaceKind: WorkspaceKind; onWorkspaceKindChange: (kind: WorkspaceKind) => void; }; type SettingsCategory = 'atmosphere' | 'appearance' | 'hotkeys'; function AtmosphereAccountPane() { const { authInfo, login, logout } = useHabitatAuth(); const [accountInput, setAccountInput] = useState(''); const [error, setError] = useState(null); const [isSubmitting, setIsSubmitting] = useState(false); const onLogin = async () => { try { setIsSubmitting(true); setError(null); await login(accountInput); setAccountInput(''); } catch (loginError) { setError( loginError instanceof Error ? loginError.message : `Unable to complete ${LOGIN_NAME} Account sign-in.`, ); } finally { setIsSubmitting(false); } }; if (authInfo) { return (
{`${LOGIN_NAME} Handle`} {authInfo.handle}
DID:{' '} {authInfo.did}
); } return (
{/* TODO: Add account creation / sign-up flow when product requirements are ready. */} {error ?

{error}

: null}
); } function AccountIcon() { return ( ); } function AppearanceIcon() { return ( ); } function SunIcon() { return ( ); } function MoonIcon() { return ( ); } function KeyboardIcon() { return ( ); } export function SettingsModal({ open, onClose, theme, onToggleTheme, workspaceKind, onWorkspaceKindChange, }: SettingsModalProps) { const [selectedCategory, setSelectedCategory] = useState('atmosphere'); if (!open) return null; const categories: { id: SettingsCategory; label: string; icon: ReactNode }[] = [ { id: 'atmosphere', label: `${LOGIN_NAME} Account`, icon: , }, { id: 'appearance', label: 'Appearance', icon: , }, { id: 'hotkeys', label: 'Hotkeys', icon: , }, ]; return ( {categories.map((category) => ( ))} } > {selectedCategory === 'atmosphere' ? ( ) : selectedCategory === 'hotkeys' ? ( ) : (

Workspace

Choose how the main editing surface is laid out. Switching resets the open documents in the workspace.

{WORKSPACE_DESCRIPTORS.map((descriptor) => { const selected = descriptor.kind === workspaceKind; return ( ); })}
{/* TODO: Add configurable theme transition controls with richer theme presets. */}
)}
); }