diff --git a/apps/dashboard/app/(app)/projects/[projectId]/deployments/components/rollback-dialog.tsx b/apps/dashboard/app/(app)/projects/[projectId]/deployments/components/rollback-dialog.tsx index d29829915a..52af6548c6 100644 --- a/apps/dashboard/app/(app)/projects/[projectId]/deployments/components/rollback-dialog.tsx +++ b/apps/dashboard/app/(app)/projects/[projectId]/deployments/components/rollback-dialog.tsx @@ -1,9 +1,28 @@ "use client"; import { type Deployment, collection } from "@/lib/collections"; +import { shortenId } from "@/lib/shorten-id"; import { trpc } from "@/lib/trpc/client"; -import { CircleInfo, Cloud, CodeBranch, CodeCommit } from "@unkey/icons"; +import { CircleInfo, CodeBranch, CodeCommit } from "@unkey/icons"; import { Badge, Button, DialogContainer, toast } from "@unkey/ui"; +import { StatusIndicator } from "../../details/active-deployment-card/status-indicator"; + +type DeploymentSectionProps = { + title: string; + deployment: Deployment; + isActive: boolean; + showSignal?: boolean; +}; + +const DeploymentSection = ({ title, deployment, isActive, showSignal }: DeploymentSectionProps) => ( +
+
+

{title}

+ +
+ +
+); type RollbackDialogProps = { isOpen: boolean; @@ -84,81 +103,57 @@ export const RollbackDialog = ({ } > -
- {/* Current active deployment */} -
-
-

Current active deployment

- -
+
+ + +
+ + ); +}; -
-
-
- -
-
- {currentDeployment.id} - -
Active
-
-
-
- {currentDeployment?.gitCommitMessage || "Current active deployment"} -
-
-
-
-
- - {currentDeployment.gitBranch} -
-
- - {currentDeployment.gitCommitSha} -
-
-
-
-
+type DeploymentCardProps = { + deployment: Deployment; + isActive: boolean; + showSignal?: boolean; +}; - {/* Target version */} -
+const DeploymentCard = ({ deployment, isActive, showSignal }: DeploymentCardProps) => ( +
+
+
+ +
-

Target version

- + + {`${deployment.id.slice(0, 3)}...${deployment.id.slice(-4)}`} + + + {isActive ? "Active" : "Preview"} +
- -
-
-
- -
-
- {deployment.id} - -
Inactive
-
-
-
- {deployment.gitCommitMessage || "Target deployment"} -
-
-
-
-
- - {deployment.gitBranch} -
-
- - {deployment.gitCommitSha} -
-
-
+
+ {deployment.gitCommitMessage || `${isActive ? "Current active" : "Target"} deployment`}
- - ); -}; +
+
+ + {deployment.gitBranch} +
+
+ + {shortenId(deployment.gitCommitSha ?? "")} +
+
+
+
+); diff --git a/apps/dashboard/app/(app)/projects/[projectId]/deployments/components/table/deployments-list.tsx b/apps/dashboard/app/(app)/projects/[projectId]/deployments/components/table/deployments-list.tsx index c411a61cca..535e97e6cf 100644 --- a/apps/dashboard/app/(app)/projects/[projectId]/deployments/components/table/deployments-list.tsx +++ b/apps/dashboard/app/(app)/projects/[projectId]/deployments/components/table/deployments-list.tsx @@ -160,7 +160,10 @@ export const DeploymentsList = ({ projectId }: Props) => { } | null>(null); const isCompactView = useIsMobile({ breakpoint: COMPACT_BREAKPOINT }); - const columns: Column<{ deployment: Deployment; environment?: Environment }>[] = useMemo(() => { + const columns: Column<{ + deployment: Deployment; + environment?: Environment; + }>[] = useMemo(() => { return [ { key: "deployment_id", @@ -386,7 +389,10 @@ export const DeploymentsList = ({ projectId }: Props) => { render: ({ deployment, environment, - }: { deployment: Deployment; environment?: Environment }) => { + }: { + deployment: Deployment; + environment?: Environment; + }) => { return ( { }, }, ]; - }, [selectedDeployment?.deployment.id, isCompactView, deployments, activeDeployment]); + }, [selectedDeployment?.deployment.id, isCompactView, activeDeployment, activeDeploymentId]); return ( { switch (status) { case "pending": - return { variant: "warning" as const, icon: CircleWarning, text: "Queued" }; + return { + variant: "warning" as const, + icon: CircleWarning, + text: "Queued", + }; case "building": - return { variant: "warning" as const, icon: CircleWarning, text: "Building" }; + return { + variant: "warning" as const, + icon: CircleWarning, + text: "Building", + }; case "deploying": - return { variant: "warning" as const, icon: CircleWarning, text: "Deploying" }; + return { + variant: "warning" as const, + icon: CircleWarning, + text: "Deploying", + }; case "network": - return { variant: "warning" as const, icon: CircleWarning, text: "Assigning Domains" }; + return { + variant: "warning" as const, + icon: CircleWarning, + text: "Assigning Domains", + }; case "ready": return { variant: "success" as const, icon: CircleCheck, text: "Ready" }; case "failed": @@ -84,7 +100,7 @@ export const ActiveDeploymentCard: React.FC = ({ deploymentId }) => {
- +
{deployment.id}
TODO
diff --git a/apps/dashboard/app/(app)/projects/[projectId]/details/active-deployment-card/status-indicator.tsx b/apps/dashboard/app/(app)/projects/[projectId]/details/active-deployment-card/status-indicator.tsx index 6c16f8e4be..275d88b56b 100644 --- a/apps/dashboard/app/(app)/projects/[projectId]/details/active-deployment-card/status-indicator.tsx +++ b/apps/dashboard/app/(app)/projects/[projectId]/details/active-deployment-card/status-indicator.tsx @@ -1,32 +1,38 @@ import { Cloud } from "@unkey/icons"; import { cn } from "@unkey/ui/src/lib/utils"; -export function StatusIndicator() { +export function StatusIndicator({ + withSignal = false, +}: { + withSignal?: boolean; +}) { return (
-
- {[0, 0.15, 0.3, 0.45].map((delay, index) => ( -
- key={index} - className={cn( - "absolute inset-0 size-2 rounded-full", - index === 0 && "bg-successA-9 opacity-75", - index === 1 && "bg-successA-10 opacity-60", - index === 2 && "bg-successA-11 opacity-40", - index === 3 && "bg-successA-12 opacity-25", - )} - style={{ - animation: "ping 2s cubic-bezier(0, 0, 0.2, 1) infinite", - animationDelay: `${delay}s`, - }} - /> - ))} -
-
+ {withSignal && ( +
+ {[0, 0.15, 0.3, 0.45].map((delay, index) => ( +
+ key={index} + className={cn( + "absolute inset-0 size-2 rounded-full", + index === 0 && "bg-successA-9 opacity-75", + index === 1 && "bg-successA-10 opacity-60", + index === 2 && "bg-successA-11 opacity-40", + index === 3 && "bg-successA-12 opacity-25", + )} + style={{ + animation: "ping 2s cubic-bezier(0, 0, 0.2, 1) infinite", + animationDelay: `${delay}s`, + }} + /> + ))} +
+
+ )}
); }