fix: show modal and not the wizard.

This commit is contained in:
Darshan
2025-09-01 19:54:51 +05:30
parent 215dcc89a3
commit b641df15d5
8 changed files with 20 additions and 16 deletions
+1 -1
View File
@@ -263,7 +263,7 @@
{/if}
<!-- Unarchive Confirmation Modal -->
<Modal bind:show={showUnarchiveModal} title="Unarchive project">
<Modal bind:show={showUnarchiveModal} title="Unarchive project" size="s">
<p>Are you sure you want to unarchive <strong>{projectToUnarchive?.name}</strong>?</p>
<p>This will move the project back to your active projects list.</p>
@@ -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.">
<svelte:fragment>
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.
</svelte:fragment>
<svelte:fragment slot="buttons">
@@ -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}
<Alert.Inline
status="warning"
title={`${projects.length - selectedProjects.length} projects will be archived on ${toLocaleDate(billingProjectsLimitDate)}`}>
title={`${projects.length - selectedProjects.length} projects will be archived on ${toLocaleDate($organization.billingNextInvoiceDate)}`}>
<span>
{@html formatProjectsToArchive()}
will be archived.
@@ -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<string[]>([]);
let error = $state<string | null>(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` });
}
</script>
@@ -293,7 +294,7 @@
{#if selectedProjects.length === allowedProjectsToKeep}
<Alert.Inline
status="warning"
title={`${projects.length - selectedProjects.length} projects will be archived on ${toLocaleDate(billingProjectsLimitDate)}`}>
title={`${projects.length - selectedProjects.length} projects will be archived on ${toLocaleDate($organization.billingNextInvoiceDate)}`}>
{formatProjectsToArchive()} will be archived
</Alert.Inline>
{/if}
-1
View File
@@ -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);
@@ -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)}
<Alert.Inline
title={`${projectsToArchive.length} projects will be archived on ${toLocaleDate(billingProjectsLimitDate)}`}>
title={`${projectsToArchive.length} projects will be archived on ${toLocaleDate($organization.billingNextInvoiceDate)}`}>
<Typography.Text>Upgrade your plan to restore archived projects</Typography.Text>
<svelte:fragment slot="actions">
<Button
@@ -28,7 +28,12 @@
}
</script>
<Modal title="Cancel plan change" onSubmit={cancelDowngrade} bind:show={showCancel} bind:error>
<Modal
title="Cancel plan change"
onSubmit={cancelDowngrade}
bind:show={showCancel}
bind:error
size="s">
<p>
Your organization is set to change to <strong>
{tierToPlan($organization?.billingPlanDowngrade).name}</strong>
@@ -129,6 +129,7 @@
const ok = usageLimitsComponent.validateOrAlert();
if (!ok) return;
}
await downgrade();
} else if (isUpgrade) {
await upgrade();