diff --git a/src/lib/layout/alertStack.svelte b/src/lib/layout/alertStack.svelte new file mode 100644 index 0000000000..597b5f2fa8 --- /dev/null +++ b/src/lib/layout/alertStack.svelte @@ -0,0 +1,71 @@ + + +
+ +
+ + diff --git a/src/lib/layout/headerAlert.svelte b/src/lib/layout/headerAlert.svelte index b092797d5f..4916e4f96f 100644 --- a/src/lib/layout/headerAlert.svelte +++ b/src/lib/layout/headerAlert.svelte @@ -5,7 +5,7 @@
-{#if $activeHeaderAlert?.show && !$isNewWizardStatusOpen} - +{#if hasAnyAlert && !$isNewWizardStatusOpen} + + + + {#if $activeHeaderAlert?.show} + + {/if} + {/if}
{#if showHeader && !$showOnboardingAnimation} diff --git a/src/lib/stores/billing.ts b/src/lib/stores/billing.ts index 7f85293ec5..7c75642a0d 100644 --- a/src/lib/stores/billing.ts +++ b/src/lib/stores/billing.ts @@ -518,7 +518,7 @@ export async function checkPaymentAuthorizationRequired(org: Models.Organization importance: 8 }); } - activeHeaderAlert.set(headerAlert.get()); + activeHeaderAlert.set(headerAlert.getExcluding('impersonation')); actionRequiredInvoices.set(invoices); } diff --git a/src/lib/stores/headerAlert.ts b/src/lib/stores/headerAlert.ts index 1d5faffeef..dbde513359 100644 --- a/src/lib/stores/headerAlert.ts +++ b/src/lib/stores/headerAlert.ts @@ -1,5 +1,5 @@ import type { Component } from 'svelte'; -import { writable } from 'svelte/store'; +import { get as getStore, writable } from 'svelte/store'; export type HeaderAlert = { id: string; @@ -13,13 +13,11 @@ export type HeaderAlertStore = { }; function createHeaderAlertStore() { - const { subscribe, update, set } = writable({ - components: [] - }); + const store = writable({ components: [] }); + const { subscribe, update } = store; return { subscribe, - set, add: (component: HeaderAlert) => { update((n) => { if (n.components.some((c) => c.id === component.id)) return n; @@ -42,19 +40,21 @@ function createHeaderAlertStore() { }, get: (): HeaderAlert => { // return highest importance visible component - let component = { - id: '', - show: false, - component: null, - importance: 0 - }; - update((n) => { - n.components.forEach((c) => { - if (c.show && c.importance > component.importance) { - component = c; - } - }); - return n; + let component = { id: '', show: false, component: null, importance: 0 }; + getStore(store).components.forEach((c) => { + if (c.show && c.importance > component.importance) { + component = c; + } + }); + return component as HeaderAlert; + }, + getExcluding: (excludeId: string): HeaderAlert => { + // return highest importance visible component, excluding a specific id + let component = { id: '', show: false, component: null, importance: 0 }; + getStore(store).components.forEach((c) => { + if (c.show && c.id !== excludeId && c.importance > component.importance) { + component = c; + } }); return component as HeaderAlert; } diff --git a/src/routes/(console)/+layout.svelte b/src/routes/(console)/+layout.svelte index 47a5c06899..ea0830ac0c 100644 --- a/src/routes/(console)/+layout.svelte +++ b/src/routes/(console)/+layout.svelte @@ -305,7 +305,7 @@ calculateTrialDay(org); } } - $activeHeaderAlert = headerAlert.get(); + $activeHeaderAlert = headerAlert.getExcluding('impersonation'); } } @@ -318,7 +318,7 @@ $registerSearchers(orgSearcher, projectsSearcher); afterUpdate(() => { - $activeHeaderAlert = headerAlert.get(); + $activeHeaderAlert = headerAlert.getExcluding('impersonation'); });