From 320bf3eeac12dbc4871b2b8501ad4943d5ca8f89 Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 17 Oct 2025 23:51:58 +0800 Subject: [PATCH] feat: move theme toggle to settings dialog Move the theme toggle from the main header to the settings dialog for a cleaner UI and better organization. The new theme selector uses a button group design consistent with the language settings. Changes: - Created ThemeSettings component with three options: Light, Dark, System - Added ThemeSettings to the General tab in settings dialog - Removed ModeToggle component from main header - Added theme-related i18n keys for all options - Theme selection takes effect immediately without requiring save Design: - Uses button group style matching LanguageSettings - Icons for each theme option (Sun, Moon, Monitor) - Consistent with app's blue theme for active state - Smooth transitions and hover effects This change simplifies the main header and consolidates all appearance settings in one place, improving the overall user experience. --- src/App.tsx | 2 - src/components/settings/SettingsDialog.tsx | 2 + src/components/settings/ThemeSettings.tsx | 73 ++++++++++++++++++++++ src/i18n/locales/en.json | 6 ++ src/i18n/locales/zh.json | 6 ++ 5 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 src/components/settings/ThemeSettings.tsx diff --git a/src/App.tsx b/src/App.tsx index f475cf5..cae24ff 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -8,7 +8,6 @@ import { providersApi, settingsApi, type AppType, type ProviderSwitchEvent } fro import { useProviderActions } from "@/hooks/useProviderActions"; import { extractErrorMessage } from "@/utils/errorUtils"; import { AppSwitcher } from "@/components/AppSwitcher"; -import { ModeToggle } from "@/components/mode-toggle"; import { ProviderList } from "@/components/providers/ProviderList"; import { AddProviderDialog } from "@/components/providers/AddProviderDialog"; import { EditProviderDialog } from "@/components/providers/EditProviderDialog"; @@ -117,7 +116,6 @@ function App() { > CC Switch - + ); +} diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 6ea9d8b..77b4b12 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -87,6 +87,12 @@ "title": "Settings", "general": "General", "language": "Language", + "languageHint": "Preview interface language immediately after switching, takes effect permanently after saving.", + "theme": "Theme", + "themeHint": "Choose the appearance theme for the app, takes effect immediately.", + "themeLight": "Light", + "themeDark": "Dark", + "themeSystem": "System", "importExport": "Import/Export Config", "exportConfig": "Export Config to File", "selectConfigFile": "Select Config File", diff --git a/src/i18n/locales/zh.json b/src/i18n/locales/zh.json index ee1c046..e24ecae 100644 --- a/src/i18n/locales/zh.json +++ b/src/i18n/locales/zh.json @@ -87,6 +87,12 @@ "title": "设置", "general": "通用", "language": "界面语言", + "languageHint": "切换后立即预览界面语言,保存后永久生效。", + "theme": "外观主题", + "themeHint": "选择应用的外观主题,立即生效。", + "themeLight": "浅色", + "themeDark": "深色", + "themeSystem": "跟随系统", "importExport": "导入导出配置", "exportConfig": "导出配置到文件", "selectConfigFile": "选择配置文件",