feat(layout): mount ConfirmDialog in root layout and provide confirm service

provideConfirmService() sets up context for the entire component tree.
ConfirmDialog is mounted once at the bottom of the layout shell.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-12 13:21:34 +02:00
parent 1942c2a5cb
commit 08bd27b5cd

View File

@@ -7,9 +7,15 @@ import ThemeToggle from '$lib/components/ThemeToggle.svelte';
import NotificationBell from '$lib/components/NotificationBell.svelte';
import AppNav from './AppNav.svelte';
import UserMenu from './UserMenu.svelte';
import ConfirmDialog from '$lib/components/ConfirmDialog.svelte';
import { provideConfirmService } from '$lib/services/confirm.svelte.js';
let { children, data } = $props();
// Provide the confirmation service to the entire component tree.
// ConfirmDialog below reads it via getConfirmService() and renders the <dialog>.
provideConfirmService();
const isAdmin = $derived(
data?.user?.groups?.some((g: { permissions: string[] }) => g.permissions.includes('ADMIN'))
);
@@ -70,4 +76,7 @@ const userInitials = $derived.by(() => {
<main class={isAuthPage ? '' : 'py-6'}>
{@render children()}
</main>
<!-- Shared confirmation dialog — used by getConfirmService() throughout the app -->
<ConfirmDialog />
</div>