/* eslint-disable @typescript-eslint/no-explicit-any */ import React, { memo } from 'react'; import { TerminalLayerFocusSidebarSection } from './TerminalLayerFocusSidebarSection'; import { TerminalLayerSidePanelSection } from './TerminalLayerSidePanelSection'; import { TerminalLayerWorkspaceSection } from './TerminalLayerWorkspaceSection'; import { terminalLayerViewCtxEqual } from './terminalLayerViewMemo'; import { useTerminalHostTreeLayoutWidth } from '../../application/state/terminalHostTreeStore'; import { resolveTerminalLayerSurfaceStyle } from '../terminalPaneVisibility'; import type { PluginSidebarHostActions } from '../../application/state/usePluginTerminalSidebar'; type TerminalLayerViewContext = Record & PluginSidebarHostActions; function TerminalLayerViewInner({ ctx }: { ctx: TerminalLayerViewContext }) { const hostTreeLayoutWidth = useTerminalHostTreeLayoutWidth(); const surfaceStyle = resolveTerminalLayerSurfaceStyle( ctx.isTerminalLayerVisible, ctx.hibernateHiddenTabs, ); const isBottomDock = ctx.sidePanelPosition === 'bottom'; return (
{/* Keep TerminalLayerSidePanelSection at a stable tree position (first child) so cycling between side and bottom docks reorders it via flex `order` instead of unmounting/recreating it. The wrapper below uses `display: contents` in side-dock mode so its children participate in the outer flex row exactly like direct children. */}
); } export const TerminalLayerView = memo( TerminalLayerViewInner, (prev, next) => terminalLayerViewCtxEqual(prev.ctx, next.ctx), ); TerminalLayerView.displayName = 'TerminalLayerView';