mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
feat: gradient alert banner
This commit is contained in:
1 parent
cb243bba59
commit
98bf355932
2 files changed
+69
No files matched your search
@@ -0,0 +1,31 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { BillingPlan } from '$lib/constants';
|
||||
import { organization } from '$lib/stores/organization';
|
||||
import { wizard } from '$lib/stores/wizard';
|
||||
import ChangeOrganizationTierCloud from '$routes/console/changeOrganizationTierCloud.svelte';
|
||||
import GradientBanner from '../gradientBanner.svelte';
|
||||
|
||||
function handleClose() {
|
||||
localStorage.setItem('hideUpgradeBanner', 'true');
|
||||
trackEvent('close_upgrade_banner', {
|
||||
source: 'upgrade_banner'
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if $organization?.$id && $organization?.billingPlan === BillingPlan.PRO && !$page.url.pathname.includes('/console/account')}
|
||||
<GradientBanner
|
||||
on:close={handleClose}
|
||||
on:click={() => {
|
||||
wizard.start(ChangeOrganizationTierCloud);
|
||||
trackEvent('click_organization_upgrade', {
|
||||
from: 'button',
|
||||
source: 'upgrade_banner'
|
||||
});
|
||||
}}
|
||||
buttonText="Upgrade">
|
||||
Appwrite Pro is now available!
|
||||
</GradientBanner>
|
||||
{/if}
|
||||
@@ -0,0 +1,38 @@
|
||||
<script lang="ts">
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
|
||||
export let buttonText: string;
|
||||
export let href: string = null;
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
</script>
|
||||
|
||||
<div class="top-banner">
|
||||
<div class="top-banner-content u-color-text-primary">
|
||||
{#if href}
|
||||
<a
|
||||
class="u-flex u-gap-16 u-main-center u-cross-center u-flex-vertical-mobile"
|
||||
{href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">
|
||||
<span class="body-text-1 u-bold"><slot /></span>
|
||||
<Button secondary fullWidthMobile on:click class="u-line-height-1"
|
||||
>{buttonText}</Button>
|
||||
</a>
|
||||
{:else}
|
||||
<div class="u-flex u-gap-16 u-main-center u-cross-center u-flex-vertical-mobile">
|
||||
<span class="body-text-1 u-bold"><slot /></span>
|
||||
<Button secondary fullWidthMobile on:click class="u-line-height-1"
|
||||
>{buttonText}</Button>
|
||||
</div>
|
||||
{/if}
|
||||
<button
|
||||
on:click|preventDefault={() => dispatch('close')}
|
||||
type="button"
|
||||
class="top-banner-button"
|
||||
aria-label="close upgrade message">
|
||||
<span class="icon-x" aria-hidden="true"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
Reference in new issue
Block a user