feat: add empty state

This commit is contained in:
Arman committed 2024-04-23 15:07:53 +02:00
1 parent 05e43fb0b4
commit 9aa0f5afe7
5 files changed
+48 -9

No files matched your search

@@ -0,0 +1,29 @@
<script lang="ts">
import { BillingPlan } from '$lib/constants';
import { Button } from '$lib/elements/forms';
import { tierToPlan } from '$lib/stores/billing';
import { wizard } from '$lib/stores/wizard';
import ChangeOrganizationTierCloud from '$routes/console/changeOrganizationTierCloud.svelte';
import { Card } from '..';
export let service: string;
</script>
<Card>
<slot>
<div class="u-flex u-flex-vertical u-main-center u-cross-center u-gap-8">
<h6 class="body-text-1 u-bold u-trim-1">Upgrade to add {service}</h6>
<p class="text u-text-center">
Upgrade to a {tierToPlan(BillingPlan.PRO).name} plan to add {service} to your organization
</p>
<Button
class="u-margin-block-start-16"
secondary
fullWidthMobile
on:click={() => wizard.start(ChangeOrganizationTierCloud)}>
Upgrade
</Button>
</div>
</slot>
</Card>
+1
View File
@@ -1,2 +1,3 @@
export { default as PaymentBoxes } from './paymentBoxes.svelte';
export { default as CouponInput } from './couponInput.svelte';
export { default as EmptyCardCloud } from './emptyCardCloud.svelte';
Whitespace-only changes.
+8 -5
View File
@@ -3,6 +3,7 @@
export let items = [];
export let limit = 5;
export let hideFooter = false;
let offset = 0;
@@ -10,9 +11,11 @@
$: paginatedItems = items.slice(offset, offset + limit);
</script>
<slot {paginatedItems} />
<slot {paginatedItems} {limit} />
<div class="u-flex u-margin-block-start-32 u-main-space-between">
<p class="text">Total results: {total}</p>
<PaginationInline {limit} bind:offset sum={total} hidePages />
</div>
{#if !hideFooter}
<div class="u-flex u-margin-block-start-32 u-main-space-between">
<p class="text">Total results: {total}</p>
<PaginationInline {limit} bind:offset sum={total} hidePages />
</div>
{/if}
@@ -1,6 +1,7 @@
<script lang="ts">
import { tooltip } from '$lib/actions/tooltip';
import { AvatarInitials, CardGrid, Heading, Paginator } from '$lib/components';
import { EmptyCardCloud } from '$lib/components/billing';
import { BillingPlan } from '$lib/constants';
import { Button } from '$lib/elements/forms';
import {
@@ -49,7 +50,10 @@
}}></span>
</p>
</div>
<Paginator items={members.memberships} let:paginatedItems>
<Paginator
items={members.memberships}
let:paginatedItems
hideFooter={members?.total <= 5}>
<TableScroll noMargin noStyles>
<TableHeader>
<TableCellHead>Members</TableCellHead>
@@ -62,12 +66,14 @@
<div class="u-flex u-gap-12 u-cross-center">
<AvatarInitials size={32} name={member.userName} />
<span class="text u-trim">
{member.userName ? member.userName : 'n/a'}
{member.userName ? member.userName : member.userEmail}
</span>
</div>
</TableCell>
<TableCellText title="joined">
{member.joined ? toLocaleDate(member.joined) : 'Never'}
{member.joined
? toLocaleDate(member.joined)
: toLocaleDate(member.$createdAt)}
</TableCellText>
</TableRow>
{/each}
@@ -75,7 +81,7 @@
</TableScroll>
</Paginator>
{:else}
test
<EmptyCardCloud service="members" />
{/if}
</svelte:fragment>
</CardGrid>