From ab6b6876aae28fded9e071587896888901150762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=87=AF?= Date: Fri, 22 May 2026 15:26:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend-web/index.html | 13 ++- frontend-web/src/App.tsx | 4 +- .../settings/appearance-settings-page.tsx | 31 +++---- frontend-web/src/contexts/ThemeContext.tsx | 83 +++++++++++++------ 4 files changed, 84 insertions(+), 47 deletions(-) diff --git a/frontend-web/index.html b/frontend-web/index.html index e1d8ce8a..f6fe9779 100644 --- a/frontend-web/index.html +++ b/frontend-web/index.html @@ -1,7 +1,18 @@ - + + CM 助手 diff --git a/frontend-web/src/App.tsx b/frontend-web/src/App.tsx index 23f7257b..1f7554d8 100644 --- a/frontend-web/src/App.tsx +++ b/frontend-web/src/App.tsx @@ -25,7 +25,9 @@ function AppProviders({ children }: { children: React.ReactNode }) { return ( diff --git a/frontend-web/src/components/workspace/settings/appearance-settings-page.tsx b/frontend-web/src/components/workspace/settings/appearance-settings-page.tsx index cd1feb3b..95195df3 100644 --- a/frontend-web/src/components/workspace/settings/appearance-settings-page.tsx +++ b/frontend-web/src/components/workspace/settings/appearance-settings-page.tsx @@ -1,9 +1,10 @@ "use client"; -import { MonitorSmartphoneIcon, MoonIcon, SunIcon } from "lucide-react"; -import { useTheme } from "next-themes"; +import { MoonIcon, SunIcon } from "lucide-react"; import { useMemo, type ComponentType, type SVGProps } from "react"; +import { useTheme } from "@/contexts/ThemeContext"; + import { Select, SelectContent, @@ -27,18 +28,12 @@ const languageOptions: { value: Locale; label: string }[] = [ export function AppearanceSettingsPage() { const { t, locale, changeLocale } = useI18n(); - const { theme, setTheme, systemTheme } = useTheme(); - const currentTheme = (theme ?? "system") as "system" | "light" | "dark"; + const { theme, setTheme } = useTheme(); + const currentTheme = theme; const [settings, setSettings] = useLocalSettings(); const themeOptions = useMemo( () => [ - { - id: "system", - label: t.settings.appearance.system, - description: t.settings.appearance.systemDescription, - icon: MonitorSmartphoneIcon, - }, { id: "light", label: t.settings.appearance.light, @@ -57,8 +52,6 @@ export function AppearanceSettingsPage() { t.settings.appearance.darkDescription, t.settings.appearance.light, t.settings.appearance.lightDescription, - t.settings.appearance.system, - t.settings.appearance.systemDescription, ], ); @@ -68,7 +61,7 @@ export function AppearanceSettingsPage() { title={t.settings.appearance.themeTitle} description={t.settings.appearance.themeDescription} > -
+
{themeOptions.map((option) => ( setTheme(value)} /> ))} @@ -144,19 +136,16 @@ function ThemePreviewCard({ description, active, mode, - systemTheme, onSelect, }: { icon: ComponentType>; label: string; description: string; active: boolean; - mode: "system" | "light" | "dark"; - systemTheme?: string; - onSelect: (mode: "system" | "light" | "dark") => void; + mode: "light" | "dark"; + onSelect: (mode: "light" | "dark") => void; }) { - const previewMode = - mode === "system" ? (systemTheme === "dark" ? "dark" : "light") : mode; + const previewMode = mode; return (