-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathStepViewerLayout.tsx
More file actions
53 lines (45 loc) · 1.53 KB
/
Copy pathStepViewerLayout.tsx
File metadata and controls
53 lines (45 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import type { ReactNode } from 'react';
import { Panel, PanelGroup, PanelResizeHandle } from 'react-resizable-panels';
import { useCurrentRun, useRunStoreInstance } from '../../hooks/useRun';
import { StepList } from './StepList';
interface StepViewerLayoutProps {
children: ReactNode;
selectedStepId: string | null;
}
/**
* Shared layout component for run viewer tabs that displays a resizable
* step list at the top and content viewer below.
*
* Used by LogTabPanel, InputTabPanel, and OutputTabPanel to provide
* consistent layout and behavior.
*/
export function StepViewerLayout({
children,
selectedStepId,
}: StepViewerLayoutProps) {
const run = useCurrentRun();
const runStore = useRunStoreInstance();
if (!run) {
return <div className="p-4 text-gray-500">No run selected</div>;
}
return (
<PanelGroup direction="vertical" className="h-full">
{/* Step list for navigation */}
<Panel defaultSize={20} minSize={10} maxSize={40}>
<div className="h-full overflow-auto border-b p-4">
<StepList
steps={run.steps}
selectedStepId={selectedStepId}
onSelectStep={runStore.selectStep}
/>
</div>
</Panel>
{/* Resize handle */}
<PanelResizeHandle className="h-1 bg-gray-200 hover:bg-blue-400 transition-colors cursor-row-resize" />
{/* Content viewer (logs, input, or output) */}
<Panel minSize={30} style={{ overflow: 'unset' }}>
<div className="h-full">{children}</div>
</Panel>
</PanelGroup>
);
}