feat: add admin dialog and move user management out of settings/profile modals
Lint / Lint (push) Successful in 25s
Tests / Go backend (push) Successful in 32s
Tests / Dashboard checks (push) Successful in 37s
Docker / Docker Build & Push (push) Successful in 2m54s

- 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 <noreply@anthropic.com>
This commit is contained in:
Gabriel20xxandClaude Sonnet 5 committed 2026-08-20 14:04:12 +02:00
1 parent f1b52a4fa6
commit 395b7d0e79
8 files changed
+183 -188

No files matched your search

@@ -1,6 +1,6 @@
<script>
import { page } from '$app/state';
import { AppShell as SharedAppShell, ProfileDialog } from '@gabriel20xx/web-ui';
import { AdminDialog, AppShell as SharedAppShell, ProfileDialog } from '@gabriel20xx/web-ui';
import { Tooltip } from 'bits-ui';
import AuthPage from '$lib/features/auth/AuthPage.svelte';
import { createAuthStore } from '$lib/features/auth/auth.svelte.js';
@@ -9,11 +9,23 @@
let { children } = $props();
const auth = createAuthStore();
const navItems = [
{ href: '/', label: 'Overview', icon: 'layout-dashboard', description: 'Browse shared tables and collaborate on structured data.' },
{ href: '/about', label: 'About', icon: 'info', description: 'Learn about CollabTable and its collaboration features.' },
{
href: '/',
label: 'Overview',
icon: 'layout-dashboard',
description: 'Browse shared tables and collaborate on structured data.',
},
{
href: '/about',
label: 'About',
icon: 'info',
description: 'Learn about CollabTable and its collaboration features.',
},
];
let settingsOpen = $state(false);
let credentialsOpen = $state(false);
let adminOpen = $state(false);
const isAdmin = $derived(auth.status?.role === 'admin' || auth.status?.role === 'superadmin');
async function saveProfile(input) {
await auth.updateCredentials({
@@ -44,6 +56,7 @@
username={auth.status.username ?? ''}
onLogout={() => auth.logout()}
onProfile={() => (credentialsOpen = true)}
onAdmin={isAdmin ? () => (adminOpen = true) : undefined}
onSettings={() => (settingsOpen = true)}
>
{@render children?.()}
@@ -51,8 +64,9 @@
{/if}
</Tooltip.Provider>
<SettingsDialog
bind:open={settingsOpen}
<SettingsDialog bind:open={settingsOpen} />
<AdminDialog
bind:open={adminOpen}
currentRole={auth.status?.role ?? 'user'}
currentUserId={auth.status?.id}
onCreateUser={(input) => auth.createUser(input)}
@@ -64,13 +78,7 @@
bind:open={credentialsOpen}
currentUsername={auth.status?.username ?? ''}
currentEmail={auth.status?.email ?? ''}
currentRole={auth.status?.role ?? 'user'}
currentUserId={auth.status?.id}
onCreateUser={(input) => auth.createUser(input)}
onDeleteUser={(id) => auth.deleteUser(id)}
onListUsers={() => auth.listUsers()}
onSave={saveProfile}
onUpdateUser={(id, input) => auth.updateUser(id, input)}
onTotpStatus={() => auth.totpStatus()}
onTotpSetup={() => auth.setupTotp()}
onTotpEnable={(token) => auth.enableTotp(token)}