feat:add warning for one free organization limitation

This commit is contained in:
Harsh Mahajan
2025-08-20 01:02:55 +05:30
parent 0059958e01
commit 46c80e44fe
2 changed files with 21 additions and 9 deletions
@@ -22,12 +22,9 @@
<LabelCard
name="plan"
bind:group={billingPlan}
disabled={anyOrgFree || !selfService}
disabled={!selfService}
value={BillingPlan.FREE}
title={tierFree.name}
tooltipShow={anyOrgFree}
tooltipText="You are limited to 1 Free organization per account."
tooltipWidth="100%">
title={tierFree.name}>
<svelte:fragment slot="action">
{#if $organization?.billingPlan === BillingPlan.FREE && !isNewOrg}
<Badge variant="secondary" size="xs" content="Current plan" />
@@ -264,7 +264,9 @@
$: isUpgrade = $plansInfo.get(selectedPlan).order > $currentPlan?.order;
$: isDowngrade = $plansInfo.get(selectedPlan).order < $currentPlan?.order;
$: isButtonDisabled = $organization?.billingPlan === selectedPlan;
$: isButtonDisabled =
$organization?.billingPlan === selectedPlan ||
(isDowngrade && selectedPlan === BillingPlan.FREE && data.hasFreeOrgs);
</script>
<svelte:head>
@@ -297,8 +299,21 @@
selfService={data.selfService}
anyOrgFree={data.hasFreeOrgs} />
{#if isDowngrade && selectedPlan === BillingPlan.FREE && data.hasFreeOrgs}
<Alert.Inline
status="warning"
title="You can only have one free organization per account">
To downgrade this organization, first migrate or delete one of your
existing paid organizations.
<Button
compact
href="https://appwrite.io/docs/advanced/migrations/cloud"
>Migration guide</Button>
</Alert.Inline>
{/if}
{#if isDowngrade}
{#if selectedPlan === BillingPlan.FREE}
{#if selectedPlan === BillingPlan.FREE && !data.hasFreeOrgs}
<PlanExcess tier={BillingPlan.FREE} />
{:else if selectedPlan === BillingPlan.PRO && data.organization.billingPlan === BillingPlan.SCALE && collaborators?.length > 0}
{@const extraMembers = collaborators?.length ?? 0}
@@ -364,7 +379,7 @@
id="members" />
</Fieldset>
{/if}
{#if isDowngrade && selectedPlan === BillingPlan.FREE}
{#if isDowngrade && selectedPlan === BillingPlan.FREE && !data.hasFreeOrgs}
<Fieldset legend="Feedback">
<Layout.Stack gap="xl">
<InputSelect
@@ -395,7 +410,7 @@
bind:billingBudget
organizationId={data.organization.$id} />
{:else if data.organization.billingPlan !== BillingPlan.CUSTOM}
<PlanComparisonBox downgrade={isDowngrade} />
<PlanComparisonBox downgrade={data.hasFreeOrgs ? false : isDowngrade} />
{/if}
</svelte:fragment>
<svelte:fragment slot="footer">