From 0e4166bd5f494c3db8761c0562894568cbd6fb33 Mon Sep 17 00:00:00 2001 From: hsiegeln <37154749+hsiegeln@users.noreply.github.com> Date: Wed, 22 Apr 2026 23:05:46 +0200 Subject: [PATCH] ui(deploy): PrimaryActionButton + computeMode state-machine helper Co-Authored-By: Claude Sonnet 4.6 --- .../AppDeploymentPage/PrimaryActionButton.tsx | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 ui/src/pages/AppsTab/AppDeploymentPage/PrimaryActionButton.tsx diff --git a/ui/src/pages/AppsTab/AppDeploymentPage/PrimaryActionButton.tsx b/ui/src/pages/AppsTab/AppDeploymentPage/PrimaryActionButton.tsx new file mode 100644 index 00000000..ef4e9ac7 --- /dev/null +++ b/ui/src/pages/AppsTab/AppDeploymentPage/PrimaryActionButton.tsx @@ -0,0 +1,34 @@ +import { Button } from '@cameleer/design-system'; + +export type PrimaryActionMode = 'save' | 'redeploy' | 'deploying'; + +interface Props { + mode: PrimaryActionMode; + enabled: boolean; + onClick: () => void; +} + +export function PrimaryActionButton({ mode, enabled, onClick }: Props) { + if (mode === 'deploying') { + return ; + } + if (mode === 'redeploy') { + return ; + } + return ; +} + +export function computeMode({ + deploymentInProgress, + hasLocalEdits, + serverDirtyAgainstDeploy, +}: { + deploymentInProgress: boolean; + hasLocalEdits: boolean; + serverDirtyAgainstDeploy: boolean; +}): PrimaryActionMode { + if (deploymentInProgress) return 'deploying'; + if (hasLocalEdits) return 'save'; + if (serverDirtyAgainstDeploy) return 'redeploy'; + return 'save'; +}