| 1 | import { createFileRoute, redirect } from "@tanstack/react-router"; |
| 2 | |
| 3 | import { DeploymentsPanel } from "../components/deployments/DeploymentsPanel"; |
| 4 | import { SidebarInset } from "../components/ui/sidebar"; |
| 5 | import { WorkspaceBreadcrumb, WorkspaceBreadcrumbItem } from "../components/WorkspaceBreadcrumb"; |
| 6 | import { WorkspacePageContainer } from "../components/WorkspacePageContainer"; |
| 7 | import { WorkspacePageHeader } from "../components/WorkspacePageHeader"; |
| 8 | import { isElectron } from "../env"; |
| 9 | import { useEscapeToGoBack } from "../hooks/useNavigateBack"; |
| 10 | import { usePrimaryEnvironmentId } from "../state/environments"; |
| 11 | |
| 12 | function DeploymentsPage() { |
| 13 | useEscapeToGoBack(); |
| 14 | const environmentId = usePrimaryEnvironmentId(); |
| 15 | |
| 16 | return ( |
| 17 | <SidebarInset className="h-dvh min-h-0 overflow-hidden overscroll-y-none isolate"> |
| 18 | <div className="flex min-h-0 min-w-0 flex-1 flex-col bg-background text-foreground"> |
| 19 | <WorkspacePageHeader electron={isElectron}> |
| 20 | <WorkspaceBreadcrumb ariaLabel="Deployments breadcrumb" className="min-w-0"> |
| 21 | <WorkspaceBreadcrumbItem current> |
| 22 | <h1>Deployments</h1> |
| 23 | </WorkspaceBreadcrumbItem> |
| 24 | </WorkspaceBreadcrumb> |
| 25 | </WorkspacePageHeader> |
| 26 | <WorkspacePageContainer className="min-h-0 flex-1 pb-0"> |
| 27 | {environmentId ? <DeploymentsPanel environmentId={environmentId} /> : null} |
| 28 | </WorkspacePageContainer> |
| 29 | </div> |
| 30 | </SidebarInset> |
| 31 | ); |
| 32 | } |
| 33 | |
| 34 | export const Route = createFileRoute("/deployments")({ |
| 35 | beforeLoad: async ({ context }) => { |
| 36 | if ( |
| 37 | context.authGateState.status !== "authenticated" && |
| 38 | context.authGateState.status !== "hosted-static" |
| 39 | ) { |
| 40 | throw redirect({ to: "/pair", replace: true }); |
| 41 | } |
| 42 | }, |
| 43 | component: DeploymentsPage, |
| 44 | }); |