From c533e8826c2d7748029d97b3c0cee783b870645e Mon Sep 17 00:00:00 2001 From: Pedram Amini Date: Mon, 2 Feb 2026 03:40:14 -0600 Subject: [PATCH] MAESTRO: Add unified tab system props to TabBar interface - Add UnifiedTab discriminated union type to types/index.ts - Add new props to TabBarProps: unifiedTabs, activeFileTabId, onFileTabSelect, onFileTabClose - Props are optional for backwards compatibility during transition - Phase 3 of file preview tabs implementation --- src/renderer/components/TabBar.tsx | 17 ++++++++++++++++- src/renderer/types/index.ts | 9 +++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/renderer/components/TabBar.tsx b/src/renderer/components/TabBar.tsx index 053f5c11..669c9a9d 100644 --- a/src/renderer/components/TabBar.tsx +++ b/src/renderer/components/TabBar.tsx @@ -19,7 +19,7 @@ import { ChevronsRight, Loader2, } from 'lucide-react'; -import type { AITab, Theme } from '../types'; +import type { AITab, Theme, FilePreviewTab, UnifiedTab } from '../types'; import { hasDraft } from '../utils/tabHelpers'; interface TabBarProps { @@ -60,6 +60,16 @@ interface TabBarProps { onCloseTabsLeft?: () => void; /** Handler to close tabs to the right of active tab */ onCloseTabsRight?: () => void; + + // === Unified Tab System Props (Phase 3) === + /** Merged ordered list of AI and file preview tabs for unified rendering */ + unifiedTabs?: UnifiedTab[]; + /** Currently active file tab ID (null if an AI tab is active) */ + activeFileTabId?: string | null; + /** Handler to select a file preview tab */ + onFileTabSelect?: (tabId: string) => void; + /** Handler to close a file preview tab */ + onFileTabClose?: (tabId: string) => void; } interface TabProps { @@ -924,6 +934,11 @@ function TabBarInner({ onCloseOtherTabs, onCloseTabsLeft, onCloseTabsRight, + // Unified tab system props (Phase 3) + unifiedTabs: _unifiedTabs, + activeFileTabId: _activeFileTabId, + onFileTabSelect: _onFileTabSelect, + onFileTabClose: _onFileTabClose, }: TabBarProps) { const [draggingTabId, setDraggingTabId] = useState(null); const [dragOverTabId, setDragOverTabId] = useState(null); diff --git a/src/renderer/types/index.ts b/src/renderer/types/index.ts index 2a2e2db8..cc5a8ea6 100644 --- a/src/renderer/types/index.ts +++ b/src/renderer/types/index.ts @@ -465,6 +465,15 @@ export interface FilePreviewTab { */ export type UnifiedTabRef = { type: 'ai' | 'file'; id: string }; +/** + * Unified tab entry for rendering in TabBar. + * Discriminated union that includes the full tab data for each type. + * Used by TabBar to render both AI and file tabs in a single list. + */ +export type UnifiedTab = + | { type: 'ai'; id: string; data: AITab } + | { type: 'file'; id: string; data: FilePreviewTab }; + export interface Session { id: string; groupId?: string;