diff --git a/apps/dokploy/components/dashboard/settings/billing/show-billing.tsx b/apps/dokploy/components/dashboard/settings/billing/show-billing.tsx index b66a23ca4..fbb85695b 100644 --- a/apps/dokploy/components/dashboard/settings/billing/show-billing.tsx +++ b/apps/dokploy/components/dashboard/settings/billing/show-billing.tsx @@ -111,14 +111,20 @@ export const ShowBilling = () => { const [trialTier, setTrialTier] = useState<"hobby" | "startup" | null>(null); const [switchingTrial, setSwitchingTrial] = useState(false); - const handleSwitchTrialPlan = async (tier: "hobby" | "startup") => { - const planName = tier === "startup" ? "Startup" : "Hobby"; + const handleSwitchTrialPlan = async ( + tier: "hobby" | "startup", + isAnnualPlan: boolean, + label?: string, + ) => { + const planName = + label ?? + `${tier === "startup" ? "Startup" : "Hobby"} ${isAnnualPlan ? "annual" : "monthly"}`; const switchPlan = async () => { await upgradeSubscription({ tier, serverQuantity: tier === "startup" ? STARTUP_SERVERS_INCLUDED : 1, - isAnnual: false, + isAnnual: isAnnualPlan, }); await new Promise((resolve) => setTimeout(resolve, 3000)); await Promise.all([ @@ -133,7 +139,7 @@ export const ShowBilling = () => { await toast .promise(switchPlan(), { loading: `Switching to ${planName}...`, - success: `Your trial is now on the ${planName} plan`, + success: `Your trial is now on ${planName}`, error: (error) => error instanceof Error ? error.message : "Error switching plan", }) @@ -336,6 +342,11 @@ export const ShowBilling = () => { {billingStatus.plan ?? "Trial"} + {billingStatus.plan && ( + + {billingStatus.isAnnual ? "Annual" : "Monthly"} + + )} {billingStatus.isOnTrial @@ -356,23 +367,45 @@ export const ShowBilling = () => { {billingStatus.isOnTrial && useNewPricing && - billingStatus.plan && ( - - handleSwitchTrialPlan( - billingStatus.plan === "startup" - ? "hobby" - : "startup", - ) - } - > - {billingStatus.plan === "startup" - ? "Switch to Hobby" - : "Switch to Startup"} - + billingStatus.plan && + billingStatus.plan !== "legacy" && ( + <> + + handleSwitchTrialPlan( + billingStatus.plan === "startup" + ? "hobby" + : "startup", + billingStatus.isAnnual, + ) + } + > + {billingStatus.plan === "startup" + ? "Switch to Hobby" + : "Switch to Startup"} + + + handleSwitchTrialPlan( + billingStatus.plan as "hobby" | "startup", + !billingStatus.isAnnual, + billingStatus.isAnnual + ? "monthly billing" + : "annual billing", + ) + } + > + {billingStatus.isAnnual + ? "Switch to monthly" + : "Switch to annual"} + + > )} 0, hasActiveAccess: plan !== null || !!trialingSub, + isAnnual, }; };