import { tr } from '../lib/i18n'; /** Settings panels share the existing preference controls. */ import { useRef, type ReactNode } from 'react'; import { Btn, Field, Icon, Select, type IconName } from '../components/ui'; import { Brand } from '../components/Brand'; import { SettingsModels } from '../components/SettingsModels'; import { SettingsTools } from '../components/SettingsTools'; import { SettingsStorage } from '../components/SettingsStorage'; import { PrivacyNotes } from '../components/PrivacyNotes'; import { AboutVersions, SettingsUpdates } from '../components/SettingsUpdates'; import { NativeOperations } from '../components/NativeOperations'; import { FontChoice } from '../components/FontChoice'; import { ElectricityPrice } from '../components/ElectricityPrice'; import { ApprovalNotifySetting, DoneSoundSetting, PortSetting, TraySetting, useShellState } from '../components/ShellSettings'; import { LANGUAGES } from '../lib/i18n'; import { setLanguage, setWhileBusy } from '../lib/store'; import { CONTENT_FONT_RANGE, setContentFontSize, setDensity, setFocus, setMotion, setShortcuts, setTheme, setTransparency, setUiScale, UI_SCALES, useStore, setSettingsSection } from '../lib/store'; const PANELS = [{ name: 'Appearance', icon: 'sun', sections: ['General', 'Reading & focus'] }, { name: 'Models', icon: 'models', sections: [] }, { name: 'Tools', icon: 'tool', sections: [] }, { name: 'Storage', icon: 'disk', sections: ['Storage'] }, { name: 'Engine', icon: 'engine', sections: [] }, { name: 'About', icon: 'info', sections: ['About', 'Update', 'Privacy'] }] as const; export function SettingsScreen() { const prefs = useStore(s => s); const [shell, saveShell] = useShellState(); const active = prefs.settingsSection; const scrollRef = useRef(null); const fields: { section: string; label: string; hint: string; aliases?: string; control: ReactNode; }[] = [ { section: 'General', label: 'Language', hint: 'Choose the language used throughout Strata.', control: setWhileBusy(value as typeof prefs.whileBusy)}/> }, { section: 'General', label: 'Sound when work finishes', hint: 'Plays a short sound when an answer or task that took a while is finished, or when Strata is in the background.', aliases: 'audio chime done complete notification', control: }, { section: 'General', label: 'Notify me when Strata needs an answer', hint: 'In Manual mode, shows a desktop notification when the assistant waits for your approval and Strata is in the background.', aliases: 'approval permission alert notification manual', control: }, ...(shell?.tray ? [{ section: 'General', label: 'Minimise to tray', hint: 'Closing the window keeps Strata running in the tray, next to the clock. Choose Quit in the tray menu to stop it. Applies the next time Strata starts.', aliases: 'tray background close notification area', control: }] : []), ...(shell?.desktop ? [{ section: 'General', label: 'App port', hint: 'The port Strata’s window and local address use. Leave it empty to let Strata choose (47831 when it is free). Applies the next time Strata starts.', aliases: 'network address 47831 localhost api', control: }] : []), { section: 'General', label: 'Electricity price', hint: 'Price of one kilowatt-hour. The Monitor then shows what your graphics card has cost since Strata started. Leave it empty to hide the cost.', aliases: 'cost power energy kwh currency money', control: }, { section: 'Reading & focus', label: 'Font', hint: 'Choose an installed font for the interface and conversations.', control: }, { section: 'General', label: 'Keyboard shortcuts', hint: 'Set the key combinations that feel natural to you.', aliases: 'command keys hotkeys', control: setShortcuts(true)}>{tr("Edit shortcuts")} }, { section: 'Reading & focus', label: 'Appearance', hint: 'System follows your computer by default.', aliases: 'theme light dark system automatic', control: setContentFontSize(Number(e.target.value))}/>{tr(prefs.contentFontSize)}{tr(" px")} }, { section: 'Reading & focus', label: 'Interface size', hint: 'Makes all text, buttons and menus in Strata larger or smaller.', aliases: 'zoom scale font text size bigger smaller 4k 90% 100% 110% 125% 150% 175% 200%', control: }, { section: 'Reading & focus', label: 'Motion', hint: 'Reduced motion also disables smooth scrolling.', aliases: 'animation system full reduced', control: }, { section: 'Reading & focus', label: 'Focus reading', hint: 'Hides navigation in chat. Settings stays open above the conversation.', aliases: 'distraction quiet', control: ))}
{tr(PANELS.map(panel => ))}
; }