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.
This commit is contained in:
2026-03-25 07:40:37 +01:00
parent 0263a18c5f
commit 3b805861cf
13 changed files with 185 additions and 25 deletions

View File

@@ -5,6 +5,7 @@
import FitnessStreakAura from '$lib/components/fitness/FitnessStreakAura.svelte';
import { onMount } from 'svelte';
import { detectFitnessLang, fitnessSlugs, t } from '$lib/js/fitnessI18n';
import { toast } from '$lib/js/toast.svelte';
const lang = $derived(detectFitnessLang($page.url.pathname));
@@ -59,8 +60,11 @@
goalWeekly = d.weeklyWorkouts;
goalStreak = d.streak;
goalEditing = false;
} else {
const err = await res.json().catch(() => null);
toast.error(err?.error ?? 'Failed to save goal');
}
} finally {
} catch { toast.error('Failed to save goal'); } finally {
goalSaving = false;
}
}