2026-04-17 15:28:22 +02:00
|
|
|
<script lang="ts">
|
2026-04-19 11:38:35 +02:00
|
|
|
import { onMount, onDestroy, tick, untrack } from 'svelte';
|
2026-04-18 14:40:57 +02:00
|
|
|
import { page } from '$app/stores';
|
2026-04-17 15:28:22 +02:00
|
|
|
import { goto } from '$app/navigation';
|
feat(ui): Favoriten-Liste, Dismiss-from-Recent, Inline-Rename, Lucide-Icons
Homepage:
- Neue Sektion "Deine Favoriten" über "Zuletzt hinzugefügt" (alphabetisch
sortiert, lädt wenn Profil aktiv ist; versteckt sonst)
- Jede Karte in "Zuletzt hinzugefügt" hat jetzt oben-rechts ein X-Icon
zum Ausblenden. Das Rezept selbst bleibt in der DB — nur die
Anzeige in der Recent-Liste wird per recipe.hidden_from_recent = 1
unterdrückt. Section versteckt sich, wenn die Liste leer wird.
DB:
- Neue Migration 004_recipe_hidden_from_recent.sql (+Index)
- listFavoritesForProfile in search-local.ts (ORDER BY title NOCASE)
- setRecipeHiddenFromRecent in actions.ts
API:
- GET /api/recipes/favorites?profile_id=X
- PATCH /api/recipes/[id] akzeptiert jetzt title und/oder
hidden_from_recent (Zod-Schema mit refine)
Rezept-Detail:
- Titel ist jetzt inline editierbar: kleines Stift-Icon rechts neben
H1. Click öffnet Input, Enter speichert (PATCH), Escape bricht ab.
Kein location.reload() mehr.
- RecipeView bekommt neuen Snippet-Prop titleSlot für Title-Override.
- Neue Aktionsreihenfolge:
Zeile 1: Favorit | Wunschliste | Drucken
Zeile 2: Heute gekocht | Löschen
(Umbenennen ist jetzt am Titel statt in der Leiste.)
Icons (lucide-svelte, neues Dep):
- Emoji-Icons durch Lucide-SVGs ersetzt auf Startseite, Header,
Rezept-Detail, Wunschliste, Header-Dropdown:
🍽️→Heart/Utensils, ⚙️→Settings, 🥘→CookingPot, 🌐→Globe,
♥/♡→Heart(filled), 🖨→Printer, ✎→Pencil, 🗑→Trash2, ✓→Check,
🍳→ChefHat, X→X
- Header-Brand-Badge auf Mobile behält sein 🍳 (ist im ::after-Pseudo,
Lucide käme da nicht sauber rein).
- SearchLoader-Emojis bleiben — die sind Teil der Animations-Charme.
Tests: 99/99 grün (bestehend), Typecheck 0 Fehler.
2026-04-17 18:57:17 +02:00
|
|
|
import {
|
|
|
|
|
Heart,
|
|
|
|
|
Utensils,
|
|
|
|
|
Printer,
|
|
|
|
|
Pencil,
|
|
|
|
|
Trash2,
|
|
|
|
|
ChefHat,
|
|
|
|
|
Check,
|
2026-04-17 19:21:28 +02:00
|
|
|
X,
|
|
|
|
|
Lightbulb,
|
|
|
|
|
LightbulbOff
|
feat(ui): Favoriten-Liste, Dismiss-from-Recent, Inline-Rename, Lucide-Icons
Homepage:
- Neue Sektion "Deine Favoriten" über "Zuletzt hinzugefügt" (alphabetisch
sortiert, lädt wenn Profil aktiv ist; versteckt sonst)
- Jede Karte in "Zuletzt hinzugefügt" hat jetzt oben-rechts ein X-Icon
zum Ausblenden. Das Rezept selbst bleibt in der DB — nur die
Anzeige in der Recent-Liste wird per recipe.hidden_from_recent = 1
unterdrückt. Section versteckt sich, wenn die Liste leer wird.
DB:
- Neue Migration 004_recipe_hidden_from_recent.sql (+Index)
- listFavoritesForProfile in search-local.ts (ORDER BY title NOCASE)
- setRecipeHiddenFromRecent in actions.ts
API:
- GET /api/recipes/favorites?profile_id=X
- PATCH /api/recipes/[id] akzeptiert jetzt title und/oder
hidden_from_recent (Zod-Schema mit refine)
Rezept-Detail:
- Titel ist jetzt inline editierbar: kleines Stift-Icon rechts neben
H1. Click öffnet Input, Enter speichert (PATCH), Escape bricht ab.
Kein location.reload() mehr.
- RecipeView bekommt neuen Snippet-Prop titleSlot für Title-Override.
- Neue Aktionsreihenfolge:
Zeile 1: Favorit | Wunschliste | Drucken
Zeile 2: Heute gekocht | Löschen
(Umbenennen ist jetzt am Titel statt in der Leiste.)
Icons (lucide-svelte, neues Dep):
- Emoji-Icons durch Lucide-SVGs ersetzt auf Startseite, Header,
Rezept-Detail, Wunschliste, Header-Dropdown:
🍽️→Heart/Utensils, ⚙️→Settings, 🥘→CookingPot, 🌐→Globe,
♥/♡→Heart(filled), 🖨→Printer, ✎→Pencil, 🗑→Trash2, ✓→Check,
🍳→ChefHat, X→X
- Header-Brand-Badge auf Mobile behält sein 🍳 (ist im ::after-Pseudo,
Lucide käme da nicht sauber rein).
- SearchLoader-Emojis bleiben — die sind Teil der Animations-Charme.
Tests: 99/99 grün (bestehend), Typecheck 0 Fehler.
2026-04-17 18:57:17 +02:00
|
|
|
} from 'lucide-svelte';
|
2026-04-17 15:28:22 +02:00
|
|
|
import RecipeView from '$lib/components/RecipeView.svelte';
|
feat(recipe): Edit-Modus für Zutaten, Schritte und Meta
Auf der Rezept-Detail-Seite ein neuer „Bearbeiten"-Button (Pencil-Icon)
in der Action-Bar. Klick schaltet RecipeView auf RecipeEditor um.
Im Editor:
- Titel, Beschreibung, Portionen, Vorbereitungs-/Koch-/Gesamtzeit als
inline-Inputs.
- Zutaten: pro Zeile Menge, Einheit, Name, Notiz + Trash-Icon zum
Entfernen. „+ Zutat hinzufügen"-Dashed-Button am Listenende.
- Schritte: nummerierte Textareas, Trash-Icon, „+ Schritt hinzufügen".
- Mengen akzeptieren Komma- oder Punkt-Dezimalen.
- Empty-Items werden beim Speichern automatisch aussortiert.
Backend:
- Neue Repo-Funktionen updateRecipeMeta(id, patch), replaceIngredients,
replaceSteps — letztere in einer Transaction mit delete+insert und
FTS-Refresh.
- PATCH /api/recipes/[id] akzeptiert jetzt zusätzlich description,
servings_default, servings_unit, prep_time_min, cook_time_min,
total_time_min, cuisine, category, ingredients[], steps[]. Vorher
nur title/hidden_from_recent; diese beiden bleiben als
Kurz-Fall erhalten, damit bestehende Aufrufer unverändert laufen.
- Zod-Schema mit expliziten Grenzen (max-Länge, positive Mengen).
Tests: 3 neue Cases für updateRecipeMeta, replaceIngredients (inkl.
FTS-Update), replaceSteps.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 12:41:10 +02:00
|
|
|
import RecipeEditor from '$lib/components/RecipeEditor.svelte';
|
2026-04-17 15:28:22 +02:00
|
|
|
import StarRating from '$lib/components/StarRating.svelte';
|
2026-04-18 22:22:19 +02:00
|
|
|
import { profileStore, requireProfile } from '$lib/client/profile.svelte';
|
feat(wishlist): per-user Wünsche + Header-Badge mit Gesamtzahl
Schema-Änderung (Migration 005):
- Tabelle wishlist umgestellt auf PK (recipe_id, profile_id)
- wishlist_like-Tabelle zusammengelegt — Liken WAR schon "will ich auch",
also werden alle bestehenden Likes Memberships auf der neuen Tabelle.
- Alt-Einträge mit added_by_profile_id werden migriert, anonyme gehen
verloren (war inkonsistent, jetzt erzwingen wir profile_id NOT NULL).
Repository:
- listWishlist aggregiert pro Rezept: wanted_by_count, wanted_by_names
(kommagetrennt), on_my_wishlist für das aktive Profil
- listWishlistProfileIds(recipeId) für den Recipe-Page-Loader
- countWishlistRecipes für das Header-Badge (DISTINCT recipe_id)
- addToWishlist/removeFromWishlist/isOnMyWishlist alle mit profile_id
als Pflicht
API:
- POST /api/wishlist: profile_id jetzt Pflicht (nullable raus)
- DELETE /api/wishlist/[recipe_id]?profile_id=X (nur eigenes Entry)
- /api/wishlist/[recipe_id]/like komplett entfernt (Konzept obsolet)
- Neu: GET /api/wishlist/count → { count: <distinct recipes> }
UI:
- Header-Heart bekommt rotes Badge mit Zahl der Wunschliste-Rezepte.
wishlistStore in $lib/client/wishlist.svelte.ts hält den Count reaktiv;
Refresh auf Mount, nach Add/Remove, beim Öffnen der Wunschliste.
- Recipe-Detail: Loader liefert wishlist_profile_ids; onMyWishlist ist
ein $derived. Toggle fragt aktives Profil (alertAction sonst), mutiert
die lokale Liste + ruft wishlistStore.refresh.
- Wunschliste-Seite: Heart toggelt eigenen Wunsch, Count zeigt Gesamt-
wünsche, kommagetrennte Namen zeigen "wer will". Trash-Button
entfernt — Heart-off reicht jetzt.
Tests (99 → 99, 8 neu geschrieben):
- Per-User-Add/Remove, aggregierte Counts, on_my_wishlist, Cascades bei
Recipe/Profile-Delete, countWishlistRecipes = DISTINCT.
2026-04-17 19:16:19 +02:00
|
|
|
import { wishlistStore } from '$lib/client/wishlist.svelte';
|
2026-04-18 22:22:19 +02:00
|
|
|
import { confirmAction } from '$lib/client/confirm.svelte';
|
|
|
|
|
import { asyncFetch } from '$lib/client/api-fetch-wrapper';
|
2026-04-18 16:54:03 +02:00
|
|
|
import { requireOnline } from '$lib/client/require-online';
|
2026-04-17 15:28:22 +02:00
|
|
|
import type { CommentRow } from '$lib/server/recipes/actions';
|
|
|
|
|
|
|
|
|
|
let { data } = $props();
|
|
|
|
|
|
|
|
|
|
// local reactive copies we can mutate after actions
|
|
|
|
|
let ratings = $state<typeof data.ratings>([]);
|
|
|
|
|
let comments = $state<CommentRow[]>([]);
|
|
|
|
|
let cookingLog = $state<typeof data.cooking_log>([]);
|
2026-04-17 18:43:38 +02:00
|
|
|
let favoriteProfileIds = $state<number[]>([]);
|
feat(wishlist): per-user Wünsche + Header-Badge mit Gesamtzahl
Schema-Änderung (Migration 005):
- Tabelle wishlist umgestellt auf PK (recipe_id, profile_id)
- wishlist_like-Tabelle zusammengelegt — Liken WAR schon "will ich auch",
also werden alle bestehenden Likes Memberships auf der neuen Tabelle.
- Alt-Einträge mit added_by_profile_id werden migriert, anonyme gehen
verloren (war inkonsistent, jetzt erzwingen wir profile_id NOT NULL).
Repository:
- listWishlist aggregiert pro Rezept: wanted_by_count, wanted_by_names
(kommagetrennt), on_my_wishlist für das aktive Profil
- listWishlistProfileIds(recipeId) für den Recipe-Page-Loader
- countWishlistRecipes für das Header-Badge (DISTINCT recipe_id)
- addToWishlist/removeFromWishlist/isOnMyWishlist alle mit profile_id
als Pflicht
API:
- POST /api/wishlist: profile_id jetzt Pflicht (nullable raus)
- DELETE /api/wishlist/[recipe_id]?profile_id=X (nur eigenes Entry)
- /api/wishlist/[recipe_id]/like komplett entfernt (Konzept obsolet)
- Neu: GET /api/wishlist/count → { count: <distinct recipes> }
UI:
- Header-Heart bekommt rotes Badge mit Zahl der Wunschliste-Rezepte.
wishlistStore in $lib/client/wishlist.svelte.ts hält den Count reaktiv;
Refresh auf Mount, nach Add/Remove, beim Öffnen der Wunschliste.
- Recipe-Detail: Loader liefert wishlist_profile_ids; onMyWishlist ist
ein $derived. Toggle fragt aktives Profil (alertAction sonst), mutiert
die lokale Liste + ruft wishlistStore.refresh.
- Wunschliste-Seite: Heart toggelt eigenen Wunsch, Count zeigt Gesamt-
wünsche, kommagetrennte Namen zeigen "wer will". Trash-Button
entfernt — Heart-off reicht jetzt.
Tests (99 → 99, 8 neu geschrieben):
- Per-User-Add/Remove, aggregierte Counts, on_my_wishlist, Cascades bei
Recipe/Profile-Delete, countWishlistRecipes = DISTINCT.
2026-04-17 19:16:19 +02:00
|
|
|
let wishlistProfileIds = $state<number[]>([]);
|
2026-04-17 15:28:22 +02:00
|
|
|
let newComment = $state('');
|
|
|
|
|
|
feat(ui): Favoriten-Liste, Dismiss-from-Recent, Inline-Rename, Lucide-Icons
Homepage:
- Neue Sektion "Deine Favoriten" über "Zuletzt hinzugefügt" (alphabetisch
sortiert, lädt wenn Profil aktiv ist; versteckt sonst)
- Jede Karte in "Zuletzt hinzugefügt" hat jetzt oben-rechts ein X-Icon
zum Ausblenden. Das Rezept selbst bleibt in der DB — nur die
Anzeige in der Recent-Liste wird per recipe.hidden_from_recent = 1
unterdrückt. Section versteckt sich, wenn die Liste leer wird.
DB:
- Neue Migration 004_recipe_hidden_from_recent.sql (+Index)
- listFavoritesForProfile in search-local.ts (ORDER BY title NOCASE)
- setRecipeHiddenFromRecent in actions.ts
API:
- GET /api/recipes/favorites?profile_id=X
- PATCH /api/recipes/[id] akzeptiert jetzt title und/oder
hidden_from_recent (Zod-Schema mit refine)
Rezept-Detail:
- Titel ist jetzt inline editierbar: kleines Stift-Icon rechts neben
H1. Click öffnet Input, Enter speichert (PATCH), Escape bricht ab.
Kein location.reload() mehr.
- RecipeView bekommt neuen Snippet-Prop titleSlot für Title-Override.
- Neue Aktionsreihenfolge:
Zeile 1: Favorit | Wunschliste | Drucken
Zeile 2: Heute gekocht | Löschen
(Umbenennen ist jetzt am Titel statt in der Leiste.)
Icons (lucide-svelte, neues Dep):
- Emoji-Icons durch Lucide-SVGs ersetzt auf Startseite, Header,
Rezept-Detail, Wunschliste, Header-Dropdown:
🍽️→Heart/Utensils, ⚙️→Settings, 🥘→CookingPot, 🌐→Globe,
♥/♡→Heart(filled), 🖨→Printer, ✎→Pencil, 🗑→Trash2, ✓→Check,
🍳→ChefHat, X→X
- Header-Brand-Badge auf Mobile behält sein 🍳 (ist im ::after-Pseudo,
Lucide käme da nicht sauber rein).
- SearchLoader-Emojis bleiben — die sind Teil der Animations-Charme.
Tests: 99/99 grün (bestehend), Typecheck 0 Fehler.
2026-04-17 18:57:17 +02:00
|
|
|
let title = $state('');
|
|
|
|
|
let editingTitle = $state(false);
|
|
|
|
|
let titleDraft = $state('');
|
|
|
|
|
let titleInput: HTMLInputElement | null = $state(null);
|
|
|
|
|
|
feat(recipe): Edit-Modus für Zutaten, Schritte und Meta
Auf der Rezept-Detail-Seite ein neuer „Bearbeiten"-Button (Pencil-Icon)
in der Action-Bar. Klick schaltet RecipeView auf RecipeEditor um.
Im Editor:
- Titel, Beschreibung, Portionen, Vorbereitungs-/Koch-/Gesamtzeit als
inline-Inputs.
- Zutaten: pro Zeile Menge, Einheit, Name, Notiz + Trash-Icon zum
Entfernen. „+ Zutat hinzufügen"-Dashed-Button am Listenende.
- Schritte: nummerierte Textareas, Trash-Icon, „+ Schritt hinzufügen".
- Mengen akzeptieren Komma- oder Punkt-Dezimalen.
- Empty-Items werden beim Speichern automatisch aussortiert.
Backend:
- Neue Repo-Funktionen updateRecipeMeta(id, patch), replaceIngredients,
replaceSteps — letztere in einer Transaction mit delete+insert und
FTS-Refresh.
- PATCH /api/recipes/[id] akzeptiert jetzt zusätzlich description,
servings_default, servings_unit, prep_time_min, cook_time_min,
total_time_min, cuisine, category, ingredients[], steps[]. Vorher
nur title/hidden_from_recent; diese beiden bleiben als
Kurz-Fall erhalten, damit bestehende Aufrufer unverändert laufen.
- Zod-Schema mit expliziten Grenzen (max-Länge, positive Mengen).
Tests: 3 neue Cases für updateRecipeMeta, replaceIngredients (inkl.
FTS-Update), replaceSteps.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 12:41:10 +02:00
|
|
|
let editMode = $state(false);
|
|
|
|
|
let saving = $state(false);
|
2026-04-19 11:38:35 +02:00
|
|
|
let recipeState = $state(untrack(() => data.recipe));
|
feat(recipe): Edit-Modus für Zutaten, Schritte und Meta
Auf der Rezept-Detail-Seite ein neuer „Bearbeiten"-Button (Pencil-Icon)
in der Action-Bar. Klick schaltet RecipeView auf RecipeEditor um.
Im Editor:
- Titel, Beschreibung, Portionen, Vorbereitungs-/Koch-/Gesamtzeit als
inline-Inputs.
- Zutaten: pro Zeile Menge, Einheit, Name, Notiz + Trash-Icon zum
Entfernen. „+ Zutat hinzufügen"-Dashed-Button am Listenende.
- Schritte: nummerierte Textareas, Trash-Icon, „+ Schritt hinzufügen".
- Mengen akzeptieren Komma- oder Punkt-Dezimalen.
- Empty-Items werden beim Speichern automatisch aussortiert.
Backend:
- Neue Repo-Funktionen updateRecipeMeta(id, patch), replaceIngredients,
replaceSteps — letztere in einer Transaction mit delete+insert und
FTS-Refresh.
- PATCH /api/recipes/[id] akzeptiert jetzt zusätzlich description,
servings_default, servings_unit, prep_time_min, cook_time_min,
total_time_min, cuisine, category, ingredients[], steps[]. Vorher
nur title/hidden_from_recent; diese beiden bleiben als
Kurz-Fall erhalten, damit bestehende Aufrufer unverändert laufen.
- Zod-Schema mit expliziten Grenzen (max-Länge, positive Mengen).
Tests: 3 neue Cases für updateRecipeMeta, replaceIngredients (inkl.
FTS-Update), replaceSteps.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 12:41:10 +02:00
|
|
|
|
2026-04-18 15:06:15 +02:00
|
|
|
// Einmalige Pulse-Animation beim Aktivieren (nicht beim Wieder-Abwählen).
|
|
|
|
|
// Per tick()-Zwischenschritt "aus → an" erzwingen, damit die Animation
|
|
|
|
|
// auch bei mehrmaligem Klick innerhalb weniger hundert ms neu startet.
|
|
|
|
|
let pulseFav = $state(false);
|
|
|
|
|
let pulseWish = $state(false);
|
|
|
|
|
|
|
|
|
|
async function firePulse(which: 'fav' | 'wish') {
|
|
|
|
|
if (which === 'fav') {
|
|
|
|
|
pulseFav = false;
|
|
|
|
|
await tick();
|
|
|
|
|
pulseFav = true;
|
|
|
|
|
} else {
|
|
|
|
|
pulseWish = false;
|
|
|
|
|
await tick();
|
|
|
|
|
pulseWish = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
feat(recipe): Edit-Modus für Zutaten, Schritte und Meta
Auf der Rezept-Detail-Seite ein neuer „Bearbeiten"-Button (Pencil-Icon)
in der Action-Bar. Klick schaltet RecipeView auf RecipeEditor um.
Im Editor:
- Titel, Beschreibung, Portionen, Vorbereitungs-/Koch-/Gesamtzeit als
inline-Inputs.
- Zutaten: pro Zeile Menge, Einheit, Name, Notiz + Trash-Icon zum
Entfernen. „+ Zutat hinzufügen"-Dashed-Button am Listenende.
- Schritte: nummerierte Textareas, Trash-Icon, „+ Schritt hinzufügen".
- Mengen akzeptieren Komma- oder Punkt-Dezimalen.
- Empty-Items werden beim Speichern automatisch aussortiert.
Backend:
- Neue Repo-Funktionen updateRecipeMeta(id, patch), replaceIngredients,
replaceSteps — letztere in einer Transaction mit delete+insert und
FTS-Refresh.
- PATCH /api/recipes/[id] akzeptiert jetzt zusätzlich description,
servings_default, servings_unit, prep_time_min, cook_time_min,
total_time_min, cuisine, category, ingredients[], steps[]. Vorher
nur title/hidden_from_recent; diese beiden bleiben als
Kurz-Fall erhalten, damit bestehende Aufrufer unverändert laufen.
- Zod-Schema mit expliziten Grenzen (max-Länge, positive Mengen).
Tests: 3 neue Cases für updateRecipeMeta, replaceIngredients (inkl.
FTS-Update), replaceSteps.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 12:41:10 +02:00
|
|
|
async function saveRecipe(patch: {
|
|
|
|
|
title: string;
|
|
|
|
|
description: string | null;
|
|
|
|
|
servings_default: number | null;
|
|
|
|
|
prep_time_min: number | null;
|
|
|
|
|
cook_time_min: number | null;
|
|
|
|
|
total_time_min: number | null;
|
|
|
|
|
ingredients: typeof data.recipe.ingredients;
|
|
|
|
|
steps: typeof data.recipe.steps;
|
|
|
|
|
}) {
|
2026-04-18 16:54:03 +02:00
|
|
|
if (!requireOnline('Das Speichern')) return;
|
feat(recipe): Edit-Modus für Zutaten, Schritte und Meta
Auf der Rezept-Detail-Seite ein neuer „Bearbeiten"-Button (Pencil-Icon)
in der Action-Bar. Klick schaltet RecipeView auf RecipeEditor um.
Im Editor:
- Titel, Beschreibung, Portionen, Vorbereitungs-/Koch-/Gesamtzeit als
inline-Inputs.
- Zutaten: pro Zeile Menge, Einheit, Name, Notiz + Trash-Icon zum
Entfernen. „+ Zutat hinzufügen"-Dashed-Button am Listenende.
- Schritte: nummerierte Textareas, Trash-Icon, „+ Schritt hinzufügen".
- Mengen akzeptieren Komma- oder Punkt-Dezimalen.
- Empty-Items werden beim Speichern automatisch aussortiert.
Backend:
- Neue Repo-Funktionen updateRecipeMeta(id, patch), replaceIngredients,
replaceSteps — letztere in einer Transaction mit delete+insert und
FTS-Refresh.
- PATCH /api/recipes/[id] akzeptiert jetzt zusätzlich description,
servings_default, servings_unit, prep_time_min, cook_time_min,
total_time_min, cuisine, category, ingredients[], steps[]. Vorher
nur title/hidden_from_recent; diese beiden bleiben als
Kurz-Fall erhalten, damit bestehende Aufrufer unverändert laufen.
- Zod-Schema mit expliziten Grenzen (max-Länge, positive Mengen).
Tests: 3 neue Cases für updateRecipeMeta, replaceIngredients (inkl.
FTS-Update), replaceSteps.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 12:41:10 +02:00
|
|
|
saving = true;
|
|
|
|
|
try {
|
2026-04-18 22:22:19 +02:00
|
|
|
const res = await asyncFetch(
|
|
|
|
|
`/api/recipes/${data.recipe.id}`,
|
|
|
|
|
{
|
|
|
|
|
method: 'PATCH',
|
|
|
|
|
headers: { 'content-type': 'application/json' },
|
|
|
|
|
body: JSON.stringify(patch)
|
|
|
|
|
},
|
|
|
|
|
'Speichern fehlgeschlagen'
|
|
|
|
|
);
|
|
|
|
|
if (!res) return;
|
feat(recipe): Edit-Modus für Zutaten, Schritte und Meta
Auf der Rezept-Detail-Seite ein neuer „Bearbeiten"-Button (Pencil-Icon)
in der Action-Bar. Klick schaltet RecipeView auf RecipeEditor um.
Im Editor:
- Titel, Beschreibung, Portionen, Vorbereitungs-/Koch-/Gesamtzeit als
inline-Inputs.
- Zutaten: pro Zeile Menge, Einheit, Name, Notiz + Trash-Icon zum
Entfernen. „+ Zutat hinzufügen"-Dashed-Button am Listenende.
- Schritte: nummerierte Textareas, Trash-Icon, „+ Schritt hinzufügen".
- Mengen akzeptieren Komma- oder Punkt-Dezimalen.
- Empty-Items werden beim Speichern automatisch aussortiert.
Backend:
- Neue Repo-Funktionen updateRecipeMeta(id, patch), replaceIngredients,
replaceSteps — letztere in einer Transaction mit delete+insert und
FTS-Refresh.
- PATCH /api/recipes/[id] akzeptiert jetzt zusätzlich description,
servings_default, servings_unit, prep_time_min, cook_time_min,
total_time_min, cuisine, category, ingredients[], steps[]. Vorher
nur title/hidden_from_recent; diese beiden bleiben als
Kurz-Fall erhalten, damit bestehende Aufrufer unverändert laufen.
- Zod-Schema mit expliziten Grenzen (max-Länge, positive Mengen).
Tests: 3 neue Cases für updateRecipeMeta, replaceIngredients (inkl.
FTS-Update), replaceSteps.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 12:41:10 +02:00
|
|
|
const body = await res.json();
|
|
|
|
|
if (body.recipe) {
|
|
|
|
|
recipeState = body.recipe;
|
|
|
|
|
title = body.recipe.title;
|
|
|
|
|
}
|
|
|
|
|
editMode = false;
|
|
|
|
|
} finally {
|
|
|
|
|
saving = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-17 15:28:22 +02:00
|
|
|
$effect(() => {
|
|
|
|
|
ratings = [...data.ratings];
|
|
|
|
|
comments = [...data.comments];
|
|
|
|
|
cookingLog = [...data.cooking_log];
|
2026-04-17 18:43:38 +02:00
|
|
|
favoriteProfileIds = [...data.favorite_profile_ids];
|
feat(wishlist): per-user Wünsche + Header-Badge mit Gesamtzahl
Schema-Änderung (Migration 005):
- Tabelle wishlist umgestellt auf PK (recipe_id, profile_id)
- wishlist_like-Tabelle zusammengelegt — Liken WAR schon "will ich auch",
also werden alle bestehenden Likes Memberships auf der neuen Tabelle.
- Alt-Einträge mit added_by_profile_id werden migriert, anonyme gehen
verloren (war inkonsistent, jetzt erzwingen wir profile_id NOT NULL).
Repository:
- listWishlist aggregiert pro Rezept: wanted_by_count, wanted_by_names
(kommagetrennt), on_my_wishlist für das aktive Profil
- listWishlistProfileIds(recipeId) für den Recipe-Page-Loader
- countWishlistRecipes für das Header-Badge (DISTINCT recipe_id)
- addToWishlist/removeFromWishlist/isOnMyWishlist alle mit profile_id
als Pflicht
API:
- POST /api/wishlist: profile_id jetzt Pflicht (nullable raus)
- DELETE /api/wishlist/[recipe_id]?profile_id=X (nur eigenes Entry)
- /api/wishlist/[recipe_id]/like komplett entfernt (Konzept obsolet)
- Neu: GET /api/wishlist/count → { count: <distinct recipes> }
UI:
- Header-Heart bekommt rotes Badge mit Zahl der Wunschliste-Rezepte.
wishlistStore in $lib/client/wishlist.svelte.ts hält den Count reaktiv;
Refresh auf Mount, nach Add/Remove, beim Öffnen der Wunschliste.
- Recipe-Detail: Loader liefert wishlist_profile_ids; onMyWishlist ist
ein $derived. Toggle fragt aktives Profil (alertAction sonst), mutiert
die lokale Liste + ruft wishlistStore.refresh.
- Wunschliste-Seite: Heart toggelt eigenen Wunsch, Count zeigt Gesamt-
wünsche, kommagetrennte Namen zeigen "wer will". Trash-Button
entfernt — Heart-off reicht jetzt.
Tests (99 → 99, 8 neu geschrieben):
- Per-User-Add/Remove, aggregierte Counts, on_my_wishlist, Cascades bei
Recipe/Profile-Delete, countWishlistRecipes = DISTINCT.
2026-04-17 19:16:19 +02:00
|
|
|
wishlistProfileIds = [...data.wishlist_profile_ids];
|
feat(ui): Favoriten-Liste, Dismiss-from-Recent, Inline-Rename, Lucide-Icons
Homepage:
- Neue Sektion "Deine Favoriten" über "Zuletzt hinzugefügt" (alphabetisch
sortiert, lädt wenn Profil aktiv ist; versteckt sonst)
- Jede Karte in "Zuletzt hinzugefügt" hat jetzt oben-rechts ein X-Icon
zum Ausblenden. Das Rezept selbst bleibt in der DB — nur die
Anzeige in der Recent-Liste wird per recipe.hidden_from_recent = 1
unterdrückt. Section versteckt sich, wenn die Liste leer wird.
DB:
- Neue Migration 004_recipe_hidden_from_recent.sql (+Index)
- listFavoritesForProfile in search-local.ts (ORDER BY title NOCASE)
- setRecipeHiddenFromRecent in actions.ts
API:
- GET /api/recipes/favorites?profile_id=X
- PATCH /api/recipes/[id] akzeptiert jetzt title und/oder
hidden_from_recent (Zod-Schema mit refine)
Rezept-Detail:
- Titel ist jetzt inline editierbar: kleines Stift-Icon rechts neben
H1. Click öffnet Input, Enter speichert (PATCH), Escape bricht ab.
Kein location.reload() mehr.
- RecipeView bekommt neuen Snippet-Prop titleSlot für Title-Override.
- Neue Aktionsreihenfolge:
Zeile 1: Favorit | Wunschliste | Drucken
Zeile 2: Heute gekocht | Löschen
(Umbenennen ist jetzt am Titel statt in der Leiste.)
Icons (lucide-svelte, neues Dep):
- Emoji-Icons durch Lucide-SVGs ersetzt auf Startseite, Header,
Rezept-Detail, Wunschliste, Header-Dropdown:
🍽️→Heart/Utensils, ⚙️→Settings, 🥘→CookingPot, 🌐→Globe,
♥/♡→Heart(filled), 🖨→Printer, ✎→Pencil, 🗑→Trash2, ✓→Check,
🍳→ChefHat, X→X
- Header-Brand-Badge auf Mobile behält sein 🍳 (ist im ::after-Pseudo,
Lucide käme da nicht sauber rein).
- SearchLoader-Emojis bleiben — die sind Teil der Animations-Charme.
Tests: 99/99 grün (bestehend), Typecheck 0 Fehler.
2026-04-17 18:57:17 +02:00
|
|
|
title = data.recipe.title;
|
feat(recipe): Edit-Modus für Zutaten, Schritte und Meta
Auf der Rezept-Detail-Seite ein neuer „Bearbeiten"-Button (Pencil-Icon)
in der Action-Bar. Klick schaltet RecipeView auf RecipeEditor um.
Im Editor:
- Titel, Beschreibung, Portionen, Vorbereitungs-/Koch-/Gesamtzeit als
inline-Inputs.
- Zutaten: pro Zeile Menge, Einheit, Name, Notiz + Trash-Icon zum
Entfernen. „+ Zutat hinzufügen"-Dashed-Button am Listenende.
- Schritte: nummerierte Textareas, Trash-Icon, „+ Schritt hinzufügen".
- Mengen akzeptieren Komma- oder Punkt-Dezimalen.
- Empty-Items werden beim Speichern automatisch aussortiert.
Backend:
- Neue Repo-Funktionen updateRecipeMeta(id, patch), replaceIngredients,
replaceSteps — letztere in einer Transaction mit delete+insert und
FTS-Refresh.
- PATCH /api/recipes/[id] akzeptiert jetzt zusätzlich description,
servings_default, servings_unit, prep_time_min, cook_time_min,
total_time_min, cuisine, category, ingredients[], steps[]. Vorher
nur title/hidden_from_recent; diese beiden bleiben als
Kurz-Fall erhalten, damit bestehende Aufrufer unverändert laufen.
- Zod-Schema mit expliziten Grenzen (max-Länge, positive Mengen).
Tests: 3 neue Cases für updateRecipeMeta, replaceIngredients (inkl.
FTS-Update), replaceSteps.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 12:41:10 +02:00
|
|
|
recipeState = data.recipe;
|
2026-04-17 15:28:22 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const myRating = $derived(
|
|
|
|
|
profileStore.active
|
|
|
|
|
? (ratings.find((r) => r.profile_id === profileStore.active!.id)?.stars ?? null)
|
|
|
|
|
: null
|
|
|
|
|
);
|
|
|
|
|
|
2026-04-17 18:43:38 +02:00
|
|
|
const isFav = $derived(
|
|
|
|
|
profileStore.active ? favoriteProfileIds.includes(profileStore.active.id) : false
|
|
|
|
|
);
|
2026-04-17 15:28:22 +02:00
|
|
|
|
feat(wishlist): per-user Wünsche + Header-Badge mit Gesamtzahl
Schema-Änderung (Migration 005):
- Tabelle wishlist umgestellt auf PK (recipe_id, profile_id)
- wishlist_like-Tabelle zusammengelegt — Liken WAR schon "will ich auch",
also werden alle bestehenden Likes Memberships auf der neuen Tabelle.
- Alt-Einträge mit added_by_profile_id werden migriert, anonyme gehen
verloren (war inkonsistent, jetzt erzwingen wir profile_id NOT NULL).
Repository:
- listWishlist aggregiert pro Rezept: wanted_by_count, wanted_by_names
(kommagetrennt), on_my_wishlist für das aktive Profil
- listWishlistProfileIds(recipeId) für den Recipe-Page-Loader
- countWishlistRecipes für das Header-Badge (DISTINCT recipe_id)
- addToWishlist/removeFromWishlist/isOnMyWishlist alle mit profile_id
als Pflicht
API:
- POST /api/wishlist: profile_id jetzt Pflicht (nullable raus)
- DELETE /api/wishlist/[recipe_id]?profile_id=X (nur eigenes Entry)
- /api/wishlist/[recipe_id]/like komplett entfernt (Konzept obsolet)
- Neu: GET /api/wishlist/count → { count: <distinct recipes> }
UI:
- Header-Heart bekommt rotes Badge mit Zahl der Wunschliste-Rezepte.
wishlistStore in $lib/client/wishlist.svelte.ts hält den Count reaktiv;
Refresh auf Mount, nach Add/Remove, beim Öffnen der Wunschliste.
- Recipe-Detail: Loader liefert wishlist_profile_ids; onMyWishlist ist
ein $derived. Toggle fragt aktives Profil (alertAction sonst), mutiert
die lokale Liste + ruft wishlistStore.refresh.
- Wunschliste-Seite: Heart toggelt eigenen Wunsch, Count zeigt Gesamt-
wünsche, kommagetrennte Namen zeigen "wer will". Trash-Button
entfernt — Heart-off reicht jetzt.
Tests (99 → 99, 8 neu geschrieben):
- Per-User-Add/Remove, aggregierte Counts, on_my_wishlist, Cascades bei
Recipe/Profile-Delete, countWishlistRecipes = DISTINCT.
2026-04-17 19:16:19 +02:00
|
|
|
const onMyWishlist = $derived(
|
|
|
|
|
profileStore.active ? wishlistProfileIds.includes(profileStore.active.id) : false
|
|
|
|
|
);
|
|
|
|
|
|
2026-04-17 15:28:22 +02:00
|
|
|
async function setRating(stars: number) {
|
2026-04-18 22:22:19 +02:00
|
|
|
const profile = await requireProfile();
|
|
|
|
|
if (!profile) return;
|
2026-04-18 16:54:03 +02:00
|
|
|
if (!requireOnline('Das Rating')) return;
|
2026-04-17 15:28:22 +02:00
|
|
|
await fetch(`/api/recipes/${data.recipe.id}/rating`, {
|
|
|
|
|
method: 'PUT',
|
|
|
|
|
headers: { 'content-type': 'application/json' },
|
2026-04-18 22:22:19 +02:00
|
|
|
body: JSON.stringify({ profile_id: profile.id, stars })
|
2026-04-17 15:28:22 +02:00
|
|
|
});
|
2026-04-18 22:22:19 +02:00
|
|
|
const existing = ratings.find((r) => r.profile_id === profile.id);
|
2026-04-17 15:28:22 +02:00
|
|
|
if (existing) existing.stars = stars;
|
2026-04-18 22:22:19 +02:00
|
|
|
else ratings = [...ratings, { profile_id: profile.id, stars }];
|
2026-04-17 15:28:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function toggleFavorite() {
|
2026-04-18 22:22:19 +02:00
|
|
|
const profile = await requireProfile();
|
|
|
|
|
if (!profile) return;
|
2026-04-18 16:54:03 +02:00
|
|
|
if (!requireOnline('Das Favorit-Setzen')) return;
|
2026-04-18 15:06:15 +02:00
|
|
|
const wasFav = isFav;
|
|
|
|
|
const method = wasFav ? 'DELETE' : 'PUT';
|
2026-04-17 15:28:22 +02:00
|
|
|
await fetch(`/api/recipes/${data.recipe.id}/favorite`, {
|
|
|
|
|
method,
|
|
|
|
|
headers: { 'content-type': 'application/json' },
|
2026-04-18 22:22:19 +02:00
|
|
|
body: JSON.stringify({ profile_id: profile.id })
|
2026-04-17 15:28:22 +02:00
|
|
|
});
|
2026-04-18 15:06:15 +02:00
|
|
|
favoriteProfileIds = wasFav
|
2026-04-18 22:22:19 +02:00
|
|
|
? favoriteProfileIds.filter((id) => id !== profile.id)
|
|
|
|
|
: [...favoriteProfileIds, profile.id];
|
2026-04-18 15:06:15 +02:00
|
|
|
if (!wasFav) void firePulse('fav');
|
2026-04-17 15:28:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function logCooked() {
|
2026-04-18 22:22:19 +02:00
|
|
|
const profile = await requireProfile();
|
|
|
|
|
if (!profile) return;
|
2026-04-18 16:54:03 +02:00
|
|
|
if (!requireOnline('Der Kochjournal-Eintrag')) return;
|
2026-04-17 15:28:22 +02:00
|
|
|
const res = await fetch(`/api/recipes/${data.recipe.id}/cooked`, {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: { 'content-type': 'application/json' },
|
2026-04-18 22:22:19 +02:00
|
|
|
body: JSON.stringify({ profile_id: profile.id })
|
2026-04-17 15:28:22 +02:00
|
|
|
});
|
|
|
|
|
const entry = await res.json();
|
|
|
|
|
cookingLog = [entry, ...cookingLog];
|
2026-04-17 22:23:08 +02:00
|
|
|
if (entry.removed_from_wishlist) {
|
|
|
|
|
wishlistProfileIds = [];
|
|
|
|
|
void wishlistStore.refresh();
|
|
|
|
|
}
|
2026-04-17 15:28:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function addComment() {
|
2026-04-18 22:22:19 +02:00
|
|
|
const profile = await requireProfile();
|
|
|
|
|
if (!profile) return;
|
2026-04-18 16:54:03 +02:00
|
|
|
if (!requireOnline('Das Speichern des Kommentars')) return;
|
2026-04-17 15:28:22 +02:00
|
|
|
const text = newComment.trim();
|
|
|
|
|
if (!text) return;
|
|
|
|
|
const res = await fetch(`/api/recipes/${data.recipe.id}/comments`, {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: { 'content-type': 'application/json' },
|
2026-04-18 22:22:19 +02:00
|
|
|
body: JSON.stringify({ profile_id: profile.id, text })
|
2026-04-17 15:28:22 +02:00
|
|
|
});
|
|
|
|
|
if (res.ok) {
|
|
|
|
|
const body = await res.json();
|
|
|
|
|
comments = [
|
|
|
|
|
...comments,
|
|
|
|
|
{
|
|
|
|
|
id: body.id,
|
2026-04-18 22:22:19 +02:00
|
|
|
profile_id: profile.id,
|
2026-04-17 15:28:22 +02:00
|
|
|
text,
|
|
|
|
|
created_at: new Date().toISOString(),
|
2026-04-18 22:22:19 +02:00
|
|
|
author: profile.name
|
2026-04-17 15:28:22 +02:00
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
newComment = '';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-19 11:56:41 +02:00
|
|
|
async function deleteComment(id: number) {
|
|
|
|
|
const ok = await confirmAction({
|
|
|
|
|
title: 'Kommentar löschen?',
|
|
|
|
|
message: 'Der Eintrag verschwindet ohne Umweg.',
|
|
|
|
|
confirmLabel: 'Löschen',
|
|
|
|
|
destructive: true
|
|
|
|
|
});
|
|
|
|
|
if (!ok) return;
|
|
|
|
|
if (!requireOnline('Das Löschen')) return;
|
|
|
|
|
const res = await asyncFetch(
|
|
|
|
|
`/api/recipes/${data.recipe.id}/comments`,
|
|
|
|
|
{
|
|
|
|
|
method: 'DELETE',
|
|
|
|
|
headers: { 'content-type': 'application/json' },
|
|
|
|
|
body: JSON.stringify({ comment_id: id })
|
|
|
|
|
},
|
|
|
|
|
'Löschen fehlgeschlagen'
|
|
|
|
|
);
|
|
|
|
|
if (!res) return;
|
|
|
|
|
comments = comments.filter((c) => c.id !== id);
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-17 15:28:22 +02:00
|
|
|
async function deleteRecipe() {
|
feat(ui): custom confirmation dialog replacing native window.confirm
Single reusable dialog with a promise-based API: confirmAction({...})
returns Promise<boolean>. Supports title, optional message body,
confirm/cancel labels, and a 'destructive' flag that paints the confirm
button red.
Accessibility: Escape cancels, Enter confirms, confirm button auto-focus,
role=dialog + aria-labelledby, backdrop click = cancel.
Rolled out to: recipe delete, domain remove, profile delete, wishlist
remove. Native confirm() is gone from the codebase.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 17:15:21 +02:00
|
|
|
const ok = await confirmAction({
|
|
|
|
|
title: 'Rezept löschen?',
|
feat(ui): Favoriten-Liste, Dismiss-from-Recent, Inline-Rename, Lucide-Icons
Homepage:
- Neue Sektion "Deine Favoriten" über "Zuletzt hinzugefügt" (alphabetisch
sortiert, lädt wenn Profil aktiv ist; versteckt sonst)
- Jede Karte in "Zuletzt hinzugefügt" hat jetzt oben-rechts ein X-Icon
zum Ausblenden. Das Rezept selbst bleibt in der DB — nur die
Anzeige in der Recent-Liste wird per recipe.hidden_from_recent = 1
unterdrückt. Section versteckt sich, wenn die Liste leer wird.
DB:
- Neue Migration 004_recipe_hidden_from_recent.sql (+Index)
- listFavoritesForProfile in search-local.ts (ORDER BY title NOCASE)
- setRecipeHiddenFromRecent in actions.ts
API:
- GET /api/recipes/favorites?profile_id=X
- PATCH /api/recipes/[id] akzeptiert jetzt title und/oder
hidden_from_recent (Zod-Schema mit refine)
Rezept-Detail:
- Titel ist jetzt inline editierbar: kleines Stift-Icon rechts neben
H1. Click öffnet Input, Enter speichert (PATCH), Escape bricht ab.
Kein location.reload() mehr.
- RecipeView bekommt neuen Snippet-Prop titleSlot für Title-Override.
- Neue Aktionsreihenfolge:
Zeile 1: Favorit | Wunschliste | Drucken
Zeile 2: Heute gekocht | Löschen
(Umbenennen ist jetzt am Titel statt in der Leiste.)
Icons (lucide-svelte, neues Dep):
- Emoji-Icons durch Lucide-SVGs ersetzt auf Startseite, Header,
Rezept-Detail, Wunschliste, Header-Dropdown:
🍽️→Heart/Utensils, ⚙️→Settings, 🥘→CookingPot, 🌐→Globe,
♥/♡→Heart(filled), 🖨→Printer, ✎→Pencil, 🗑→Trash2, ✓→Check,
🍳→ChefHat, X→X
- Header-Brand-Badge auf Mobile behält sein 🍳 (ist im ::after-Pseudo,
Lucide käme da nicht sauber rein).
- SearchLoader-Emojis bleiben — die sind Teil der Animations-Charme.
Tests: 99/99 grün (bestehend), Typecheck 0 Fehler.
2026-04-17 18:57:17 +02:00
|
|
|
message: `„${title}" wird endgültig entfernt — mit Bewertungen, Kommentaren und Kochjournal-Einträgen.`,
|
feat(ui): custom confirmation dialog replacing native window.confirm
Single reusable dialog with a promise-based API: confirmAction({...})
returns Promise<boolean>. Supports title, optional message body,
confirm/cancel labels, and a 'destructive' flag that paints the confirm
button red.
Accessibility: Escape cancels, Enter confirms, confirm button auto-focus,
role=dialog + aria-labelledby, backdrop click = cancel.
Rolled out to: recipe delete, domain remove, profile delete, wishlist
remove. Native confirm() is gone from the codebase.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 17:15:21 +02:00
|
|
|
confirmLabel: 'Löschen',
|
|
|
|
|
destructive: true
|
|
|
|
|
});
|
|
|
|
|
if (!ok) return;
|
2026-04-18 16:54:03 +02:00
|
|
|
if (!requireOnline('Das Löschen')) return;
|
2026-04-17 15:28:22 +02:00
|
|
|
await fetch(`/api/recipes/${data.recipe.id}`, { method: 'DELETE' });
|
|
|
|
|
goto('/');
|
|
|
|
|
}
|
|
|
|
|
|
feat(ui): Favoriten-Liste, Dismiss-from-Recent, Inline-Rename, Lucide-Icons
Homepage:
- Neue Sektion "Deine Favoriten" über "Zuletzt hinzugefügt" (alphabetisch
sortiert, lädt wenn Profil aktiv ist; versteckt sonst)
- Jede Karte in "Zuletzt hinzugefügt" hat jetzt oben-rechts ein X-Icon
zum Ausblenden. Das Rezept selbst bleibt in der DB — nur die
Anzeige in der Recent-Liste wird per recipe.hidden_from_recent = 1
unterdrückt. Section versteckt sich, wenn die Liste leer wird.
DB:
- Neue Migration 004_recipe_hidden_from_recent.sql (+Index)
- listFavoritesForProfile in search-local.ts (ORDER BY title NOCASE)
- setRecipeHiddenFromRecent in actions.ts
API:
- GET /api/recipes/favorites?profile_id=X
- PATCH /api/recipes/[id] akzeptiert jetzt title und/oder
hidden_from_recent (Zod-Schema mit refine)
Rezept-Detail:
- Titel ist jetzt inline editierbar: kleines Stift-Icon rechts neben
H1. Click öffnet Input, Enter speichert (PATCH), Escape bricht ab.
Kein location.reload() mehr.
- RecipeView bekommt neuen Snippet-Prop titleSlot für Title-Override.
- Neue Aktionsreihenfolge:
Zeile 1: Favorit | Wunschliste | Drucken
Zeile 2: Heute gekocht | Löschen
(Umbenennen ist jetzt am Titel statt in der Leiste.)
Icons (lucide-svelte, neues Dep):
- Emoji-Icons durch Lucide-SVGs ersetzt auf Startseite, Header,
Rezept-Detail, Wunschliste, Header-Dropdown:
🍽️→Heart/Utensils, ⚙️→Settings, 🥘→CookingPot, 🌐→Globe,
♥/♡→Heart(filled), 🖨→Printer, ✎→Pencil, 🗑→Trash2, ✓→Check,
🍳→ChefHat, X→X
- Header-Brand-Badge auf Mobile behält sein 🍳 (ist im ::after-Pseudo,
Lucide käme da nicht sauber rein).
- SearchLoader-Emojis bleiben — die sind Teil der Animations-Charme.
Tests: 99/99 grün (bestehend), Typecheck 0 Fehler.
2026-04-17 18:57:17 +02:00
|
|
|
async function startEditTitle() {
|
|
|
|
|
titleDraft = title;
|
|
|
|
|
editingTitle = true;
|
|
|
|
|
await tick();
|
|
|
|
|
titleInput?.focus();
|
|
|
|
|
titleInput?.select();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function cancelEditTitle() {
|
|
|
|
|
editingTitle = false;
|
|
|
|
|
titleDraft = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function saveTitle() {
|
|
|
|
|
const next = titleDraft.trim();
|
|
|
|
|
if (!next || next === title) {
|
|
|
|
|
editingTitle = false;
|
|
|
|
|
return;
|
|
|
|
|
}
|
2026-04-18 16:54:03 +02:00
|
|
|
if (!requireOnline('Das Umbenennen')) return;
|
2026-04-18 22:22:19 +02:00
|
|
|
const res = await asyncFetch(
|
|
|
|
|
`/api/recipes/${data.recipe.id}`,
|
|
|
|
|
{
|
|
|
|
|
method: 'PATCH',
|
|
|
|
|
headers: { 'content-type': 'application/json' },
|
|
|
|
|
body: JSON.stringify({ title: next })
|
|
|
|
|
},
|
|
|
|
|
'Umbenennen fehlgeschlagen'
|
|
|
|
|
);
|
|
|
|
|
if (!res) return;
|
feat(ui): Favoriten-Liste, Dismiss-from-Recent, Inline-Rename, Lucide-Icons
Homepage:
- Neue Sektion "Deine Favoriten" über "Zuletzt hinzugefügt" (alphabetisch
sortiert, lädt wenn Profil aktiv ist; versteckt sonst)
- Jede Karte in "Zuletzt hinzugefügt" hat jetzt oben-rechts ein X-Icon
zum Ausblenden. Das Rezept selbst bleibt in der DB — nur die
Anzeige in der Recent-Liste wird per recipe.hidden_from_recent = 1
unterdrückt. Section versteckt sich, wenn die Liste leer wird.
DB:
- Neue Migration 004_recipe_hidden_from_recent.sql (+Index)
- listFavoritesForProfile in search-local.ts (ORDER BY title NOCASE)
- setRecipeHiddenFromRecent in actions.ts
API:
- GET /api/recipes/favorites?profile_id=X
- PATCH /api/recipes/[id] akzeptiert jetzt title und/oder
hidden_from_recent (Zod-Schema mit refine)
Rezept-Detail:
- Titel ist jetzt inline editierbar: kleines Stift-Icon rechts neben
H1. Click öffnet Input, Enter speichert (PATCH), Escape bricht ab.
Kein location.reload() mehr.
- RecipeView bekommt neuen Snippet-Prop titleSlot für Title-Override.
- Neue Aktionsreihenfolge:
Zeile 1: Favorit | Wunschliste | Drucken
Zeile 2: Heute gekocht | Löschen
(Umbenennen ist jetzt am Titel statt in der Leiste.)
Icons (lucide-svelte, neues Dep):
- Emoji-Icons durch Lucide-SVGs ersetzt auf Startseite, Header,
Rezept-Detail, Wunschliste, Header-Dropdown:
🍽️→Heart/Utensils, ⚙️→Settings, 🥘→CookingPot, 🌐→Globe,
♥/♡→Heart(filled), 🖨→Printer, ✎→Pencil, 🗑→Trash2, ✓→Check,
🍳→ChefHat, X→X
- Header-Brand-Badge auf Mobile behält sein 🍳 (ist im ::after-Pseudo,
Lucide käme da nicht sauber rein).
- SearchLoader-Emojis bleiben — die sind Teil der Animations-Charme.
Tests: 99/99 grün (bestehend), Typecheck 0 Fehler.
2026-04-17 18:57:17 +02:00
|
|
|
title = next;
|
|
|
|
|
editingTitle = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function onTitleKey(e: KeyboardEvent) {
|
|
|
|
|
if (e.key === 'Enter') {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
void saveTitle();
|
|
|
|
|
} else if (e.key === 'Escape') {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
cancelEditTitle();
|
|
|
|
|
}
|
2026-04-17 15:28:22 +02:00
|
|
|
}
|
|
|
|
|
|
2026-04-17 17:08:22 +02:00
|
|
|
async function toggleWishlist() {
|
2026-04-18 22:22:19 +02:00
|
|
|
const profile = await requireProfile();
|
|
|
|
|
if (!profile) return;
|
2026-04-18 16:54:03 +02:00
|
|
|
if (!requireOnline('Das Wunschlisten-Setzen')) return;
|
2026-04-18 15:06:15 +02:00
|
|
|
const wasOn = onMyWishlist;
|
|
|
|
|
if (wasOn) {
|
2026-04-18 22:22:19 +02:00
|
|
|
await fetch(`/api/wishlist/${data.recipe.id}?profile_id=${profile.id}`, {
|
feat(wishlist): per-user Wünsche + Header-Badge mit Gesamtzahl
Schema-Änderung (Migration 005):
- Tabelle wishlist umgestellt auf PK (recipe_id, profile_id)
- wishlist_like-Tabelle zusammengelegt — Liken WAR schon "will ich auch",
also werden alle bestehenden Likes Memberships auf der neuen Tabelle.
- Alt-Einträge mit added_by_profile_id werden migriert, anonyme gehen
verloren (war inkonsistent, jetzt erzwingen wir profile_id NOT NULL).
Repository:
- listWishlist aggregiert pro Rezept: wanted_by_count, wanted_by_names
(kommagetrennt), on_my_wishlist für das aktive Profil
- listWishlistProfileIds(recipeId) für den Recipe-Page-Loader
- countWishlistRecipes für das Header-Badge (DISTINCT recipe_id)
- addToWishlist/removeFromWishlist/isOnMyWishlist alle mit profile_id
als Pflicht
API:
- POST /api/wishlist: profile_id jetzt Pflicht (nullable raus)
- DELETE /api/wishlist/[recipe_id]?profile_id=X (nur eigenes Entry)
- /api/wishlist/[recipe_id]/like komplett entfernt (Konzept obsolet)
- Neu: GET /api/wishlist/count → { count: <distinct recipes> }
UI:
- Header-Heart bekommt rotes Badge mit Zahl der Wunschliste-Rezepte.
wishlistStore in $lib/client/wishlist.svelte.ts hält den Count reaktiv;
Refresh auf Mount, nach Add/Remove, beim Öffnen der Wunschliste.
- Recipe-Detail: Loader liefert wishlist_profile_ids; onMyWishlist ist
ein $derived. Toggle fragt aktives Profil (alertAction sonst), mutiert
die lokale Liste + ruft wishlistStore.refresh.
- Wunschliste-Seite: Heart toggelt eigenen Wunsch, Count zeigt Gesamt-
wünsche, kommagetrennte Namen zeigen "wer will". Trash-Button
entfernt — Heart-off reicht jetzt.
Tests (99 → 99, 8 neu geschrieben):
- Per-User-Add/Remove, aggregierte Counts, on_my_wishlist, Cascades bei
Recipe/Profile-Delete, countWishlistRecipes = DISTINCT.
2026-04-17 19:16:19 +02:00
|
|
|
method: 'DELETE'
|
|
|
|
|
});
|
2026-04-18 22:22:19 +02:00
|
|
|
wishlistProfileIds = wishlistProfileIds.filter((id) => id !== profile.id);
|
2026-04-17 17:08:22 +02:00
|
|
|
} else {
|
|
|
|
|
await fetch('/api/wishlist', {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: { 'content-type': 'application/json' },
|
2026-04-18 22:22:19 +02:00
|
|
|
body: JSON.stringify({ recipe_id: data.recipe.id, profile_id: profile.id })
|
2026-04-17 17:08:22 +02:00
|
|
|
});
|
2026-04-18 22:22:19 +02:00
|
|
|
wishlistProfileIds = [...wishlistProfileIds, profile.id];
|
2026-04-17 17:08:22 +02:00
|
|
|
}
|
feat(wishlist): per-user Wünsche + Header-Badge mit Gesamtzahl
Schema-Änderung (Migration 005):
- Tabelle wishlist umgestellt auf PK (recipe_id, profile_id)
- wishlist_like-Tabelle zusammengelegt — Liken WAR schon "will ich auch",
also werden alle bestehenden Likes Memberships auf der neuen Tabelle.
- Alt-Einträge mit added_by_profile_id werden migriert, anonyme gehen
verloren (war inkonsistent, jetzt erzwingen wir profile_id NOT NULL).
Repository:
- listWishlist aggregiert pro Rezept: wanted_by_count, wanted_by_names
(kommagetrennt), on_my_wishlist für das aktive Profil
- listWishlistProfileIds(recipeId) für den Recipe-Page-Loader
- countWishlistRecipes für das Header-Badge (DISTINCT recipe_id)
- addToWishlist/removeFromWishlist/isOnMyWishlist alle mit profile_id
als Pflicht
API:
- POST /api/wishlist: profile_id jetzt Pflicht (nullable raus)
- DELETE /api/wishlist/[recipe_id]?profile_id=X (nur eigenes Entry)
- /api/wishlist/[recipe_id]/like komplett entfernt (Konzept obsolet)
- Neu: GET /api/wishlist/count → { count: <distinct recipes> }
UI:
- Header-Heart bekommt rotes Badge mit Zahl der Wunschliste-Rezepte.
wishlistStore in $lib/client/wishlist.svelte.ts hält den Count reaktiv;
Refresh auf Mount, nach Add/Remove, beim Öffnen der Wunschliste.
- Recipe-Detail: Loader liefert wishlist_profile_ids; onMyWishlist ist
ein $derived. Toggle fragt aktives Profil (alertAction sonst), mutiert
die lokale Liste + ruft wishlistStore.refresh.
- Wunschliste-Seite: Heart toggelt eigenen Wunsch, Count zeigt Gesamt-
wünsche, kommagetrennte Namen zeigen "wer will". Trash-Button
entfernt — Heart-off reicht jetzt.
Tests (99 → 99, 8 neu geschrieben):
- Per-User-Add/Remove, aggregierte Counts, on_my_wishlist, Cascades bei
Recipe/Profile-Delete, countWishlistRecipes = DISTINCT.
2026-04-17 19:16:19 +02:00
|
|
|
void wishlistStore.refresh();
|
2026-04-18 15:06:15 +02:00
|
|
|
if (!wasOn) void firePulse('wish');
|
2026-04-17 17:08:22 +02:00
|
|
|
}
|
|
|
|
|
|
2026-04-17 19:21:28 +02:00
|
|
|
// Wake-Lock — Bildschirm beim Kochen nicht dimmen lassen.
|
|
|
|
|
// Browser-API navigator.wakeLock.request('screen') verhindert auto-lock
|
|
|
|
|
// und -dimmen, solange der Tab sichtbar ist. Sobald der Tab in den
|
|
|
|
|
// Hintergrund geht, verliert der Sentinel seine Wirkung von selbst; wir
|
|
|
|
|
// re-requesten bei visibilitychange.
|
|
|
|
|
let wakeLockEnabled = $state(true);
|
2026-04-17 15:28:22 +02:00
|
|
|
let wakeLock: WakeLockSentinel | null = null;
|
2026-04-17 19:21:28 +02:00
|
|
|
|
|
|
|
|
async function acquireWakeLock() {
|
|
|
|
|
if (wakeLock || !wakeLockEnabled) return;
|
2026-04-17 15:28:22 +02:00
|
|
|
try {
|
|
|
|
|
if ('wakeLock' in navigator) {
|
|
|
|
|
wakeLock = await navigator.wakeLock.request('screen');
|
2026-04-17 19:21:28 +02:00
|
|
|
wakeLock.addEventListener('release', () => {
|
|
|
|
|
wakeLock = null;
|
|
|
|
|
});
|
2026-04-17 15:28:22 +02:00
|
|
|
}
|
|
|
|
|
} catch {
|
2026-04-17 19:21:28 +02:00
|
|
|
// User hat es gecancelt oder Browser unterstützt es nicht — ignorieren
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function releaseWakeLock() {
|
|
|
|
|
if (!wakeLock) return;
|
|
|
|
|
try {
|
|
|
|
|
await wakeLock.release();
|
|
|
|
|
} catch {
|
|
|
|
|
// ignore
|
|
|
|
|
}
|
|
|
|
|
wakeLock = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function toggleWakeLock() {
|
|
|
|
|
wakeLockEnabled = !wakeLockEnabled;
|
|
|
|
|
if (typeof window !== 'undefined') {
|
|
|
|
|
localStorage.setItem('kochwas.wakeLock', wakeLockEnabled ? '1' : '0');
|
2026-04-17 15:28:22 +02:00
|
|
|
}
|
2026-04-17 19:21:28 +02:00
|
|
|
if (wakeLockEnabled) void acquireWakeLock();
|
|
|
|
|
else void releaseWakeLock();
|
2026-04-17 15:28:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMount(() => {
|
2026-04-18 14:40:57 +02:00
|
|
|
// Wenn wir über "Manuell anlegen" hier landen, ist ?edit=1 gesetzt
|
|
|
|
|
// und wir starten direkt im Editor. Den Param danach aus der URL
|
|
|
|
|
// entfernen, damit Refresh nicht automatisch wieder edit-Mode ist.
|
|
|
|
|
if ($page.url.searchParams.get('edit') === '1') {
|
|
|
|
|
editMode = true;
|
|
|
|
|
const url = new URL(window.location.href);
|
|
|
|
|
url.searchParams.delete('edit');
|
|
|
|
|
history.replaceState(history.state, '', url.toString());
|
|
|
|
|
}
|
2026-04-17 19:21:28 +02:00
|
|
|
const stored = localStorage.getItem('kochwas.wakeLock');
|
|
|
|
|
if (stored !== null) wakeLockEnabled = stored === '1';
|
|
|
|
|
if (wakeLockEnabled) void acquireWakeLock();
|
2026-04-17 15:28:22 +02:00
|
|
|
const onVisibility = () => {
|
2026-04-17 19:21:28 +02:00
|
|
|
if (document.visibilityState === 'visible' && wakeLockEnabled && !wakeLock) {
|
|
|
|
|
void acquireWakeLock();
|
|
|
|
|
}
|
2026-04-17 15:28:22 +02:00
|
|
|
};
|
|
|
|
|
document.addEventListener('visibilitychange', onVisibility);
|
2026-04-22 14:28:32 +02:00
|
|
|
|
|
|
|
|
// Track view per active profile (fire-and-forget). Skipped when no
|
|
|
|
|
// profile is active — we'd just be writing rows nobody can sort against later.
|
|
|
|
|
if (profileStore.active) {
|
|
|
|
|
void fetch(`/api/recipes/${data.recipe.id}/view`, {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: { 'content-type': 'application/json' },
|
|
|
|
|
body: JSON.stringify({ profile_id: profileStore.active.id })
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-17 15:28:22 +02:00
|
|
|
return () => document.removeEventListener('visibilitychange', onVisibility);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
onDestroy(() => {
|
2026-04-17 19:21:28 +02:00
|
|
|
void releaseWakeLock();
|
2026-04-17 15:28:22 +02:00
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
feat(recipe): Edit-Modus für Zutaten, Schritte und Meta
Auf der Rezept-Detail-Seite ein neuer „Bearbeiten"-Button (Pencil-Icon)
in der Action-Bar. Klick schaltet RecipeView auf RecipeEditor um.
Im Editor:
- Titel, Beschreibung, Portionen, Vorbereitungs-/Koch-/Gesamtzeit als
inline-Inputs.
- Zutaten: pro Zeile Menge, Einheit, Name, Notiz + Trash-Icon zum
Entfernen. „+ Zutat hinzufügen"-Dashed-Button am Listenende.
- Schritte: nummerierte Textareas, Trash-Icon, „+ Schritt hinzufügen".
- Mengen akzeptieren Komma- oder Punkt-Dezimalen.
- Empty-Items werden beim Speichern automatisch aussortiert.
Backend:
- Neue Repo-Funktionen updateRecipeMeta(id, patch), replaceIngredients,
replaceSteps — letztere in einer Transaction mit delete+insert und
FTS-Refresh.
- PATCH /api/recipes/[id] akzeptiert jetzt zusätzlich description,
servings_default, servings_unit, prep_time_min, cook_time_min,
total_time_min, cuisine, category, ingredients[], steps[]. Vorher
nur title/hidden_from_recent; diese beiden bleiben als
Kurz-Fall erhalten, damit bestehende Aufrufer unverändert laufen.
- Zod-Schema mit expliziten Grenzen (max-Länge, positive Mengen).
Tests: 3 neue Cases für updateRecipeMeta, replaceIngredients (inkl.
FTS-Update), replaceSteps.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 12:41:10 +02:00
|
|
|
{#if editMode}
|
|
|
|
|
<RecipeEditor
|
|
|
|
|
recipe={recipeState}
|
|
|
|
|
{saving}
|
|
|
|
|
onsave={saveRecipe}
|
|
|
|
|
oncancel={() => (editMode = false)}
|
2026-04-18 21:39:54 +02:00
|
|
|
onimagechange={(path) => (recipeState = { ...recipeState, image_path: path })}
|
feat(recipe): Edit-Modus für Zutaten, Schritte und Meta
Auf der Rezept-Detail-Seite ein neuer „Bearbeiten"-Button (Pencil-Icon)
in der Action-Bar. Klick schaltet RecipeView auf RecipeEditor um.
Im Editor:
- Titel, Beschreibung, Portionen, Vorbereitungs-/Koch-/Gesamtzeit als
inline-Inputs.
- Zutaten: pro Zeile Menge, Einheit, Name, Notiz + Trash-Icon zum
Entfernen. „+ Zutat hinzufügen"-Dashed-Button am Listenende.
- Schritte: nummerierte Textareas, Trash-Icon, „+ Schritt hinzufügen".
- Mengen akzeptieren Komma- oder Punkt-Dezimalen.
- Empty-Items werden beim Speichern automatisch aussortiert.
Backend:
- Neue Repo-Funktionen updateRecipeMeta(id, patch), replaceIngredients,
replaceSteps — letztere in einer Transaction mit delete+insert und
FTS-Refresh.
- PATCH /api/recipes/[id] akzeptiert jetzt zusätzlich description,
servings_default, servings_unit, prep_time_min, cook_time_min,
total_time_min, cuisine, category, ingredients[], steps[]. Vorher
nur title/hidden_from_recent; diese beiden bleiben als
Kurz-Fall erhalten, damit bestehende Aufrufer unverändert laufen.
- Zod-Schema mit expliziten Grenzen (max-Länge, positive Mengen).
Tests: 3 neue Cases für updateRecipeMeta, replaceIngredients (inkl.
FTS-Update), replaceSteps.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 12:41:10 +02:00
|
|
|
/>
|
|
|
|
|
{:else}
|
|
|
|
|
<RecipeView recipe={recipeState}>
|
feat(ui): Favoriten-Liste, Dismiss-from-Recent, Inline-Rename, Lucide-Icons
Homepage:
- Neue Sektion "Deine Favoriten" über "Zuletzt hinzugefügt" (alphabetisch
sortiert, lädt wenn Profil aktiv ist; versteckt sonst)
- Jede Karte in "Zuletzt hinzugefügt" hat jetzt oben-rechts ein X-Icon
zum Ausblenden. Das Rezept selbst bleibt in der DB — nur die
Anzeige in der Recent-Liste wird per recipe.hidden_from_recent = 1
unterdrückt. Section versteckt sich, wenn die Liste leer wird.
DB:
- Neue Migration 004_recipe_hidden_from_recent.sql (+Index)
- listFavoritesForProfile in search-local.ts (ORDER BY title NOCASE)
- setRecipeHiddenFromRecent in actions.ts
API:
- GET /api/recipes/favorites?profile_id=X
- PATCH /api/recipes/[id] akzeptiert jetzt title und/oder
hidden_from_recent (Zod-Schema mit refine)
Rezept-Detail:
- Titel ist jetzt inline editierbar: kleines Stift-Icon rechts neben
H1. Click öffnet Input, Enter speichert (PATCH), Escape bricht ab.
Kein location.reload() mehr.
- RecipeView bekommt neuen Snippet-Prop titleSlot für Title-Override.
- Neue Aktionsreihenfolge:
Zeile 1: Favorit | Wunschliste | Drucken
Zeile 2: Heute gekocht | Löschen
(Umbenennen ist jetzt am Titel statt in der Leiste.)
Icons (lucide-svelte, neues Dep):
- Emoji-Icons durch Lucide-SVGs ersetzt auf Startseite, Header,
Rezept-Detail, Wunschliste, Header-Dropdown:
🍽️→Heart/Utensils, ⚙️→Settings, 🥘→CookingPot, 🌐→Globe,
♥/♡→Heart(filled), 🖨→Printer, ✎→Pencil, 🗑→Trash2, ✓→Check,
🍳→ChefHat, X→X
- Header-Brand-Badge auf Mobile behält sein 🍳 (ist im ::after-Pseudo,
Lucide käme da nicht sauber rein).
- SearchLoader-Emojis bleiben — die sind Teil der Animations-Charme.
Tests: 99/99 grün (bestehend), Typecheck 0 Fehler.
2026-04-17 18:57:17 +02:00
|
|
|
{#snippet titleSlot()}
|
|
|
|
|
<div class="title-row">
|
|
|
|
|
{#if editingTitle}
|
|
|
|
|
<input
|
|
|
|
|
bind:this={titleInput}
|
|
|
|
|
bind:value={titleDraft}
|
|
|
|
|
class="title-input"
|
|
|
|
|
onkeydown={onTitleKey}
|
|
|
|
|
aria-label="Rezept-Titel"
|
|
|
|
|
maxlength="200"
|
|
|
|
|
/>
|
|
|
|
|
<button class="icon-btn save" aria-label="Titel speichern" onclick={saveTitle}>
|
|
|
|
|
<Check size={20} strokeWidth={2.5} />
|
|
|
|
|
</button>
|
|
|
|
|
<button class="icon-btn cancel" aria-label="Abbrechen" onclick={cancelEditTitle}>
|
|
|
|
|
<X size={20} strokeWidth={2.5} />
|
|
|
|
|
</button>
|
|
|
|
|
{:else}
|
|
|
|
|
<h1 class="title-heading">{title}</h1>
|
|
|
|
|
<button class="icon-btn edit" aria-label="Titel umbenennen" onclick={startEditTitle}>
|
|
|
|
|
<Pencil size={18} strokeWidth={2} />
|
|
|
|
|
</button>
|
|
|
|
|
{/if}
|
|
|
|
|
</div>
|
|
|
|
|
{/snippet}
|
|
|
|
|
|
2026-04-17 15:28:22 +02:00
|
|
|
{#snippet showActions()}
|
|
|
|
|
<div class="action-bar">
|
|
|
|
|
<div class="rating-row">
|
|
|
|
|
<span class="label">Deine Bewertung:</span>
|
|
|
|
|
<StarRating value={myRating} onChange={setRating} size="lg" />
|
|
|
|
|
{#if data.avg_stars !== null}
|
|
|
|
|
<span class="avg">⌀ {data.avg_stars.toFixed(1)} ({ratings.length})</span>
|
|
|
|
|
{/if}
|
|
|
|
|
</div>
|
feat(ui): Favoriten-Liste, Dismiss-from-Recent, Inline-Rename, Lucide-Icons
Homepage:
- Neue Sektion "Deine Favoriten" über "Zuletzt hinzugefügt" (alphabetisch
sortiert, lädt wenn Profil aktiv ist; versteckt sonst)
- Jede Karte in "Zuletzt hinzugefügt" hat jetzt oben-rechts ein X-Icon
zum Ausblenden. Das Rezept selbst bleibt in der DB — nur die
Anzeige in der Recent-Liste wird per recipe.hidden_from_recent = 1
unterdrückt. Section versteckt sich, wenn die Liste leer wird.
DB:
- Neue Migration 004_recipe_hidden_from_recent.sql (+Index)
- listFavoritesForProfile in search-local.ts (ORDER BY title NOCASE)
- setRecipeHiddenFromRecent in actions.ts
API:
- GET /api/recipes/favorites?profile_id=X
- PATCH /api/recipes/[id] akzeptiert jetzt title und/oder
hidden_from_recent (Zod-Schema mit refine)
Rezept-Detail:
- Titel ist jetzt inline editierbar: kleines Stift-Icon rechts neben
H1. Click öffnet Input, Enter speichert (PATCH), Escape bricht ab.
Kein location.reload() mehr.
- RecipeView bekommt neuen Snippet-Prop titleSlot für Title-Override.
- Neue Aktionsreihenfolge:
Zeile 1: Favorit | Wunschliste | Drucken
Zeile 2: Heute gekocht | Löschen
(Umbenennen ist jetzt am Titel statt in der Leiste.)
Icons (lucide-svelte, neues Dep):
- Emoji-Icons durch Lucide-SVGs ersetzt auf Startseite, Header,
Rezept-Detail, Wunschliste, Header-Dropdown:
🍽️→Heart/Utensils, ⚙️→Settings, 🥘→CookingPot, 🌐→Globe,
♥/♡→Heart(filled), 🖨→Printer, ✎→Pencil, 🗑→Trash2, ✓→Check,
🍳→ChefHat, X→X
- Header-Brand-Badge auf Mobile behält sein 🍳 (ist im ::after-Pseudo,
Lucide käme da nicht sauber rein).
- SearchLoader-Emojis bleiben — die sind Teil der Animations-Charme.
Tests: 99/99 grün (bestehend), Typecheck 0 Fehler.
2026-04-17 18:57:17 +02:00
|
|
|
<div class="btn-row">
|
2026-04-18 15:06:15 +02:00
|
|
|
<button
|
|
|
|
|
class="btn"
|
|
|
|
|
class:heart={isFav}
|
|
|
|
|
class:pulse={pulseFav}
|
|
|
|
|
onclick={toggleFavorite}
|
|
|
|
|
onanimationend={() => (pulseFav = false)}
|
|
|
|
|
>
|
feat(ui): Favoriten-Liste, Dismiss-from-Recent, Inline-Rename, Lucide-Icons
Homepage:
- Neue Sektion "Deine Favoriten" über "Zuletzt hinzugefügt" (alphabetisch
sortiert, lädt wenn Profil aktiv ist; versteckt sonst)
- Jede Karte in "Zuletzt hinzugefügt" hat jetzt oben-rechts ein X-Icon
zum Ausblenden. Das Rezept selbst bleibt in der DB — nur die
Anzeige in der Recent-Liste wird per recipe.hidden_from_recent = 1
unterdrückt. Section versteckt sich, wenn die Liste leer wird.
DB:
- Neue Migration 004_recipe_hidden_from_recent.sql (+Index)
- listFavoritesForProfile in search-local.ts (ORDER BY title NOCASE)
- setRecipeHiddenFromRecent in actions.ts
API:
- GET /api/recipes/favorites?profile_id=X
- PATCH /api/recipes/[id] akzeptiert jetzt title und/oder
hidden_from_recent (Zod-Schema mit refine)
Rezept-Detail:
- Titel ist jetzt inline editierbar: kleines Stift-Icon rechts neben
H1. Click öffnet Input, Enter speichert (PATCH), Escape bricht ab.
Kein location.reload() mehr.
- RecipeView bekommt neuen Snippet-Prop titleSlot für Title-Override.
- Neue Aktionsreihenfolge:
Zeile 1: Favorit | Wunschliste | Drucken
Zeile 2: Heute gekocht | Löschen
(Umbenennen ist jetzt am Titel statt in der Leiste.)
Icons (lucide-svelte, neues Dep):
- Emoji-Icons durch Lucide-SVGs ersetzt auf Startseite, Header,
Rezept-Detail, Wunschliste, Header-Dropdown:
🍽️→Heart/Utensils, ⚙️→Settings, 🥘→CookingPot, 🌐→Globe,
♥/♡→Heart(filled), 🖨→Printer, ✎→Pencil, 🗑→Trash2, ✓→Check,
🍳→ChefHat, X→X
- Header-Brand-Badge auf Mobile behält sein 🍳 (ist im ::after-Pseudo,
Lucide käme da nicht sauber rein).
- SearchLoader-Emojis bleiben — die sind Teil der Animations-Charme.
Tests: 99/99 grün (bestehend), Typecheck 0 Fehler.
2026-04-17 18:57:17 +02:00
|
|
|
<Heart size={18} strokeWidth={2} fill={isFav ? 'currentColor' : 'none'} />
|
|
|
|
|
<span>Favorit</span>
|
|
|
|
|
</button>
|
2026-04-18 15:06:15 +02:00
|
|
|
<button
|
|
|
|
|
class="btn"
|
|
|
|
|
class:wish={onMyWishlist}
|
|
|
|
|
class:pulse={pulseWish}
|
|
|
|
|
onclick={toggleWishlist}
|
|
|
|
|
onanimationend={() => (pulseWish = false)}
|
|
|
|
|
>
|
feat(wishlist): per-user Wünsche + Header-Badge mit Gesamtzahl
Schema-Änderung (Migration 005):
- Tabelle wishlist umgestellt auf PK (recipe_id, profile_id)
- wishlist_like-Tabelle zusammengelegt — Liken WAR schon "will ich auch",
also werden alle bestehenden Likes Memberships auf der neuen Tabelle.
- Alt-Einträge mit added_by_profile_id werden migriert, anonyme gehen
verloren (war inkonsistent, jetzt erzwingen wir profile_id NOT NULL).
Repository:
- listWishlist aggregiert pro Rezept: wanted_by_count, wanted_by_names
(kommagetrennt), on_my_wishlist für das aktive Profil
- listWishlistProfileIds(recipeId) für den Recipe-Page-Loader
- countWishlistRecipes für das Header-Badge (DISTINCT recipe_id)
- addToWishlist/removeFromWishlist/isOnMyWishlist alle mit profile_id
als Pflicht
API:
- POST /api/wishlist: profile_id jetzt Pflicht (nullable raus)
- DELETE /api/wishlist/[recipe_id]?profile_id=X (nur eigenes Entry)
- /api/wishlist/[recipe_id]/like komplett entfernt (Konzept obsolet)
- Neu: GET /api/wishlist/count → { count: <distinct recipes> }
UI:
- Header-Heart bekommt rotes Badge mit Zahl der Wunschliste-Rezepte.
wishlistStore in $lib/client/wishlist.svelte.ts hält den Count reaktiv;
Refresh auf Mount, nach Add/Remove, beim Öffnen der Wunschliste.
- Recipe-Detail: Loader liefert wishlist_profile_ids; onMyWishlist ist
ein $derived. Toggle fragt aktives Profil (alertAction sonst), mutiert
die lokale Liste + ruft wishlistStore.refresh.
- Wunschliste-Seite: Heart toggelt eigenen Wunsch, Count zeigt Gesamt-
wünsche, kommagetrennte Namen zeigen "wer will". Trash-Button
entfernt — Heart-off reicht jetzt.
Tests (99 → 99, 8 neu geschrieben):
- Per-User-Add/Remove, aggregierte Counts, on_my_wishlist, Cascades bei
Recipe/Profile-Delete, countWishlistRecipes = DISTINCT.
2026-04-17 19:16:19 +02:00
|
|
|
{#if onMyWishlist}
|
feat(ui): Favoriten-Liste, Dismiss-from-Recent, Inline-Rename, Lucide-Icons
Homepage:
- Neue Sektion "Deine Favoriten" über "Zuletzt hinzugefügt" (alphabetisch
sortiert, lädt wenn Profil aktiv ist; versteckt sonst)
- Jede Karte in "Zuletzt hinzugefügt" hat jetzt oben-rechts ein X-Icon
zum Ausblenden. Das Rezept selbst bleibt in der DB — nur die
Anzeige in der Recent-Liste wird per recipe.hidden_from_recent = 1
unterdrückt. Section versteckt sich, wenn die Liste leer wird.
DB:
- Neue Migration 004_recipe_hidden_from_recent.sql (+Index)
- listFavoritesForProfile in search-local.ts (ORDER BY title NOCASE)
- setRecipeHiddenFromRecent in actions.ts
API:
- GET /api/recipes/favorites?profile_id=X
- PATCH /api/recipes/[id] akzeptiert jetzt title und/oder
hidden_from_recent (Zod-Schema mit refine)
Rezept-Detail:
- Titel ist jetzt inline editierbar: kleines Stift-Icon rechts neben
H1. Click öffnet Input, Enter speichert (PATCH), Escape bricht ab.
Kein location.reload() mehr.
- RecipeView bekommt neuen Snippet-Prop titleSlot für Title-Override.
- Neue Aktionsreihenfolge:
Zeile 1: Favorit | Wunschliste | Drucken
Zeile 2: Heute gekocht | Löschen
(Umbenennen ist jetzt am Titel statt in der Leiste.)
Icons (lucide-svelte, neues Dep):
- Emoji-Icons durch Lucide-SVGs ersetzt auf Startseite, Header,
Rezept-Detail, Wunschliste, Header-Dropdown:
🍽️→Heart/Utensils, ⚙️→Settings, 🥘→CookingPot, 🌐→Globe,
♥/♡→Heart(filled), 🖨→Printer, ✎→Pencil, 🗑→Trash2, ✓→Check,
🍳→ChefHat, X→X
- Header-Brand-Badge auf Mobile behält sein 🍳 (ist im ::after-Pseudo,
Lucide käme da nicht sauber rein).
- SearchLoader-Emojis bleiben — die sind Teil der Animations-Charme.
Tests: 99/99 grün (bestehend), Typecheck 0 Fehler.
2026-04-17 18:57:17 +02:00
|
|
|
<Check size={18} strokeWidth={2.5} />
|
|
|
|
|
<span>Auf Wunschliste</span>
|
|
|
|
|
{:else}
|
|
|
|
|
<Utensils size={18} strokeWidth={2} />
|
|
|
|
|
<span>Auf Wunschliste setzen</span>
|
|
|
|
|
{/if}
|
|
|
|
|
</button>
|
|
|
|
|
<button class="btn" onclick={() => window.print()}>
|
|
|
|
|
<Printer size={18} strokeWidth={2} />
|
|
|
|
|
<span>Drucken</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2026-04-17 15:28:22 +02:00
|
|
|
<div class="btn-row">
|
|
|
|
|
<button class="btn" onclick={logCooked}>
|
feat(ui): Favoriten-Liste, Dismiss-from-Recent, Inline-Rename, Lucide-Icons
Homepage:
- Neue Sektion "Deine Favoriten" über "Zuletzt hinzugefügt" (alphabetisch
sortiert, lädt wenn Profil aktiv ist; versteckt sonst)
- Jede Karte in "Zuletzt hinzugefügt" hat jetzt oben-rechts ein X-Icon
zum Ausblenden. Das Rezept selbst bleibt in der DB — nur die
Anzeige in der Recent-Liste wird per recipe.hidden_from_recent = 1
unterdrückt. Section versteckt sich, wenn die Liste leer wird.
DB:
- Neue Migration 004_recipe_hidden_from_recent.sql (+Index)
- listFavoritesForProfile in search-local.ts (ORDER BY title NOCASE)
- setRecipeHiddenFromRecent in actions.ts
API:
- GET /api/recipes/favorites?profile_id=X
- PATCH /api/recipes/[id] akzeptiert jetzt title und/oder
hidden_from_recent (Zod-Schema mit refine)
Rezept-Detail:
- Titel ist jetzt inline editierbar: kleines Stift-Icon rechts neben
H1. Click öffnet Input, Enter speichert (PATCH), Escape bricht ab.
Kein location.reload() mehr.
- RecipeView bekommt neuen Snippet-Prop titleSlot für Title-Override.
- Neue Aktionsreihenfolge:
Zeile 1: Favorit | Wunschliste | Drucken
Zeile 2: Heute gekocht | Löschen
(Umbenennen ist jetzt am Titel statt in der Leiste.)
Icons (lucide-svelte, neues Dep):
- Emoji-Icons durch Lucide-SVGs ersetzt auf Startseite, Header,
Rezept-Detail, Wunschliste, Header-Dropdown:
🍽️→Heart/Utensils, ⚙️→Settings, 🥘→CookingPot, 🌐→Globe,
♥/♡→Heart(filled), 🖨→Printer, ✎→Pencil, 🗑→Trash2, ✓→Check,
🍳→ChefHat, X→X
- Header-Brand-Badge auf Mobile behält sein 🍳 (ist im ::after-Pseudo,
Lucide käme da nicht sauber rein).
- SearchLoader-Emojis bleiben — die sind Teil der Animations-Charme.
Tests: 99/99 grün (bestehend), Typecheck 0 Fehler.
2026-04-17 18:57:17 +02:00
|
|
|
<ChefHat size={18} strokeWidth={2} />
|
|
|
|
|
<span>Heute gekocht</span>
|
2026-04-17 15:28:22 +02:00
|
|
|
{#if cookingLog.length > 0}
|
|
|
|
|
<span class="count">({cookingLog.length})</span>
|
|
|
|
|
{/if}
|
|
|
|
|
</button>
|
2026-04-17 19:21:28 +02:00
|
|
|
<button
|
|
|
|
|
class="btn"
|
|
|
|
|
class:screen-on={wakeLockEnabled}
|
|
|
|
|
onclick={toggleWakeLock}
|
|
|
|
|
aria-label={wakeLockEnabled
|
|
|
|
|
? 'Bildschirm bleibt an — zum Deaktivieren klicken'
|
|
|
|
|
: 'Bildschirm darf dimmen — zum Aktivieren klicken'}
|
|
|
|
|
>
|
|
|
|
|
{#if wakeLockEnabled}
|
|
|
|
|
<Lightbulb size={18} strokeWidth={2} />
|
|
|
|
|
<span>Bildschirm an</span>
|
|
|
|
|
{:else}
|
|
|
|
|
<LightbulbOff size={18} strokeWidth={2} />
|
|
|
|
|
<span>Bildschirm aus</span>
|
|
|
|
|
{/if}
|
|
|
|
|
</button>
|
feat(recipe): Edit-Modus für Zutaten, Schritte und Meta
Auf der Rezept-Detail-Seite ein neuer „Bearbeiten"-Button (Pencil-Icon)
in der Action-Bar. Klick schaltet RecipeView auf RecipeEditor um.
Im Editor:
- Titel, Beschreibung, Portionen, Vorbereitungs-/Koch-/Gesamtzeit als
inline-Inputs.
- Zutaten: pro Zeile Menge, Einheit, Name, Notiz + Trash-Icon zum
Entfernen. „+ Zutat hinzufügen"-Dashed-Button am Listenende.
- Schritte: nummerierte Textareas, Trash-Icon, „+ Schritt hinzufügen".
- Mengen akzeptieren Komma- oder Punkt-Dezimalen.
- Empty-Items werden beim Speichern automatisch aussortiert.
Backend:
- Neue Repo-Funktionen updateRecipeMeta(id, patch), replaceIngredients,
replaceSteps — letztere in einer Transaction mit delete+insert und
FTS-Refresh.
- PATCH /api/recipes/[id] akzeptiert jetzt zusätzlich description,
servings_default, servings_unit, prep_time_min, cook_time_min,
total_time_min, cuisine, category, ingredients[], steps[]. Vorher
nur title/hidden_from_recent; diese beiden bleiben als
Kurz-Fall erhalten, damit bestehende Aufrufer unverändert laufen.
- Zod-Schema mit expliziten Grenzen (max-Länge, positive Mengen).
Tests: 3 neue Cases für updateRecipeMeta, replaceIngredients (inkl.
FTS-Update), replaceSteps.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 12:41:10 +02:00
|
|
|
<button class="btn" onclick={() => (editMode = true)}>
|
|
|
|
|
<Pencil size={18} strokeWidth={2} />
|
|
|
|
|
<span>Bearbeiten</span>
|
|
|
|
|
</button>
|
feat(ui): Favoriten-Liste, Dismiss-from-Recent, Inline-Rename, Lucide-Icons
Homepage:
- Neue Sektion "Deine Favoriten" über "Zuletzt hinzugefügt" (alphabetisch
sortiert, lädt wenn Profil aktiv ist; versteckt sonst)
- Jede Karte in "Zuletzt hinzugefügt" hat jetzt oben-rechts ein X-Icon
zum Ausblenden. Das Rezept selbst bleibt in der DB — nur die
Anzeige in der Recent-Liste wird per recipe.hidden_from_recent = 1
unterdrückt. Section versteckt sich, wenn die Liste leer wird.
DB:
- Neue Migration 004_recipe_hidden_from_recent.sql (+Index)
- listFavoritesForProfile in search-local.ts (ORDER BY title NOCASE)
- setRecipeHiddenFromRecent in actions.ts
API:
- GET /api/recipes/favorites?profile_id=X
- PATCH /api/recipes/[id] akzeptiert jetzt title und/oder
hidden_from_recent (Zod-Schema mit refine)
Rezept-Detail:
- Titel ist jetzt inline editierbar: kleines Stift-Icon rechts neben
H1. Click öffnet Input, Enter speichert (PATCH), Escape bricht ab.
Kein location.reload() mehr.
- RecipeView bekommt neuen Snippet-Prop titleSlot für Title-Override.
- Neue Aktionsreihenfolge:
Zeile 1: Favorit | Wunschliste | Drucken
Zeile 2: Heute gekocht | Löschen
(Umbenennen ist jetzt am Titel statt in der Leiste.)
Icons (lucide-svelte, neues Dep):
- Emoji-Icons durch Lucide-SVGs ersetzt auf Startseite, Header,
Rezept-Detail, Wunschliste, Header-Dropdown:
🍽️→Heart/Utensils, ⚙️→Settings, 🥘→CookingPot, 🌐→Globe,
♥/♡→Heart(filled), 🖨→Printer, ✎→Pencil, 🗑→Trash2, ✓→Check,
🍳→ChefHat, X→X
- Header-Brand-Badge auf Mobile behält sein 🍳 (ist im ::after-Pseudo,
Lucide käme da nicht sauber rein).
- SearchLoader-Emojis bleiben — die sind Teil der Animations-Charme.
Tests: 99/99 grün (bestehend), Typecheck 0 Fehler.
2026-04-17 18:57:17 +02:00
|
|
|
<button class="btn danger" onclick={deleteRecipe}>
|
|
|
|
|
<Trash2 size={18} strokeWidth={2} />
|
|
|
|
|
<span>Löschen</span>
|
2026-04-17 15:28:22 +02:00
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{/snippet}
|
|
|
|
|
</RecipeView>
|
feat(recipe): Edit-Modus für Zutaten, Schritte und Meta
Auf der Rezept-Detail-Seite ein neuer „Bearbeiten"-Button (Pencil-Icon)
in der Action-Bar. Klick schaltet RecipeView auf RecipeEditor um.
Im Editor:
- Titel, Beschreibung, Portionen, Vorbereitungs-/Koch-/Gesamtzeit als
inline-Inputs.
- Zutaten: pro Zeile Menge, Einheit, Name, Notiz + Trash-Icon zum
Entfernen. „+ Zutat hinzufügen"-Dashed-Button am Listenende.
- Schritte: nummerierte Textareas, Trash-Icon, „+ Schritt hinzufügen".
- Mengen akzeptieren Komma- oder Punkt-Dezimalen.
- Empty-Items werden beim Speichern automatisch aussortiert.
Backend:
- Neue Repo-Funktionen updateRecipeMeta(id, patch), replaceIngredients,
replaceSteps — letztere in einer Transaction mit delete+insert und
FTS-Refresh.
- PATCH /api/recipes/[id] akzeptiert jetzt zusätzlich description,
servings_default, servings_unit, prep_time_min, cook_time_min,
total_time_min, cuisine, category, ingredients[], steps[]. Vorher
nur title/hidden_from_recent; diese beiden bleiben als
Kurz-Fall erhalten, damit bestehende Aufrufer unverändert laufen.
- Zod-Schema mit expliziten Grenzen (max-Länge, positive Mengen).
Tests: 3 neue Cases für updateRecipeMeta, replaceIngredients (inkl.
FTS-Update), replaceSteps.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 12:41:10 +02:00
|
|
|
{/if}
|
2026-04-17 15:28:22 +02:00
|
|
|
|
|
|
|
|
<section class="comments">
|
|
|
|
|
<h2>Kommentare</h2>
|
|
|
|
|
{#if comments.length === 0}
|
|
|
|
|
<p class="muted">Noch keine Kommentare.</p>
|
|
|
|
|
{/if}
|
|
|
|
|
<ul>
|
|
|
|
|
{#each comments as c (c.id)}
|
|
|
|
|
<li>
|
|
|
|
|
<div class="author">{c.author}</div>
|
|
|
|
|
<div class="text">{c.text}</div>
|
|
|
|
|
<div class="date">{new Date(c.created_at).toLocaleString('de-DE')}</div>
|
2026-04-19 11:56:41 +02:00
|
|
|
{#if profileStore.active?.id === c.profile_id}
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
class="comment-del"
|
|
|
|
|
aria-label="Kommentar löschen"
|
|
|
|
|
onclick={() => void deleteComment(c.id)}
|
|
|
|
|
>
|
|
|
|
|
<Trash2 size="14" />
|
|
|
|
|
</button>
|
|
|
|
|
{/if}
|
2026-04-17 15:28:22 +02:00
|
|
|
</li>
|
|
|
|
|
{/each}
|
|
|
|
|
</ul>
|
|
|
|
|
<div class="new-comment">
|
|
|
|
|
<textarea
|
|
|
|
|
bind:value={newComment}
|
|
|
|
|
placeholder={profileStore.active
|
|
|
|
|
? 'z.B. Salz durch Zucker ersetzen'
|
|
|
|
|
: 'Erst Profil wählen, um Kommentare zu schreiben.'}
|
|
|
|
|
rows="3"
|
|
|
|
|
disabled={!profileStore.active}
|
|
|
|
|
></textarea>
|
|
|
|
|
<button class="btn primary" onclick={addComment} disabled={!profileStore.active}>
|
|
|
|
|
Kommentar speichern
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
{#if cookingLog.length > 0}
|
|
|
|
|
<section class="cooking-log">
|
|
|
|
|
<h2>Kochjournal</h2>
|
|
|
|
|
<ul>
|
|
|
|
|
{#each cookingLog.slice(0, 20) as entry (entry.id)}
|
|
|
|
|
<li>
|
|
|
|
|
{new Date(entry.cooked_at).toLocaleString('de-DE')}
|
|
|
|
|
</li>
|
|
|
|
|
{/each}
|
|
|
|
|
</ul>
|
|
|
|
|
</section>
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
<style>
|
feat(ui): Favoriten-Liste, Dismiss-from-Recent, Inline-Rename, Lucide-Icons
Homepage:
- Neue Sektion "Deine Favoriten" über "Zuletzt hinzugefügt" (alphabetisch
sortiert, lädt wenn Profil aktiv ist; versteckt sonst)
- Jede Karte in "Zuletzt hinzugefügt" hat jetzt oben-rechts ein X-Icon
zum Ausblenden. Das Rezept selbst bleibt in der DB — nur die
Anzeige in der Recent-Liste wird per recipe.hidden_from_recent = 1
unterdrückt. Section versteckt sich, wenn die Liste leer wird.
DB:
- Neue Migration 004_recipe_hidden_from_recent.sql (+Index)
- listFavoritesForProfile in search-local.ts (ORDER BY title NOCASE)
- setRecipeHiddenFromRecent in actions.ts
API:
- GET /api/recipes/favorites?profile_id=X
- PATCH /api/recipes/[id] akzeptiert jetzt title und/oder
hidden_from_recent (Zod-Schema mit refine)
Rezept-Detail:
- Titel ist jetzt inline editierbar: kleines Stift-Icon rechts neben
H1. Click öffnet Input, Enter speichert (PATCH), Escape bricht ab.
Kein location.reload() mehr.
- RecipeView bekommt neuen Snippet-Prop titleSlot für Title-Override.
- Neue Aktionsreihenfolge:
Zeile 1: Favorit | Wunschliste | Drucken
Zeile 2: Heute gekocht | Löschen
(Umbenennen ist jetzt am Titel statt in der Leiste.)
Icons (lucide-svelte, neues Dep):
- Emoji-Icons durch Lucide-SVGs ersetzt auf Startseite, Header,
Rezept-Detail, Wunschliste, Header-Dropdown:
🍽️→Heart/Utensils, ⚙️→Settings, 🥘→CookingPot, 🌐→Globe,
♥/♡→Heart(filled), 🖨→Printer, ✎→Pencil, 🗑→Trash2, ✓→Check,
🍳→ChefHat, X→X
- Header-Brand-Badge auf Mobile behält sein 🍳 (ist im ::after-Pseudo,
Lucide käme da nicht sauber rein).
- SearchLoader-Emojis bleiben — die sind Teil der Animations-Charme.
Tests: 99/99 grün (bestehend), Typecheck 0 Fehler.
2026-04-17 18:57:17 +02:00
|
|
|
.title-row {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 0.5rem;
|
|
|
|
|
margin: 0 0 0.4rem;
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
}
|
|
|
|
|
.title-heading {
|
|
|
|
|
font-size: clamp(1.5rem, 5.5vw, 2rem);
|
|
|
|
|
line-height: 1.15;
|
|
|
|
|
margin: 0;
|
|
|
|
|
flex: 1;
|
|
|
|
|
min-width: 0;
|
|
|
|
|
}
|
|
|
|
|
.title-input {
|
|
|
|
|
flex: 1;
|
|
|
|
|
min-width: 0;
|
|
|
|
|
font-size: clamp(1.3rem, 5vw, 1.8rem);
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
padding: 0.25rem 0.5rem;
|
|
|
|
|
border: 2px solid #2b6a3d;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
background: white;
|
|
|
|
|
font-family: inherit;
|
|
|
|
|
}
|
|
|
|
|
.title-input:focus {
|
|
|
|
|
outline: none;
|
|
|
|
|
}
|
|
|
|
|
.icon-btn {
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
width: 40px;
|
|
|
|
|
height: 40px;
|
|
|
|
|
border-radius: 10px;
|
|
|
|
|
border: 1px solid #cfd9d1;
|
|
|
|
|
background: white;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
color: #444;
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
}
|
|
|
|
|
.icon-btn:hover {
|
|
|
|
|
background: #f4f8f5;
|
|
|
|
|
}
|
|
|
|
|
.icon-btn.save {
|
|
|
|
|
background: #2b6a3d;
|
|
|
|
|
color: white;
|
|
|
|
|
border-color: #2b6a3d;
|
|
|
|
|
}
|
|
|
|
|
.icon-btn.save:hover {
|
|
|
|
|
background: #235532;
|
|
|
|
|
}
|
|
|
|
|
.icon-btn.cancel {
|
|
|
|
|
color: #c53030;
|
|
|
|
|
border-color: #f1b4b4;
|
|
|
|
|
}
|
2026-04-17 15:28:22 +02:00
|
|
|
.action-bar {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: 0.75rem;
|
|
|
|
|
padding: 0.9rem;
|
|
|
|
|
background: white;
|
|
|
|
|
border: 1px solid #e4eae7;
|
|
|
|
|
border-radius: 14px;
|
|
|
|
|
}
|
|
|
|
|
.rating-row {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 0.5rem;
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
}
|
|
|
|
|
.label {
|
|
|
|
|
font-size: 0.95rem;
|
|
|
|
|
color: #555;
|
|
|
|
|
}
|
|
|
|
|
.avg {
|
|
|
|
|
color: #888;
|
|
|
|
|
font-size: 0.9rem;
|
|
|
|
|
}
|
|
|
|
|
.btn-row {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
gap: 0.5rem;
|
|
|
|
|
}
|
|
|
|
|
.btn {
|
feat(ui): Favoriten-Liste, Dismiss-from-Recent, Inline-Rename, Lucide-Icons
Homepage:
- Neue Sektion "Deine Favoriten" über "Zuletzt hinzugefügt" (alphabetisch
sortiert, lädt wenn Profil aktiv ist; versteckt sonst)
- Jede Karte in "Zuletzt hinzugefügt" hat jetzt oben-rechts ein X-Icon
zum Ausblenden. Das Rezept selbst bleibt in der DB — nur die
Anzeige in der Recent-Liste wird per recipe.hidden_from_recent = 1
unterdrückt. Section versteckt sich, wenn die Liste leer wird.
DB:
- Neue Migration 004_recipe_hidden_from_recent.sql (+Index)
- listFavoritesForProfile in search-local.ts (ORDER BY title NOCASE)
- setRecipeHiddenFromRecent in actions.ts
API:
- GET /api/recipes/favorites?profile_id=X
- PATCH /api/recipes/[id] akzeptiert jetzt title und/oder
hidden_from_recent (Zod-Schema mit refine)
Rezept-Detail:
- Titel ist jetzt inline editierbar: kleines Stift-Icon rechts neben
H1. Click öffnet Input, Enter speichert (PATCH), Escape bricht ab.
Kein location.reload() mehr.
- RecipeView bekommt neuen Snippet-Prop titleSlot für Title-Override.
- Neue Aktionsreihenfolge:
Zeile 1: Favorit | Wunschliste | Drucken
Zeile 2: Heute gekocht | Löschen
(Umbenennen ist jetzt am Titel statt in der Leiste.)
Icons (lucide-svelte, neues Dep):
- Emoji-Icons durch Lucide-SVGs ersetzt auf Startseite, Header,
Rezept-Detail, Wunschliste, Header-Dropdown:
🍽️→Heart/Utensils, ⚙️→Settings, 🥘→CookingPot, 🌐→Globe,
♥/♡→Heart(filled), 🖨→Printer, ✎→Pencil, 🗑→Trash2, ✓→Check,
🍳→ChefHat, X→X
- Header-Brand-Badge auf Mobile behält sein 🍳 (ist im ::after-Pseudo,
Lucide käme da nicht sauber rein).
- SearchLoader-Emojis bleiben — die sind Teil der Animations-Charme.
Tests: 99/99 grün (bestehend), Typecheck 0 Fehler.
2026-04-17 18:57:17 +02:00
|
|
|
display: inline-flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 0.4rem;
|
2026-04-17 15:28:22 +02:00
|
|
|
padding: 0.6rem 0.85rem;
|
|
|
|
|
min-height: 44px;
|
|
|
|
|
border: 1px solid #cfd9d1;
|
|
|
|
|
background: white;
|
|
|
|
|
border-radius: 10px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
font-size: 0.95rem;
|
feat(ui): Favoriten-Liste, Dismiss-from-Recent, Inline-Rename, Lucide-Icons
Homepage:
- Neue Sektion "Deine Favoriten" über "Zuletzt hinzugefügt" (alphabetisch
sortiert, lädt wenn Profil aktiv ist; versteckt sonst)
- Jede Karte in "Zuletzt hinzugefügt" hat jetzt oben-rechts ein X-Icon
zum Ausblenden. Das Rezept selbst bleibt in der DB — nur die
Anzeige in der Recent-Liste wird per recipe.hidden_from_recent = 1
unterdrückt. Section versteckt sich, wenn die Liste leer wird.
DB:
- Neue Migration 004_recipe_hidden_from_recent.sql (+Index)
- listFavoritesForProfile in search-local.ts (ORDER BY title NOCASE)
- setRecipeHiddenFromRecent in actions.ts
API:
- GET /api/recipes/favorites?profile_id=X
- PATCH /api/recipes/[id] akzeptiert jetzt title und/oder
hidden_from_recent (Zod-Schema mit refine)
Rezept-Detail:
- Titel ist jetzt inline editierbar: kleines Stift-Icon rechts neben
H1. Click öffnet Input, Enter speichert (PATCH), Escape bricht ab.
Kein location.reload() mehr.
- RecipeView bekommt neuen Snippet-Prop titleSlot für Title-Override.
- Neue Aktionsreihenfolge:
Zeile 1: Favorit | Wunschliste | Drucken
Zeile 2: Heute gekocht | Löschen
(Umbenennen ist jetzt am Titel statt in der Leiste.)
Icons (lucide-svelte, neues Dep):
- Emoji-Icons durch Lucide-SVGs ersetzt auf Startseite, Header,
Rezept-Detail, Wunschliste, Header-Dropdown:
🍽️→Heart/Utensils, ⚙️→Settings, 🥘→CookingPot, 🌐→Globe,
♥/♡→Heart(filled), 🖨→Printer, ✎→Pencil, 🗑→Trash2, ✓→Check,
🍳→ChefHat, X→X
- Header-Brand-Badge auf Mobile behält sein 🍳 (ist im ::after-Pseudo,
Lucide käme da nicht sauber rein).
- SearchLoader-Emojis bleiben — die sind Teil der Animations-Charme.
Tests: 99/99 grün (bestehend), Typecheck 0 Fehler.
2026-04-17 18:57:17 +02:00
|
|
|
color: #1a1a1a;
|
2026-04-17 15:28:22 +02:00
|
|
|
}
|
|
|
|
|
.btn:hover {
|
|
|
|
|
background: #f4f8f5;
|
|
|
|
|
}
|
|
|
|
|
.btn.heart {
|
|
|
|
|
color: #c53030;
|
|
|
|
|
border-color: #f1b4b4;
|
|
|
|
|
background: #fdf3f3;
|
2026-04-18 15:06:15 +02:00
|
|
|
--pulse-color: rgba(197, 48, 48, 0.45);
|
2026-04-17 15:28:22 +02:00
|
|
|
}
|
2026-04-17 17:08:22 +02:00
|
|
|
.btn.wish {
|
|
|
|
|
color: #2b6a3d;
|
|
|
|
|
border-color: #b7d6c2;
|
|
|
|
|
background: #eaf4ed;
|
2026-04-18 15:06:15 +02:00
|
|
|
--pulse-color: rgba(43, 106, 61, 0.45);
|
|
|
|
|
}
|
|
|
|
|
/* Einmalige Bestätigung beim Aktivieren der Aktion — kurzer Scale-Bounce
|
|
|
|
|
plus ausklingender Ring in der Aktionsfarbe (siehe --pulse-color).
|
|
|
|
|
prefers-reduced-motion: Ring aus, kein Scale. */
|
|
|
|
|
.btn.pulse {
|
|
|
|
|
animation: btnPulse 0.5s ease-out;
|
|
|
|
|
}
|
|
|
|
|
@keyframes btnPulse {
|
|
|
|
|
0% {
|
|
|
|
|
transform: scale(1);
|
|
|
|
|
box-shadow: 0 0 0 0 var(--pulse-color, rgba(43, 106, 61, 0.45));
|
|
|
|
|
}
|
|
|
|
|
55% {
|
|
|
|
|
transform: scale(1.07);
|
|
|
|
|
box-shadow: 0 0 0 10px rgba(0, 0, 0, 0);
|
|
|
|
|
}
|
|
|
|
|
100% {
|
|
|
|
|
transform: scale(1);
|
|
|
|
|
box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@media (prefers-reduced-motion: reduce) {
|
|
|
|
|
.btn.pulse {
|
|
|
|
|
animation: none;
|
|
|
|
|
}
|
2026-04-17 17:08:22 +02:00
|
|
|
}
|
2026-04-17 19:21:28 +02:00
|
|
|
.btn.screen-on {
|
|
|
|
|
color: #b07e00;
|
|
|
|
|
border-color: #e6d48a;
|
|
|
|
|
background: #fff6d7;
|
|
|
|
|
}
|
2026-04-17 15:28:22 +02:00
|
|
|
.btn.primary {
|
|
|
|
|
background: #2b6a3d;
|
|
|
|
|
color: white;
|
|
|
|
|
border: 0;
|
|
|
|
|
}
|
|
|
|
|
.btn.danger {
|
|
|
|
|
color: #c53030;
|
|
|
|
|
border-color: #f1b4b4;
|
|
|
|
|
}
|
|
|
|
|
.count {
|
|
|
|
|
color: #888;
|
|
|
|
|
font-size: 0.85em;
|
|
|
|
|
}
|
|
|
|
|
.comments {
|
|
|
|
|
margin-top: 2rem;
|
|
|
|
|
}
|
|
|
|
|
.comments h2 {
|
|
|
|
|
font-size: 1.15rem;
|
|
|
|
|
margin: 0 0 0.75rem;
|
|
|
|
|
}
|
|
|
|
|
.comments ul {
|
|
|
|
|
list-style: none;
|
|
|
|
|
padding: 0;
|
|
|
|
|
margin: 0;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: 0.6rem;
|
|
|
|
|
}
|
|
|
|
|
.comments li {
|
|
|
|
|
background: white;
|
|
|
|
|
border: 1px solid #e4eae7;
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
padding: 0.75rem 0.9rem;
|
2026-04-19 11:56:41 +02:00
|
|
|
position: relative;
|
|
|
|
|
}
|
|
|
|
|
.comment-del {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 0.5rem;
|
|
|
|
|
right: 0.5rem;
|
|
|
|
|
width: 28px;
|
|
|
|
|
height: 28px;
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
border: 0;
|
|
|
|
|
background: transparent;
|
|
|
|
|
color: #888;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
.comment-del:hover {
|
|
|
|
|
background: #f3f5f3;
|
|
|
|
|
color: #b42626;
|
2026-04-17 15:28:22 +02:00
|
|
|
}
|
|
|
|
|
.comments .author {
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
font-size: 0.9rem;
|
|
|
|
|
}
|
|
|
|
|
.comments .text {
|
|
|
|
|
margin-top: 0.25rem;
|
|
|
|
|
line-height: 1.4;
|
|
|
|
|
}
|
|
|
|
|
.comments .date {
|
|
|
|
|
font-size: 0.8rem;
|
|
|
|
|
color: #888;
|
|
|
|
|
margin-top: 0.3rem;
|
|
|
|
|
}
|
|
|
|
|
.new-comment {
|
|
|
|
|
margin-top: 1rem;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: 0.5rem;
|
|
|
|
|
}
|
|
|
|
|
.new-comment textarea {
|
|
|
|
|
width: 100%;
|
|
|
|
|
padding: 0.75rem;
|
|
|
|
|
border: 1px solid #cfd9d1;
|
|
|
|
|
border-radius: 10px;
|
|
|
|
|
font: inherit;
|
|
|
|
|
resize: vertical;
|
|
|
|
|
}
|
|
|
|
|
.muted {
|
|
|
|
|
color: #888;
|
|
|
|
|
}
|
|
|
|
|
.cooking-log {
|
|
|
|
|
margin-top: 2rem;
|
|
|
|
|
}
|
|
|
|
|
.cooking-log h2 {
|
|
|
|
|
font-size: 1.1rem;
|
|
|
|
|
margin: 0 0 0.5rem;
|
|
|
|
|
}
|
|
|
|
|
.cooking-log ul {
|
|
|
|
|
list-style: none;
|
|
|
|
|
padding: 0;
|
|
|
|
|
margin: 0;
|
|
|
|
|
color: #555;
|
|
|
|
|
}
|
|
|
|
|
.cooking-log li {
|
|
|
|
|
padding: 0.35rem 0;
|
|
|
|
|
border-bottom: 1px solid #edf1ee;
|
|
|
|
|
font-size: 0.9rem;
|
|
|
|
|
}
|
|
|
|
|
</style>
|