From bcd6b711bf442628278900917587660d494fd16c Mon Sep 17 00:00:00 2001
From: Dean
Date: Wed, 14 Sep 2022 18:04:58 +0100
Subject: [PATCH] Apps Page update to hide apps when sessions are maxed.
General refactoring and updates to the licensing notification flows.
---
packages/bbui/src/Banner/BannerDisplay.svelte | 6 +-
packages/bbui/src/Stores/banner.js | 22 ++++--
.../bbui/src/Tooltip/TooltipWrapper.svelte | 3 +-
packages/bbui/src/index.js | 2 +-
.../src/builderStore/store/temporal.js | 3 +-
.../licensing/AccountDowngradedModal.svelte | 14 ++--
.../portal/licensing/AppLimitModal.svelte | 9 ++-
.../licensing/DayPassWarningModal.svelte | 52 +++++++++----
.../portal/licensing/LicensingOverlays.svelte | 31 ++++----
.../licensing/PaymentFailedModal.svelte | 25 +++----
.../components/portal/licensing/constants.js | 2 +-
.../{banners.js => licensingBanners.js} | 74 ++++++++++++-------
.../src/pages/builder/apps/index.svelte | 22 +++++-
.../builder/src/stores/portal/licensing.js | 72 ++++++++----------
14 files changed, 198 insertions(+), 139 deletions(-)
rename packages/builder/src/components/portal/licensing/{banners.js => licensingBanners.js} (62%)
diff --git a/packages/bbui/src/Banner/BannerDisplay.svelte b/packages/bbui/src/Banner/BannerDisplay.svelte
index 4785fcb9ba..9ea2eaf2ec 100644
--- a/packages/bbui/src/Banner/BannerDisplay.svelte
+++ b/packages/bbui/src/Banner/BannerDisplay.svelte
@@ -16,13 +16,15 @@
extraButtonText={message.extraButtonText}
extraButtonAction={message.extraButtonAction}
on:change={() => {
- message.onChange()
+ if (message.onChange) {
+ message.onChange()
+ }
}}
showCloseButton={typeof message.showCloseButton === "boolean"
? message.showCloseButton
: true}
>
-
+
{message.message}
diff --git a/packages/bbui/src/Stores/banner.js b/packages/bbui/src/Stores/banner.js
index 745c77e188..ba6d187d97 100644
--- a/packages/bbui/src/Stores/banner.js
+++ b/packages/bbui/src/Stores/banner.js
@@ -1,5 +1,10 @@
import { writable } from "svelte/store"
+export const BANNER_TYPES = {
+ INFO: "info",
+ NEGATIVE: "negative",
+}
+
export function createBannerStore() {
const DEFAULT_CONFIG = {
messages: [],
@@ -22,19 +27,26 @@ export function createBannerStore() {
const showStatus = async () => {
const config = {
message: "Some systems are experiencing issues",
- type: "negative",
+ type: BANNER_TYPES.NEGATIVE,
extraButtonText: "View Status",
extraButtonAction: () => window.open("https://status.budibase.com/"),
}
- await show(config)
+ await queue([config])
}
const queue = async entries => {
+ const priority = {
+ [BANNER_TYPES.NEGATIVE]: 0,
+ [BANNER_TYPES.INFO]: 1,
+ }
banner.update(store => {
- const sorted = [...store.messages, ...entries].sort(
- (a, b) => a.priority > b.priority
- )
+ const sorted = [...store.messages, ...entries].sort((a, b) => {
+ if (priority[a.type] == priority[b.type]) {
+ return 0
+ }
+ return priority[a.type] < priority[b.type] ? -1 : 1
+ })
return {
...store,
messages: sorted,
diff --git a/packages/bbui/src/Tooltip/TooltipWrapper.svelte b/packages/bbui/src/Tooltip/TooltipWrapper.svelte
index 0c6c8e167b..e7a96f6cd8 100644
--- a/packages/bbui/src/Tooltip/TooltipWrapper.svelte
+++ b/packages/bbui/src/Tooltip/TooltipWrapper.svelte
@@ -4,6 +4,7 @@
export let tooltip = ""
export let size = "M"
+ export let disabled = true
let showTooltip = false
@@ -19,7 +20,7 @@
on:mouseleave={() => (showTooltip = false)}
on:focus
>
-
+
{#if showTooltip}
- {`${$licensing.paymentDueDaysRemaining} day${
- $licensing.paymentDueDaysRemaining == 1 ? "" : "s"
+ {`${$licensing.pastDueDaysRemaining} day${
+ $licensing.pastDueDaysRemaining == 1 ? "" : "s"
} remaining`}
-
+
Please contact your account holder.
- {`${$licensing.paymentDueDaysRemaining} day${
- $licensing.paymentDueDaysRemaining == 1 ? "" : "s"
+ {`${$licensing.pastDueDaysRemaining} day${
+ $licensing.pastDueDaysRemaining == 1 ? "" : "s"
} remaining`}
-
+