From 05e43fb0b45f7638de3c366b5fdd820c1a7a8ad4 Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 23 Apr 2024 14:50:30 +0200 Subject: [PATCH] feat: add members usage page --- src/lib/components/emptyAsideCloud.svelte | 0 .../usage/[[invoice]]/+page.svelte | 2 + .../usage/[[invoice]]/+page.ts | 3 +- .../usage/[[invoice]]/totalMembers.svelte | 81 +++++++++++++++++++ 4 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 src/lib/components/emptyAsideCloud.svelte create mode 100644 src/routes/console/organization-[organization]/usage/[[invoice]]/totalMembers.svelte diff --git a/src/lib/components/emptyAsideCloud.svelte b/src/lib/components/emptyAsideCloud.svelte new file mode 100644 index 000000000..e69de29bb diff --git a/src/routes/console/organization-[organization]/usage/[[invoice]]/+page.svelte b/src/routes/console/organization-[organization]/usage/[[invoice]]/+page.svelte index 9bc13dc07..6278cec0a 100644 --- a/src/routes/console/organization-[organization]/usage/[[invoice]]/+page.svelte +++ b/src/routes/console/organization-[organization]/usage/[[invoice]]/+page.svelte @@ -14,6 +14,7 @@ import type { OrganizationUsage } from '$lib/sdk/billing'; import { BillingPlan } from '$lib/constants'; import { trackEvent } from '$lib/actions/analytics'; + import TotalMembers from './totalMembers.svelte'; export let data; @@ -102,6 +103,7 @@ ]} /> --> + Bandwidth diff --git a/src/routes/console/organization-[organization]/usage/[[invoice]]/+page.ts b/src/routes/console/organization-[organization]/usage/[[invoice]]/+page.ts index b1ef9a272..17118e058 100644 --- a/src/routes/console/organization-[organization]/usage/[[invoice]]/+page.ts +++ b/src/routes/console/organization-[organization]/usage/[[invoice]]/+page.ts @@ -58,6 +58,7 @@ export const load: PageLoad = async ({ params, parent }) => { organizationUsage: usage, projectNames: projectNames.projects, invoices, - currentInvoice + currentInvoice, + organizationMembers: await sdk.forConsole.teams.listMemberships(params.organization) }; }; diff --git a/src/routes/console/organization-[organization]/usage/[[invoice]]/totalMembers.svelte b/src/routes/console/organization-[organization]/usage/[[invoice]]/totalMembers.svelte new file mode 100644 index 000000000..e22c515bf --- /dev/null +++ b/src/routes/console/organization-[organization]/usage/[[invoice]]/totalMembers.svelte @@ -0,0 +1,81 @@ + + + + Members + +

The number of members in your organization.

+ + {#if $organization.billingPlan !== BillingPlan.STARTER} +
+
+

+ {total} + Members +

+ +
+

+ Unlimited + +

+
+ + + + Members + Joined + + + {#each paginatedItems as member} + + +
+ + + {member.userName ? member.userName : 'n/a'} + +
+
+ + {member.joined ? toLocaleDate(member.joined) : 'Never'} + +
+ {/each} +
+
+
+ {:else} + test + {/if} +
+