Files
homepage/src/routes/+layout.svelte
T
Alexander 376fbf1ba7 feat: replace browser confirm() with reusable ConfirmDialog component
Promise-based modal dialog with backdrop, keyboard support, and animations,
replacing all 18 native confirm() call sites across fitness, cospend, recipes,
and tasks pages.
2026-04-08 16:47:22 +02:00

27 lines
805 B
Svelte

<script>
import '../app.css';
import { onNavigate } from '$app/navigation';
import Toast from '$lib/components/Toast.svelte';
import ConfirmDialog from '$lib/components/ConfirmDialog.svelte';
let { children } = $props();
onNavigate((navigation) => {
if (!(/** @type {any} */ (document)).startViewTransition) return;
// Skip if staying within the same route group (recipe layout handles its own)
const fromGroup = navigation.from?.route.id?.split('/')[1] ?? '';
const toGroup = navigation.to?.route.id?.split('/')[1] ?? '';
if (fromGroup === toGroup) return;
return new Promise((resolve) => {
(/** @type {any} */ (document)).startViewTransition(async () => {
resolve();
await navigation.complete;
});
});
});
</script>
{@render children()}
<Toast />
<ConfirmDialog />