132 lines
2.9 KiB
TypeScript
132 lines
2.9 KiB
TypeScript
import type { Pathname } from "$app/types";
|
||
import type { IconName } from "$lib/components/ui/icons";
|
||
|
||
// IDs are retained for the existing page contracts while B1–B4 replace layouts.
|
||
export type NavId =
|
||
| "projects"
|
||
| "workbench"
|
||
| "image"
|
||
| "video"
|
||
| "tasks"
|
||
| "agents"
|
||
| "connections"
|
||
| "models"
|
||
| "library"
|
||
| "settings"
|
||
| "canvas"
|
||
| "workflows";
|
||
export interface NavItem {
|
||
id: NavId;
|
||
label: string;
|
||
icon: IconName;
|
||
href: Pathname;
|
||
scene: "project" | "image" | "agent" | "manage" | "asset" | "gold";
|
||
matches: (path: string) => boolean;
|
||
}
|
||
export const NAV_MAIN: NavItem[] = [
|
||
{
|
||
id: "projects",
|
||
label: "工作室",
|
||
icon: "nav-home",
|
||
href: "/",
|
||
scene: "gold",
|
||
matches: (p) => p === "/",
|
||
},
|
||
{
|
||
id: "workbench",
|
||
label: "项目",
|
||
icon: "nav-project",
|
||
href: "/workbench",
|
||
scene: "project",
|
||
matches: (p) => /^\/(workbench|project)(\/|$)/.test(p),
|
||
},
|
||
{
|
||
id: "image",
|
||
label: "创作台",
|
||
icon: "nav-create",
|
||
href: "/create",
|
||
scene: "image",
|
||
matches: (p) =>
|
||
["/create", "/image", "/video", "/playground", "/build-scene"].includes(
|
||
p,
|
||
),
|
||
},
|
||
{
|
||
id: "agents",
|
||
label: "智能体",
|
||
icon: "nav-agent",
|
||
href: "/agents",
|
||
scene: "agent",
|
||
matches: (p) => p === "/agents",
|
||
},
|
||
{
|
||
id: "canvas",
|
||
label: "画布",
|
||
icon: "nav-canvas",
|
||
href: "/canvas",
|
||
scene: "image",
|
||
matches: (p) => p.startsWith("/canvas"),
|
||
},
|
||
{
|
||
id: "library",
|
||
label: "素材库",
|
||
icon: "nav-lib",
|
||
href: "/library",
|
||
scene: "gold",
|
||
matches: (p) => p === "/library",
|
||
},
|
||
];
|
||
export const NAV_MANAGE: NavItem[] = [
|
||
{
|
||
id: "tasks",
|
||
label: "任务",
|
||
icon: "nav-queue",
|
||
href: "/tasks",
|
||
scene: "manage",
|
||
matches: (p) => p === "/tasks",
|
||
},
|
||
{
|
||
id: "workflows",
|
||
label: "工作流",
|
||
icon: "nav-flow",
|
||
href: "/workflows",
|
||
scene: "manage",
|
||
matches: (p) => p === "/workflows",
|
||
},
|
||
{
|
||
id: "connections",
|
||
label: "模型连接",
|
||
icon: "nav-plug",
|
||
href: "/model-connections",
|
||
scene: "manage",
|
||
matches: (p) =>
|
||
["/connections", "/models", "/model-connections"].includes(p),
|
||
},
|
||
];
|
||
export const NAV_FOOT: NavItem[] = [
|
||
{
|
||
id: "settings",
|
||
label: "设置",
|
||
icon: "nav-gear",
|
||
href: "/settings",
|
||
scene: "manage",
|
||
matches: (p) => p === "/settings",
|
||
},
|
||
];
|
||
// Tools awaiting their replacement keep reachable entries in global search.
|
||
export const NAV = [
|
||
...NAV_MAIN,
|
||
...NAV_MANAGE,
|
||
...NAV_FOOT,
|
||
{ id: "video", label: "视频创作", icon: "film", href: "/video" },
|
||
{ id: "models", label: "大语言模型", icon: "assets", href: "/models" },
|
||
{
|
||
id: "connections",
|
||
label: "ComfyUI 连接",
|
||
icon: "link",
|
||
href: "/connections",
|
||
},
|
||
{ id: "image", label: "试验台", icon: "playground", href: "/playground" },
|
||
{ id: "video", label: "三维搭景", icon: "story", href: "/build-scene" },
|
||
] as const;
|