diff --git a/web/src/hooks/useAppGoBack.ts b/web/src/hooks/useAppGoBack.ts index 56a38dcf..623ba530 100644 --- a/web/src/hooks/useAppGoBack.ts +++ b/web/src/hooks/useAppGoBack.ts @@ -13,6 +13,12 @@ export function useAppGoBack(): () => void { return } + // Settings page always goes back to sessions + if (pathname === '/settings') { + navigate({ to: '/sessions' }) + return + } + // For single file view, go back to files list if (pathname.match(/^\/sessions\/[^/]+\/file$/)) { const filesPath = pathname.replace(/\/file$/, '/files') diff --git a/web/src/lib/locales/en.ts b/web/src/lib/locales/en.ts index fd570e8d..408d780c 100644 --- a/web/src/lib/locales/en.ts +++ b/web/src/lib/locales/en.ts @@ -225,6 +225,11 @@ export default { 'language.english': 'English', 'language.chinese': '简体中文', + // Settings page + 'settings.title': 'Settings', + 'settings.language.title': 'Language', + 'settings.language.label': 'Language', + // Misc 'misc.noMachines': 'No machines available', 'misc.machine': 'Machine', diff --git a/web/src/lib/locales/zh-CN.ts b/web/src/lib/locales/zh-CN.ts index 4842e5d3..569939b1 100644 --- a/web/src/lib/locales/zh-CN.ts +++ b/web/src/lib/locales/zh-CN.ts @@ -227,6 +227,11 @@ export default { 'language.english': 'English', 'language.chinese': '简体中文', + // Settings page + 'settings.title': '设置', + 'settings.language.title': '语言', + 'settings.language.label': '语言', + // Misc 'misc.noMachines': '无可用机器', 'misc.machine': '机器', diff --git a/web/src/router.tsx b/web/src/router.tsx index 1ab4880b..200c704e 100644 --- a/web/src/router.tsx +++ b/web/src/router.tsx @@ -13,7 +13,6 @@ import { SessionChat } from '@/components/SessionChat' import { SessionList } from '@/components/SessionList' import { NewSession } from '@/components/NewSession' import { LoadingState } from '@/components/LoadingState' -import { LanguageSwitcher } from '@/components/LanguageSwitcher' import { useAppContext } from '@/lib/app-context' import { useAppGoBack } from '@/hooks/useAppGoBack' import { isTelegramApp } from '@/hooks/useTelegram' @@ -28,6 +27,7 @@ import { useTranslation } from '@/lib/use-translation' import FilesPage from '@/routes/sessions/files' import FilePage from '@/routes/sessions/file' import TerminalPage from '@/routes/sessions/terminal' +import SettingsPage from '@/routes/settings' function BackIcon(props: { className?: string }) { return ( @@ -68,6 +68,26 @@ function PlusIcon(props: { className?: string }) { ) } +function SettingsIcon(props: { className?: string }) { + return ( + + + + + ) +} + function SessionsPage() { const { api } = useAppContext() const navigate = useNavigate() @@ -88,7 +108,14 @@ function SessionsPage() { {t('sessions.count', { n: sessions.length, m: projectCount })}
- + +
{t('settings.title')}
+
+ + +
+
+ {/* Language section */} +
+
+ {t('settings.language.title')} +
+
+ + + {isOpen && ( +
+ {locales.map((loc) => { + const isSelected = locale === loc.value + return ( + + ) + })} +
+ )} +
+
+
+
+ + ) +}