diff --git a/apps/dashboard/src/components/billing/CloudDeployPlanModal.tsx b/apps/dashboard/src/components/billing/CloudDeployPlanModal.tsx index 7e2411e4..1c5c32f8 100644 --- a/apps/dashboard/src/components/billing/CloudDeployPlanModal.tsx +++ b/apps/dashboard/src/components/billing/CloudDeployPlanModal.tsx @@ -5,12 +5,16 @@ import { Icon as UiIcon } from "@repo/ui/icons"; import { useCallback, useEffect, useId, useRef, useState } from "react"; import { useDialogFocus } from "@/hooks/useDialogFocus"; import { useI18n } from "@/components/i18n-provider"; +import { Button } from "@/components/ui/button"; import { billingApi, type BillingState } from "@/lib/api/billing"; import { ApiError } from "@/lib/api/client"; import { cloudDeployRecovery, type CloudDeployRestriction } from "@/lib/cloud-deploy-pricing"; import { CloudPlanPicker } from "./CloudPlanPicker"; -export function CloudDeployPlanModal({ restriction, onClose }: { +export function CloudDeployPlanModal({ + restriction, + onClose, +}: { restriction: CloudDeployRestriction; onClose: () => void; }) { @@ -58,89 +62,167 @@ export function CloudDeployPlanModal({ restriction, onClose }: { }, [refresh]); const recovery = state ? cloudDeployRecovery(state, restriction) : "subscribe"; - const planChanged = recovery === "upgrade" && state && !state.overQuota && state.tier !== initialTier.current; + const planChanged = + recovery === "upgrade" && state && !state.overQuota && state.tier !== initialTier.current; const ready = recovery === "ready" || planChanged; const showPlans = !ready && (recovery === "subscribe" || recovery === "upgrade"); - const title = recovery === "credits" ? copy.creditsTitle - : recovery === "upgrade" ? copy.upgradeTitle - : recovery === "payment" || recovery === "paused" ? copy.blockedTitle : copy.title; - const reason = restriction.reason && Object.hasOwn(copy.reasons, restriction.reason) - ? copy.reasons[restriction.reason as keyof typeof copy.reasons] : undefined; - const description = ready ? copy.ready - : recovery === "credits" ? copy.creditsDescription - : recovery === "payment" ? copy.paymentDescription - : recovery === "paused" ? copy.pausedDescription - : recovery === "upgrade" ? (reason ?? copy.upgradeDescription) : copy.description; + const title = + recovery === "credits" + ? copy.creditsTitle + : recovery === "upgrade" + ? copy.upgradeTitle + : recovery === "payment" || recovery === "paused" + ? copy.blockedTitle + : copy.title; + const reason = + restriction.reason && Object.hasOwn(copy.reasons, restriction.reason) + ? copy.reasons[restriction.reason as keyof typeof copy.reasons] + : undefined; + const description = ready + ? copy.ready + : recovery === "credits" + ? copy.creditsDescription + : recovery === "payment" + ? copy.paymentDescription + : recovery === "paused" + ? copy.pausedDescription + : recovery === "upgrade" + ? (reason ?? copy.upgradeDescription) + : copy.description; return ( -
{description}
-- {error === "owner" ? copy.ownerRequired : copy.loadError} +
+ {description}
- ) : state && ( -+ {error === "owner" ? copy.ownerRequired : copy.loadError} +
+ ) : ( + state && ( ++ {copy.pending} +
+ )}{copy.pending}
} -{copy.preserved}
{copy.preserved}
-