fix: Fixed TypeScript error in SettingsModal.tsx

This commit is contained in:
Ruhani Rabin
2026-03-04 11:10:39 +08:00
parent 090e39016f
commit 989b74f48a

View File

@@ -78,15 +78,16 @@ export function SettingsModal({ open, onClose, soundEnabled, onToggleSound }: Pr
} = useTheme(); } = useTheme();
const { sendOnEnter, toggle: toggleSendShortcut } = useSendShortcut(); const { sendOnEnter, toggle: toggleSendShortcut } = useSendShortcut();
const currentLocale = useLocale(); const currentLocale = useLocale();
const [tab, setTab] = useState<'appearance' | 'typography' | 'chat' | 'notifications'>('appearance'); type TabId = 'appearance' | 'typography' | 'chat' | 'notifications';
const [tab, setTab] = useState<TabId>('appearance');
const tabs = useMemo(() => { const tabs = useMemo(() => {
const base = [ const base: { id: TabId; label: string }[] = [
{ id: 'appearance' as const, label: t('settings.tab.appearance') }, { id: 'appearance', label: t('settings.tab.appearance') },
{ id: 'typography' as const, label: t('settings.tab.typography') }, { id: 'typography', label: t('settings.tab.typography') },
{ id: 'chat' as const, label: t('settings.tab.chat') }, { id: 'chat', label: t('settings.tab.chat') },
]; ];
if (onToggleSound) base.push({ id: 'notifications' as const, label: t('settings.tab.notifications') }); if (onToggleSound) base.push({ id: 'notifications', label: t('settings.tab.notifications') });
return base; return base;
}, [onToggleSound, t]); }, [onToggleSound, t]);