import { useState } from 'react' import { useTranslation } from 'react-i18next' import type { ThemeId, Language, PomodoroDuration } from '@shared/types' import { useSettingsStore } from '@renderer/stores/useSettingsStore' import { ShortcutEditor } from '@renderer/components/settings/ShortcutEditor' import { AiSettingsPage } from '@renderer/components/settings/AiSettingsPage' const THEMES: { id: ThemeId; key: string }[] = [ { id: 'default', key: 'theme.default' }, { id: 'bamboo', key: 'theme.bamboo' }, { id: 'moonlit', key: 'theme.moonlit' }, { id: 'ricepaper', key: 'theme.ricepaper' }, { id: 'mist', key: 'theme.mist' }, { id: 'teagarden', key: 'theme.teagarden' }, { id: 'twilight', key: 'theme.twilight' } ] export function SettingsPage(): React.JSX.Element { const { t } = useTranslation() const settings = useSettingsStore() const [section, setSection] = useState<'general' | 'ai' | 'shortcuts' | 'about'>('general') return (
setSection('general')} role="button" tabIndex={0} > {t('settings.general')}
setSection('ai')} role="button" tabIndex={0} data-testid="settings-nav-ai" > {t('settings.ai')}
setSection('shortcuts')} role="button" tabIndex={0} > {t('settings.shortcuts')}
setSection('about')} role="button" tabIndex={0} > {t('settings.about')}

{t('settings.title')}

{section === 'general' && ( <>
{t('settings.penName')} void settings.update({ penName: e.target.value })} />
{t('settings.theme')}
{t('settings.language')}
{t('settings.updateSchedule')}
{t('settings.stockBufferThreshold')} void settings.update({ stockBufferThreshold: Math.min(20, Math.max(1, Number(e.target.value) || 3)) }) } />
{t('settings.dailyWordGoal')} void settings.update({ dailyWordGoal: Math.max(0, Number(e.target.value) || 0) }) } />
{t('settings.pomodoroDuration')}
{t('settings.extractThreshold')} void settings.update({ knowledgeExtractConfidenceThreshold: Math.min( 1, Math.max(0, Number(e.target.value) || 0.8) ) }) } />
)} {section === 'ai' && } {section === 'shortcuts' && } {section === 'about' && (

{t('app.name')} v1.0.0
{t('app.tagline')}

)}
) }