From 7270f41b0ba2935fcda4978a14a58467e7fe61ac Mon Sep 17 00:00:00 2001 From: Harsh Mahajan <127186841+HarshMN2345@users.noreply.github.com> Date: Wed, 27 Aug 2025 14:06:50 +0530 Subject: [PATCH] fix: only archived shows, and new project goes to archive automatically. --- pnpm-lock.yaml | 9 ------ .../organization-[organization]/+page.svelte | 32 ++++++++----------- 2 files changed, 13 insertions(+), 28 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2bfbbf0e2..4b3c0e512 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -260,13 +260,8 @@ packages: '@analytics/type-utils@0.6.2': resolution: {integrity: sha512-TD+xbmsBLyYy/IxFimW/YL/9L2IEnM7/EoV9Aeh56U64Ify8o27HJcKjo38XY9Tcn0uOq1AX3thkKgvtWvwFQg==} -<<<<<<< HEAD '@appwrite.io/console@https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@ef43e68': resolution: {tarball: https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@ef43e68} -======= - '@appwrite.io/console@https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@c0da899': - resolution: {tarball: https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@c0da899} ->>>>>>> 339abe7ac676d56c9a5f84c46b696c71f563fb9a version: 1.10.0 '@appwrite.io/pink-icons-svelte@2.0.0-RC.1': @@ -3701,11 +3696,7 @@ snapshots: '@analytics/type-utils@0.6.2': {} -<<<<<<< HEAD '@appwrite.io/console@https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@ef43e68': {} -======= - '@appwrite.io/console@https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@c0da899': {} ->>>>>>> 339abe7ac676d56c9a5f84c46b696c71f563fb9a '@appwrite.io/pink-icons-svelte@2.0.0-RC.1(svelte@5.25.3)': dependencies: diff --git a/src/routes/(console)/organization-[organization]/+page.svelte b/src/routes/(console)/organization-[organization]/+page.svelte index 8f06927bd..3e4eb62b3 100644 --- a/src/routes/(console)/organization-[organization]/+page.svelte +++ b/src/routes/(console)/organization-[organization]/+page.svelte @@ -135,13 +135,16 @@ return name ? (name.length > actualLimit ? `${name.slice(0, actualLimit)}...` : name) : '-'; } - $: projectsToArchive = data.projects.projects.filter( - (project) => !data.organization.projects?.includes(project.$id) - ); + $: selectedProjects = data.organization.projects ?? []; + $: hasSelection = Array.isArray(selectedProjects) && selectedProjects.length > 0; - $: activeProjects = data.projects.projects.filter((project) => - data.organization.projects?.includes(project.$id) - ); + $: projectsToArchive = hasSelection + ? data.projects.projects.filter((project) => !selectedProjects.includes(project.$id)) + : []; + + $: activeProjects = hasSelection + ? data.projects.projects.filter((project) => selectedProjects.includes(project.$id)) + : data.projects.projects; - {#if isCloud - && $currentPlan?.projects - && $currentPlan?.projects > 0 - && data.organization.projects.length > 0 - && $canWriteProjects - && (projectsToArchive.length > 0 || data.projects.total > $currentPlan.projects)} + {#if isCloud && $currentPlan?.projects && $currentPlan?.projects > 0 && data.organization.projects.length > 0 && $canWriteProjects && (projectsToArchive.length > 0 || data.projects.total > $currentPlan.projects)} 0 - ? `${projectsToArchive.length} projects will be archived on ${toLocaleDate(billingProjectsLimitDate)}` - : `Your organization has exceeded the project limit. Projects will be archived on ${toLocaleDate(billingProjectsLimitDate)}` - }> + title={projectsToArchive.length > 0 + ? `${projectsToArchive.length} projects will be archived on ${toLocaleDate(billingProjectsLimitDate)}` + : `Your organization has exceeded the project limit. Projects will be archived on ${toLocaleDate(billingProjectsLimitDate)}`}> {#if projectsToArchive.length > 0} {#each projectsToArchive as project, index}{@const text = `${project.name}`} @@ -314,5 +310,3 @@ bind:showCreateProjectCloud regions={$regionsStore.regions} teamId={page.params.organization} /> - - \ No newline at end of file