11import type { RefObject } from 'react'
2- import SandboxInspectFrame from '@/features/dashboard/sandbox/inspect/frame '
2+ import { DashboardPanelFrame } from '@/features/dashboard/shared '
33import { IconButton } from '@/ui/primitives/icon-button'
44import {
55 CopyIcon ,
@@ -13,6 +13,7 @@ interface TerminalPanelProps {
1313 status : TerminalStatus
1414 template : string
1515 restartAction ?: 'new' | 'reconnect'
16+ reconnectSandboxId ?: string
1617 terminalContainerRef : RefObject < HTMLDivElement | null >
1718 onFocusTerminal : ( ) => void
1819 onCopyTerminalText : ( ) => void
@@ -24,6 +25,7 @@ export default function TerminalPanel({
2425 status,
2526 template,
2627 restartAction = 'new' ,
28+ reconnectSandboxId,
2729 terminalContainerRef,
2830 onFocusTerminal,
2931 onCopyTerminalText,
@@ -33,6 +35,8 @@ export default function TerminalPanel({
3335 const restartLabel = isReconnectAction
3436 ? 'Reconnect terminal'
3537 : 'Start new terminal sandbox'
38+ const isRestartDisabled =
39+ status === 'starting' || ( isReconnectAction && ! reconnectSandboxId )
3640
3741 const header = (
3842 < div className = "flex h-full items-center justify-between px-3" >
@@ -69,11 +73,11 @@ export default function TerminalPanel({
6973 className = "size-7"
7074 aria-label = { restartLabel }
7175 title = { restartLabel }
72- disabled = { status === 'starting' }
76+ disabled = { isRestartDisabled }
7377 onClick = { ( ) =>
7478 onStartTerminal (
75- isReconnectAction && sandboxId
76- ? { sandboxId }
79+ isReconnectAction
80+ ? { sandboxId : reconnectSandboxId }
7781 : { forceNewSandbox : true }
7882 )
7983 }
@@ -85,14 +89,14 @@ export default function TerminalPanel({
8589 )
8690
8791 return (
88- < SandboxInspectFrame header = { header } >
92+ < DashboardPanelFrame header = { header } >
8993 < div
9094 ref = { terminalContainerRef }
9195 role = "application"
9296 aria-label = "Terminal"
9397 className = "min-h-0 flex-1 cursor-text overflow-hidden bg-black p-3"
9498 onMouseDown = { onFocusTerminal }
9599 />
96- </ SandboxInspectFrame >
100+ </ DashboardPanelFrame >
97101 )
98102}
0 commit comments