Files
homepage/src/routes/+layout.svelte
Alexander Bocken 3b805861cf feat: add toast notification system, replace all alert() calls
Create shared toast store and Toast component mounted in root layout.
Wire toast.error() into all fitness API calls that previously failed
silently, and replace all alert() calls across recipes and cospend.
2026-03-25 07:40:52 +01:00

25 lines
720 B
Svelte

<script>
import '../app.css';
import { onNavigate } from '$app/navigation';
import Toast from '$lib/components/Toast.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 />