From d86e1be800dd97d797353b29b2f70b5ec737bd27 Mon Sep 17 00:00:00 2001 From: ItzNotABug Date: Tue, 20 Aug 2024 13:29:21 +0530 Subject: [PATCH 01/11] update: show projects and members. --- .../organization-[organization]/settings/+page.svelte | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/routes/console/organization-[organization]/settings/+page.svelte b/src/routes/console/organization-[organization]/settings/+page.svelte index 840754307..73cc02e24 100644 --- a/src/routes/console/organization-[organization]/settings/+page.svelte +++ b/src/routes/console/organization-[organization]/settings/+page.svelte @@ -5,6 +5,7 @@ import { addNotification } from '$lib/stores/notifications'; import { sdk } from '$lib/stores/sdk'; import { members, organization } from '$lib/stores/organization'; + import { projects } from '../store'; import { invalidate } from '$app/navigation'; import { Dependencies } from '$lib/constants'; import { onMount } from 'svelte'; @@ -40,6 +41,8 @@ } $: avatars = $members.memberships.map((team) => team.userName); + $: orgProjects = `${$projects.total} ${$projects.total === 1 ? 'project' : 'projects'}`; + $: orgMembers = `${$organization.total} ${$organization.total === 1 ? 'member' : 'members'}`; @@ -85,7 +88,7 @@
{$organization.name}
-

{$organization.total} members

+

{orgMembers}, {orgProjects}

From c8fe12ae001c952b35b5e0f57189f0a80e466b0d Mon Sep 17 00:00:00 2001 From: ItzNotABug Date: Tue, 20 Aug 2024 15:07:57 +0530 Subject: [PATCH 02/11] update: new org deletion flow. --- .../settings/deleteOrganizationModal.svelte | 162 +++++++++++++++--- 1 file changed, 134 insertions(+), 28 deletions(-) diff --git a/src/routes/console/organization-[organization]/settings/deleteOrganizationModal.svelte b/src/routes/console/organization-[organization]/settings/deleteOrganizationModal.svelte index f071e6108..1618f8481 100644 --- a/src/routes/console/organization-[organization]/settings/deleteOrganizationModal.svelte +++ b/src/routes/console/organization-[organization]/settings/deleteOrganizationModal.svelte @@ -1,9 +1,9 @@ - - {#if upcomingInvoice} -

- The organization {$organization.name} will be flagged for deletion. -

+
+ + {#if upcomingInvoice} + + + You have a pending {formatCurrency(upcomingInvoice.grossAmount)} invoice for your + {tierToPlan(upcomingInvoice.plan).name} plan + +

+ By proceeding, your invoice will be processed within the hour. Upon successful + payment, your organization will be deleted. +

+
+ {/if}

- All existing projects will be paused and the organization will be deleted once your - upcoming invoice is processed on {toLocaleDate($organization.billingNextInvoiceDate)}. + {#if $projects.total > 0} + The following projects and all data associated with {$organization.name} will + be permanently deleted. This action is irreversible. + {:else} + {$organization.name} will be permanently deleted. This action is irreversible. + {/if}

- {:else} -

- Are you sure you want to delete {$organization.name}? All projects ({$projects.total}) - and data associated with this organization will be deleted. This action is irreversible. -

- {/if} - - - - -
+ + {#if $projects.total > 0} +
+ + {#each tabs as { name, label, total }} + (selectedTab = name)}> + {label} ({total}) + + {/each} + + + + + {#each tabData.headers as header} + {header} + {/each} + + + {#each tabData.rows as row} + + {#each row.cells as cell, index} + {cell} + {/each} + + {/each} + + +
+ {/if} + + + + + + + + + + +
+ + From 82177dea5f5a96fff209cad97be70e675e7be47e Mon Sep 17 00:00:00 2001 From: ItzNotABug Date: Tue, 20 Aug 2024 15:08:43 +0530 Subject: [PATCH 03/11] ran: `npm run format`. --- .../settings/deleteOrganizationModal.svelte | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/routes/console/organization-[organization]/settings/deleteOrganizationModal.svelte b/src/routes/console/organization-[organization]/settings/deleteOrganizationModal.svelte index 1618f8481..71b6268f7 100644 --- a/src/routes/console/organization-[organization]/settings/deleteOrganizationModal.svelte +++ b/src/routes/console/organization-[organization]/settings/deleteOrganizationModal.svelte @@ -114,7 +114,8 @@ The following projects and all data associated with {$organization.name} will be permanently deleted. This action is irreversible. {:else} - {$organization.name} will be permanently deleted. This action is irreversible. + {$organization.name} will be permanently deleted. + This action is irreversible. {/if}

From 1d74b0cd16984be6f749e8bdac60e2889ddbb5a4 Mon Sep 17 00:00:00 2001 From: Darshan Date: Tue, 20 Aug 2024 16:51:54 +0530 Subject: [PATCH 04/11] address comment. Co-authored-by: Carla --- .../settings/deleteOrganizationModal.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/console/organization-[organization]/settings/deleteOrganizationModal.svelte b/src/routes/console/organization-[organization]/settings/deleteOrganizationModal.svelte index 71b6268f7..0c7373a44 100644 --- a/src/routes/console/organization-[organization]/settings/deleteOrganizationModal.svelte +++ b/src/routes/console/organization-[organization]/settings/deleteOrganizationModal.svelte @@ -114,7 +114,7 @@ The following projects and all data associated with {$organization.name} will be permanently deleted. This action is irreversible. {:else} - {$organization.name} will be permanently deleted. + All data associated with {$organization.name} will be permanently deleted. This action is irreversible. {/if}

From 449d601e40d5479ed11d880970c40e3d8bcb65e5 Mon Sep 17 00:00:00 2001 From: ItzNotABug Date: Tue, 20 Aug 2024 20:44:18 +0530 Subject: [PATCH 05/11] update: horizontal scrolling, manage views per device type. --- .../settings/deleteOrganizationModal.svelte | 48 ++++++++++++++++--- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/src/routes/console/organization-[organization]/settings/deleteOrganizationModal.svelte b/src/routes/console/organization-[organization]/settings/deleteOrganizationModal.svelte index 0c7373a44..d27b310cd 100644 --- a/src/routes/console/organization-[organization]/settings/deleteOrganizationModal.svelte +++ b/src/routes/console/organization-[organization]/settings/deleteOrganizationModal.svelte @@ -30,6 +30,10 @@ let selectedTab = 'projects'; let organizationName: string = null; + /* enable overflow-x */ + const columnWidth = 120; + const columnWidthSmall = columnWidth / 4; + async function deleteOrg() { try { if (isCloud) { @@ -60,8 +64,8 @@ } const tabs = [ - { name: 'projects', label: 'Projects', total: $projects.total }, - { name: 'members', label: 'Team members', total: $members.total } + { name: 'projects', label: { desktop: 'Projects', mobile: 'Projects' }, total: $projects.total }, + { name: 'members', label: { desktop: 'Total Members', mobile: 'Members' }, total: $members.total } ]; $: tabData = @@ -120,7 +124,7 @@

{#if $projects.total > 0} -
+
{#each tabs as { name, label, total }} (selectedTab = name)}> - {label} ({total}) + {label.desktop} ({total}) {/each} - + {#each tabData.headers as header} - {header} + {header} + {/each} + + + {#each tabData.rows as row} + + {#each row.cells as cell} + {cell} + {/each} + + {/each} + + +
+
+ + {#each tabs as { name, label, total }} + (selectedTab = name)}> + {label.mobile} ({total}) + + {/each} + + + + + {#each tabData.headers as header, index} + {header} {/each} {#each tabData.rows as row} {#each row.cells as cell, index} - {cell} + {cell} {/each} {/each} From 46e20498e97915caa39d205e983735cb31ff3949 Mon Sep 17 00:00:00 2001 From: ItzNotABug Date: Tue, 20 Aug 2024 21:05:08 +0530 Subject: [PATCH 06/11] fix: table styles. --- .../settings/deleteOrganizationModal.svelte | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/routes/console/organization-[organization]/settings/deleteOrganizationModal.svelte b/src/routes/console/organization-[organization]/settings/deleteOrganizationModal.svelte index d27b310cd..46f85b461 100644 --- a/src/routes/console/organization-[organization]/settings/deleteOrganizationModal.svelte +++ b/src/routes/console/organization-[organization]/settings/deleteOrganizationModal.svelte @@ -124,7 +124,7 @@

{#if $projects.total > 0} -
+
{#each tabs as { name, label, total }}
-
+
{#each tabs as { name, label, total }} From 411627b292dae4439219c8329ea5150cf4c000d7 Mon Sep 17 00:00:00 2001 From: ItzNotABug Date: Tue, 20 Aug 2024 21:05:57 +0530 Subject: [PATCH 07/11] ran: `npm run format`. --- .../settings/deleteOrganizationModal.svelte | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/routes/console/organization-[organization]/settings/deleteOrganizationModal.svelte b/src/routes/console/organization-[organization]/settings/deleteOrganizationModal.svelte index 46f85b461..ad1fe547d 100644 --- a/src/routes/console/organization-[organization]/settings/deleteOrganizationModal.svelte +++ b/src/routes/console/organization-[organization]/settings/deleteOrganizationModal.svelte @@ -64,8 +64,16 @@ } const tabs = [ - { name: 'projects', label: { desktop: 'Projects', mobile: 'Projects' }, total: $projects.total }, - { name: 'members', label: { desktop: 'Total Members', mobile: 'Members' }, total: $members.total } + { + name: 'projects', + label: { desktop: 'Projects', mobile: 'Projects' }, + total: $projects.total + }, + { + name: 'members', + label: { desktop: 'Total Members', mobile: 'Members' }, + total: $members.total + } ]; $: tabData = @@ -170,14 +178,16 @@ {#each tabData.headers as header, index} - {header} + {header} {/each} {#each tabData.rows as row} {#each row.cells as cell, index} - {cell} + {cell} {/each} {/each} From 4d6e4175c712cd532fac9fc495a8da46a406ad83 Mon Sep 17 00:00:00 2001 From: ItzNotABug Date: Tue, 27 Aug 2024 13:35:10 +0530 Subject: [PATCH 08/11] ran: `pnpm format`. --- src/lib/helpers/load.ts | 2 +- src/lib/layout/unauthenticated.svelte | 2 +- src/lib/stores/feedback.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/helpers/load.ts b/src/lib/helpers/load.ts index 05e043ddc..21e2f1ee6 100644 --- a/src/lib/helpers/load.ts +++ b/src/lib/helpers/load.ts @@ -21,7 +21,7 @@ export enum View { export function getView(url: URL, route: Page['route'], fallback: View): View { return (url.searchParams.get('view') ?? preferences.get(route).view) === View.Grid ? View.Grid - : View.Table ?? fallback; + : (View.Table ?? fallback); } export function getColumns(route: Page['route'], fallback: string[]): string[] { diff --git a/src/lib/layout/unauthenticated.svelte b/src/lib/layout/unauthenticated.svelte index b7e250b54..4d859d492 100644 --- a/src/lib/layout/unauthenticated.svelte +++ b/src/lib/layout/unauthenticated.svelte @@ -16,7 +16,7 @@ export let coupon: Coupon = null; $: selectedCampaign = campaigns.get(coupon?.campaign ?? campaign); - $: variation = (coupon?.campaign ?? campaign ? selectedCampaign?.template : 'default') as + $: variation = ((coupon?.campaign ?? campaign) ? selectedCampaign?.template : 'default') as | 'default' | CampaignData['template']; diff --git a/src/lib/stores/feedback.ts b/src/lib/stores/feedback.ts index 7f9b6b200..7eaefca2d 100644 --- a/src/lib/stores/feedback.ts +++ b/src/lib/stores/feedback.ts @@ -71,8 +71,8 @@ export const feedbackData = createFeedbackDataStore(); function createFeedbackStore() { const { subscribe, update } = writable({ - elapsed: browser ? parseInt(localStorage.getItem('feedbackElapsed')) ?? 0 : 0, - visualized: browser ? parseInt(localStorage.getItem('feedbackVisualized')) ?? 0 : 0, + elapsed: browser ? (parseInt(localStorage.getItem('feedbackElapsed')) ?? 0) : 0, + visualized: browser ? (parseInt(localStorage.getItem('feedbackVisualized')) ?? 0) : 0, notification: false, type: 'general', show: false From 7707bcc24e5168d4d0689e0cb7e778e2a9b033d4 Mon Sep 17 00:00:00 2001 From: ItzNotABug Date: Thu, 3 Oct 2024 14:53:03 +0530 Subject: [PATCH 09/11] address comments. --- .../settings/deleteOrganizationModal.svelte | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/routes/(console)/organization-[organization]/settings/deleteOrganizationModal.svelte b/src/routes/(console)/organization-[organization]/settings/deleteOrganizationModal.svelte index 0c622ce5c..7ba6a4cec 100644 --- a/src/routes/(console)/organization-[organization]/settings/deleteOrganizationModal.svelte +++ b/src/routes/(console)/organization-[organization]/settings/deleteOrganizationModal.svelte @@ -219,17 +219,17 @@ From a66e46dbc179ae734dff7365d39536806502e5d6 Mon Sep 17 00:00:00 2001 From: ItzNotABug Date: Thu, 3 Oct 2024 15:26:00 +0530 Subject: [PATCH 10/11] minor refactor. --- .../settings/deleteOrganizationModal.svelte | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/routes/(console)/organization-[organization]/settings/deleteOrganizationModal.svelte b/src/routes/(console)/organization-[organization]/settings/deleteOrganizationModal.svelte index 7ba6a4cec..3ca94e195 100644 --- a/src/routes/(console)/organization-[organization]/settings/deleteOrganizationModal.svelte +++ b/src/routes/(console)/organization-[organization]/settings/deleteOrganizationModal.svelte @@ -132,7 +132,7 @@

{#if $projects.total > 0} -
+
{#each tabs as { name, label, total }}
-
+
{#each tabs as { name, label, total }} .box { padding: unset; - background-color: unset; border-radius: var(--border-radius-medium, 8px); } :global(.max-height-dialog dialog) { max-height: 650px; } - - :global(.no-inner-borders .table-with-scroll .table) { - box-shadow: unset; - border-radius: unset; - } From 5061a6615e83a758243f99ff7216396a907decbc Mon Sep 17 00:00:00 2001 From: Arman Date: Thu, 3 Oct 2024 15:17:18 +0200 Subject: [PATCH 11/11] feat: add date columns to documents --- .../collection-[collection]/table.svelte | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/table.svelte b/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/table.svelte index 8b8c7832d..ca8ac7160 100644 --- a/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/table.svelte +++ b/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/table.svelte @@ -30,6 +30,7 @@ import { attributes, collection, columns } from './store'; import { clickOnEnter } from '$lib/helpers/a11y'; import type { ColumnType } from '$lib/helpers/types'; + import { toLocaleDateTime } from '$lib/helpers/date'; export let data: PageData; @@ -154,6 +155,8 @@ {column.title} {/if} {/each} + Created + Updated {#each data.documents.documents as document} @@ -231,6 +234,12 @@ {/if} {/if} {/each} + + {toLocaleDateTime(document.$createdAt)} + + + {toLocaleDateTime(document.$updatedAt)} + {/each} @@ -319,8 +328,9 @@ - +