feat(frontend): split test assistant nav into cases and batch pages
Make 测试助手 a sidebar section like 监控观察, with placeholder routes for 测试用例 and 批量测试. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
5
frontend/src/app/test/batch/page.tsx
Normal file
5
frontend/src/app/test/batch/page.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
import { BatchTestPage } from "@/components/pages/BatchTestPage";
|
||||
|
||||
export default function Page() {
|
||||
return <BatchTestPage />;
|
||||
}
|
||||
5
frontend/src/app/test/cases/page.tsx
Normal file
5
frontend/src/app/test/cases/page.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
import { TestCasesPage } from "@/components/pages/TestCasesPage";
|
||||
|
||||
export default function Page() {
|
||||
return <TestCasesPage />;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { TestPage } from "@/components/pages/TestPage";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export default function Page() {
|
||||
return <TestPage />;
|
||||
redirect("/test/cases");
|
||||
}
|
||||
|
||||
@@ -9,9 +9,11 @@ import {
|
||||
Brain,
|
||||
ChevronLeft,
|
||||
ChevronUp,
|
||||
ClipboardList,
|
||||
Clock3,
|
||||
Database,
|
||||
HelpCircle,
|
||||
Layers,
|
||||
Wrench,
|
||||
Home,
|
||||
LogOut,
|
||||
@@ -51,6 +53,11 @@ const monitorSubItems: NavItem[] = [
|
||||
{ href: "/dashboard", label: "数据看板", icon: Database },
|
||||
];
|
||||
|
||||
const testSubItems: NavItem[] = [
|
||||
{ href: "/test/cases", label: "测试用例", icon: ClipboardList },
|
||||
{ href: "/test/batch", label: "批量测试", icon: Layers },
|
||||
];
|
||||
|
||||
export function Sidebar({ collapsed, onToggle }: SidebarProps) {
|
||||
const pathname = usePathname();
|
||||
const router = useRouter();
|
||||
@@ -62,6 +69,7 @@ export function Sidebar({ collapsed, onToggle }: SidebarProps) {
|
||||
|
||||
const componentActive = componentSubItems.some((item) => isActive(item.href));
|
||||
const monitorActive = monitorSubItems.some((item) => isActive(item.href));
|
||||
const testActive = testSubItems.some((item) => isActive(item.href));
|
||||
|
||||
async function handleLogout() {
|
||||
await logout();
|
||||
@@ -201,13 +209,43 @@ export function Sidebar({ collapsed, onToggle }: SidebarProps) {
|
||||
</div>
|
||||
|
||||
<div className="pt-2">
|
||||
{collapsed ? (
|
||||
<div
|
||||
className="flex h-8 items-center justify-center"
|
||||
aria-hidden="true"
|
||||
title="测试助手"
|
||||
>
|
||||
<span className="h-px w-6 rounded-full bg-hairline-strong" />
|
||||
</div>
|
||||
) : (
|
||||
<div
|
||||
className={[
|
||||
"flex h-11 w-full items-center gap-3 rounded-full px-3 text-sm",
|
||||
testActive ? "text-foreground" : "text-muted-foreground",
|
||||
].join(" ")}
|
||||
>
|
||||
<PlayCircle size={18} />
|
||||
<span className="font-medium">测试助手</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div
|
||||
className={[
|
||||
"mt-1 space-y-1 transition-[padding] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)]",
|
||||
collapsed ? "pl-0" : "pl-5",
|
||||
].join(" ")}
|
||||
>
|
||||
{testSubItems.map((item) => (
|
||||
<NavButton
|
||||
active={isActive("/test")}
|
||||
key={item.href}
|
||||
active={isActive(item.href)}
|
||||
collapsed={collapsed}
|
||||
icon={PlayCircle}
|
||||
label="测试助手"
|
||||
href="/test"
|
||||
icon={item.icon}
|
||||
label={item.label}
|
||||
href={item.href}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
10
frontend/src/components/pages/BatchTestPage.tsx
Normal file
10
frontend/src/components/pages/BatchTestPage.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import { PlaceholderPage } from "./PlaceholderPage";
|
||||
|
||||
export function BatchTestPage() {
|
||||
return (
|
||||
<PlaceholderPage
|
||||
title="批量测试"
|
||||
description="按用例集批量跑测助手,汇总通过率与失败详情。"
|
||||
/>
|
||||
);
|
||||
}
|
||||
10
frontend/src/components/pages/TestCasesPage.tsx
Normal file
10
frontend/src/components/pages/TestCasesPage.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import { PlaceholderPage } from "./PlaceholderPage";
|
||||
|
||||
export function TestCasesPage() {
|
||||
return (
|
||||
<PlaceholderPage
|
||||
title="测试用例"
|
||||
description="管理助手的测试用例,覆盖典型问答与边界场景。"
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
import { PlaceholderPage } from "./PlaceholderPage";
|
||||
|
||||
export function TestPage() {
|
||||
return (
|
||||
<PlaceholderPage
|
||||
title="测试助手"
|
||||
description="在发布前通过实时视频对话测试助手的表现与交互体验。"
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user