/** Multi-Workspace Tab 管理器 — 多 Tab + 独立上下文 + 最多 8 个。 */ "use client"; import { X, Plus } from "lucide-react"; /** 工作区 Tab 定义。 */ export interface WorkspaceTab { id: string; title: string; href: string; } /** Workspace Tabs Props。 */ interface WorkspaceTabsProps { tabs: WorkspaceTab[]; activeId: string; onSwitch: (id: string) => void; onClose: (id: string) => void; onAdd: () => void; } /** 最大 Tab 数量。 */ const MAX_TABS = 8; /** * Multi-Workspace Tab 管理器组件。 * * 支持多 Tab 独立上下文,最多 8 个 Tab,超出时淘汰最久未访问的 Tab。 */ export function WorkspaceTabs({ tabs, activeId, onSwitch, onClose, onAdd }: WorkspaceTabsProps) { return (
{tabs.map((tab) => (
{tabs.length > 1 && ( )}
))} {tabs.length < MAX_TABS && ( )}
); }