diff --git a/packages/web-ui/src/lib/components/AdminDialog.svelte b/packages/web-ui/src/lib/components/AdminDialog.svelte new file mode 100644 index 0000000..be27a10 --- /dev/null +++ b/packages/web-ui/src/lib/components/AdminDialog.svelte @@ -0,0 +1,86 @@ + + + + {#if onLoginRequiredChange} +
+ + {#if loginSettingError}{/if} +
+ {/if} + + +
diff --git a/packages/web-ui/src/lib/components/AppShell.svelte b/packages/web-ui/src/lib/components/AppShell.svelte index 204b5be..64ae198 100644 --- a/packages/web-ui/src/lib/components/AppShell.svelte +++ b/packages/web-ui/src/lib/components/AppShell.svelte @@ -15,6 +15,7 @@ headerActions, navItems = [], onAbout, + onAdmin, onLogout, onNavigate, onProfile, @@ -34,6 +35,7 @@ headerActions?: Snippet; navItems?: NavItem[]; onAbout?: () => void | Promise; + onAdmin?: () => void | Promise; onLogout?: () => void | Promise; onNavigate?: (item: NavItem) => void; onProfile?: () => void; @@ -61,6 +63,7 @@ actions={headerActions} {navItems} {onAbout} + {onAdmin} {onLogout} {onNavigate} {onProfile} diff --git a/packages/web-ui/src/lib/components/Header.svelte b/packages/web-ui/src/lib/components/Header.svelte index 03c3f6c..d97db48 100644 --- a/packages/web-ui/src/lib/components/Header.svelte +++ b/packages/web-ui/src/lib/components/Header.svelte @@ -100,6 +100,7 @@ navItems = [], actions, onAbout, + onAdmin, onLogout, onNavigate, onProfile, @@ -115,6 +116,7 @@ navItems?: NavItem[]; actions?: Snippet; onAbout?: () => void | Promise; + onAdmin?: () => void | Promise; onLogout?: () => void | Promise; onNavigate?: (item: NavItem) => void; onProfile?: () => void | Promise; @@ -126,8 +128,12 @@ let navOpen = $state(false); let profileOpen = $state(false); + // onAdmin is only ever passed by the caller when the signed-in user's role qualifies, so its + // presence alone is enough to decide visibility here - same as onProfile/onLogout below. const hasProfileMenu = $derived( - Boolean(username && (onProfile || (showSettings && onSettings) || onAbout || aboutHref || onLogout)), + Boolean( + username && (onProfile || onAdmin || (showSettings && onSettings) || onAbout || aboutHref || onLogout), + ), ); function closeMenus(): void { @@ -219,6 +225,21 @@ {/if} + {#if onAdmin} + + {/if} + {#if showSettings && onSettings}