/** * Context menu for editor tabs. * Supports: close, close others, close to left/right, close all. */ import * as ContextMenu from '@radix-ui/react-context-menu'; interface EditorTabContextMenuProps { children: React.ReactNode; tabId: string; tabIndex: number; totalTabs: number; onClose: (tabId: string) => void; onCloseOthers: (tabId: string) => void; onCloseToLeft: (tabId: string) => void; onCloseToRight: (tabId: string) => void; onCloseAll: () => void; } export const EditorTabContextMenu = ({ children, tabId, tabIndex, totalTabs, onClose, onCloseOthers, onCloseToLeft, onCloseToRight, onCloseAll, }: EditorTabContextMenuProps): React.ReactElement => { const hasLeft = tabIndex > 0; const hasRight = tabIndex < totalTabs - 1; const hasOthers = totalTabs > 1; return (
{children}
onClose(tabId)} > Close onCloseOthers(tabId)} > Close Others onCloseToLeft(tabId)} > Close Tabs to the Left onCloseToRight(tabId)} > Close Tabs to the Right Close All
); };