mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-21 23:50:45 +00:00
* perf(terminal): smooth layout drags and faster tab switching Defer xterm refit during split, sidebar, and host-tree drags while keeping pane containers in sync with live layout measurements. Refactor TerminalLayer into focused sections with TabBridge/memo optimizations and add the terminal host tree sidebar. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(terminal): keep side panels alive and guard session attach races Prevent terminal boot unmount from leaking backend sessions, keep SFTP/scripts/theme/AI state when switching side tabs, and defer heavy SFTP UI mount so first entry stays responsive. Co-authored-by: Cursor <cursoragent@cursor.com> * perf(terminal): reduce tab switch jank --------- Co-authored-by: Cursor <cursoragent@cursor.com>
65 lines
2.1 KiB
TypeScript
65 lines
2.1 KiB
TypeScript
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
import React, { memo } from 'react';
|
|
|
|
import { TerminalLayerFocusSidebarSection } from './TerminalLayerFocusSidebarSection';
|
|
import { TerminalLayerHostTreeSection } from './TerminalLayerHostTreeSection';
|
|
import { TerminalLayerSidePanelSection } from './TerminalLayerSidePanelSection';
|
|
import { TerminalLayerWorkspaceSection } from './TerminalLayerWorkspaceSection';
|
|
import { terminalLayerViewCtxEqual } from './terminalLayerViewMemo';
|
|
|
|
type TerminalLayerViewContext = Record<string, any>;
|
|
|
|
function TerminalLayerViewInner({ ctx }: { ctx: TerminalLayerViewContext }) {
|
|
const {
|
|
activeWorkspace,
|
|
composeBarThemeColors,
|
|
focusedSessionId,
|
|
handleComposeSend,
|
|
isBroadcastEnabled,
|
|
isComposeBarOpen,
|
|
isTerminalLayerVisible,
|
|
refocusTerminalSession,
|
|
setIsComposeBarOpen,
|
|
TerminalComposeBar,
|
|
workspaceOuterRef,
|
|
} = ctx;
|
|
|
|
return (
|
|
<div
|
|
ref={workspaceOuterRef}
|
|
className="absolute inset-0 bg-background flex flex-col"
|
|
data-section="terminal-workspace"
|
|
style={{
|
|
visibility: isTerminalLayerVisible ? 'visible' : 'hidden',
|
|
pointerEvents: isTerminalLayerVisible ? 'auto' : 'none',
|
|
zIndex: isTerminalLayerVisible ? 10 : 0,
|
|
}}
|
|
>
|
|
<div className="flex-1 flex min-h-0 relative">
|
|
<TerminalLayerHostTreeSection ctx={ctx} />
|
|
<TerminalLayerSidePanelSection ctx={ctx} />
|
|
<TerminalLayerFocusSidebarSection ctx={ctx} />
|
|
<TerminalLayerWorkspaceSection ctx={ctx} />
|
|
</div>
|
|
|
|
{activeWorkspace && isComposeBarOpen && (
|
|
<TerminalComposeBar
|
|
onSend={handleComposeSend}
|
|
onClose={() => {
|
|
setIsComposeBarOpen(false);
|
|
refocusTerminalSession(focusedSessionId);
|
|
}}
|
|
isBroadcastEnabled={isBroadcastEnabled?.(activeWorkspace.id)}
|
|
themeColors={composeBarThemeColors}
|
|
/>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export const TerminalLayerView = memo(
|
|
TerminalLayerViewInner,
|
|
(prev, next) => terminalLayerViewCtxEqual(prev.ctx, next.ctx),
|
|
);
|
|
TerminalLayerView.displayName = 'TerminalLayerView';
|