Skip to content

Commit 0fdf0c0

Browse files
committed
refactor: 合并导航栏,减少导航项从 11 个到 7 个
合并相关功能页面: - 智能路由 + 容错配置 → 路由管理(Tab 切换) - 配置切换 + 配置管理 → 配置管理(Tab 切换) - MCP + Prompts + Skills → 扩展(Tab 切换) 新增组件: - RoutingManagementPage: 路由管理合并页面 - ConfigManagementPage: 配置管理合并页面 - ExtensionsPage: 扩展合并页面 各子页面支持 hideHeader 属性,嵌入合并页面时隐藏标题
1 parent 341839a commit 0fdf0c0

15 files changed

Lines changed: 913 additions & 579 deletions

File tree

src/App.tsx

Lines changed: 14 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,21 @@
11
import { useState } from "react";
22
import { Sidebar } from "./components/Sidebar";
33
import { Dashboard } from "./components/Dashboard";
4-
import { Providers } from "./components/Providers";
54
import { SettingsPage } from "./components/settings";
6-
import { SwitchPage } from "./components/switch";
7-
import { ClientsPage } from "./components/clients";
8-
import { McpPage } from "./components/mcp";
9-
import { PromptsPage } from "./components/prompts";
105
import { ApiServerPage } from "./components/api-server/ApiServerPage";
11-
import { SkillsPage } from "./components/skills";
126
import { ProviderPoolPage } from "./components/provider-pool";
13-
import { RoutingPage } from "./components/routing";
14-
import { ResiliencePage } from "./components/resilience";
15-
import { ConfigPage } from "./components/config";
7+
import { RoutingManagementPage } from "./components/routing/RoutingManagementPage";
8+
import { ConfigManagementPage } from "./components/config/ConfigManagementPage";
9+
import { ExtensionsPage } from "./components/extensions";
1610

1711
type Page =
1812
| "dashboard"
19-
| "clients"
20-
| "api-server"
21-
| "providers"
22-
| "settings"
23-
| "switch"
24-
| "mcp"
25-
| "prompts"
26-
| "skills"
2713
| "provider-pool"
28-
| "routing"
29-
| "resilience"
30-
| "config";
14+
| "routing-management"
15+
| "config-management"
16+
| "extensions"
17+
| "api-server"
18+
| "settings";
3119

3220
function App() {
3321
const [currentPage, setCurrentPage] = useState<Page>("dashboard");
@@ -38,28 +26,16 @@ function App() {
3826
return <Dashboard />;
3927
case "provider-pool":
4028
return <ProviderPoolPage />;
41-
case "clients":
42-
return <ClientsPage />;
29+
case "routing-management":
30+
return <RoutingManagementPage />;
31+
case "config-management":
32+
return <ConfigManagementPage />;
33+
case "extensions":
34+
return <ExtensionsPage />;
4335
case "api-server":
4436
return <ApiServerPage />;
45-
case "providers":
46-
return <Providers />;
4737
case "settings":
4838
return <SettingsPage />;
49-
case "switch":
50-
return <SwitchPage />;
51-
case "mcp":
52-
return <McpPage />;
53-
case "prompts":
54-
return <PromptsPage />;
55-
case "skills":
56-
return <SkillsPage />;
57-
case "routing":
58-
return <RoutingPage />;
59-
case "resilience":
60-
return <ResiliencePage />;
61-
case "config":
62-
return <ConfigPage />;
6339
default:
6440
return <Dashboard />;
6541
}

src/components/Sidebar.tsx

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,22 @@
11
import {
22
LayoutDashboard,
33
Settings,
4-
Plug,
5-
MessageSquare,
6-
Monitor,
74
Globe,
8-
Boxes,
95
Database,
106
Route,
11-
Shield,
127
FileCode,
8+
Puzzle,
139
} from "lucide-react";
1410
import { cn } from "@/lib/utils";
1511

1612
type Page =
1713
| "dashboard"
18-
| "clients"
19-
| "api-server"
20-
| "providers"
21-
| "settings"
22-
| "switch"
23-
| "mcp"
24-
| "prompts"
25-
| "skills"
2614
| "provider-pool"
27-
| "routing"
28-
| "resilience"
29-
| "config";
15+
| "routing-management"
16+
| "config-management"
17+
| "extensions"
18+
| "api-server"
19+
| "settings";
3020

3121
interface SidebarProps {
3222
currentPage: Page;
@@ -36,14 +26,10 @@ interface SidebarProps {
3626
const navItems = [
3727
{ id: "dashboard" as Page, label: "仪表盘", icon: LayoutDashboard },
3828
{ id: "provider-pool" as Page, label: "凭证池", icon: Database },
39-
{ id: "routing" as Page, label: "智能路由", icon: Route },
40-
{ id: "resilience" as Page, label: "容错配置", icon: Shield },
41-
{ id: "config" as Page, label: "配置管理", icon: FileCode },
42-
{ id: "clients" as Page, label: "配置切换", icon: Monitor },
29+
{ id: "routing-management" as Page, label: "路由管理", icon: Route },
30+
{ id: "config-management" as Page, label: "配置管理", icon: FileCode },
31+
{ id: "extensions" as Page, label: "扩展", icon: Puzzle },
4332
{ id: "api-server" as Page, label: "API Server", icon: Globe },
44-
{ id: "mcp" as Page, label: "MCP", icon: Plug },
45-
{ id: "prompts" as Page, label: "Prompts", icon: MessageSquare },
46-
{ id: "skills" as Page, label: "Skills", icon: Boxes },
4733
{ id: "settings" as Page, label: "设置", icon: Settings },
4834
];
4935

src/components/clients/ClientsPage.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,24 @@ import { AppTabs } from "./AppTabs";
44
import { ProviderList } from "./ProviderList";
55
import { HelpTip } from "@/components/HelpTip";
66

7-
export function ClientsPage() {
7+
interface ClientsPageProps {
8+
hideHeader?: boolean;
9+
}
10+
11+
export function ClientsPage({ hideHeader = false }: ClientsPageProps) {
812
const [activeApp, setActiveApp] = useState<AppType>("claude");
913

1014
return (
1115
<div className="space-y-6">
12-
<div>
13-
<h2 className="text-2xl font-bold">配置切换</h2>
14-
<p className="text-muted-foreground">
15-
一键切换 Claude Code / Codex / Gemini CLI 的 API 配置,快速在不同
16-
Provider 间切换
17-
</p>
18-
</div>
16+
{!hideHeader && (
17+
<div>
18+
<h2 className="text-2xl font-bold">配置切换</h2>
19+
<p className="text-muted-foreground">
20+
一键切换 Claude Code / Codex / Gemini CLI 的 API 配置,快速在不同
21+
Provider 间切换
22+
</p>
23+
</div>
24+
)}
1925

2026
<HelpTip title="关于 ProxyCast 本地代理" variant="blue">
2127
<p className="text-sm text-blue-700 dark:text-blue-400">
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { useState } from "react";
2+
import { Monitor, FileCode } from "lucide-react";
3+
import { cn } from "@/lib/utils";
4+
import { ClientsPage } from "../clients/ClientsPage";
5+
import { ConfigPage } from "./ConfigPage";
6+
7+
type Tab = "switch" | "config";
8+
9+
const tabs = [
10+
{ id: "switch" as Tab, label: "配置切换", icon: Monitor },
11+
{ id: "config" as Tab, label: "配置文件", icon: FileCode },
12+
];
13+
14+
export function ConfigManagementPage() {
15+
const [activeTab, setActiveTab] = useState<Tab>("switch");
16+
17+
return (
18+
<div className="space-y-6">
19+
<div>
20+
<h2 className="text-2xl font-bold">配置管理</h2>
21+
<p className="text-muted-foreground">管理客户端配置和配置文件</p>
22+
</div>
23+
24+
{/* Tab 切换 */}
25+
<div className="flex gap-1 border-b">
26+
{tabs.map((tab) => (
27+
<button
28+
key={tab.id}
29+
onClick={() => setActiveTab(tab.id)}
30+
className={cn(
31+
"flex items-center gap-2 px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",
32+
activeTab === tab.id
33+
? "border-primary text-primary"
34+
: "border-transparent text-muted-foreground hover:text-foreground",
35+
)}
36+
>
37+
<tab.icon className="h-4 w-4" />
38+
{tab.label}
39+
</button>
40+
))}
41+
</div>
42+
43+
{/* Tab 内容 */}
44+
<div className="pt-2">
45+
{activeTab === "switch" && <ClientsPage hideHeader />}
46+
{activeTab === "config" && <ConfigPage hideHeader />}
47+
</div>
48+
</div>
49+
);
50+
}

0 commit comments

Comments
 (0)