| 1 | // TabContent renders the active tab's panel inside the tab container. Panel |
| 2 | // content needs the shell's props (context, usage, workspace state…), so the |
| 3 | // component takes a renderer callback: the shell provides `renderTab(tab)`, |
| 4 | // and TabContent routes the active tab through it, falling back to the tab |
| 5 | // picker when the dock holds no tab at all. |
| 6 | |
| 7 | import type { ReactNode } from "react"; |
| 8 | import { DockTabPicker } from "./DockTabPicker"; |
| 9 | import type { TabItem } from "../../store/activityBar"; |
| 10 | |
| 11 | interface TabContentProps { |
| 12 | activeTab: TabItem | null; |
| 13 | /** App-provided panel renderer for the active tab. */ |
| 14 | renderTab: (tab: TabItem) => ReactNode; |
| 15 | /** Opens (or activates) the view an empty-state entry stands for. */ |
| 16 | onPickEntry: (entryId: string) => void; |
| 17 | } |
| 18 | |
| 19 | export function TabContent({ activeTab, renderTab, onPickEntry }: TabContentProps) { |
| 20 | if (!activeTab) { |
| 21 | return <DockTabPicker onSelect={onPickEntry} />; |
| 22 | } |
| 23 | return <>{renderTab(activeTab)}</>; |
| 24 | } |
| 25 |