From 6ae9f49b4c5bd0cf1813a804fe4564fc6f28f3b7 Mon Sep 17 00:00:00 2001 From: Yaosanqi137 Date: Mon, 6 Apr 2026 14:26:18 +0800 Subject: [PATCH] refactor(web-ai): split chat and settings pages --- apps/web/src/App.tsx | 84 +- .../src/components/ai/ai-assistant-panel.tsx | 811 ------------------ apps/web/src/components/ai/ai-shared.ts | 72 ++ apps/web/src/pages/ai-chat-page.tsx | 443 ++++++++++ apps/web/src/pages/placeholder-page.tsx | 26 + apps/web/src/pages/settings-page.tsx | 474 ++++++++++ apps/web/src/pages/todo-shell-page.tsx | 5 +- 7 files changed, 1090 insertions(+), 825 deletions(-) delete mode 100644 apps/web/src/components/ai/ai-assistant-panel.tsx create mode 100644 apps/web/src/components/ai/ai-shared.ts create mode 100644 apps/web/src/pages/ai-chat-page.tsx create mode 100644 apps/web/src/pages/placeholder-page.tsx create mode 100644 apps/web/src/pages/settings-page.tsx diff --git a/apps/web/src/App.tsx b/apps/web/src/App.tsx index 4c6384e..dd51c3b 100644 --- a/apps/web/src/App.tsx +++ b/apps/web/src/App.tsx @@ -17,8 +17,11 @@ import { import { Navigate, Route, Routes, useLocation, useNavigate } from "react-router-dom"; import { Button } from "@/components/ui/button"; import { cn } from "@/lib/utils"; +import { AiChatPage } from "@/pages/ai-chat-page"; import { EmailLoginPage } from "@/pages/email-login-page"; import { OAuthCallbackPage } from "@/pages/oauth-callback-page"; +import { PlaceholderPage } from "@/pages/placeholder-page"; +import { SettingsPage } from "@/pages/settings-page"; import { TodoShellPage } from "@/pages/todo-shell-page"; import { revokeRefreshToken, type EmailLoginResult } from "@/services/auth-api"; import { @@ -38,17 +41,18 @@ type SidebarItem = { key: string; label: string; icon: LucideIcon; + path: string; }; const SIDEBAR_ITEMS: SidebarItem[] = [ - { key: "dashboard", label: "概览面板", icon: LayoutDashboard }, - { key: "todo", label: "待办事项", icon: ListTodo }, - { key: "ai", label: "AI 建议", icon: Sparkles }, - { key: "notice", label: "提醒中心", icon: Bell }, - { key: "settings", label: "系统设置", icon: Settings } + { key: "dashboard", label: "概览面板", icon: LayoutDashboard, path: "/dashboard" }, + { key: "todo", label: "待办事项", icon: ListTodo, path: "/todo" }, + { key: "ai", label: "AI 助手", icon: Sparkles, path: "/ai" }, + { key: "notice", label: "提醒中心", icon: Bell, path: "/notice" }, + { key: "settings", label: "系统设置", icon: Settings, path: "/settings" } ]; -const READY_SIDEBAR_KEYS = new Set(["todo", "ai"]); +const READY_SIDEBAR_KEYS = new Set(["todo", "ai", "settings"]); function toWebSession(payload: EmailLoginResult): WebSession { return { @@ -106,7 +110,7 @@ function App() { saveSession(nextSession); setSession(nextSession); setMobileSidebarOpen(false); - navigate("/", { replace: true }); + navigate("/todo", { replace: true }); } function handleBootstrapSession(nextSession: WebSession): void { @@ -138,14 +142,21 @@ function App() {