Files
AI/ontology_platform/web/frontend/src/components/layout/navigation.ts

206 lines
4.8 KiB
TypeScript
Raw Normal View History

2026-05-20 18:43:08 +09:00
import type { ComponentType } from "react";
import {
Activity,
Brain,
ClipboardCheck,
Code2,
GitBranch,
2026-05-20 20:59:40 +09:00
Globe2,
2026-05-20 18:43:08 +09:00
Layers3,
LayoutDashboard,
ListChecks,
Network,
SearchCheck,
Settings2,
ShieldCheck,
UploadCloud,
} from "lucide-react";
export type NavGroupId = "workspace" | "build" | "review" | "publish";
export interface NavItem {
/** Stable identifier — used as React key and palette command id */
id: string;
/** i18n key */
labelKey: string;
/** Default label (English) */
label: string;
/** Static route — mutually exclusive with projectPath */
to?: string;
/** Path segment under /:projectId — joined as `/${projectPath}/${projectId}` */
projectPath?: string;
icon: ComponentType<{ className?: string }>;
/** Search keywords for the command palette (in addition to label) */
keywords?: string[];
/** Optional shortcut hint shown next to the item */
shortcut?: string;
}
export interface NavGroup {
id: NavGroupId;
labelKey: string;
label: string;
items: NavItem[];
}
export const NAV_GROUPS: NavGroup[] = [
{
id: "workspace",
labelKey: "navGroup.workspace",
label: "Workspace",
items: [
{
id: "dashboard",
to: "/",
labelKey: "nav.dashboard",
label: "Dashboard",
icon: LayoutDashboard,
keywords: ["home", "overview"],
shortcut: "g d",
},
{
id: "onboard",
to: "/onboard",
labelKey: "nav.onboard",
label: "New Project",
icon: UploadCloud,
keywords: ["create", "start", "wizard"],
shortcut: "g n",
},
2026-05-20 20:59:40 +09:00
{
id: "domains",
to: "/domains",
labelKey: "nav.domains",
label: "Domain Builder",
icon: Globe2,
keywords: ["domain", "schema", "reference", "crawler"],
shortcut: "g m",
},
2026-05-20 18:43:08 +09:00
],
},
{
id: "build",
labelKey: "navGroup.build",
label: "Build",
items: [
{
id: "sources",
projectPath: "sources",
labelKey: "nav.sources",
label: "Source Explorer",
icon: Settings2,
keywords: ["urls", "domains", "seed"],
shortcut: "g s",
},
{
id: "crawl",
projectPath: "crawl",
labelKey: "nav.crawl",
label: "Seed Crawl",
icon: Activity,
keywords: ["scrape", "fetch"],
shortcut: "g c",
},
{
id: "pipeline",
projectPath: "pipeline",
labelKey: "nav.pipeline",
label: "Build Pipeline",
icon: Layers3,
keywords: ["jobs", "run", "extract"],
shortcut: "g p",
},
{
id: "analysis",
projectPath: "analysis",
labelKey: "nav.analysis",
label: "Page Analysis",
icon: SearchCheck,
keywords: ["html", "structure"],
shortcut: "g a",
},
{
id: "schema",
projectPath: "schema",
labelKey: "nav.schema",
label: "Schema Designer",
icon: ShieldCheck,
keywords: ["types", "predicate", "model"],
shortcut: "g t",
},
{
id: "research",
projectPath: "research",
labelKey: "nav.research",
label: "Graph Research",
icon: Brain,
keywords: ["graphrag", "query", "ai", "autonomous"],
shortcut: "g r",
},
],
},
{
id: "review",
labelKey: "navGroup.review",
label: "Review",
items: [
{
id: "editor",
projectPath: "editor",
labelKey: "nav.editor",
label: "Entity Manager",
icon: Network,
keywords: ["entities", "nodes", "merge"],
shortcut: "g e",
},
{
id: "review",
projectPath: "review",
labelKey: "nav.review",
label: "Claim Review",
icon: ListChecks,
keywords: ["validate", "approve", "queue"],
shortcut: "g v",
},
{
id: "quality",
projectPath: "quality",
labelKey: "nav.quality",
label: "Quality Inspector",
icon: ClipboardCheck,
keywords: ["metrics", "qa", "audit"],
shortcut: "g q",
},
{
id: "graph",
projectPath: "graph",
labelKey: "nav.graph",
label: "Graph View",
icon: GitBranch,
keywords: ["visualization", "network"],
shortcut: "g g",
},
],
},
{
id: "publish",
labelKey: "navGroup.publish",
label: "Publish",
items: [
{
id: "export",
projectPath: "export",
labelKey: "nav.export",
label: "Export / API",
icon: Code2,
keywords: ["download", "rest", "json"],
shortcut: "g x",
},
],
},
];
export const PROJECT_ROUTE_PATTERNS = NAV_GROUPS.flatMap((g) =>
g.items.filter((i) => i.projectPath).map((i) => `/${i.projectPath}/:projectId`),
);