Refactor Assistant navigation and update HomePage button

Updated the AppShell and Sidebar components to streamline navigation for the Assistant section, consolidating assistant-related pages under a single "assistants" key. Removed deprecated assistant sub-items and adjusted the HomePage button to link to the new assistant navigation. Enhanced the AssistantPage with a list view for managing assistants, including mock data for demonstration.
This commit is contained in:
Xin Wang
2026-06-05 16:58:13 +08:00
parent 66e75fa856
commit 1794957bb1
4 changed files with 189 additions and 61 deletions

View File

@@ -9,7 +9,6 @@ import {
Clock3,
Database,
Wrench,
FileText,
Home,
PlayCircle,
Video,
@@ -34,15 +33,6 @@ const mainItems: Array<{
{ key: "test", label: "测试助手", icon: PlayCircle },
];
const assistantSubItems: Array<{
key: NavKey;
label: string;
icon: React.ComponentType<{ size?: number }>;
}> = [
{ key: "assistant-prompt", label: "提示词模式", icon: FileText },
{ key: "assistant-workflow", label: "工作流模式", icon: Workflow },
];
const componentSubItems: Array<{
key: NavKey;
label: string;
@@ -59,8 +49,7 @@ export function Sidebar({
onNavigate,
onToggle,
}: SidebarProps) {
const assistantActive =
active === "assistant-prompt" || active === "assistant-workflow";
const assistantActive = active === "assistants";
const componentActive =
active === "components-models" || active === "components-knowledge" || active === "components-tools";
@@ -106,46 +95,14 @@ export function Sidebar({
label="控制台"
onClick={() => onNavigate("home")}
/>
<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",
assistantActive ? "text-foreground" : "text-muted-foreground",
].join(" ")}
>
<Bot 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(" ")}
>
{assistantSubItems.map((item) => (
<NavButton
key={item.key}
active={active === item.key}
collapsed={collapsed}
icon={item.icon}
label={item.label}
onClick={() => onNavigate(item.key)}
small
/>
))}
</div>
<NavButton
active={assistantActive}
collapsed={collapsed}
icon={Bot}
label="创建助手"
onClick={() => onNavigate("assistants")}
/>
</div>
<div className="pt-2">