From 395b7d0e7932a8cb94db87dd3c5f3488a3c14fd5 Mon Sep 17 00:00:00 2001 From: Gabriel20xx Date: Thu, 20 Aug 2026 14:04:12 +0200 Subject: [PATCH] feat: add admin dialog and move user management out of settings/profile modals - Sync shared web-ui AdminDialog and header/profile/settings dialog updates - Add a dedicated admin entry to the header profile dropdown, admin-only - Move user-management settings from SettingsDialog/ProfileDialog into AdminDialog Co-Authored-By: Claude Sonnet 5 --- .../src/lib/features/layout/AppShell.svelte | 30 +++-- .../lib/features/layout/SettingsDialog.svelte | 124 +++++++----------- .../src/lib/components/AdminDialog.svelte | 86 ++++++++++++ .../web-ui/src/lib/components/AppShell.svelte | 3 + .../web-ui/src/lib/components/Header.svelte | 23 +++- .../src/lib/components/ProfileDialog.svelte | 35 +---- .../src/lib/components/SettingsDialog.svelte | 69 ---------- shared/packages/web-ui/src/lib/index.ts | 1 + 8 files changed, 183 insertions(+), 188 deletions(-) create mode 100644 shared/packages/web-ui/src/lib/components/AdminDialog.svelte diff --git a/frontend/src/lib/features/layout/AppShell.svelte b/frontend/src/lib/features/layout/AppShell.svelte index 8731623..b76e8a2 100644 --- a/frontend/src/lib/features/layout/AppShell.svelte +++ b/frontend/src/lib/features/layout/AppShell.svelte @@ -1,6 +1,6 @@ - - -
- Theme -
- - - -
-
-
- - + + Light + + +
+ +
+ + +
diff --git a/shared/packages/web-ui/src/lib/components/AdminDialog.svelte b/shared/packages/web-ui/src/lib/components/AdminDialog.svelte new file mode 100644 index 0000000..be27a10 --- /dev/null +++ b/shared/packages/web-ui/src/lib/components/AdminDialog.svelte @@ -0,0 +1,86 @@ + + + + {#if onLoginRequiredChange} +
+ + {#if loginSettingError}{/if} +
+ {/if} + + +
diff --git a/shared/packages/web-ui/src/lib/components/AppShell.svelte b/shared/packages/web-ui/src/lib/components/AppShell.svelte index 204b5be..64ae198 100644 --- a/shared/packages/web-ui/src/lib/components/AppShell.svelte +++ b/shared/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/shared/packages/web-ui/src/lib/components/Header.svelte b/shared/packages/web-ui/src/lib/components/Header.svelte index 03c3f6c..d97db48 100644 --- a/shared/packages/web-ui/src/lib/components/Header.svelte +++ b/shared/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}