|
8 | 8 | import { isTabSelected } from '$lib/helpers/load';
|
9 | 9 | import { Cover } from '$lib/layout';
|
10 | 10 | import { daysLeftInTrial, getServiceLimit, plansInfo, readOnly } from '$lib/stores/billing';
|
11 |
| - import { members, newMemberModal, organization } from '$lib/stores/organization'; |
| 11 | + import { members, newMemberModal, type Organization } from '$lib/stores/organization'; |
12 | 12 | import {
|
13 | 13 | canSeeBilling,
|
14 | 14 | canSeeProjects,
|
|
21 | 21 | import { Badge, Icon, Layout, Tooltip, Typography } from '@appwrite.io/pink-svelte';
|
22 | 22 |
|
23 | 23 | let areMembersLimited: boolean;
|
24 |
| - $: organization.subscribe(() => { |
| 24 | +
|
| 25 | + $: { |
25 | 26 | const limit = getServiceLimit('members') || Infinity;
|
26 | 27 | const isLimited = limit !== 0 && limit < Infinity;
|
27 | 28 | areMembersLimited =
|
28 | 29 | isCloud &&
|
29 | 30 | (($readOnly && !GRACE_PERIOD_OVERRIDE) || (isLimited && $members?.total >= limit));
|
30 |
| - }); |
| 31 | + } |
31 | 32 |
|
| 33 | + $: organization = page.data.organization as Organization; |
32 | 34 | $: avatars = $members.memberships?.map((m) => m.userName || m.userEmail) ?? [];
|
33 |
| - $: organizationId = $organization?.$id ?? page.params.organization; |
| 35 | + $: organizationId = organization?.$id ?? page.params.organization; |
34 | 36 | $: path = `${base}/organization-${organizationId}`;
|
35 | 37 | $: tabs = [
|
36 | 38 | {
|
|
75 | 77 | ].filter((tab) => !tab.disabled);
|
76 | 78 | </script>
|
77 | 79 |
|
78 |
| -{#if $organization?.$id} |
| 80 | +{#if organization?.$id} |
79 | 81 | <Cover>
|
80 | 82 | <svelte:fragment slot="header">
|
81 | 83 | <span class="u-flex u-cross-center u-gap-8 u-min-width-0">
|
82 | 84 | <Typography.Title color="--fgcolor-neutral-primary" size="xl" truncate>
|
83 |
| - {$organization.name} |
| 85 | + {organization.name} |
84 | 86 | </Typography.Title>
|
85 |
| - {#if isCloud && $organization?.billingPlan === BillingPlan.GITHUB_EDUCATION} |
| 87 | + {#if isCloud && organization?.billingPlan === BillingPlan.GITHUB_EDUCATION} |
86 | 88 | <Badge variant="secondary" content="Education">
|
87 | 89 | <Icon icon={IconGithub} size="s" slot="start" />
|
88 | 90 | </Badge>
|
89 |
| - {:else if isCloud && $organization?.billingPlan === BillingPlan.FREE} |
| 91 | + {:else if isCloud && organization?.billingPlan === BillingPlan.FREE} |
90 | 92 | <Badge variant="secondary" content="Free"></Badge>
|
91 | 93 | {/if}
|
92 |
| - {#if isCloud && $organization?.billingTrialStartDate && $daysLeftInTrial > 0 && $organization.billingPlan !== BillingPlan.FREE && $plansInfo.get($organization.billingPlan)?.trialDays} |
| 94 | + {#if isCloud && organization?.billingTrialStartDate && $daysLeftInTrial > 0 && organization.billingPlan !== BillingPlan.FREE && $plansInfo.get(organization.billingPlan)?.trialDays} |
93 | 95 | <Tooltip>
|
94 | 96 | <Badge variant="secondary" content="Trial" />
|
95 | 97 | <svelte:fragment slot="tooltip">
|
96 | 98 | {`Your trial ends on ${toLocaleDate(
|
97 |
| - $organization.billingStartDate |
| 99 | + organization.billingStartDate |
98 | 100 | )}. ${$daysLeftInTrial} days remaining.`}
|
99 | 101 | </svelte:fragment>
|
100 | 102 | </Tooltip>
|
|
0 commit comments