Skip to content

Commit 78109c7

Browse files
Add sandbox terminal tab
1 parent 697b013 commit 78109c7

4 files changed

Lines changed: 45 additions & 0 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import SandboxTerminalView from '@/features/dashboard/sandbox/terminal/view'
2+
3+
export default async function SandboxTerminalPage({
4+
params,
5+
}: {
6+
params: Promise<{ teamSlug: string; sandboxId: string }>
7+
}) {
8+
const { sandboxId } = await params
9+
10+
return <SandboxTerminalView sandboxId={sandboxId} />
11+
}

src/configs/urls.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ export const PROTECTED_URLS = {
3535
`/dashboard/${teamSlug}/sandboxes/${sandboxId}/events`,
3636
SANDBOX_LOGS: (teamSlug: string, sandboxId: string) =>
3737
`/dashboard/${teamSlug}/sandboxes/${sandboxId}/logs`,
38+
SANDBOX_TERMINAL: (teamSlug: string, sandboxId: string) =>
39+
`/dashboard/${teamSlug}/sandboxes/${sandboxId}/terminal`,
3840
SANDBOX_FILESYSTEM: (teamSlug: string, sandboxId: string) =>
3941
`/dashboard/${teamSlug}/sandboxes/${sandboxId}/filesystem`,
4042

src/features/dashboard/sandbox/layout.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
HistoryIcon,
99
ListIcon,
1010
StorageIcon,
11+
TerminalCustomIcon,
1112
TrendIcon,
1213
} from '@/ui/primitives/icons'
1314
import { useSandboxContext } from './context'
@@ -68,6 +69,12 @@ export default function SandboxLayout({
6869
href: PROTECTED_URLS.SANDBOX_LOGS(teamSlug, sandboxId),
6970
icon: <ListIcon className="size-4" />,
7071
},
72+
{
73+
id: 'terminal',
74+
label: 'Terminal',
75+
href: PROTECTED_URLS.SANDBOX_TERMINAL(teamSlug, sandboxId),
76+
icon: <TerminalCustomIcon className="size-4" />,
77+
},
7178
{
7279
id: 'filesystem',
7380
label: 'Filesystem',
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
'use client'
2+
3+
import { useDashboard } from '@/features/dashboard/context'
4+
import DashboardTerminal from '@/features/dashboard/terminal/dashboard-terminal'
5+
6+
interface SandboxTerminalViewProps {
7+
sandboxId: string
8+
}
9+
10+
export default function SandboxTerminalView({
11+
sandboxId,
12+
}: SandboxTerminalViewProps) {
13+
const { team } = useDashboard()
14+
15+
return (
16+
<div className="flex min-h-0 flex-1 overflow-hidden p-3 md:p-6">
17+
<DashboardTerminal
18+
autoStart
19+
initialSandboxId={sandboxId}
20+
sandboxScoped
21+
teamId={team.id}
22+
/>
23+
</div>
24+
)
25+
}

0 commit comments

Comments
 (0)