From 2a4de3bf528e3ca47c2fb409ed1e5b444905cd09 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 27 May 2025 19:27:35 +0200 Subject: [PATCH 1/3] Update @appwrite.io/pink-svelte to commit 7b28443 --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 13f517e66..98b200768 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "@appwrite.io/pink-icons": "0.25.0", "@appwrite.io/pink-icons-svelte": "^2.0.0-RC.1", "@appwrite.io/pink-legacy": "^1.0.3", - "@appwrite.io/pink-svelte": "https://try-module.cloud/-/@appwrite/@appwrite.io/pink-svelte@6ea6004", + "@appwrite.io/pink-svelte": "https://try-module.cloud/-/@appwrite/@appwrite.io/pink-svelte@7b28443", "@popperjs/core": "^2.11.8", "@sentry/sveltekit": "^8.38.0", "@stripe/stripe-js": "^3.5.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0744b1623..9279a8137 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -24,8 +24,8 @@ importers: specifier: ^1.0.3 version: 1.0.3 '@appwrite.io/pink-svelte': - specifier: https://try-module.cloud/-/@appwrite/@appwrite.io/pink-svelte@6ea6004 - version: https://try-module.cloud/-/@appwrite/%40appwrite.io%2Fpink-svelte@6ea6004(svelte@5.25.3) + specifier: https://try-module.cloud/-/@appwrite/@appwrite.io/pink-svelte@7b28443 + version: https://try-module.cloud/-/@appwrite/%40appwrite.io%2Fpink-svelte@7b28443(svelte@5.25.3) '@popperjs/core': specifier: ^2.11.8 version: 2.11.8 @@ -278,8 +278,8 @@ packages: '@appwrite.io/pink-legacy@1.0.3': resolution: {integrity: sha512-GGde5fmPhs+s6/3aFeMPc/kKADG/gTFkYQSy6oBN8pK0y0XNCLrZZgBv+EBbdhwdtqVEWXa0X85Mv9w7jcIlwQ==} - '@appwrite.io/pink-svelte@https://try-module.cloud/-/@appwrite/%40appwrite.io%2Fpink-svelte@6ea6004': - resolution: {tarball: https://try-module.cloud/-/@appwrite/%40appwrite.io%2Fpink-svelte@6ea6004} + '@appwrite.io/pink-svelte@https://try-module.cloud/-/@appwrite/%40appwrite.io%2Fpink-svelte@7b28443': + resolution: {tarball: https://try-module.cloud/-/@appwrite/%40appwrite.io%2Fpink-svelte@7b28443} version: 2.0.0-RC.2 peerDependencies: svelte: ^4.0.0 @@ -3635,7 +3635,7 @@ snapshots: '@appwrite.io/pink-icons': 1.0.0 the-new-css-reset: 1.11.3 - '@appwrite.io/pink-svelte@https://try-module.cloud/-/@appwrite/%40appwrite.io%2Fpink-svelte@6ea6004(svelte@5.25.3)': + '@appwrite.io/pink-svelte@https://try-module.cloud/-/@appwrite/%40appwrite.io%2Fpink-svelte@7b28443(svelte@5.25.3)': dependencies: '@appwrite.io/pink-icons-svelte': 2.0.0-RC.1(svelte@5.25.3) '@floating-ui/dom': 1.6.13 From 9bfefbd4d06f4d715cd11bb281c64f63923e65e1 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 27 May 2025 19:29:38 +0200 Subject: [PATCH 2/3] Add default column widths and improve text display - Set 168px width for all table columns - Replace span with Typography.Text for better text truncation - Add word-break styling to tooltip for long text wrapping --- .../collection-[collection]/table.svelte | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/table.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/table.svelte index abbe66541..a7265fa64 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/table.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/table.svelte @@ -22,7 +22,8 @@ Button, Link, Badge, - FloatingActionBar + FloatingActionBar, + Typography } from '@appwrite.io/pink-svelte'; import DualTimeView from '$lib/components/dualTimeView.svelte'; @@ -102,6 +103,7 @@ type: attribute.type as ColumnType, show: selected?.includes(attribute.key) ?? true, array: attribute?.array, + width: 168, format: 'format' in attribute && attribute?.format === 'enum' ? attribute.format : null, elements: 'elements' in attribute ? attribute.elements : null @@ -166,7 +168,12 @@ let:root allowSelection bind:selectedRows - columns={[{ id: '$id', width: 200 }, ...$columns, { id: '$created' }, { id: '$updated' }]}> + columns={[ + { id: '$id', width: 200 }, + ...$columns, + { id: '$created', width: 200 }, + { id: '$updated', width: 200 } + ]}> Document ID {#each $columns as column} @@ -238,10 +245,13 @@ {:else} {@const formatted = formatColumn(document[id])} - + {formatted.value} - - + + {formatted.whole} From 1097377e563a0239b65286f486e5f8d748ba7907 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 27 May 2025 19:57:49 +0200 Subject: [PATCH 3/3] Refactor usage rates to use dynamic plan structure Replace hardcoded planData array with dynamic iteration over plan.addons and plan.usage objects. Add getPlanLimit helper function and name field to AdditionalResource type for improved data handling. --- src/lib/components/billing/usageRates.svelte | 65 ++++++++------------ src/lib/sdk/billing.ts | 1 + 2 files changed, 25 insertions(+), 41 deletions(-) diff --git a/src/lib/components/billing/usageRates.svelte b/src/lib/components/billing/usageRates.svelte index 653b9c154..b58df6f3a 100644 --- a/src/lib/components/billing/usageRates.svelte +++ b/src/lib/components/billing/usageRates.svelte @@ -17,31 +17,6 @@ ? new Date(new Date().getFullYear(), new Date().getMonth() + 1, 1).toString() : org?.billingNextInvoiceDate; - const planData = [ - { - id: 'members', - resource: 'Organization members', - unit: 'member' - }, - { id: 'bandwidth', resource: 'Bandwidth', unit: 'GB' }, - { id: 'storage', resource: 'Storage', unit: 'GB' }, - { - id: 'executions', - resource: 'Function executions', - unit: ' executions' - }, - { - id: 'users', - resource: 'Users', - unit: ' Users' - }, - { - id: 'realtime', - resource: 'Concurrent connections', - unit: ' connections' - } - ]; - $: isFree = org.billingPlan === BillingPlan.FREE; // equal or above means unlimited! @@ -50,6 +25,10 @@ const exceedsSafeLimit = count >= Number.MAX_SAFE_INTEGER; return exceedsSafeLimit ? 'Unlimited' : count || 0; }; + + function getPlanLimit(key: string): number | false { + return plan[key] || false; + } @@ -77,29 +56,33 @@ Limit Rate - {#each planData as usage} - {#if usage['id'] === 'members'} - - {usage.resource} - - {getCorrectSeatsCountValue(plan.addons.seats.limit)} - + {#each Object.values(plan.addons) as addon} + + {addon.invoiceDesc} + + {getCorrectSeatsCountValue(addon.limit)} + + {#if !isFree} - {formatCurrency(plan.addons?.seats?.price)}/{usage?.unit} + {formatCurrency(addon.price)}/member - - {:else} - {@const addon = plan.addons[usage.id]} + {/if} + + {/each} + {#each Object.entries(plan.usage) as [key, usage]} + {@const limit = getPlanLimit(key)} + {@const show = limit !== false} + {#if show} - {usage.resource} + {usage.name} - {abbreviateNumber(plan[usage.id])}{usage?.unit} + {abbreviateNumber(limit)}{usage.unit} {#if !isFree} - {formatCurrency(addon?.price)}/{['MB', 'GB', 'TB'].includes(addon?.unit) - ? addon?.value - : abbreviateNumber(addon?.value, 0)}{usage?.unit} + {formatCurrency(usage.price)}/{abbreviateNumber( + usage.value + )}{usage.unit} {/if} diff --git a/src/lib/sdk/billing.ts b/src/lib/sdk/billing.ts index aab3ffe59..9a4cdfe4f 100644 --- a/src/lib/sdk/billing.ts +++ b/src/lib/sdk/billing.ts @@ -278,6 +278,7 @@ export type AddressesList = { }; export type AdditionalResource = { + name: string; currency: string; invoiceDesc: string; price: number;