From e9aad64463e909d15f7c783be233b487f984fe0b Mon Sep 17 00:00:00 2001 From: Devin Villarosa Date: Wed, 5 Feb 2025 14:31:16 -0800 Subject: [PATCH] [UI v2] feat: Scaffolds UX components for deployment details page --- .../deployments/deployment-details-header.tsx | 32 ++++++ .../deployments/deployment-details-page.tsx | 41 ++++++++ .../deployments/deployment-details-tabs.tsx | 97 +++++++++++++++++++ .../src/routes/deployments/deployment.$id.tsx | 5 +- 4 files changed, 174 insertions(+), 1 deletion(-) create mode 100644 ui-v2/src/components/deployments/deployment-details-header.tsx create mode 100644 ui-v2/src/components/deployments/deployment-details-page.tsx create mode 100644 ui-v2/src/components/deployments/deployment-details-tabs.tsx diff --git a/ui-v2/src/components/deployments/deployment-details-header.tsx b/ui-v2/src/components/deployments/deployment-details-header.tsx new file mode 100644 index 000000000000..0195feb40660 --- /dev/null +++ b/ui-v2/src/components/deployments/deployment-details-header.tsx @@ -0,0 +1,32 @@ +import { Deployment } from "@/api/deployments"; +import { + Breadcrumb, + BreadcrumbItem, + BreadcrumbLink, + BreadcrumbList, + BreadcrumbPage, + BreadcrumbSeparator, +} from "../ui/breadcrumb"; + +type DeploymentDetailsHeaderProps = { + deployment: Deployment; +}; +export const DeploymentDetailsHeader = ({ + deployment, +}: DeploymentDetailsHeaderProps) => { + return ( + + + + + Deployments + + + + + {deployment.name} + + + + ); +}; diff --git a/ui-v2/src/components/deployments/deployment-details-page.tsx b/ui-v2/src/components/deployments/deployment-details-page.tsx new file mode 100644 index 000000000000..3280fadea802 --- /dev/null +++ b/ui-v2/src/components/deployments/deployment-details-page.tsx @@ -0,0 +1,41 @@ +import { buildDeploymentDetailsQuery } from "@/api/deployments"; +import { useSuspenseQuery } from "@tanstack/react-query"; + +import { DeploymentDetailsHeader } from "./deployment-details-header"; +import { DeploymentDetailsTabs } from "./deployment-details-tabs"; + +type DeploymentDetailsPageProps = { + id: string; +}; + +export const DeploymentDetailsPage = ({ id }: DeploymentDetailsPageProps) => { + const { data } = useSuspenseQuery(buildDeploymentDetailsQuery(id)); + + return ( +
+
+
+ +
{""}
+
+
+
{""}
+
{""}
+
+
+
+
+ +
+
+
{""}
+
{""}
+
+
{""}
+
+
{""}
+
+
+
+ ); +}; diff --git a/ui-v2/src/components/deployments/deployment-details-tabs.tsx b/ui-v2/src/components/deployments/deployment-details-tabs.tsx new file mode 100644 index 000000000000..735b44424b4a --- /dev/null +++ b/ui-v2/src/components/deployments/deployment-details-tabs.tsx @@ -0,0 +1,97 @@ +import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; +import type { DeploymentDetailsTabOptions } from "@/routes/deployments/deployment.$id"; +import { Link, getRouteApi } from "@tanstack/react-router"; +import { type JSX } from "react"; + +const routeApi = getRouteApi("/deployments/deployment/$id"); + +type TabOption = { + value: DeploymentDetailsTabOptions; + LinkComponent: () => JSX.Element; + ViewComponent: () => JSX.Element; +}; + +const TAB_OPTIONS = [ + { + value: "Runs", + LinkComponent: () => ( + + Runs + + ), + ViewComponent: () => ( + +
{""}
+
+ ), + }, + { + value: "Upcoming", + LinkComponent: () => ( + + Upcoming + + ), + ViewComponent: () => ( + +
{""}
+
+ ), + }, + { + value: "Upcoming", + LinkComponent: () => ( + + Parameters + + ), + ViewComponent: () => ( + +
{""}
+
+ ), + }, + { + value: "Configuration", + LinkComponent: () => ( + + Configuration + + ), + ViewComponent: () => ( + +
{""}
+
+ ), + }, + { + value: "Description", + LinkComponent: () => ( + + Description + + ), + ViewComponent: () => ( + +
{""}
+
+ ), + }, +] as const satisfies Array; + +export const DeploymentDetailsTabs = (): JSX.Element => { + const { tab } = routeApi.useSearch(); + + return ( + + + {TAB_OPTIONS.map(({ value, LinkComponent }) => ( + + ))} + + {TAB_OPTIONS.map(({ value, ViewComponent }) => ( + + ))} + + ); +}; diff --git a/ui-v2/src/routes/deployments/deployment.$id.tsx b/ui-v2/src/routes/deployments/deployment.$id.tsx index 73b6f3a34b0f..b2571e9d127a 100644 --- a/ui-v2/src/routes/deployments/deployment.$id.tsx +++ b/ui-v2/src/routes/deployments/deployment.$id.tsx @@ -3,6 +3,8 @@ import { createFileRoute } from "@tanstack/react-router"; import { zodValidator } from "@tanstack/zod-adapter"; import { z } from "zod"; +import { DeploymentDetailsPage } from "@/components/deployments/deployment-details-page"; + /** * Schema for validating URL search parameters for the Deployment Details page * @property {"Runs" | "Upcoming" | "Parameters" | "Configuration" | "Description"} tab used designate which tab view to display @@ -24,5 +26,6 @@ export const Route = createFileRoute("/deployments/deployment/$id")({ }); function RouteComponent() { - return "🚧🚧 Pardon our dust! 🚧🚧"; + const { id } = Route.useParams(); + return ; }