feat(ui): custom dialog replaces all remaining window.alert() calls
All checks were successful
Build & Publish Docker Image / build-and-push (push) Successful in 53s
All checks were successful
Build & Publish Docker Image / build-and-push (push) Successful in 53s
alertAction({title, message}) returns Promise<void> and renders the
same ConfirmDialog with infoOnly:true — single OK button, no Abbrechen.
Replaces:
- 'Bitte Profil wählen.' (recipe rating / favorite / cooked / comment)
- 'Bitte Profil wählen, um zu liken.' (wishlist)
- 'Profil konnte nicht angelegt werden' (ProfileSwitcher)
- 'Umbenennen fehlgeschlagen' (admin/profiles)
- 'Speichern fehlgeschlagen' (preview)
No window.alert() or window.confirm() left in the codebase.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
import RecipeView from '$lib/components/RecipeView.svelte';
|
||||
import StarRating from '$lib/components/StarRating.svelte';
|
||||
import { profileStore } from '$lib/client/profile.svelte';
|
||||
import { confirmAction } from '$lib/client/confirm.svelte';
|
||||
import { confirmAction, alertAction } from '$lib/client/confirm.svelte';
|
||||
import type { CommentRow } from '$lib/server/recipes/actions';
|
||||
|
||||
let { data } = $props();
|
||||
@@ -40,7 +40,10 @@
|
||||
|
||||
async function setRating(stars: number) {
|
||||
if (!profileStore.active) {
|
||||
alert('Bitte erst Profil wählen.');
|
||||
await alertAction({
|
||||
title: 'Kein Profil gewählt',
|
||||
message: 'Tippe oben rechts auf „Profil wählen", dann klappt die Aktion.'
|
||||
});
|
||||
return;
|
||||
}
|
||||
await fetch(`/api/recipes/${data.recipe.id}/rating`, {
|
||||
@@ -55,7 +58,10 @@
|
||||
|
||||
async function toggleFavorite() {
|
||||
if (!profileStore.active) {
|
||||
alert('Bitte erst Profil wählen.');
|
||||
await alertAction({
|
||||
title: 'Kein Profil gewählt',
|
||||
message: 'Tippe oben rechts auf „Profil wählen", dann klappt die Aktion.'
|
||||
});
|
||||
return;
|
||||
}
|
||||
const method = isFav ? 'DELETE' : 'PUT';
|
||||
@@ -69,7 +75,10 @@
|
||||
|
||||
async function logCooked() {
|
||||
if (!profileStore.active) {
|
||||
alert('Bitte erst Profil wählen.');
|
||||
await alertAction({
|
||||
title: 'Kein Profil gewählt',
|
||||
message: 'Tippe oben rechts auf „Profil wählen", dann klappt die Aktion.'
|
||||
});
|
||||
return;
|
||||
}
|
||||
const res = await fetch(`/api/recipes/${data.recipe.id}/cooked`, {
|
||||
@@ -83,7 +92,10 @@
|
||||
|
||||
async function addComment() {
|
||||
if (!profileStore.active) {
|
||||
alert('Bitte erst Profil wählen.');
|
||||
await alertAction({
|
||||
title: 'Kein Profil gewählt',
|
||||
message: 'Tippe oben rechts auf „Profil wählen", dann klappt die Aktion.'
|
||||
});
|
||||
return;
|
||||
}
|
||||
const text = newComment.trim();
|
||||
|
||||
Reference in New Issue
Block a user