diff --git a/media-webui/src/lib/components/AppShell.svelte b/media-webui/src/lib/components/AppShell.svelte index 2929a7e..e5a6f3d 100644 --- a/media-webui/src/lib/components/AppShell.svelte +++ b/media-webui/src/lib/components/AppShell.svelte @@ -5,21 +5,12 @@ import AuthPage from '$lib/components/AuthPage.svelte' import ProjectIcon from '$lib/components/ProjectIcon.svelte' import AboutWorkspace from '$lib/features/AboutWorkspace.svelte' - import { AboutDialog, AdminDialog, Header, NotificationStack, PageHeader, ProfileDialog } from '@gabriel20xx/web-ui' - import type { - AuthLoginInput, - AuthSetupInput, - ManagedUser, - ProfileUpdateInput, - UserCreateInput, - UserId, - UserRole, - UserUpdateInput, - } from '@gabriel20xx/web-ui' + import { AboutDialog, Header, NotificationStack, PageHeader, ProfileDialog } from '@gabriel20xx/web-ui' + import type { AuthLoginInput, AuthSetupInput, ProfileUpdateInput } from '@gabriel20xx/web-ui' import SettingsDialog from '$lib/components/SettingsDialog.svelte' import { getPanelForPath } from '$lib/app-config' import { pageActions } from '$lib/stores/page-actions.svelte' - import { del, get, post, put } from '$lib/api' + import { get, post, put } from '$lib/api' import '$lib/language.svelte' import type { AppConfig, AuthState, AuthUser } from '$lib/types' import type { Snippet } from 'svelte' @@ -36,7 +27,6 @@ let settingsOpen = $state(false) let aboutOpen = $state(false) let profileOpen = $state(false) - let adminOpen = $state(false) // Header only renders its profile/settings menu when username is truthy - with login not // required and nobody signed in, auth.user is legitimately null (there's no session to read @@ -56,11 +46,6 @@ const activeNavItem = $derived( app.nav.find((item) => item.panel === getPanelForPath(app, page.url.pathname)) || app.nav[0], ) - const currentRole = $derived( - auth.user?.role === 'superadmin' || auth.user?.role === 'admin' ? auth.user.role : 'user', - ) - const currentUserId = $derived(auth.user?.id) - const isAdmin = $derived(currentRole === 'admin' || currentRole === 'superadmin') function openSettings() { settingsOpen = true @@ -74,10 +59,6 @@ profileOpen = true } - function openAdmin() { - adminOpen = true - } - function closeSettings() { settingsOpen = false if (page.url.pathname === '/settings') void goto(homePath) @@ -153,27 +134,6 @@ auth = { ...auth, user: data.user, error: null } } - async function listUsers(): Promise { - return get('/api/auth/users') - } - - async function createUser(input: UserCreateInput): Promise { - return post('/api/auth/users', input) - } - - async function updateUser(id: UserId, input: UserUpdateInput): Promise { - return put(`/api/auth/users/${encodeURIComponent(String(id))}`, input) - } - - async function deleteUser(id: UserId): Promise { - await del<{ ok: boolean }>(`/api/auth/users/${encodeURIComponent(String(id))}`) - } - - async function updateLoginRequired(loginRequired: boolean) { - await put<{ loginRequired: boolean }>('/api/auth/access', { loginRequired }) - auth = { ...auth, authRequired: loginRequired } - } - onMount(() => { void loadAuth() }) @@ -204,7 +164,6 @@ faviconHref="/favicon.svg" {navItems} onAbout={openAbout} - onAdmin={isAdmin ? openAdmin : undefined} onLogout={logout} onProfile={openProfile} onSettings={openSettings} @@ -223,17 +182,6 @@ {/if} - {#snippet icon()} diff --git a/packages/web-ui/src/lib/components/AdminDialog.svelte b/packages/web-ui/src/lib/components/AdminDialog.svelte deleted file mode 100644 index be27a10..0000000 --- a/packages/web-ui/src/lib/components/AdminDialog.svelte +++ /dev/null @@ -1,86 +0,0 @@ - - - - {#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 08d4888..3770f35 100644 --- a/packages/web-ui/src/lib/components/AppShell.svelte +++ b/packages/web-ui/src/lib/components/AppShell.svelte @@ -16,7 +16,6 @@ headerActions, navItems = [], onAbout, - onAdmin, onLogout, onNavigate, onProfile, @@ -37,7 +36,6 @@ headerActions?: Snippet; navItems?: NavItem[]; onAbout?: () => void | Promise; - onAdmin?: () => void | Promise; onLogout?: () => void | Promise; onNavigate?: (item: NavItem) => void; onProfile?: () => void; @@ -68,7 +66,6 @@ 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 d97db48..03c3f6c 100644 --- a/packages/web-ui/src/lib/components/Header.svelte +++ b/packages/web-ui/src/lib/components/Header.svelte @@ -100,7 +100,6 @@ navItems = [], actions, onAbout, - onAdmin, onLogout, onNavigate, onProfile, @@ -116,7 +115,6 @@ navItems?: NavItem[]; actions?: Snippet; onAbout?: () => void | Promise; - onAdmin?: () => void | Promise; onLogout?: () => void | Promise; onNavigate?: (item: NavItem) => void; onProfile?: () => void | Promise; @@ -128,12 +126,8 @@ 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 || onAdmin || (showSettings && onSettings) || onAbout || aboutHref || onLogout), - ), + Boolean(username && (onProfile || (showSettings && onSettings) || onAbout || aboutHref || onLogout)), ); function closeMenus(): void { @@ -225,21 +219,6 @@ {/if} - {#if onAdmin} - - {/if} - {#if showSettings && onSettings}