/** * PaneView - Single pane wrapper with focus management. * Handles click-to-focus, width, and edge split drop zones for DnD. * TabBar is now rendered in TabBarRow (above sidebar + content area). */ import { useDndContext } from '@dnd-kit/core'; import { useStore } from '@renderer/store'; import { MAX_PANES } from '@renderer/types/panes'; import { useShallow } from 'zustand/react/shallow'; import { PaneContent } from './PaneContent'; import { PaneSplitDropZone } from './PaneSplitDropZone'; interface PaneViewProps { paneId: string; } export const PaneView = ({ paneId }: PaneViewProps): React.JSX.Element => { const { pane, isFocused, paneCount, focusPane } = useStore( useShallow((s) => ({ pane: s.paneLayout.panes.find((p) => p.id === paneId), isFocused: s.paneLayout.focusedPaneId === paneId, paneCount: s.paneLayout.panes.length, focusPane: s.focusPane, })) ); // Check if a drag is active to show/hide edge drop zones const { active } = useDndContext(); const isDragging = active !== null; const canSplit = paneCount < MAX_PANES; const showSplitZones = isDragging && canSplit; if (!pane) return
; const handleMouseDown = (): void => { if (!isFocused) { focusPane(paneId); } }; return ( // eslint-disable-next-line jsx-a11y/no-static-element-interactions -- pane focus management requires mousedown
{/* Edge split drop zones - visible only during active drag when under MAX_PANES */} {/* Max pane indicator - shown during drag when at limit */} {isDragging && !canSplit && (
Maximum {MAX_PANES} panes reached
)}
); };