fix header

This commit is contained in:
harsh mahajan committed 2026-04-23 16:57:41 +05:30
1 parent 9e8ff77a21
commit 435ceba9f6
2 files changed
+23 -4

No files matched your search

+12 -2
View File
@@ -30,8 +30,18 @@ function createHeaderAlertStore() {
}
});
},
updateShow: (id: string, show: boolean) => {
update((n) => {
const component = n.components.find((c) => c.id === id);
if (!component || component.show === show) return n;
component.show = show;
n.components = [...n.components];
return n;
});
},
get: (): HeaderAlert => {
//return highest importance component
// return highest importance visible component
let component = {
id: '',
show: false,
@@ -40,7 +50,7 @@ function createHeaderAlertStore() {
};
update((n) => {
n.components.forEach((c) => {
if (c.importance > component.importance) {
if (c.show && c.importance > component.importance) {
component = c;
}
});
+11 -2
View File
@@ -13,7 +13,11 @@
import { sdk } from '$lib/stores/sdk';
import { user } from '$lib/stores/user';
import { loading } from '$routes/store';
import { restoreImpersonation } from '$lib/appwrite/impersonation';
import {
impersonationRevision,
readImpersonationTargetUserId,
restoreImpersonation
} from '$lib/appwrite/impersonation';
import { headerAlert } from '$lib/stores/headerAlert';
import ImpersonationBanner from '$lib/components/impersonation/banner.svelte';
import { Root } from '@appwrite.io/pink-svelte';
@@ -37,7 +41,7 @@
headerAlert.add({
id: 'impersonation',
component: ImpersonationBanner,
show: true,
show: !!readImpersonationTargetUserId(),
importance: 100 // highest priority — always visible when active
});
@@ -129,6 +133,11 @@
}
});
$: if (browser) {
void $impersonationRevision;
headerAlert.updateShow('impersonation', !!readImpersonationTargetUserId());
}
$: {
if (browser) {
const isCloudClass = isCloud ? 'is-cloud' : '';