Files
Netcatty/components/terminalLayer/TerminalLayerView.tsx
T
陈大猫 636f4d7037 fix(terminal): reflow workspace when compose bar or side panel layout changes (#1376)
Keep the compose bar inside the terminal workspace so SFTP side panels stay full height, refit xterm when the bar toggles, and remeasure split-pane geometry when side panels open or close.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-10 19:00:46 +08:00

39 lines
1.4 KiB
TypeScript

/* 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';
type TerminalLayerViewContext = Record<string, any>;
function TerminalLayerViewInner({ ctx }: { ctx: TerminalLayerViewContext }) {
const hostTreeLayoutWidth = useTerminalHostTreeLayoutWidth();
return (
<div
ref={ctx.workspaceOuterRef}
className="absolute inset-0 bg-background flex min-h-0"
data-section="terminal-workspace"
style={{
visibility: ctx.isTerminalLayerVisible ? 'visible' : 'hidden',
pointerEvents: ctx.isTerminalLayerVisible ? 'auto' : 'none',
zIndex: ctx.isTerminalLayerVisible ? 10 : 0,
left: hostTreeLayoutWidth,
}}
>
<TerminalLayerSidePanelSection ctx={ctx} />
<TerminalLayerFocusSidebarSection ctx={ctx} />
<TerminalLayerWorkspaceSection ctx={ctx} />
</div>
);
}
export const TerminalLayerView = memo(
TerminalLayerViewInner,
(prev, next) => terminalLayerViewCtxEqual(prev.ctx, next.ctx),
);
TerminalLayerView.displayName = 'TerminalLayerView';