feat: create card plan limit, add tooltip to disabled button for plan limit

This commit is contained in:
Arman
2023-07-27 18:15:54 +02:00
parent c614aec06f
commit 34d32b2ca1
5 changed files with 41 additions and 11 deletions
+10 -3
View File
@@ -3,10 +3,13 @@
import { Empty } from '$lib/components';
import { CARD_LIMIT } from '$lib/constants';
import { preferences } from '$lib/stores/preferences';
import { isCloud } from '$lib/system';
import CardPlanLimit from './cardPlanLimit.svelte';
export let offset = 0;
export let total = 0;
export let event: string = null;
export let service: string = '';
$: limit = preferences.get($page.route)?.limit ?? CARD_LIMIT;
</script>
@@ -18,8 +21,12 @@
<slot />
{#if total > 3 ? total < limit + offset : total % 2 !== 0}
<Empty on:click target={event}>
<slot name="empty" />
</Empty>
{#if isCloud && !!service}
<CardPlanLimit {service} />
{:else}
<Empty on:click target={event}>
<slot name="empty" />
</Empty>
{/if}
{/if}
</ul>
+16
View File
@@ -0,0 +1,16 @@
<script lang="ts">
import { Button } from '$lib/elements/forms';
import { wizard } from '$lib/stores/wizard';
import ChangeOrganizationTierCloud from '$routes/console/changeOrganizationTierCloud.svelte';
export let service: string = '';
</script>
<article class="card u-grid u-cross-center u-width-full-line">
<div class="u-flex u-flex-vertical u-gap-24 u-main-center u-cross-center">
<p class="text u-text-center">Upgrade your plan add more {service}</p>
<Button secondary on:click={() => wizard.start(ChangeOrganizationTierCloud)}>
Change plan
</Button>
</div>
</article>
+1
View File
@@ -57,3 +57,4 @@ export { default as ProgressBar } from './progressBar.svelte';
export { default as ProgressBarBig } from './progressBarBig.svelte';
export { default as ProjectUsage } from './projectUsage.svelte';
export { default as CreditCardInfo } from './creditCardInfo.svelte';
export { default as CardPlanLimit } from './cardPlanLimit.svelte';
+13 -7
View File
@@ -65,13 +65,19 @@
</div>
<slot>
<Button
on:click={buttonMethod}
event={buttonEvent}
disabled={limit !== 'unlimited' && total >= limit}>
<span class="icon-plus" aria-hidden="true" />
<span class="text">{buttonText}</span>
</Button>
<div
use:tooltip={{
content: `Upgrade to add more ${title.toLocaleLowerCase()}`,
disabled: total < limit || limit === 'unlimited'
}}>
<Button
on:click={buttonMethod}
event={buttonEvent}
disabled={limit !== 'unlimited' && total >= limit}>
<span class="icon-plus" aria-hidden="true" />
<span class="text">{buttonText}</span>
</Button>
</div>
</slot>
</div>
@@ -50,7 +50,7 @@
<TableCellHead width={180}>POST URL</TableCellHead>
<TableCellHead width={80}>Events</TableCellHead>
</TableHeader>
<TableBody>
<TableBody service="webhooks">
{#each data.webhooks.webhooks as webhook}
<TableRowLink
href={`${base}/console/project-${projectId}/settings/webhooks/${webhook.$id}`}>