From 679cae2df025230e78baa391305ed65b7a433a06 Mon Sep 17 00:00:00 2001 From: LPF Date: Thu, 12 Mar 2026 10:24:40 +0800 Subject: [PATCH] fix ui --- webui/src/App.tsx | 2 +- webui/src/components/SectionPanel.tsx | 47 ---- .../channel/ChannelFieldRenderer.tsx | 2 +- .../channel/WhatsAppQRCodePanel.tsx | 2 +- .../channel/WhatsAppStatusPanel.tsx | 6 +- webui/src/components/chat/ChatComposer.tsx | 2 +- webui/src/components/chat/SubagentSidebar.tsx | 14 +- .../components/chat/SubagentStreamFilters.tsx | 2 +- .../components/config/ConfigPageChrome.tsx | 34 +-- .../config/GatewayConfigSection.tsx | 4 +- .../config/ProviderConfigSection.tsx | 4 +- .../config/ProviderModelPickerModal.tsx | 4 +- .../ArtifactPreviewCard.tsx | 0 .../{ => data-display}/CodeBlockPanel.tsx | 0 .../{ => data-display}/DetailGrid.tsx | 0 .../{ => data-display}/EmptyState.tsx | 0 .../{ => data-display}/FieldCard.tsx | 0 .../{ => data-display}/InfoBlock.tsx | 0 .../{ => data-display}/InfoTile.tsx | 0 .../{ => data-display}/InsetCard.tsx | 11 +- .../{ => data-display}/MetricPanel.tsx | 35 ++- .../{ => data-display}/SpaceParticles.tsx | 0 .../{ => data-display}/StatCard.tsx | 12 +- webui/src/components/{ => layout}/Header.tsx | 6 +- webui/src/components/{ => layout}/Layout.tsx | 2 +- .../src/components/{ => layout}/ListPanel.tsx | 0 webui/src/components/{ => layout}/NavItem.tsx | 0 .../components/{ => layout}/NoticePanel.tsx | 0 .../components/{ => layout}/PageHeader.tsx | 0 .../components/{ => layout}/PanelHeader.tsx | 0 .../components/{ => layout}/SectionHeader.tsx | 0 webui/src/components/layout/SectionPanel.tsx | 69 ++++++ webui/src/components/{ => layout}/Sidebar.tsx | 81 +++---- .../components/{ => layout}/ToolbarRow.tsx | 0 .../components/{ => list}/FileListItem.tsx | 0 .../{ => list}/SelectableListItem.tsx | 0 .../components/{ => list}/SummaryListItem.tsx | 0 webui/src/components/mcp/MCPServerCard.tsx | 6 +- webui/src/components/mcp/MCPServerEditor.tsx | 6 +- webui/src/components/nodes/AgentTreePanel.tsx | 4 +- .../nodes/DispatchArtifactPreviewSection.tsx | 6 +- .../components/nodes/DispatchReplayPanel.tsx | 6 +- webui/src/components/nodes/NodeP2PPanel.tsx | 4 +- .../subagentProfiles/ProfileEditorPanel.tsx | 4 +- .../subagentProfiles/ProfileListPanel.tsx | 6 +- .../components/subagents/TopologyCanvas.tsx | 2 +- .../components/subagents/TopologyTooltip.tsx | 2 +- webui/src/components/{ => ui}/Button.tsx | 0 webui/src/components/{ => ui}/Checkbox.tsx | 0 .../src/components/{ => ui}/FormControls.tsx | 40 ++-- webui/src/components/{ => ui}/FormField.tsx | 0 .../src/components/{ => ui}/GlobalDialog.tsx | 0 webui/src/components/{ => ui}/Input.tsx | 0 webui/src/components/{ => ui}/ModalFrame.tsx | 0 .../components/{ => ui}/RecursiveConfig.tsx | 2 +- webui/src/components/{ => ui}/Select.tsx | 0 webui/src/components/{ => ui}/Textarea.tsx | 0 webui/src/context/UIContext.tsx | 2 +- webui/src/hooks/useChatStream.ts | 102 ++++++++ webui/src/hooks/useLogStream.ts | 103 ++++++++ webui/src/i18n/index.ts | 42 +--- webui/src/pages/ChannelSettings.tsx | 6 +- webui/src/pages/Chat.tsx | 93 +------- webui/src/pages/Config.tsx | 4 +- webui/src/pages/Cron.tsx | 10 +- webui/src/pages/Dashboard.tsx | 221 +----------------- webui/src/pages/EKG.tsx | 6 +- webui/src/pages/LogCodes.tsx | 4 +- webui/src/pages/Logs.tsx | 87 +------ webui/src/pages/MCP.tsx | 12 +- webui/src/pages/Memory.tsx | 6 +- webui/src/pages/NodeArtifacts.tsx | 14 +- webui/src/pages/Nodes.tsx | 22 +- webui/src/pages/Providers.tsx | 4 +- webui/src/pages/Skills.tsx | 12 +- webui/src/pages/SubagentProfiles.tsx | 4 +- webui/src/pages/Subagents.tsx | 6 +- webui/src/pages/TaskAudit.tsx | 24 +- 78 files changed, 545 insertions(+), 666 deletions(-) delete mode 100644 webui/src/components/SectionPanel.tsx rename webui/src/components/{ => data-display}/ArtifactPreviewCard.tsx (100%) rename webui/src/components/{ => data-display}/CodeBlockPanel.tsx (100%) rename webui/src/components/{ => data-display}/DetailGrid.tsx (100%) rename webui/src/components/{ => data-display}/EmptyState.tsx (100%) rename webui/src/components/{ => data-display}/FieldCard.tsx (100%) rename webui/src/components/{ => data-display}/InfoBlock.tsx (100%) rename webui/src/components/{ => data-display}/InfoTile.tsx (100%) rename webui/src/components/{ => data-display}/InsetCard.tsx (51%) rename webui/src/components/{ => data-display}/MetricPanel.tsx (55%) rename webui/src/components/{ => data-display}/SpaceParticles.tsx (100%) rename webui/src/components/{ => data-display}/StatCard.tsx (62%) rename webui/src/components/{ => layout}/Header.tsx (96%) rename webui/src/components/{ => layout}/Layout.tsx (95%) rename webui/src/components/{ => layout}/ListPanel.tsx (100%) rename webui/src/components/{ => layout}/NavItem.tsx (100%) rename webui/src/components/{ => layout}/NoticePanel.tsx (100%) rename webui/src/components/{ => layout}/PageHeader.tsx (100%) rename webui/src/components/{ => layout}/PanelHeader.tsx (100%) rename webui/src/components/{ => layout}/SectionHeader.tsx (100%) create mode 100644 webui/src/components/layout/SectionPanel.tsx rename webui/src/components/{ => layout}/Sidebar.tsx (74%) rename webui/src/components/{ => layout}/ToolbarRow.tsx (100%) rename webui/src/components/{ => list}/FileListItem.tsx (100%) rename webui/src/components/{ => list}/SelectableListItem.tsx (100%) rename webui/src/components/{ => list}/SummaryListItem.tsx (100%) rename webui/src/components/{ => ui}/Button.tsx (100%) rename webui/src/components/{ => ui}/Checkbox.tsx (100%) rename webui/src/components/{ => ui}/FormControls.tsx (67%) rename webui/src/components/{ => ui}/FormField.tsx (100%) rename webui/src/components/{ => ui}/GlobalDialog.tsx (100%) rename webui/src/components/{ => ui}/Input.tsx (100%) rename webui/src/components/{ => ui}/ModalFrame.tsx (100%) rename webui/src/components/{ => ui}/RecursiveConfig.tsx (98%) rename webui/src/components/{ => ui}/Select.tsx (100%) rename webui/src/components/{ => ui}/Textarea.tsx (100%) create mode 100644 webui/src/hooks/useChatStream.ts create mode 100644 webui/src/hooks/useLogStream.ts diff --git a/webui/src/App.tsx b/webui/src/App.tsx index 4e86e68..053c79d 100644 --- a/webui/src/App.tsx +++ b/webui/src/App.tsx @@ -2,7 +2,7 @@ import React, { Suspense, lazy } from 'react'; import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'; import { AppProvider } from './context/AppContext'; import { UIProvider } from './context/UIContext'; -import Layout from './components/Layout'; +import Layout from './components/layout/Layout'; const Dashboard = lazy(() => import('./pages/Dashboard')); const Chat = lazy(() => import('./pages/Chat')); diff --git a/webui/src/components/SectionPanel.tsx b/webui/src/components/SectionPanel.tsx deleted file mode 100644 index d411cfb..0000000 --- a/webui/src/components/SectionPanel.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import React from 'react'; - -type SectionPanelProps = { - actions?: React.ReactNode; - children: React.ReactNode; - className?: string; - headerClassName?: string; - icon?: React.ReactNode; - subtitle?: React.ReactNode; - title?: React.ReactNode; -}; - -function joinClasses(...values: Array) { - return values.filter(Boolean).join(' '); -} - -const SectionPanel: React.FC = ({ - actions, - children, - className, - headerClassName, - icon, - subtitle, - title, -}) => { - return ( -
- {title || subtitle || actions || icon ? ( -
-
- {title ? ( -
- {icon} -

{title}

-
- ) : null} - {subtitle ?
{subtitle}
: null} -
- {actions ?
{actions}
: null} -
- ) : null} - {children} -
- ); -}; - -export default SectionPanel; diff --git a/webui/src/components/channel/ChannelFieldRenderer.tsx b/webui/src/components/channel/ChannelFieldRenderer.tsx index 883d8fb..2544323 100644 --- a/webui/src/components/channel/ChannelFieldRenderer.tsx +++ b/webui/src/components/channel/ChannelFieldRenderer.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { Check, ShieldCheck, Users, Wifi } from 'lucide-react'; -import { CheckboxCardField, FieldBlock, TextField } from '../FormControls'; +import { CheckboxCardField, FieldBlock, TextField } from '../ui/FormControls'; import type { ChannelField, ChannelKey } from './channelSchema'; type Translate = (key: string, options?: any) => string; diff --git a/webui/src/components/channel/WhatsAppQRCodePanel.tsx b/webui/src/components/channel/WhatsAppQRCodePanel.tsx index 3c6e3dd..5a23fe5 100644 --- a/webui/src/components/channel/WhatsAppQRCodePanel.tsx +++ b/webui/src/components/channel/WhatsAppQRCodePanel.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { QrCode, Smartphone } from 'lucide-react'; import ChannelSectionCard from './ChannelSectionCard'; -import EmptyState from '../EmptyState'; +import EmptyState from '../data-display/EmptyState'; type Translate = (key: string, options?: any) => string; diff --git a/webui/src/components/channel/WhatsAppStatusPanel.tsx b/webui/src/components/channel/WhatsAppStatusPanel.tsx index a471bc5..b71f54d 100644 --- a/webui/src/components/channel/WhatsAppStatusPanel.tsx +++ b/webui/src/components/channel/WhatsAppStatusPanel.tsx @@ -1,9 +1,9 @@ import React from 'react'; import { LogOut, Wifi, WifiOff } from 'lucide-react'; -import { FixedButton } from '../Button'; +import { FixedButton } from '../ui/Button'; import ChannelSectionCard from './ChannelSectionCard'; -import InfoTile from '../InfoTile'; -import NoticePanel from '../NoticePanel'; +import InfoTile from '../data-display/InfoTile'; +import NoticePanel from '../layout/NoticePanel'; type Translate = (key: string, options?: any) => string; diff --git a/webui/src/components/chat/ChatComposer.tsx b/webui/src/components/chat/ChatComposer.tsx index aedbfcf..6786725 100644 --- a/webui/src/components/chat/ChatComposer.tsx +++ b/webui/src/components/chat/ChatComposer.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { Paperclip, Send } from 'lucide-react'; -import { TextField } from '../FormControls'; +import { TextField } from '../ui/FormControls'; type ChatComposerProps = { chatTab: 'main' | 'subagents'; diff --git a/webui/src/components/chat/SubagentSidebar.tsx b/webui/src/components/chat/SubagentSidebar.tsx index 0061f6f..56a3d6f 100644 --- a/webui/src/components/chat/SubagentSidebar.tsx +++ b/webui/src/components/chat/SubagentSidebar.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { Button } from '../Button'; -import { SelectField, TextField, TextareaField } from '../FormControls'; +import { Button } from '../ui/Button'; +import { SelectField, TextField, TextareaField } from '../ui/FormControls'; import type { AgentRuntimeBadge, RegistryAgent } from './chatUtils'; type SubagentSidebarProps = { @@ -103,15 +103,15 @@ const SubagentSidebar: React.FC = ({ ); })} diff --git a/webui/src/components/chat/SubagentStreamFilters.tsx b/webui/src/components/chat/SubagentStreamFilters.tsx index 110f661..815742e 100644 --- a/webui/src/components/chat/SubagentStreamFilters.tsx +++ b/webui/src/components/chat/SubagentStreamFilters.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Button } from '../Button'; +import { Button } from '../ui/Button'; type SubagentStreamFiltersProps = { agents: string[]; diff --git a/webui/src/components/config/ConfigPageChrome.tsx b/webui/src/components/config/ConfigPageChrome.tsx index 5c6b966..c7467b3 100644 --- a/webui/src/components/config/ConfigPageChrome.tsx +++ b/webui/src/components/config/ConfigPageChrome.tsx @@ -1,8 +1,9 @@ import React from 'react'; import { RefreshCw, Save } from 'lucide-react'; -import { Button, FixedButton } from '../Button'; -import { TextField, ToolbarCheckboxField } from '../FormControls'; -import { ModalBackdrop, ModalCard, ModalHeader, ModalShell } from '../ModalFrame'; +import { Button, FixedButton } from '../ui/Button'; +import { TextField, ToolbarCheckboxField } from '../ui/FormControls'; +import CodeBlockPanel from '../data-display/CodeBlockPanel'; +import { ModalBackdrop, ModalCard, ModalHeader, ModalShell } from '../ui/ModalFrame'; type Translate = (key: string, options?: any) => string; @@ -95,18 +96,21 @@ export function ConfigSidebar({ t, }: ConfigSidebarProps) { return ( -