From cff379809c96203c2fe8b3f4b7f24715862305c0 Mon Sep 17 00:00:00 2001 From: lpf Date: Sat, 7 Mar 2026 20:49:58 +0800 Subject: [PATCH] feat(webui): refresh brand theme and add day-night mode --- webui/src/components/GlobalDialog.tsx | 14 +- webui/src/components/Header.tsx | 19 ++- webui/src/components/Layout.tsx | 4 +- webui/src/components/NavItem.tsx | 4 +- webui/src/components/RecursiveConfig.tsx | 16 +-- webui/src/components/Sidebar.tsx | 16 +-- webui/src/components/SpaceParticles.tsx | 30 +++- webui/src/components/StatCard.tsx | 8 +- webui/src/context/UIContext.tsx | 30 +++- webui/src/i18n/index.ts | 4 + webui/src/index.css | 176 ++++++++++++++++++++++- webui/src/pages/Chat.tsx | 42 +++--- webui/src/pages/Config.tsx | 44 +++--- webui/src/pages/Cron.tsx | 34 ++--- webui/src/pages/Dashboard.tsx | 22 +-- webui/src/pages/EKG.tsx | 10 +- webui/src/pages/LogCodes.tsx | 8 +- webui/src/pages/Logs.tsx | 18 +-- webui/src/pages/Memory.tsx | 12 +- webui/src/pages/Skills.tsx | 14 +- webui/src/pages/SubagentProfiles.tsx | 12 +- webui/src/pages/Subagents.tsx | 28 ++-- webui/src/pages/TaskAudit.tsx | 28 ++-- 23 files changed, 415 insertions(+), 178 deletions(-) diff --git a/webui/src/components/GlobalDialog.tsx b/webui/src/components/GlobalDialog.tsx index 137fd01..14aa703 100644 --- a/webui/src/components/GlobalDialog.tsx +++ b/webui/src/components/GlobalDialog.tsx @@ -34,12 +34,12 @@ export const GlobalDialog: React.FC<{ {open && ( - -
+

{options.title || (kind === 'confirm' ? t('dialogPleaseConfirm') : kind === 'prompt' ? t('dialogInputTitle') : t('dialogNotice'))}

-
+
{options.message}
{kind === 'prompt' && (
@@ -54,16 +54,16 @@ export const GlobalDialog: React.FC<{ } }} placeholder={options.inputPlaceholder || t('dialogInputPlaceholder')} - className="w-full px-3 py-2 rounded-lg bg-zinc-950 border border-zinc-800 text-sm text-zinc-100" + className="w-full px-3 py-2 rounded-xl bg-zinc-950/75 border border-zinc-800 text-sm text-zinc-100 focus:outline-none focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500/20" />
)}
-
+
{(kind === 'confirm' || kind === 'prompt') && ( - + )} -
diff --git a/webui/src/components/Header.tsx b/webui/src/components/Header.tsx index 9c9fbde..3b9948e 100644 --- a/webui/src/components/Header.tsx +++ b/webui/src/components/Header.tsx @@ -1,11 +1,13 @@ import React from 'react'; -import { Terminal, Globe, Menu } from 'lucide-react'; +import { Terminal, Globe, Menu, Moon, SunMedium } from 'lucide-react'; import { useTranslation } from 'react-i18next'; import { useAppContext } from '../context/AppContext'; +import { useUI } from '../context/UIContext'; const Header: React.FC = () => { const { t, i18n } = useTranslation(); const { isGatewayOnline, setSidebarOpen, sidebarCollapsed } = useAppContext(); + const { theme, toggleTheme } = useUI(); const toggleLang = () => { const nextLang = i18n.language === 'en' ? 'zh' : 'en'; @@ -13,20 +15,20 @@ const Header: React.FC = () => { }; return ( -
+
-
+
{!sidebarCollapsed && ( {t('appName')} )}
-
+
{t('appName')} @@ -49,6 +51,15 @@ const Header: React.FC = () => {
+ + @@ -70,7 +70,7 @@ const PrimitiveArrayEditor: React.FC<{ value={draft} onChange={(e) => setDraft(e.target.value)} placeholder={t('recursiveAddValuePlaceholder')} - className="w-full bg-zinc-950 border border-zinc-800 rounded-lg px-3 py-2 text-sm focus:outline-none focus:border-indigo-500" + className="w-full bg-zinc-950/70 border border-zinc-800 rounded-xl px-3 py-2 text-sm focus:outline-none focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500/20" /> {suggestions.map((s) => ( @@ -83,7 +83,7 @@ const PrimitiveArrayEditor: React.FC<{ addValue(draft); setDraft(''); }} - className="px-3 py-2 text-xs rounded-lg bg-zinc-800 hover:bg-zinc-700" + className="px-3 py-2 text-xs rounded-xl bg-zinc-800 hover:bg-zinc-700" > {t('add')} @@ -95,7 +95,7 @@ const PrimitiveArrayEditor: React.FC<{ setSelected(v); if (v) addValue(v); }} - className="px-3 py-2 text-xs rounded-lg bg-zinc-950 border border-zinc-800" + className="px-3 py-2 text-xs rounded-xl bg-zinc-950/70 border border-zinc-800" > {suggestions.filter((s) => !value.includes(s)).map((s) => ( @@ -129,7 +129,7 @@ const RecursiveConfig: React.FC = ({ data, labels, path = {label} {currentPath}
-
+
{allPrimitive ? ( = ({ data, labels, path = // ignore invalid json during typing } }} - className="w-full min-h-28 bg-zinc-950 border border-zinc-800 rounded-lg px-3 py-2 text-sm font-mono focus:outline-none focus:border-indigo-500" + className="w-full min-h-28 bg-zinc-950/70 border border-zinc-800 rounded-xl px-3 py-2 text-sm font-mono focus:outline-none focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500/20" /> )}
@@ -176,7 +176,7 @@ const RecursiveConfig: React.FC = ({ data, labels, path = {currentPath}
{typeof value === 'boolean' ? ( -
diff --git a/webui/src/components/Sidebar.tsx b/webui/src/components/Sidebar.tsx index ee323c1..b5aea96 100644 --- a/webui/src/components/Sidebar.tsx +++ b/webui/src/components/Sidebar.tsx @@ -44,10 +44,10 @@ const Sidebar: React.FC = () => { ]; return ( -