feat(ui): implement dropdown menu component with items and separators
Build & Push Docker Image / Docker Build & Push (push) Successful in 4m32s
Lint / Lint (push) Successful in 17s
Tests / Test (push) Successful in 11s

This commit is contained in:
Gabriel20xx committed 2026-08-02 15:54:34 +02:00
1 parent cd72558db8
commit 9af1e0ce73
7 files changed
+100 -36

No files matched your search

@@ -1,28 +1,10 @@
<script>
import { LogOut, Moon, Sun, SunMoon, UserCog } from '@lucide/svelte';
import { Moon, Sun, SunMoon } from '@lucide/svelte';
import Button from '$lib/components/ui/button.svelte';
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from '$lib/components/ui/dialog';
import { themeState } from '$lib/theme.svelte.js';
import { useAuth } from '$lib/features/auth/auth.svelte.js';
import CredentialsDialog from '$lib/features/auth/CredentialsDialog.svelte';
let { open = $bindable(false) } = $props();
const auth = useAuth();
let credentialsOpen = $state(false);
// bits-ui dialogs don't nest cleanly (focus-trap/z-index conflicts), so close this one
// before opening the next, matching the pattern used elsewhere in this project series.
function openCredentials() {
open = false;
credentialsOpen = true;
}
async function handleLogout() {
open = false;
await auth.logout();
}
</script>
<Dialog bind:open>
@@ -65,23 +47,8 @@
</Button>
</div>
</div>
<div>
<span class="mb-2 block text-sm font-medium">Account</span>
<div class="flex flex-col gap-2">
<Button type="button" variant="secondary" class="justify-start gap-2" onclick={openCredentials}>
<UserCog class="size-4" />
Change username / password
</Button>
<Button type="button" variant="secondary" class="justify-start gap-2" onclick={handleLogout}>
<LogOut class="size-4" />
Log out
</Button>
</div>
</div>
<DialogFooter>
<Button type="button" variant="secondary" onclick={() => (open = false)}>Dismiss</Button>
</DialogFooter>
</DialogContent>
</Dialog>
<CredentialsDialog bind:open={credentialsOpen} currentUsername={auth.status?.username ?? ''} />