From 02b9cdbc6884a49240ab7a471ee744ede7491f59 Mon Sep 17 00:00:00 2001 From: hsiegeln <37154749+hsiegeln@users.noreply.github.com> Date: Sun, 19 Apr 2026 11:45:00 +0200 Subject: [PATCH] refactor(client): requireProfile(message?) + Wunschliste migriert (Item G) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Option B aus dem Roadmap-Plan. requireProfile bekommt einen optionalen message-Parameter mit dem bisherigen Text als Default — die 5 Bestands- Aufrufe aendern sich nicht, die Wunschliste nutzt die Custom-Message „um mitzuwünschen" sauber ueber den Helper statt mit dupliziertem alertAction-Block. Netto: -3 Zeilen in wishlist/+page.svelte, eine Duplikation weniger, Helper dokumentiert jetzt explizit den Message-Override-Use-Case. Gate: svelte-check 0 Warnings, 184/184 Tests, Wunschliste zeigt korrekte Message beim Klick ohne Profil. Refs docs/superpowers/plans/2026-04-19-post-review-roadmap.md Item G. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/lib/client/profile.svelte.ts | 12 +++++++----- src/routes/wishlist/+page.svelte | 17 +++++++---------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/lib/client/profile.svelte.ts b/src/lib/client/profile.svelte.ts index d8ba289..256fc6c 100644 --- a/src/lib/client/profile.svelte.ts +++ b/src/lib/client/profile.svelte.ts @@ -66,12 +66,14 @@ export const profileStore = new ProfileStore(); * Returns the active profile, or null after showing the standard * "kein Profil gewählt" dialog. Use as the first line of any per-profile * action so we don't repeat the guard at every call-site. + * + * `message` ueberschreibt den Default, wenn eine Aktion einen spezifischen + * Hinweis braucht (z. B. „um mitzuwünschen" auf der Wunschliste). */ -export async function requireProfile(): Promise { +export async function requireProfile( + message = 'Tippe oben rechts auf „Profil wählen", dann klappt die Aktion.' +): Promise { if (profileStore.active) return profileStore.active; - await alertAction({ - title: 'Kein Profil gewählt', - message: 'Tippe oben rechts auf „Profil wählen", dann klappt die Aktion.' - }); + await alertAction({ title: 'Kein Profil gewählt', message }); return null; } diff --git a/src/routes/wishlist/+page.svelte b/src/routes/wishlist/+page.svelte index 448ef33..6cea129 100644 --- a/src/routes/wishlist/+page.svelte +++ b/src/routes/wishlist/+page.svelte @@ -1,9 +1,9 @@