From f57b039e6a18f92eef57103cd71ecba0001d9df5 Mon Sep 17 00:00:00 2001 From: ItzNotABug Date: Tue, 24 Sep 2024 12:30:57 +0530 Subject: [PATCH] address comments. --- src/lib/components/bottomModalAlert.svelte | 41 +++-- src/lib/images/samples/backups-dark.png | Bin 0 -> 285406 bytes src/lib/images/samples/backups-light.png | Bin 0 -> 158312 bytes .../images/samples/backups-sample-dark.svg | 82 --------- .../images/samples/backups-sample-light.svg | 35 ---- src/lib/images/samples/roles-dark.png | Bin 0 -> 229257 bytes src/lib/images/samples/roles-light.png | Bin 0 -> 232198 bytes src/lib/images/samples/roles-sample-dark.svg | 144 ---------------- src/lib/images/samples/roles-sample-light.svg | 160 ------------------ src/lib/stores/bottom-alerts.ts | 1 + .../project-[project]/bottomAlerts.ts | 14 +- 11 files changed, 39 insertions(+), 438 deletions(-) create mode 100644 src/lib/images/samples/backups-dark.png create mode 100644 src/lib/images/samples/backups-light.png delete mode 100644 src/lib/images/samples/backups-sample-dark.svg delete mode 100644 src/lib/images/samples/backups-sample-light.svg create mode 100644 src/lib/images/samples/roles-dark.png create mode 100644 src/lib/images/samples/roles-light.png delete mode 100644 src/lib/images/samples/roles-sample-dark.svg delete mode 100644 src/lib/images/samples/roles-sample-light.svg diff --git a/src/lib/components/bottomModalAlert.svelte b/src/lib/components/bottomModalAlert.svelte index fca8ab7a5..e3fafcba6 100644 --- a/src/lib/components/bottomModalAlert.svelte +++ b/src/lib/components/bottomModalAlert.svelte @@ -9,6 +9,9 @@ dismissBottomModalAlert, hideAllModalAlerts } from '$lib/stores/bottom-alerts'; + import { organization } from '$lib/stores/organization'; + import { BillingPlan } from '$lib/constants'; + import { upgradeURL } from '$lib/stores/billing'; let currentIndex = 0; let openModalOnMobile = false; @@ -19,7 +22,8 @@ $: currentModalAlert = filteredModalAlerts[currentIndex] as BottomModalAlertItem; - function handleClose(modalAlert: BottomModalAlertItem) { + function handleClose() { + const modalAlert = currentModalAlert; dismissBottomModalAlert(modalAlert.id); hideNotification(modalAlert.id); if (modalAlert.closed) modalAlert.closed(); @@ -38,14 +42,28 @@ function showPrevious() { currentIndex = (currentIndex - 1 + filteredModalAlerts.length) % filteredModalAlerts.length; } + + function showUpgrade() { + const plan = currentModalAlert.plan; + const organizationPlan = $organization.billingPlan; + switch (plan) { + case 'free': + return false; + case 'pro': + return organizationPlan === BillingPlan.FREE; + case 'scale': + return organizationPlan === BillingPlan.FREE || organizationPlan === BillingPlan.PRO; + } + } {#if filteredModalAlerts.length > 0 && currentModalAlert} + {@const shouldShowUpgrade = showUpgrade()}
{#key currentModalAlert.id} - {#if currentModalAlert.learnMore && currentModalAlert.learnMore.link} @@ -160,7 +179,7 @@
{#if currentModalAlert.learnMore && currentModalAlert.learnMore.link} @@ -245,7 +264,7 @@