From b641df15d5cf1e1b7d73af3a07a01e7dc659dff2 Mon Sep 17 00:00:00 2001 From: Darshan Date: Mon, 1 Sep 2025 19:54:51 +0530 Subject: [PATCH] fix: show modal and not the wizard. --- src/lib/components/archiveProject.svelte | 2 +- src/lib/components/billing/alerts/projectsLimit.svelte | 5 ++--- .../components/billing/alerts/selectProjectCloud.svelte | 5 ++--- src/lib/components/organizationUsageLimits.svelte | 9 +++++---- src/lib/stores/billing.ts | 1 - .../(console)/organization-[organization]/+page.svelte | 6 +++--- .../billing/cancelDowngradeModal.svelte | 7 ++++++- .../organization-[organization]/change-plan/+page.svelte | 1 + 8 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/lib/components/archiveProject.svelte b/src/lib/components/archiveProject.svelte index 42d1e6443..3ebb938c1 100644 --- a/src/lib/components/archiveProject.svelte +++ b/src/lib/components/archiveProject.svelte @@ -263,7 +263,7 @@ {/if} - +

Are you sure you want to unarchive {projectToUnarchive?.name}?

This will move the project back to your active projects list.

diff --git a/src/lib/components/billing/alerts/projectsLimit.svelte b/src/lib/components/billing/alerts/projectsLimit.svelte index 8d7b10b33..a5e5d81e7 100644 --- a/src/lib/components/billing/alerts/projectsLimit.svelte +++ b/src/lib/components/billing/alerts/projectsLimit.svelte @@ -4,11 +4,10 @@ import { Button } from '$lib/elements/forms'; import { HeaderAlert } from '$lib/layout'; import { - billingProjectsLimitDate, hideBillingHeaderRoutes, upgradeURL } from '$lib/stores/billing'; - import { currentPlan } from '$lib/stores/organization'; + import { currentPlan, organization } from '$lib/stores/organization'; import SelectProjectCloud from './selectProjectCloud.svelte'; import { toLocaleDate } from '$lib/helpers/date'; @@ -31,7 +30,7 @@ type="warning" title="Action required: You have more than {$currentPlan.projects} projects."> - Choose which projects to keep before {toLocaleDate(billingProjectsLimitDate)} or upgrade + Choose which projects to keep before {toLocaleDate($organization.billingNextInvoiceDate)} or upgrade to Pro. Projects over the limit will be blocked after this date. diff --git a/src/lib/components/billing/alerts/selectProjectCloud.svelte b/src/lib/components/billing/alerts/selectProjectCloud.svelte index e0afdfbe2..66c1b04fa 100644 --- a/src/lib/components/billing/alerts/selectProjectCloud.svelte +++ b/src/lib/components/billing/alerts/selectProjectCloud.svelte @@ -6,9 +6,8 @@ import { addNotification } from '$lib/stores/notifications'; import { invalidate } from '$app/navigation'; import { Dependencies } from '$lib/constants'; - import { billingProjectsLimitDate } from '$lib/stores/billing'; import { toLocaleDate, toLocaleDateTime } from '$lib/helpers/date'; - import { currentPlan } from '$lib/stores/organization'; + import { currentPlan, organization } from '$lib/stores/organization'; let { showSelectProject = $bindable(false), @@ -151,7 +150,7 @@ {#if selectedProjects.length === $currentPlan?.projects} + title={`${projects.length - selectedProjects.length} projects will be archived on ${toLocaleDate($organization.billingNextInvoiceDate)}`}> {@html formatProjectsToArchive()} will be archived. diff --git a/src/lib/components/organizationUsageLimits.svelte b/src/lib/components/organizationUsageLimits.svelte index 883480a26..1f240f479 100644 --- a/src/lib/components/organizationUsageLimits.svelte +++ b/src/lib/components/organizationUsageLimits.svelte @@ -11,8 +11,7 @@ import { Alert } from '@appwrite.io/pink-svelte'; import { addNotification } from '$lib/stores/notifications'; import { toLocaleDate, toLocaleDateTime } from '$lib/helpers/date'; - import { billingProjectsLimitDate } from '$lib/stores/billing'; - import type { Organization } from '$lib/stores/organization'; + import { organization, type Organization } from '$lib/stores/organization'; import type { Models } from '@appwrite.io/console'; // Props @@ -28,7 +27,7 @@ let showSelectProject = $state(false); let selectedProjects = $state([]); let error = $state(null); - let showSelectionReminder = $derived.by(() => validateOrAlert()); + let showSelectionReminder = $state(false); // Derived state using runes let freePlanLimits = $derived({ @@ -87,6 +86,7 @@ function handleManageProjects() { showSelectProject = true; + showSelectionReminder = false; trackEvent(Click.OrganizationClickUpgrade, { source: 'usage_limits_manage_projects' }); } @@ -115,6 +115,7 @@ } // Keep selection locally; parent flow will apply after plan change showSelectProject = false; + showSelectionReminder = false; addNotification({ type: 'success', message: `Projects selected for archiving` }); } @@ -293,7 +294,7 @@ {#if selectedProjects.length === allowedProjectsToKeep} + title={`${projects.length - selectedProjects.length} projects will be archived on ${toLocaleDate($organization.billingNextInvoiceDate)}`}> {formatProjectsToArchive()} will be archived {/if} diff --git a/src/lib/stores/billing.ts b/src/lib/stores/billing.ts index af6f48c36..2a88fa83a 100644 --- a/src/lib/stores/billing.ts +++ b/src/lib/stores/billing.ts @@ -69,7 +69,6 @@ export const roles = [ export const teamStatusReadonly = 'readonly'; export const billingLimitOutstandingInvoice = 'outstanding_invoice'; -export const billingProjectsLimitDate = '2025-09-01'; export const paymentMethods = derived(page, ($page) => $page.data.paymentMethods as PaymentList); export const addressList = derived(page, ($page) => $page.data.addressList as AddressesList); diff --git a/src/routes/(console)/organization-[organization]/+page.svelte b/src/routes/(console)/organization-[organization]/+page.svelte index c4d94274a..909b1ead7 100644 --- a/src/routes/(console)/organization-[organization]/+page.svelte +++ b/src/routes/(console)/organization-[organization]/+page.svelte @@ -18,7 +18,7 @@ } from '$lib/components'; import { trackEvent, Click } from '$lib/actions/analytics'; import { type Models } from '@appwrite.io/console'; - import { billingProjectsLimitDate, readOnly, upgradeURL } from '$lib/stores/billing'; + import { readOnly, upgradeURL } from '$lib/stores/billing'; import { onMount, type ComponentType } from 'svelte'; import { canWriteProjects } from '$lib/stores/roles'; import { checkPricingRefAndRedirect } from '$lib/helpers/pricingRedirect'; @@ -35,7 +35,7 @@ } from '@appwrite.io/pink-icons-svelte'; import { getPlatformInfo } from '$lib/helpers/platform'; import CreateProjectCloud from './createProjectCloud.svelte'; - import { currentPlan, regions as regionsStore } from '$lib/stores/organization'; + import { currentPlan, organization, regions as regionsStore } from '$lib/stores/organization'; import SelectProjectCloud from '$lib/components/billing/alerts/selectProjectCloud.svelte'; import ArchiveProject from '$lib/components/archiveProject.svelte'; import { toLocaleDate } from '$lib/helpers/date'; @@ -135,7 +135,7 @@ {#if isCloud && $currentPlan?.projects && $currentPlan?.projects > 0 && data.organization.projects.length > 0 && $canWriteProjects && (projectsToArchive.length > 0 || data.projects.total > $currentPlan.projects)} + title={`${projectsToArchive.length} projects will be archived on ${toLocaleDate($organization.billingNextInvoiceDate)}`}> Upgrade your plan to restore archived projects