diff --git a/src/routes/(console)/organization-[organization]/billing/planSummary.svelte b/src/routes/(console)/organization-[organization]/billing/planSummary.svelte index 3c9900e802..f35163025c 100644 --- a/src/routes/(console)/organization-[organization]/billing/planSummary.svelte +++ b/src/routes/(console)/organization-[organization]/billing/planSummary.svelte @@ -7,7 +7,6 @@ import { organization } from '$lib/stores/organization'; import type { Aggregation, CreditList, Invoice, Plan } from '$lib/sdk/billing'; import { abbreviateNumber, formatCurrency, formatNumberWithCommas } from '$lib/helpers/numbers'; - import { humanFileSize } from '$lib/helpers/sizeConvertion'; import { BillingPlan } from '$lib/constants'; import { Click, trackEvent } from '$lib/actions/analytics'; import { @@ -35,21 +34,6 @@ new Date($organization?.billingStartDate).getTime() - today.getTime() > 0 && $plansInfo.get($organization.billingPlan)?.trialDays; const extraUsage = currentInvoice ? currentInvoice.amount - currentPlan?.price : 0; - - function usageNameToLabel(name: string): string { - switch (name) { - case 'executions': - return 'Executions'; - case 'storage': - return 'Storage'; - case 'users': - return 'Users'; - case 'bandwidth': - return 'Bandwidth'; - default: - return ''; - } - } {#if $organization} @@ -112,69 +96,29 @@ {#if i > 0 || currentAggregation.additionalMembers} {/if} - {#if ['storage', 'bandwidth'].includes(excess.name)} - {@const excessValue = humanFileSize(excess.value)} - - - {usageNameToLabel( - excess.name - )} - {formatCurrency( - excess.amount - )} - - - - - - {formatNumberWithCommas( - excess.value ?? 0 - )} bytes - - {excessValue.value ?? - 0}{excessValue.unit} - - - + + + + + {excess.name} + + + {formatCurrency(excess.amount)} + - {/if} - {#if ['users', 'executions'].includes(excess.name)} - - - {usageNameToLabel( - excess.name - )} - {formatCurrency( - excess.amount - )} - - - - - {formatNumberWithCommas(excess.value)} - - {abbreviateNumber(excess.value)} - - + + + + {formatNumberWithCommas(excess.value)} + + {abbreviateNumber(excess.value)} + - {/if} + {/each} {/if} diff --git a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/ProjectBreakdown.svelte b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/ProjectBreakdown.svelte index fb9ff7a824..36be4abcc8 100644 --- a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/ProjectBreakdown.svelte +++ b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/ProjectBreakdown.svelte @@ -6,6 +6,7 @@ import { onMount } from 'svelte'; import { Accordion, Table } from '@appwrite.io/pink-svelte'; import { base } from '$app/paths'; + import type { PageData } from './$types'; type Metric = | 'users' @@ -21,7 +22,7 @@ type DatabaseOperationMetric = Extract; - export let data; + export let data: PageData; export let projects: OrganizationUsage['projects']; export let metric: Metric | undefined = undefined; export let estimate: Estimate | undefined = undefined; @@ -137,7 +138,7 @@ {#if !$canSeeProjects} - {data.projectNames[project.projectId]?.name ?? 'Unknown'} + {data.projects[project.projectId]?.name ?? 'Unknown'} {format(project.databasesReads ?? 0)} @@ -155,7 +156,7 @@ {:else} - {data.projectNames[project.projectId]?.name ?? 'Unknown'} + {data.projects[project.projectId]?.name ?? 'Unknown'} {format(project.databasesReads ?? 0)}