2026-04-17 15:07:22 +02:00
|
|
|
<script lang="ts">
|
2026-04-17 15:28:22 +02:00
|
|
|
import { onMount } from 'svelte';
|
2026-04-17 19:03:50 +02:00
|
|
|
import { page } from '$app/stores';
|
2026-04-17 22:08:00 +02:00
|
|
|
import { CookingPot, X } from 'lucide-svelte';
|
2026-04-17 19:06:58 +02:00
|
|
|
import type { Snapshot } from './$types';
|
2026-04-17 15:28:22 +02:00
|
|
|
import type { SearchHit } from '$lib/server/recipes/search-local';
|
2026-04-17 17:47:26 +02:00
|
|
|
import type { WebHit } from '$lib/server/search/searxng';
|
2026-04-17 17:58:27 +02:00
|
|
|
import { randomQuote } from '$lib/quotes';
|
2026-04-17 18:40:38 +02:00
|
|
|
import SearchLoader from '$lib/components/SearchLoader.svelte';
|
2026-04-18 08:13:33 +02:00
|
|
|
import SearchFilter from '$lib/components/SearchFilter.svelte';
|
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 { profileStore } from '$lib/client/profile.svelte';
|
2026-04-18 08:13:33 +02:00
|
|
|
import { searchFilterStore } from '$lib/client/search-filter.svelte';
|
2026-04-17 15:28:22 +02:00
|
|
|
|
2026-04-17 22:08:00 +02:00
|
|
|
const LOCAL_PAGE = 30;
|
|
|
|
|
|
2026-04-17 15:28:22 +02:00
|
|
|
let query = $state('');
|
2026-04-17 17:58:27 +02:00
|
|
|
let quote = $state('');
|
2026-04-17 15:28:22 +02:00
|
|
|
let recent = $state<SearchHit[]>([]);
|
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 favorites = $state<SearchHit[]>([]);
|
2026-04-17 17:41:10 +02:00
|
|
|
let hits = $state<SearchHit[]>([]);
|
2026-04-17 17:47:26 +02:00
|
|
|
let webHits = $state<WebHit[]>([]);
|
2026-04-17 17:41:10 +02:00
|
|
|
let searching = $state(false);
|
2026-04-17 17:47:26 +02:00
|
|
|
let webSearching = $state(false);
|
|
|
|
|
let webError = $state<string | null>(null);
|
2026-04-17 17:41:10 +02:00
|
|
|
let searchedFor = $state<string | null>(null);
|
2026-04-17 22:08:00 +02:00
|
|
|
let localExhausted = $state(false);
|
|
|
|
|
let webPageno = $state(0);
|
|
|
|
|
let webExhausted = $state(false);
|
|
|
|
|
let loadingMore = $state(false);
|
2026-04-17 19:06:58 +02:00
|
|
|
let skipNextSearch = false;
|
2026-04-18 08:13:33 +02:00
|
|
|
let debounceTimer: ReturnType<typeof setTimeout> | null = null;
|
2026-04-17 19:06:58 +02:00
|
|
|
|
|
|
|
|
type SearchSnapshot = {
|
|
|
|
|
query: string;
|
|
|
|
|
hits: SearchHit[];
|
|
|
|
|
webHits: WebHit[];
|
|
|
|
|
searchedFor: string | null;
|
|
|
|
|
webError: string | null;
|
2026-04-17 22:08:00 +02:00
|
|
|
localExhausted: boolean;
|
|
|
|
|
webPageno: number;
|
|
|
|
|
webExhausted: boolean;
|
2026-04-17 19:06:58 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const snapshot: Snapshot<SearchSnapshot> = {
|
2026-04-17 22:08:00 +02:00
|
|
|
capture: () => ({
|
|
|
|
|
query,
|
|
|
|
|
hits,
|
|
|
|
|
webHits,
|
|
|
|
|
searchedFor,
|
|
|
|
|
webError,
|
|
|
|
|
localExhausted,
|
|
|
|
|
webPageno,
|
|
|
|
|
webExhausted
|
|
|
|
|
}),
|
2026-04-17 19:06:58 +02:00
|
|
|
restore: (v) => {
|
|
|
|
|
query = v.query;
|
|
|
|
|
hits = v.hits;
|
|
|
|
|
webHits = v.webHits;
|
|
|
|
|
searchedFor = v.searchedFor;
|
|
|
|
|
webError = v.webError;
|
2026-04-17 22:08:00 +02:00
|
|
|
localExhausted = v.localExhausted;
|
|
|
|
|
webPageno = v.webPageno;
|
|
|
|
|
webExhausted = v.webExhausted;
|
2026-04-17 19:06:58 +02:00
|
|
|
skipNextSearch = true;
|
|
|
|
|
}
|
|
|
|
|
};
|
2026-04-17 15:28:22 +02:00
|
|
|
|
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 loadRecent() {
|
2026-04-17 15:28:22 +02:00
|
|
|
const res = await fetch('/api/recipes/search');
|
|
|
|
|
const body = await res.json();
|
|
|
|
|
recent = body.hits;
|
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 loadFavorites(profileId: number) {
|
|
|
|
|
const res = await fetch(`/api/recipes/favorites?profile_id=${profileId}`);
|
|
|
|
|
if (!res.ok) {
|
|
|
|
|
favorites = [];
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const body = await res.json();
|
|
|
|
|
favorites = body.hits;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMount(() => {
|
|
|
|
|
quote = randomQuote();
|
2026-04-17 19:03:50 +02:00
|
|
|
// Restore query from URL so history.back() from preview/recipe
|
|
|
|
|
// brings the user back to the same search results.
|
|
|
|
|
const urlQ = ($page.url.searchParams.get('q') ?? '').trim();
|
|
|
|
|
if (urlQ) query = urlQ;
|
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
|
|
|
void loadRecent();
|
2026-04-18 08:13:33 +02:00
|
|
|
void searchFilterStore.load();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Bei Änderung der Domain-Auswahl: laufende Suche neu ausführen,
|
|
|
|
|
// damit der User nicht manuell re-tippen muss.
|
|
|
|
|
$effect(() => {
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
|
|
|
searchFilterStore.active;
|
|
|
|
|
const q = query.trim();
|
|
|
|
|
if (!q || q.length <= 3) return;
|
|
|
|
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
|
|
|
searching = true;
|
|
|
|
|
webHits = [];
|
|
|
|
|
webSearching = false;
|
|
|
|
|
webError = null;
|
|
|
|
|
debounceTimer = setTimeout(() => void runSearch(q), 150);
|
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
|
|
|
});
|
|
|
|
|
|
2026-04-17 19:03:50 +02:00
|
|
|
// Sync current query back into the URL as ?q=... via replaceState,
|
|
|
|
|
// without spamming the history stack. Pushing a new entry happens only
|
|
|
|
|
// when the user clicks a result or otherwise navigates away.
|
|
|
|
|
$effect(() => {
|
|
|
|
|
if (typeof window === 'undefined') return;
|
|
|
|
|
const q = query.trim();
|
|
|
|
|
const url = new URL(window.location.href);
|
|
|
|
|
const current = url.searchParams.get('q') ?? '';
|
|
|
|
|
if (q === current) return;
|
|
|
|
|
if (q) url.searchParams.set('q', q);
|
|
|
|
|
else url.searchParams.delete('q');
|
|
|
|
|
history.replaceState(history.state, '', url.toString());
|
|
|
|
|
});
|
|
|
|
|
|
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
|
|
|
$effect(() => {
|
|
|
|
|
const active = profileStore.active;
|
|
|
|
|
if (!active) {
|
|
|
|
|
favorites = [];
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
void loadFavorites(active.id);
|
2026-04-17 15:28:22 +02:00
|
|
|
});
|
2026-04-17 17:41:10 +02:00
|
|
|
|
2026-04-18 08:13:33 +02:00
|
|
|
function filterParam(): string {
|
|
|
|
|
const p = searchFilterStore.queryParam;
|
|
|
|
|
return p ? `&domains=${encodeURIComponent(p)}` : '';
|
|
|
|
|
}
|
2026-04-17 17:41:10 +02:00
|
|
|
|
2026-04-17 18:04:59 +02:00
|
|
|
async function runSearch(q: string) {
|
2026-04-17 22:08:00 +02:00
|
|
|
localExhausted = false;
|
|
|
|
|
webPageno = 0;
|
|
|
|
|
webExhausted = false;
|
2026-04-17 18:04:59 +02:00
|
|
|
try {
|
2026-04-17 22:08:00 +02:00
|
|
|
const res = await fetch(
|
2026-04-18 08:13:33 +02:00
|
|
|
`/api/recipes/search?q=${encodeURIComponent(q)}&limit=${LOCAL_PAGE}${filterParam()}`
|
2026-04-17 22:08:00 +02:00
|
|
|
);
|
2026-04-17 18:04:59 +02:00
|
|
|
const body = await res.json();
|
|
|
|
|
if (query.trim() !== q) return;
|
|
|
|
|
hits = body.hits;
|
|
|
|
|
searchedFor = q;
|
2026-04-17 22:08:00 +02:00
|
|
|
if (hits.length < LOCAL_PAGE) localExhausted = true;
|
|
|
|
|
if (hits.length === 0) {
|
|
|
|
|
// Gar keine lokalen Treffer → erste Web-Seite gleich laden,
|
|
|
|
|
// damit der User nicht extra auf „+ weitere" klicken muss.
|
2026-04-17 18:04:59 +02:00
|
|
|
webSearching = true;
|
|
|
|
|
try {
|
2026-04-18 08:13:33 +02:00
|
|
|
const wres = await fetch(
|
|
|
|
|
`/api/recipes/search/web?q=${encodeURIComponent(q)}&pageno=1${filterParam()}`
|
|
|
|
|
);
|
2026-04-17 18:04:59 +02:00
|
|
|
if (query.trim() !== q) return;
|
|
|
|
|
if (!wres.ok) {
|
|
|
|
|
const err = await wres.json().catch(() => ({}));
|
|
|
|
|
webError = err.message ?? `HTTP ${wres.status}`;
|
2026-04-17 22:08:00 +02:00
|
|
|
webExhausted = true;
|
2026-04-17 18:04:59 +02:00
|
|
|
} else {
|
|
|
|
|
const wbody = await wres.json();
|
|
|
|
|
webHits = wbody.hits;
|
2026-04-17 22:08:00 +02:00
|
|
|
webPageno = 1;
|
|
|
|
|
if (wbody.hits.length === 0) webExhausted = true;
|
2026-04-17 18:04:59 +02:00
|
|
|
}
|
|
|
|
|
} finally {
|
|
|
|
|
if (query.trim() === q) webSearching = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} finally {
|
|
|
|
|
if (query.trim() === q) searching = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-17 22:08:00 +02:00
|
|
|
async function loadMore() {
|
|
|
|
|
if (loadingMore) return;
|
|
|
|
|
const q = query.trim();
|
|
|
|
|
if (!q) return;
|
|
|
|
|
loadingMore = true;
|
|
|
|
|
try {
|
|
|
|
|
if (!localExhausted) {
|
|
|
|
|
// Noch mehr lokale Treffer holen.
|
|
|
|
|
const res = await fetch(
|
2026-04-18 08:13:33 +02:00
|
|
|
`/api/recipes/search?q=${encodeURIComponent(q)}&limit=${LOCAL_PAGE}&offset=${hits.length}${filterParam()}`
|
2026-04-17 22:08:00 +02:00
|
|
|
);
|
|
|
|
|
const body = await res.json();
|
|
|
|
|
if (query.trim() !== q) return;
|
|
|
|
|
const more = body.hits as SearchHit[];
|
|
|
|
|
const seen = new Set(hits.map((h) => h.id));
|
|
|
|
|
const deduped = more.filter((h) => !seen.has(h.id));
|
|
|
|
|
hits = [...hits, ...deduped];
|
|
|
|
|
if (more.length < LOCAL_PAGE) localExhausted = true;
|
|
|
|
|
} else if (!webExhausted) {
|
|
|
|
|
// Lokale erschöpft → auf Web umschalten / weiterblättern.
|
|
|
|
|
const nextPage = webPageno + 1;
|
|
|
|
|
webSearching = webHits.length === 0;
|
|
|
|
|
try {
|
|
|
|
|
const wres = await fetch(
|
2026-04-18 08:13:33 +02:00
|
|
|
`/api/recipes/search/web?q=${encodeURIComponent(q)}&pageno=${nextPage}${filterParam()}`
|
2026-04-17 22:08:00 +02:00
|
|
|
);
|
|
|
|
|
if (query.trim() !== q) return;
|
|
|
|
|
if (!wres.ok) {
|
|
|
|
|
const err = await wres.json().catch(() => ({}));
|
|
|
|
|
webError = err.message ?? `HTTP ${wres.status}`;
|
|
|
|
|
webExhausted = true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const wbody = await wres.json();
|
|
|
|
|
const more = wbody.hits as WebHit[];
|
|
|
|
|
const seen = new Set(webHits.map((h) => h.url));
|
|
|
|
|
const deduped = more.filter((h) => !seen.has(h.url));
|
|
|
|
|
if (deduped.length === 0) {
|
|
|
|
|
webExhausted = true;
|
|
|
|
|
} else {
|
|
|
|
|
webHits = [...webHits, ...deduped];
|
|
|
|
|
webPageno = nextPage;
|
|
|
|
|
}
|
|
|
|
|
} finally {
|
|
|
|
|
if (query.trim() === q) webSearching = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} finally {
|
|
|
|
|
loadingMore = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-17 17:41:10 +02:00
|
|
|
$effect(() => {
|
|
|
|
|
const q = query.trim();
|
|
|
|
|
if (debounceTimer) clearTimeout(debounceTimer);
|
2026-04-17 19:06:58 +02:00
|
|
|
if (skipNextSearch) {
|
|
|
|
|
// Snapshot-Restore hat hits/webHits/searchedFor wiederhergestellt —
|
|
|
|
|
// nicht erneut fetchen.
|
|
|
|
|
skipNextSearch = false;
|
|
|
|
|
return;
|
|
|
|
|
}
|
2026-04-17 17:41:10 +02:00
|
|
|
if (q.length <= 3) {
|
|
|
|
|
hits = [];
|
2026-04-17 17:47:26 +02:00
|
|
|
webHits = [];
|
2026-04-17 17:41:10 +02:00
|
|
|
searchedFor = null;
|
|
|
|
|
searching = false;
|
2026-04-17 17:47:26 +02:00
|
|
|
webSearching = false;
|
|
|
|
|
webError = null;
|
2026-04-17 17:41:10 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
searching = true;
|
2026-04-17 17:47:26 +02:00
|
|
|
webHits = [];
|
|
|
|
|
webSearching = false;
|
|
|
|
|
webError = null;
|
2026-04-17 18:04:59 +02:00
|
|
|
debounceTimer = setTimeout(() => {
|
|
|
|
|
void runSearch(q);
|
2026-04-17 17:41:10 +02:00
|
|
|
}, 300);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function submit(e: SubmitEvent) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
const q = query.trim();
|
2026-04-17 18:04:59 +02:00
|
|
|
if (q.length <= 3) return;
|
|
|
|
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
|
|
|
searching = true;
|
|
|
|
|
void runSearch(q);
|
2026-04-17 17:41:10 +02:00
|
|
|
}
|
|
|
|
|
|
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 dismissFromRecent(recipeId: number, e: MouseEvent) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
recent = recent.filter((r) => r.id !== recipeId);
|
|
|
|
|
await fetch(`/api/recipes/${recipeId}`, {
|
|
|
|
|
method: 'PATCH',
|
|
|
|
|
headers: { 'content-type': 'application/json' },
|
|
|
|
|
body: JSON.stringify({ hidden_from_recent: true })
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-17 17:41:10 +02:00
|
|
|
const activeSearch = $derived(query.trim().length > 3);
|
2026-04-17 15:07:22 +02:00
|
|
|
</script>
|
|
|
|
|
|
2026-04-17 15:28:22 +02:00
|
|
|
<section class="hero">
|
2026-04-17 15:07:22 +02:00
|
|
|
<h1>Kochwas</h1>
|
2026-04-17 17:58:27 +02:00
|
|
|
<p class="tagline" aria-live="polite">{quote || '\u00a0'}</p>
|
2026-04-18 08:13:33 +02:00
|
|
|
<form class="search-form" onsubmit={submit}>
|
2026-04-18 08:28:02 +02:00
|
|
|
<div class="search-box">
|
|
|
|
|
<SearchFilter inline />
|
|
|
|
|
<input
|
|
|
|
|
type="search"
|
|
|
|
|
bind:value={query}
|
|
|
|
|
placeholder="Rezept suchen…"
|
|
|
|
|
autocomplete="off"
|
|
|
|
|
inputmode="search"
|
|
|
|
|
aria-label="Suchbegriff"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2026-04-17 15:07:22 +02:00
|
|
|
</form>
|
2026-04-17 15:28:22 +02:00
|
|
|
</section>
|
|
|
|
|
|
2026-04-17 17:41:10 +02:00
|
|
|
{#if activeSearch}
|
|
|
|
|
<section class="results">
|
2026-04-17 22:08:00 +02:00
|
|
|
{#if searching && hits.length === 0 && webHits.length === 0}
|
2026-04-17 18:40:38 +02:00
|
|
|
<SearchLoader scope="local" />
|
2026-04-17 22:08:00 +02:00
|
|
|
{:else}
|
|
|
|
|
{#if hits.length > 0}
|
|
|
|
|
<ul class="cards">
|
|
|
|
|
{#each hits as r (r.id)}
|
|
|
|
|
<li>
|
|
|
|
|
<a href={`/recipes/${r.id}`} class="card">
|
|
|
|
|
{#if r.image_path}
|
|
|
|
|
<img src={`/images/${r.image_path}`} alt="" loading="lazy" />
|
|
|
|
|
{:else}
|
|
|
|
|
<div class="placeholder"><CookingPot size={36} /></div>
|
2026-04-17 17:41:10 +02:00
|
|
|
{/if}
|
2026-04-17 22:08:00 +02:00
|
|
|
<div class="card-body">
|
|
|
|
|
<div class="title">{r.title}</div>
|
|
|
|
|
{#if r.source_domain}
|
|
|
|
|
<div class="domain">{r.source_domain}</div>
|
|
|
|
|
{/if}
|
|
|
|
|
</div>
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
{/each}
|
|
|
|
|
</ul>
|
|
|
|
|
{:else if searchedFor === query.trim() && !webSearching && webHits.length === 0 && !webError}
|
|
|
|
|
<p class="muted no-local-msg">Keine lokalen Rezepte für „{searchedFor}".</p>
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
{#if webHits.length > 0}
|
|
|
|
|
{#if hits.length > 0}
|
|
|
|
|
<h3 class="sep">Aus dem Internet</h3>
|
|
|
|
|
{:else if searchedFor === query.trim()}
|
|
|
|
|
<p class="muted no-local-msg">
|
|
|
|
|
Keine lokalen Rezepte für „{searchedFor}" — Ergebnisse aus dem Internet:
|
|
|
|
|
</p>
|
|
|
|
|
{/if}
|
2026-04-17 17:47:26 +02:00
|
|
|
<ul class="cards">
|
|
|
|
|
{#each webHits as w (w.url)}
|
|
|
|
|
<li>
|
|
|
|
|
<a class="card" href={`/preview?url=${encodeURIComponent(w.url)}`}>
|
|
|
|
|
{#if w.thumbnail}
|
|
|
|
|
<img src={w.thumbnail} alt="" loading="lazy" />
|
|
|
|
|
{:else}
|
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="placeholder"><CookingPot size={36} /></div>
|
2026-04-17 17:47:26 +02:00
|
|
|
{/if}
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<div class="title">{w.title}</div>
|
|
|
|
|
<div class="domain">{w.domain}</div>
|
|
|
|
|
</div>
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
{/each}
|
|
|
|
|
</ul>
|
2026-04-17 22:08:00 +02:00
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
{#if webSearching}
|
|
|
|
|
<SearchLoader scope="web" />
|
|
|
|
|
{:else if webError && webHits.length === 0}
|
|
|
|
|
<p class="error">Internet-Suche zurzeit nicht möglich: {webError}</p>
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
{#if searchedFor === query.trim() && !(localExhausted && webExhausted) && !(searching && hits.length === 0)}
|
|
|
|
|
<div class="more-cta">
|
|
|
|
|
<button class="more-btn" onclick={loadMore} disabled={loadingMore || webSearching}>
|
|
|
|
|
{loadingMore || webSearching ? 'Lade …' : '+ weitere Ergebnisse'}
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2026-04-17 17:47:26 +02:00
|
|
|
{/if}
|
2026-04-17 17:41:10 +02:00
|
|
|
{/if}
|
|
|
|
|
</section>
|
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
|
|
|
{:else}
|
|
|
|
|
{#if profileStore.active && favorites.length > 0}
|
|
|
|
|
<section class="listing">
|
|
|
|
|
<h2>Deine Favoriten</h2>
|
|
|
|
|
<ul class="cards">
|
|
|
|
|
{#each favorites as r (r.id)}
|
|
|
|
|
<li class="card-wrap">
|
|
|
|
|
<a href={`/recipes/${r.id}`} class="card">
|
|
|
|
|
{#if r.image_path}
|
|
|
|
|
<img src={`/images/${r.image_path}`} alt="" loading="lazy" />
|
|
|
|
|
{:else}
|
|
|
|
|
<div class="placeholder"><CookingPot size={36} /></div>
|
2026-04-17 15:28:22 +02:00
|
|
|
{/if}
|
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="card-body">
|
|
|
|
|
<div class="title">{r.title}</div>
|
|
|
|
|
{#if r.source_domain}
|
|
|
|
|
<div class="domain">{r.source_domain}</div>
|
|
|
|
|
{/if}
|
|
|
|
|
</div>
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
{/each}
|
|
|
|
|
</ul>
|
|
|
|
|
</section>
|
|
|
|
|
{/if}
|
|
|
|
|
{#if recent.length > 0}
|
|
|
|
|
<section class="listing">
|
|
|
|
|
<h2>Zuletzt hinzugefügt</h2>
|
|
|
|
|
<ul class="cards">
|
|
|
|
|
{#each recent as r (r.id)}
|
|
|
|
|
<li class="card-wrap">
|
|
|
|
|
<a href={`/recipes/${r.id}`} class="card">
|
|
|
|
|
{#if r.image_path}
|
|
|
|
|
<img src={`/images/${r.image_path}`} alt="" loading="lazy" />
|
|
|
|
|
{:else}
|
|
|
|
|
<div class="placeholder"><CookingPot size={36} /></div>
|
|
|
|
|
{/if}
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<div class="title">{r.title}</div>
|
|
|
|
|
{#if r.source_domain}
|
|
|
|
|
<div class="domain">{r.source_domain}</div>
|
|
|
|
|
{/if}
|
|
|
|
|
</div>
|
|
|
|
|
</a>
|
|
|
|
|
<button
|
|
|
|
|
class="dismiss"
|
|
|
|
|
aria-label="Aus Zuletzt-hinzugefügt entfernen"
|
|
|
|
|
onclick={(e) => dismissFromRecent(r.id, e)}
|
|
|
|
|
>
|
|
|
|
|
<X size={16} strokeWidth={2.5} />
|
|
|
|
|
</button>
|
|
|
|
|
</li>
|
|
|
|
|
{/each}
|
|
|
|
|
</ul>
|
|
|
|
|
</section>
|
|
|
|
|
{/if}
|
2026-04-17 15:28:22 +02:00
|
|
|
{/if}
|
2026-04-17 15:07:22 +02:00
|
|
|
|
|
|
|
|
<style>
|
2026-04-17 15:28:22 +02:00
|
|
|
.hero {
|
2026-04-17 15:07:22 +02:00
|
|
|
text-align: center;
|
2026-04-17 15:28:22 +02:00
|
|
|
padding: 3rem 0 1.5rem;
|
|
|
|
|
}
|
|
|
|
|
.hero h1 {
|
|
|
|
|
font-size: clamp(2.2rem, 8vw, 3.5rem);
|
2026-04-17 17:58:27 +02:00
|
|
|
margin: 0 0 0.5rem;
|
2026-04-17 15:28:22 +02:00
|
|
|
color: #2b6a3d;
|
|
|
|
|
letter-spacing: -0.02em;
|
2026-04-17 15:07:22 +02:00
|
|
|
}
|
2026-04-17 17:58:27 +02:00
|
|
|
.tagline {
|
|
|
|
|
margin: 0 auto 1.5rem;
|
|
|
|
|
max-width: 36rem;
|
|
|
|
|
color: #6a7670;
|
|
|
|
|
font-style: italic;
|
|
|
|
|
font-size: 1rem;
|
|
|
|
|
line-height: 1.35;
|
|
|
|
|
min-height: 1.4rem;
|
|
|
|
|
}
|
2026-04-17 15:07:22 +02:00
|
|
|
form {
|
|
|
|
|
display: flex;
|
2026-04-18 08:28:02 +02:00
|
|
|
}
|
|
|
|
|
.search-box {
|
|
|
|
|
flex: 1;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: stretch;
|
|
|
|
|
background: white;
|
|
|
|
|
border: 1px solid #cfd9d1;
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
min-height: 52px;
|
|
|
|
|
}
|
|
|
|
|
.search-box:focus-within {
|
|
|
|
|
outline: 2px solid #2b6a3d;
|
|
|
|
|
outline-offset: 1px;
|
2026-04-17 15:07:22 +02:00
|
|
|
}
|
2026-04-17 15:28:22 +02:00
|
|
|
input[type='search'] {
|
2026-04-17 15:07:22 +02:00
|
|
|
flex: 1;
|
2026-04-17 15:28:22 +02:00
|
|
|
padding: 0.9rem 1rem;
|
2026-04-17 15:07:22 +02:00
|
|
|
font-size: 1.1rem;
|
2026-04-18 08:28:02 +02:00
|
|
|
border: 0;
|
|
|
|
|
background: transparent;
|
|
|
|
|
min-width: 0;
|
2026-04-17 15:28:22 +02:00
|
|
|
}
|
|
|
|
|
input[type='search']:focus {
|
2026-04-18 08:28:02 +02:00
|
|
|
outline: none;
|
2026-04-17 15:07:22 +02:00
|
|
|
}
|
2026-04-17 17:41:10 +02:00
|
|
|
.results,
|
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
|
|
|
.listing {
|
2026-04-17 17:41:10 +02:00
|
|
|
margin-top: 1.5rem;
|
2026-04-17 15:07:22 +02:00
|
|
|
}
|
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
|
|
|
.listing h2 {
|
2026-04-17 15:28:22 +02:00
|
|
|
font-size: 1.05rem;
|
|
|
|
|
color: #444;
|
|
|
|
|
margin: 0 0 0.75rem;
|
|
|
|
|
}
|
2026-04-17 17:41:10 +02:00
|
|
|
.muted {
|
|
|
|
|
color: #888;
|
|
|
|
|
text-align: center;
|
2026-04-17 17:47:26 +02:00
|
|
|
padding: 1rem 0;
|
|
|
|
|
}
|
|
|
|
|
.no-local-msg {
|
|
|
|
|
font-size: 0.95rem;
|
|
|
|
|
padding: 0.25rem 0 1rem;
|
|
|
|
|
}
|
|
|
|
|
.error {
|
|
|
|
|
color: #c53030;
|
|
|
|
|
text-align: center;
|
|
|
|
|
padding: 1rem 0;
|
2026-04-17 17:41:10 +02:00
|
|
|
}
|
2026-04-17 15:28:22 +02:00
|
|
|
.cards {
|
|
|
|
|
list-style: none;
|
|
|
|
|
padding: 0;
|
|
|
|
|
margin: 0;
|
|
|
|
|
display: grid;
|
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
|
|
|
|
|
gap: 0.75rem;
|
|
|
|
|
}
|
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
|
|
|
.card-wrap {
|
|
|
|
|
position: relative;
|
|
|
|
|
}
|
2026-04-17 15:28:22 +02:00
|
|
|
.card {
|
|
|
|
|
display: block;
|
|
|
|
|
background: white;
|
|
|
|
|
border: 1px solid #e4eae7;
|
|
|
|
|
border-radius: 14px;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
text-decoration: none;
|
|
|
|
|
color: inherit;
|
|
|
|
|
transition: transform 0.1s;
|
|
|
|
|
}
|
|
|
|
|
.card:active {
|
|
|
|
|
transform: scale(0.98);
|
|
|
|
|
}
|
|
|
|
|
.card img,
|
|
|
|
|
.placeholder {
|
|
|
|
|
width: 100%;
|
|
|
|
|
aspect-ratio: 4 / 3;
|
|
|
|
|
object-fit: cover;
|
|
|
|
|
background: #eef3ef;
|
|
|
|
|
display: grid;
|
|
|
|
|
place-items: center;
|
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: #8fb097;
|
2026-04-17 15:28:22 +02:00
|
|
|
}
|
|
|
|
|
.card-body {
|
|
|
|
|
padding: 0.6rem 0.75rem 0.75rem;
|
|
|
|
|
}
|
|
|
|
|
.title {
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
font-size: 0.95rem;
|
|
|
|
|
line-height: 1.25;
|
|
|
|
|
}
|
|
|
|
|
.domain {
|
|
|
|
|
font-size: 0.8rem;
|
|
|
|
|
color: #888;
|
|
|
|
|
margin-top: 0.25rem;
|
|
|
|
|
}
|
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
|
|
|
.dismiss {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 0.4rem;
|
|
|
|
|
right: 0.4rem;
|
|
|
|
|
width: 28px;
|
|
|
|
|
height: 28px;
|
|
|
|
|
border-radius: 999px;
|
|
|
|
|
border: 0;
|
|
|
|
|
background: rgba(255, 255, 255, 0.9);
|
|
|
|
|
color: #444;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
|
|
|
|
|
opacity: 0;
|
|
|
|
|
transition: opacity 0.1s;
|
|
|
|
|
}
|
|
|
|
|
.card-wrap:hover .dismiss,
|
|
|
|
|
.dismiss:focus-visible {
|
|
|
|
|
opacity: 1;
|
|
|
|
|
}
|
|
|
|
|
@media (max-width: 640px) {
|
|
|
|
|
.dismiss {
|
|
|
|
|
opacity: 1; /* always visible on touch devices */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.dismiss:hover {
|
|
|
|
|
background: #fff;
|
|
|
|
|
color: #c53030;
|
|
|
|
|
}
|
2026-04-17 22:08:00 +02:00
|
|
|
.sep {
|
|
|
|
|
margin: 1.5rem 0 0.5rem;
|
|
|
|
|
font-size: 0.9rem;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
color: #666;
|
|
|
|
|
text-transform: uppercase;
|
|
|
|
|
letter-spacing: 0.04em;
|
|
|
|
|
padding-bottom: 0.3rem;
|
|
|
|
|
border-bottom: 1px solid #e4eae7;
|
|
|
|
|
}
|
|
|
|
|
.more-cta {
|
|
|
|
|
margin-top: 1.25rem;
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
|
|
|
|
.more-btn {
|
|
|
|
|
padding: 0.75rem 1.25rem;
|
|
|
|
|
background: white;
|
2026-04-17 17:47:26 +02:00
|
|
|
color: #2b6a3d;
|
2026-04-17 22:08:00 +02:00
|
|
|
border: 1px solid #cfd9d1;
|
|
|
|
|
border-radius: 10px;
|
2026-04-17 17:47:26 +02:00
|
|
|
font-size: 0.95rem;
|
2026-04-17 22:08:00 +02:00
|
|
|
min-height: 44px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
.more-btn:hover:not(:disabled) {
|
|
|
|
|
background: #f4f8f5;
|
2026-04-17 17:47:26 +02:00
|
|
|
}
|
2026-04-17 22:08:00 +02:00
|
|
|
.more-btn:disabled {
|
|
|
|
|
opacity: 0.6;
|
|
|
|
|
cursor: progress;
|
2026-04-17 17:41:10 +02:00
|
|
|
}
|
2026-04-17 15:07:22 +02:00
|
|
|
</style>
|