2026-04-17 15:28:22 +02:00
|
|
|
|
<script lang="ts">
|
|
|
|
|
|
import { onMount } from 'svelte';
|
2026-04-17 17:31:08 +02:00
|
|
|
|
import { page } from '$app/stores';
|
2026-04-17 17:41:10 +02:00
|
|
|
|
import { goto, afterNavigate } from '$app/navigation';
|
2026-04-18 11:06:52 +02:00
|
|
|
|
import { Settings, CookingPot, Utensils, Menu, BookOpen, ArrowLeft } from 'lucide-svelte';
|
2026-04-17 15:28:22 +02:00
|
|
|
|
import { profileStore } 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-17 19:38:00 +02:00
|
|
|
|
import { pwaStore } from '$lib/client/pwa.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
|
|
|
|
import ProfileSwitcher from '$lib/components/ProfileSwitcher.svelte';
|
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
|
|
|
|
import ConfirmDialog from '$lib/components/ConfirmDialog.svelte';
|
2026-04-17 18:40:38 +02:00
|
|
|
|
import SearchLoader from '$lib/components/SearchLoader.svelte';
|
2026-04-18 08:53:54 +02:00
|
|
|
|
import SearchFilter from '$lib/components/SearchFilter.svelte';
|
2026-04-17 19:38:00 +02:00
|
|
|
|
import UpdateToast from '$lib/components/UpdateToast.svelte';
|
2026-04-18 16:21:14 +02:00
|
|
|
|
import Toast from '$lib/components/Toast.svelte';
|
2026-04-18 16:29:31 +02:00
|
|
|
|
import SyncIndicator from '$lib/components/SyncIndicator.svelte';
|
|
|
|
|
|
import { network } from '$lib/client/network.svelte';
|
2026-04-18 16:57:49 +02:00
|
|
|
|
import { installPrompt } from '$lib/client/install-prompt.svelte';
|
2026-04-18 16:38:09 +02:00
|
|
|
|
import { registerServiceWorker } from '$lib/client/sw-register';
|
2026-04-17 17:41:10 +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 15:28:22 +02:00
|
|
|
|
|
|
|
|
|
|
let { children } = $props();
|
|
|
|
|
|
|
2026-04-18 08:03:52 +02:00
|
|
|
|
const NAV_PAGE_SIZE = 30;
|
|
|
|
|
|
|
2026-04-17 17:31:08 +02:00
|
|
|
|
let navQuery = $state('');
|
2026-04-17 17:41:10 +02:00
|
|
|
|
let navHits = $state<SearchHit[]>([]);
|
2026-04-17 17:47:26 +02:00
|
|
|
|
let navWebHits = $state<WebHit[]>([]);
|
2026-04-17 17:41:10 +02:00
|
|
|
|
let navSearching = $state(false);
|
2026-04-17 17:47:26 +02:00
|
|
|
|
let navWebSearching = $state(false);
|
|
|
|
|
|
let navWebError = $state<string | null>(null);
|
2026-04-17 17:41:10 +02:00
|
|
|
|
let navOpen = $state(false);
|
2026-04-18 08:03:52 +02:00
|
|
|
|
let navLocalExhausted = $state(false);
|
|
|
|
|
|
let navWebPageno = $state(0);
|
|
|
|
|
|
let navWebExhausted = $state(false);
|
|
|
|
|
|
let navLoadingMore = $state(false);
|
2026-04-17 17:41:10 +02:00
|
|
|
|
let navContainer: HTMLElement | undefined = $state();
|
|
|
|
|
|
let debounceTimer: ReturnType<typeof setTimeout> | null = null;
|
2026-04-17 21:54:04 +02:00
|
|
|
|
let menuOpen = $state(false);
|
|
|
|
|
|
let menuContainer: HTMLElement | undefined = $state();
|
2026-04-17 17:41:10 +02:00
|
|
|
|
|
|
|
|
|
|
const showHeaderSearch = $derived(
|
|
|
|
|
|
$page.url.pathname.startsWith('/recipes/') || $page.url.pathname === '/preview'
|
|
|
|
|
|
);
|
2026-04-17 17:31:08 +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:31:08 +02:00
|
|
|
|
$effect(() => {
|
2026-04-17 17:41:10 +02:00
|
|
|
|
const q = navQuery.trim();
|
|
|
|
|
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
|
|
|
|
if (q.length <= 3) {
|
|
|
|
|
|
navHits = [];
|
2026-04-17 17:47:26 +02:00
|
|
|
|
navWebHits = [];
|
2026-04-17 17:41:10 +02:00
|
|
|
|
navSearching = false;
|
2026-04-17 17:47:26 +02:00
|
|
|
|
navWebSearching = false;
|
|
|
|
|
|
navWebError = null;
|
2026-04-17 17:41:10 +02:00
|
|
|
|
navOpen = false;
|
2026-04-18 08:03:52 +02:00
|
|
|
|
navLocalExhausted = false;
|
|
|
|
|
|
navWebPageno = 0;
|
|
|
|
|
|
navWebExhausted = false;
|
2026-04-17 17:41:10 +02:00
|
|
|
|
return;
|
2026-04-17 17:31:08 +02:00
|
|
|
|
}
|
2026-04-17 17:41:10 +02:00
|
|
|
|
navSearching = true;
|
2026-04-17 17:47:26 +02:00
|
|
|
|
navWebHits = [];
|
|
|
|
|
|
navWebSearching = false;
|
|
|
|
|
|
navWebError = null;
|
2026-04-17 17:41:10 +02:00
|
|
|
|
navOpen = true;
|
2026-04-18 08:03:52 +02:00
|
|
|
|
navLocalExhausted = false;
|
|
|
|
|
|
navWebPageno = 0;
|
|
|
|
|
|
navWebExhausted = false;
|
2026-04-17 17:41:10 +02:00
|
|
|
|
debounceTimer = setTimeout(async () => {
|
|
|
|
|
|
try {
|
2026-04-18 08:03:52 +02:00
|
|
|
|
const res = await fetch(
|
2026-04-18 08:13:33 +02:00
|
|
|
|
`/api/recipes/search?q=${encodeURIComponent(q)}&limit=${NAV_PAGE_SIZE}${filterParam()}`
|
2026-04-18 08:03:52 +02:00
|
|
|
|
);
|
2026-04-17 17:41:10 +02:00
|
|
|
|
const body = await res.json();
|
2026-04-17 17:47:26 +02:00
|
|
|
|
if (navQuery.trim() !== q) return;
|
|
|
|
|
|
navHits = body.hits;
|
2026-04-18 08:03:52 +02:00
|
|
|
|
if (navHits.length < NAV_PAGE_SIZE) navLocalExhausted = true;
|
|
|
|
|
|
if (navHits.length === 0) {
|
2026-04-17 17:47:26 +02:00
|
|
|
|
navWebSearching = true;
|
|
|
|
|
|
try {
|
2026-04-18 08:03:52 +02:00
|
|
|
|
const wres = await fetch(
|
2026-04-18 08:13:33 +02:00
|
|
|
|
`/api/recipes/search/web?q=${encodeURIComponent(q)}&pageno=1${filterParam()}`
|
2026-04-18 08:03:52 +02:00
|
|
|
|
);
|
2026-04-17 17:47:26 +02:00
|
|
|
|
if (navQuery.trim() !== q) return;
|
|
|
|
|
|
if (!wres.ok) {
|
|
|
|
|
|
const err = await wres.json().catch(() => ({}));
|
|
|
|
|
|
navWebError = err.message ?? `HTTP ${wres.status}`;
|
2026-04-18 08:03:52 +02:00
|
|
|
|
navWebExhausted = true;
|
2026-04-17 17:47:26 +02:00
|
|
|
|
} else {
|
|
|
|
|
|
const wbody = await wres.json();
|
|
|
|
|
|
navWebHits = wbody.hits;
|
2026-04-18 08:03:52 +02:00
|
|
|
|
navWebPageno = 1;
|
|
|
|
|
|
if (navWebHits.length === 0) navWebExhausted = true;
|
2026-04-17 17:47:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
if (navQuery.trim() === q) navWebSearching = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-04-17 17:41:10 +02:00
|
|
|
|
} finally {
|
|
|
|
|
|
if (navQuery.trim() === q) navSearching = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}, 300);
|
2026-04-17 17:31:08 +02:00
|
|
|
|
});
|
|
|
|
|
|
|
2026-04-18 08:03:52 +02:00
|
|
|
|
async function loadMoreNav() {
|
|
|
|
|
|
if (navLoadingMore) return;
|
|
|
|
|
|
const q = navQuery.trim();
|
|
|
|
|
|
if (!q) return;
|
|
|
|
|
|
navLoadingMore = true;
|
|
|
|
|
|
try {
|
|
|
|
|
|
if (!navLocalExhausted) {
|
|
|
|
|
|
const res = await fetch(
|
2026-04-18 08:13:33 +02:00
|
|
|
|
`/api/recipes/search?q=${encodeURIComponent(q)}&limit=${NAV_PAGE_SIZE}&offset=${navHits.length}${filterParam()}`
|
2026-04-18 08:03:52 +02:00
|
|
|
|
);
|
|
|
|
|
|
const body = await res.json();
|
|
|
|
|
|
if (navQuery.trim() !== q) return;
|
|
|
|
|
|
const more = body.hits as SearchHit[];
|
|
|
|
|
|
const seen = new Set(navHits.map((h) => h.id));
|
|
|
|
|
|
const deduped = more.filter((h) => !seen.has(h.id));
|
|
|
|
|
|
navHits = [...navHits, ...deduped];
|
|
|
|
|
|
if (more.length < NAV_PAGE_SIZE) navLocalExhausted = true;
|
|
|
|
|
|
} else if (!navWebExhausted) {
|
|
|
|
|
|
const nextPage = navWebPageno + 1;
|
|
|
|
|
|
navWebSearching = navWebHits.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-18 08:03:52 +02:00
|
|
|
|
);
|
|
|
|
|
|
if (navQuery.trim() !== q) return;
|
|
|
|
|
|
if (!wres.ok) {
|
|
|
|
|
|
const err = await wres.json().catch(() => ({}));
|
|
|
|
|
|
navWebError = err.message ?? `HTTP ${wres.status}`;
|
|
|
|
|
|
navWebExhausted = true;
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
const wbody = await wres.json();
|
|
|
|
|
|
const more = wbody.hits as WebHit[];
|
|
|
|
|
|
const seen = new Set(navWebHits.map((h) => h.url));
|
|
|
|
|
|
const deduped = more.filter((h) => !seen.has(h.url));
|
|
|
|
|
|
if (deduped.length === 0) {
|
|
|
|
|
|
navWebExhausted = true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
navWebHits = [...navWebHits, ...deduped];
|
|
|
|
|
|
navWebPageno = nextPage;
|
|
|
|
|
|
}
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
if (navQuery.trim() === q) navWebSearching = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
navLoadingMore = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-17 17:41:10 +02:00
|
|
|
|
function submitNav(e: SubmitEvent) {
|
2026-04-17 17:31:08 +02:00
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
const q = navQuery.trim();
|
|
|
|
|
|
if (!q) return;
|
2026-04-17 17:41:10 +02:00
|
|
|
|
navOpen = false;
|
2026-04-17 22:08:00 +02:00
|
|
|
|
void goto(`/?q=${encodeURIComponent(q)}`);
|
2026-04-17 17:31:08 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-17 17:41:10 +02:00
|
|
|
|
function handleClickOutside(e: MouseEvent) {
|
|
|
|
|
|
if (navContainer && !navContainer.contains(e.target as Node)) {
|
|
|
|
|
|
navOpen = false;
|
|
|
|
|
|
}
|
2026-04-17 21:54:04 +02:00
|
|
|
|
if (menuContainer && !menuContainer.contains(e.target as Node)) {
|
|
|
|
|
|
menuOpen = false;
|
|
|
|
|
|
}
|
2026-04-17 17:41:10 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function handleKey(e: KeyboardEvent) {
|
2026-04-17 21:54:04 +02:00
|
|
|
|
if (e.key === 'Escape') {
|
|
|
|
|
|
if (navOpen) navOpen = false;
|
|
|
|
|
|
if (menuOpen) menuOpen = false;
|
|
|
|
|
|
}
|
2026-04-17 17:41:10 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function pickHit() {
|
|
|
|
|
|
navOpen = false;
|
|
|
|
|
|
navQuery = '';
|
|
|
|
|
|
navHits = [];
|
2026-04-17 17:47:26 +02:00
|
|
|
|
navWebHits = [];
|
2026-04-17 17:41:10 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
afterNavigate(() => {
|
|
|
|
|
|
navQuery = '';
|
|
|
|
|
|
navHits = [];
|
2026-04-17 17:47:26 +02:00
|
|
|
|
navWebHits = [];
|
2026-04-17 17:41:10 +02:00
|
|
|
|
navOpen = false;
|
2026-04-17 21:54:04 +02:00
|
|
|
|
menuOpen = false;
|
2026-04-17 19:29:00 +02:00
|
|
|
|
// Badge nach jeder Client-Navigation frisch halten — sonst kann er
|
|
|
|
|
|
// hinter den tatsächlichen Wunschliste-Einträgen herlaufen, wenn
|
|
|
|
|
|
// auf einem anderen Gerät oder in einem anderen Tab etwas geändert
|
|
|
|
|
|
// wurde.
|
|
|
|
|
|
void wishlistStore.refresh();
|
2026-04-17 17:41:10 +02:00
|
|
|
|
});
|
|
|
|
|
|
|
2026-04-17 15:28:22 +02:00
|
|
|
|
onMount(() => {
|
|
|
|
|
|
profileStore.load();
|
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 08:13:33 +02:00
|
|
|
|
void searchFilterStore.load();
|
2026-04-17 19:38:00 +02:00
|
|
|
|
void pwaStore.init();
|
2026-04-18 16:29:31 +02:00
|
|
|
|
network.init();
|
2026-04-18 16:57:49 +02:00
|
|
|
|
installPrompt.init();
|
2026-04-18 16:38:09 +02:00
|
|
|
|
void registerServiceWorker();
|
2026-04-17 17:41:10 +02:00
|
|
|
|
document.addEventListener('click', handleClickOutside);
|
|
|
|
|
|
document.addEventListener('keydown', handleKey);
|
|
|
|
|
|
return () => {
|
|
|
|
|
|
document.removeEventListener('click', handleClickOutside);
|
|
|
|
|
|
document.removeEventListener('keydown', handleKey);
|
|
|
|
|
|
};
|
2026-04-17 15:28:22 +02:00
|
|
|
|
});
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
2026-04-18 16:21:14 +02:00
|
|
|
|
<Toast />
|
2026-04-18 16:29:31 +02:00
|
|
|
|
<SyncIndicator />
|
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
|
|
|
|
<ConfirmDialog />
|
2026-04-17 19:38:00 +02:00
|
|
|
|
<UpdateToast />
|
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
|
|
|
|
|
2026-04-17 15:28:22 +02:00
|
|
|
|
<header class="bar">
|
2026-04-17 17:41:10 +02:00
|
|
|
|
<div class="bar-inner">
|
2026-04-18 11:06:52 +02:00
|
|
|
|
{#if $page.url.pathname === '/'}
|
|
|
|
|
|
<a href="/" class="brand">Kochwas</a>
|
|
|
|
|
|
{:else}
|
|
|
|
|
|
<a href="/" class="home-back" aria-label="Zurück zur Startseite">
|
|
|
|
|
|
<ArrowLeft size={22} strokeWidth={2} />
|
|
|
|
|
|
</a>
|
|
|
|
|
|
{/if}
|
2026-04-17 17:41:10 +02:00
|
|
|
|
{#if showHeaderSearch}
|
|
|
|
|
|
<div class="nav-search-wrap" bind:this={navContainer}>
|
|
|
|
|
|
<form class="nav-search" onsubmit={submitNav} role="search">
|
2026-04-18 08:53:54 +02:00
|
|
|
|
<SearchFilter inline />
|
2026-04-17 17:41:10 +02:00
|
|
|
|
<input
|
|
|
|
|
|
type="search"
|
|
|
|
|
|
bind:value={navQuery}
|
|
|
|
|
|
onfocus={() => {
|
|
|
|
|
|
if (navHits.length > 0 || navQuery.trim().length > 3) navOpen = true;
|
|
|
|
|
|
}}
|
|
|
|
|
|
placeholder="Rezept suchen…"
|
|
|
|
|
|
autocomplete="off"
|
|
|
|
|
|
inputmode="search"
|
|
|
|
|
|
aria-label="Suchbegriff"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</form>
|
|
|
|
|
|
{#if navOpen}
|
|
|
|
|
|
<div class="dropdown" role="listbox">
|
2026-04-18 08:03:52 +02:00
|
|
|
|
{#if navSearching && navHits.length === 0 && navWebHits.length === 0}
|
2026-04-17 18:40:38 +02:00
|
|
|
|
<SearchLoader scope="local" size="sm" />
|
2026-04-17 17:47:26 +02:00
|
|
|
|
{:else}
|
2026-04-18 08:03:52 +02:00
|
|
|
|
{#if navHits.length > 0}
|
|
|
|
|
|
<ul class="dd-list">
|
|
|
|
|
|
{#each navHits as r (r.id)}
|
|
|
|
|
|
<li>
|
|
|
|
|
|
<a
|
|
|
|
|
|
href={`/recipes/${r.id}`}
|
|
|
|
|
|
class="dd-item"
|
|
|
|
|
|
onclick={pickHit}
|
|
|
|
|
|
role="option"
|
|
|
|
|
|
aria-selected="false"
|
|
|
|
|
|
>
|
|
|
|
|
|
{#if r.image_path}
|
|
|
|
|
|
<img src={`/images/${r.image_path}`} alt="" loading="lazy" />
|
|
|
|
|
|
{:else}
|
|
|
|
|
|
<div class="dd-placeholder"><CookingPot size={22} /></div>
|
|
|
|
|
|
{/if}
|
|
|
|
|
|
<div class="dd-body">
|
|
|
|
|
|
<div class="dd-title">{r.title}</div>
|
|
|
|
|
|
{#if r.source_domain}
|
|
|
|
|
|
<div class="dd-domain">{r.source_domain}</div>
|
|
|
|
|
|
{/if}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</a>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
{/each}
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
|
|
{#if navWebHits.length > 0}
|
|
|
|
|
|
{#if navHits.length > 0}
|
|
|
|
|
|
<p class="dd-section">Aus dem Internet</p>
|
|
|
|
|
|
{:else}
|
|
|
|
|
|
<p class="dd-section">Keine lokalen Rezepte – aus dem Internet:</p>
|
|
|
|
|
|
{/if}
|
2026-04-17 17:47:26 +02:00
|
|
|
|
<ul class="dd-list">
|
|
|
|
|
|
{#each navWebHits as w (w.url)}
|
|
|
|
|
|
<li>
|
|
|
|
|
|
<a
|
|
|
|
|
|
href={`/preview?url=${encodeURIComponent(w.url)}`}
|
|
|
|
|
|
class="dd-item"
|
|
|
|
|
|
onclick={pickHit}
|
|
|
|
|
|
role="option"
|
|
|
|
|
|
aria-selected="false"
|
|
|
|
|
|
>
|
|
|
|
|
|
{#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="dd-placeholder"><Utensils size={22} /></div>
|
2026-04-17 17:47:26 +02:00
|
|
|
|
{/if}
|
|
|
|
|
|
<div class="dd-body">
|
|
|
|
|
|
<div class="dd-title">{w.title}</div>
|
|
|
|
|
|
<div class="dd-domain">{w.domain}</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</a>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
{/each}
|
|
|
|
|
|
</ul>
|
2026-04-18 08:03:52 +02:00
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
|
|
{#if navWebSearching}
|
|
|
|
|
|
<SearchLoader scope="web" size="sm" />
|
|
|
|
|
|
{:else if navWebError && navWebHits.length === 0}
|
|
|
|
|
|
<p class="dd-status dd-error">Internet-Suche zurzeit nicht möglich.</p>
|
|
|
|
|
|
{:else if navHits.length === 0 && navWebHits.length === 0 && !navSearching}
|
|
|
|
|
|
<p class="dd-status">Auch im Internet nichts gefunden.</p>
|
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
|
|
{#if !(navLocalExhausted && navWebExhausted) && (navHits.length > 0 || navWebHits.length > 0)}
|
|
|
|
|
|
<button
|
2026-04-17 22:13:03 +02:00
|
|
|
|
class="dd-web"
|
2026-04-18 08:03:52 +02:00
|
|
|
|
type="button"
|
|
|
|
|
|
onclick={loadMoreNav}
|
|
|
|
|
|
disabled={navLoadingMore || navWebSearching}
|
2026-04-17 22:13:03 +02:00
|
|
|
|
>
|
2026-04-18 08:03:52 +02:00
|
|
|
|
<span
|
|
|
|
|
|
>{navLoadingMore || navWebSearching
|
|
|
|
|
|
? 'Lade …'
|
|
|
|
|
|
: '+ weitere Ergebnisse'}</span
|
|
|
|
|
|
>
|
|
|
|
|
|
</button>
|
2026-04-17 17:47:26 +02:00
|
|
|
|
{/if}
|
2026-04-17 17:41:10 +02:00
|
|
|
|
{/if}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
{/if}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
{/if}
|
|
|
|
|
|
<div class="bar-right">
|
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
|
|
|
|
<a
|
|
|
|
|
|
href="/wishlist"
|
|
|
|
|
|
class="nav-link wishlist-link"
|
|
|
|
|
|
aria-label={wishlistStore.count > 0
|
|
|
|
|
|
? `Wunschliste (${wishlistStore.count})`
|
|
|
|
|
|
: 'Wunschliste'}
|
|
|
|
|
|
>
|
2026-04-17 19:31:24 +02:00
|
|
|
|
<CookingPot size={20} strokeWidth={2} />
|
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 wishlistStore.count > 0}
|
|
|
|
|
|
<span class="badge">{wishlistStore.count}</span>
|
|
|
|
|
|
{/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
|
|
|
|
</a>
|
2026-04-17 21:54:04 +02:00
|
|
|
|
<div class="menu-wrap" bind:this={menuContainer}>
|
|
|
|
|
|
<button
|
|
|
|
|
|
class="nav-link"
|
|
|
|
|
|
aria-label="Menü"
|
|
|
|
|
|
aria-haspopup="menu"
|
|
|
|
|
|
aria-expanded={menuOpen}
|
|
|
|
|
|
onclick={() => (menuOpen = !menuOpen)}
|
|
|
|
|
|
>
|
|
|
|
|
|
<Menu size={22} strokeWidth={2} />
|
|
|
|
|
|
</button>
|
|
|
|
|
|
{#if menuOpen}
|
|
|
|
|
|
<div class="menu" role="menu">
|
|
|
|
|
|
<a href="/recipes" class="menu-item" role="menuitem" onclick={() => (menuOpen = false)}>
|
|
|
|
|
|
<BookOpen size={18} strokeWidth={2} />
|
|
|
|
|
|
<span>Register</span>
|
|
|
|
|
|
</a>
|
|
|
|
|
|
<a href="/admin" class="menu-item" role="menuitem" onclick={() => (menuOpen = false)}>
|
|
|
|
|
|
<Settings size={18} strokeWidth={2} />
|
|
|
|
|
|
<span>Einstellungen</span>
|
|
|
|
|
|
</a>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
{/if}
|
|
|
|
|
|
</div>
|
2026-04-17 17:41:10 +02:00
|
|
|
|
<ProfileSwitcher />
|
|
|
|
|
|
</div>
|
2026-04-17 15:35:20 +02:00
|
|
|
|
</div>
|
2026-04-17 15:28:22 +02:00
|
|
|
|
</header>
|
|
|
|
|
|
|
|
|
|
|
|
<main>
|
|
|
|
|
|
{@render children()}
|
|
|
|
|
|
</main>
|
|
|
|
|
|
|
|
|
|
|
|
<style>
|
2026-04-19 11:43:19 +02:00
|
|
|
|
:global(:root) {
|
|
|
|
|
|
--pill-radius: 999px;
|
|
|
|
|
|
}
|
2026-04-17 15:28:22 +02:00
|
|
|
|
:global(html, body) {
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
background: #f8faf8;
|
|
|
|
|
|
color: #1a1a1a;
|
|
|
|
|
|
font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
|
|
|
|
|
|
-webkit-font-smoothing: antialiased;
|
|
|
|
|
|
}
|
|
|
|
|
|
:global(a) {
|
|
|
|
|
|
color: #2b6a3d;
|
|
|
|
|
|
}
|
|
|
|
|
|
:global(*) {
|
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
}
|
|
|
|
|
|
.bar {
|
|
|
|
|
|
position: sticky;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
z-index: 10;
|
2026-04-17 17:41:10 +02:00
|
|
|
|
background: white;
|
|
|
|
|
|
border-bottom: 1px solid #e4eae7;
|
|
|
|
|
|
}
|
|
|
|
|
|
.bar-inner {
|
2026-04-18 11:00:48 +02:00
|
|
|
|
max-width: 1040px;
|
2026-04-17 17:41:10 +02:00
|
|
|
|
margin: 0 auto;
|
2026-04-17 15:28:22 +02:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
2026-04-17 17:31:08 +02:00
|
|
|
|
gap: 0.6rem;
|
|
|
|
|
|
padding: 0.6rem 1rem;
|
2026-04-17 17:52:51 +02:00
|
|
|
|
position: relative;
|
2026-04-17 15:28:22 +02:00
|
|
|
|
}
|
|
|
|
|
|
.brand {
|
|
|
|
|
|
font-size: 1.15rem;
|
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
|
text-decoration: none;
|
|
|
|
|
|
color: #2b6a3d;
|
2026-04-17 17:31:08 +02:00
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
}
|
2026-04-18 11:06:52 +02:00
|
|
|
|
.home-back {
|
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
width: 40px;
|
|
|
|
|
|
height: 40px;
|
2026-04-19 11:43:19 +02:00
|
|
|
|
border-radius: var(--pill-radius);
|
2026-04-18 11:06:52 +02:00
|
|
|
|
color: #2b6a3d;
|
|
|
|
|
|
text-decoration: none;
|
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
.home-back:hover {
|
|
|
|
|
|
background: #f4f8f5;
|
|
|
|
|
|
}
|
2026-04-17 17:41:10 +02:00
|
|
|
|
.nav-search-wrap {
|
|
|
|
|
|
position: relative;
|
2026-04-17 17:31:08 +02:00
|
|
|
|
flex: 1;
|
|
|
|
|
|
min-width: 0;
|
2026-04-17 17:41:10 +02:00
|
|
|
|
}
|
|
|
|
|
|
.nav-search {
|
2026-04-17 17:31:08 +02:00
|
|
|
|
display: flex;
|
2026-04-18 08:53:54 +02:00
|
|
|
|
align-items: stretch;
|
2026-04-17 17:31:08 +02:00
|
|
|
|
border: 1px solid #cfd9d1;
|
2026-04-18 09:06:22 +02:00
|
|
|
|
border-radius: 12px;
|
|
|
|
|
|
background: white;
|
2026-04-17 17:31:08 +02:00
|
|
|
|
min-height: 40px;
|
|
|
|
|
|
}
|
2026-04-18 08:53:54 +02:00
|
|
|
|
.nav-search:focus-within {
|
2026-04-17 17:31:08 +02:00
|
|
|
|
outline: 2px solid #2b6a3d;
|
|
|
|
|
|
outline-offset: 1px;
|
2026-04-17 15:28:22 +02:00
|
|
|
|
}
|
2026-04-18 08:53:54 +02:00
|
|
|
|
.nav-search input {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
padding: 0.55rem 0.85rem;
|
|
|
|
|
|
font-size: 0.95rem;
|
|
|
|
|
|
border: 0;
|
|
|
|
|
|
background: transparent;
|
|
|
|
|
|
min-width: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
.nav-search input:focus {
|
|
|
|
|
|
outline: none;
|
|
|
|
|
|
}
|
2026-04-17 17:41:10 +02:00
|
|
|
|
.dropdown {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: calc(100% + 0.4rem);
|
|
|
|
|
|
left: 0;
|
|
|
|
|
|
right: 0;
|
|
|
|
|
|
background: white;
|
|
|
|
|
|
border: 1px solid #e4eae7;
|
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
|
box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
|
|
|
|
|
|
max-height: 70vh;
|
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
|
z-index: 50;
|
|
|
|
|
|
}
|
|
|
|
|
|
.dd-list {
|
|
|
|
|
|
list-style: none;
|
|
|
|
|
|
padding: 0.35rem;
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
gap: 0.1rem;
|
|
|
|
|
|
}
|
|
|
|
|
|
.dd-item {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 0.65rem;
|
|
|
|
|
|
padding: 0.45rem 0.55rem;
|
|
|
|
|
|
text-decoration: none;
|
|
|
|
|
|
color: #1a1a1a;
|
|
|
|
|
|
border-radius: 10px;
|
|
|
|
|
|
min-height: 52px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.dd-item:hover {
|
|
|
|
|
|
background: #f4f8f5;
|
|
|
|
|
|
}
|
|
|
|
|
|
.dd-item img,
|
|
|
|
|
|
.dd-placeholder {
|
|
|
|
|
|
width: 44px;
|
|
|
|
|
|
height: 44px;
|
|
|
|
|
|
object-fit: cover;
|
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
background: #eef3ef;
|
|
|
|
|
|
display: grid;
|
|
|
|
|
|
place-items: center;
|
|
|
|
|
|
font-size: 1.3rem;
|
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
.dd-body {
|
|
|
|
|
|
min-width: 0;
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
.dd-title {
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
font-size: 0.95rem;
|
|
|
|
|
|
line-height: 1.25;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
}
|
|
|
|
|
|
.dd-domain {
|
|
|
|
|
|
font-size: 0.78rem;
|
|
|
|
|
|
color: #888;
|
|
|
|
|
|
margin-top: 0.1rem;
|
|
|
|
|
|
}
|
|
|
|
|
|
.dd-status {
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
color: #888;
|
|
|
|
|
|
padding: 0.9rem 0.6rem;
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
font-size: 0.9rem;
|
|
|
|
|
|
}
|
2026-04-17 17:47:26 +02:00
|
|
|
|
.dd-error {
|
|
|
|
|
|
color: #c53030;
|
|
|
|
|
|
}
|
|
|
|
|
|
.dd-section {
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
padding: 0.6rem 0.85rem 0.3rem;
|
|
|
|
|
|
font-size: 0.8rem;
|
|
|
|
|
|
color: #888;
|
|
|
|
|
|
border-bottom: 1px solid #f0f3f1;
|
|
|
|
|
|
text-transform: uppercase;
|
|
|
|
|
|
letter-spacing: 0.03em;
|
|
|
|
|
|
}
|
2026-04-17 17:41:10 +02:00
|
|
|
|
.dd-web {
|
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: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
gap: 0.4rem;
|
2026-04-17 17:41:10 +02:00
|
|
|
|
padding: 0.75rem 0.85rem;
|
2026-04-18 08:03:52 +02:00
|
|
|
|
border: 0;
|
2026-04-17 17:41:10 +02:00
|
|
|
|
border-top: 1px solid #e4eae7;
|
|
|
|
|
|
text-decoration: none;
|
|
|
|
|
|
color: #2b6a3d;
|
|
|
|
|
|
font-size: 0.95rem;
|
|
|
|
|
|
background: #fafdfb;
|
2026-04-18 08:03:52 +02:00
|
|
|
|
width: 100%;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
font-family: inherit;
|
2026-04-17 17:41:10 +02:00
|
|
|
|
}
|
2026-04-18 08:03:52 +02:00
|
|
|
|
.dd-web:hover:not(:disabled) {
|
2026-04-17 17:41:10 +02:00
|
|
|
|
background: #eaf4ed;
|
|
|
|
|
|
}
|
2026-04-18 08:03:52 +02:00
|
|
|
|
.dd-web:disabled {
|
|
|
|
|
|
opacity: 0.6;
|
|
|
|
|
|
cursor: progress;
|
|
|
|
|
|
}
|
2026-04-17 15:35:20 +02:00
|
|
|
|
.bar-right {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
2026-04-17 17:31:08 +02:00
|
|
|
|
gap: 0.4rem;
|
|
|
|
|
|
flex-shrink: 0;
|
2026-04-17 17:43:08 +02:00
|
|
|
|
margin-left: auto;
|
2026-04-17 17:31:08 +02:00
|
|
|
|
}
|
2026-04-17 21:54:04 +02:00
|
|
|
|
.menu-wrap {
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
}
|
|
|
|
|
|
.menu-wrap > .nav-link {
|
|
|
|
|
|
background: transparent;
|
|
|
|
|
|
border: 0;
|
|
|
|
|
|
cursor: pointer;
|
2026-04-17 22:14:21 +02:00
|
|
|
|
color: #2b6a3d;
|
2026-04-17 21:54:04 +02:00
|
|
|
|
}
|
|
|
|
|
|
.menu {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: calc(100% + 0.35rem);
|
|
|
|
|
|
right: 0;
|
|
|
|
|
|
background: white;
|
|
|
|
|
|
border: 1px solid #e4eae7;
|
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
|
box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
|
|
|
|
|
|
min-width: 180px;
|
|
|
|
|
|
padding: 0.3rem;
|
|
|
|
|
|
z-index: 55;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
}
|
|
|
|
|
|
.menu-item {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 0.55rem;
|
|
|
|
|
|
padding: 0.6rem 0.75rem;
|
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
text-decoration: none;
|
|
|
|
|
|
color: #1a1a1a;
|
|
|
|
|
|
font-size: 0.95rem;
|
|
|
|
|
|
min-height: 44px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.menu-item:hover {
|
|
|
|
|
|
background: #f4f8f5;
|
|
|
|
|
|
}
|
2026-04-17 17:41:10 +02:00
|
|
|
|
.nav-link {
|
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
width: 40px;
|
|
|
|
|
|
height: 40px;
|
2026-04-19 11:43:19 +02:00
|
|
|
|
border-radius: var(--pill-radius);
|
2026-04-17 17:41:10 +02:00
|
|
|
|
text-decoration: none;
|
|
|
|
|
|
font-size: 1.15rem;
|
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
|
|
|
|
position: relative;
|
2026-04-17 17:41:10 +02:00
|
|
|
|
}
|
|
|
|
|
|
.nav-link:hover {
|
|
|
|
|
|
background: #f4f8f5;
|
|
|
|
|
|
}
|
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
|
|
|
|
.badge {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: -2px;
|
|
|
|
|
|
right: -2px;
|
|
|
|
|
|
min-width: 18px;
|
|
|
|
|
|
height: 18px;
|
|
|
|
|
|
padding: 0 5px;
|
2026-04-19 11:43:19 +02:00
|
|
|
|
border-radius: var(--pill-radius);
|
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
|
|
|
|
background: #c53030;
|
|
|
|
|
|
color: white;
|
|
|
|
|
|
font-size: 0.7rem;
|
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
|
line-height: 18px;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
box-shadow: 0 0 0 2px white;
|
|
|
|
|
|
pointer-events: none;
|
|
|
|
|
|
}
|
2026-04-17 17:41:10 +02:00
|
|
|
|
main {
|
|
|
|
|
|
padding: 0 1rem 4rem;
|
2026-04-18 11:00:48 +02:00
|
|
|
|
max-width: 1040px;
|
2026-04-17 17:41:10 +02:00
|
|
|
|
margin: 0 auto;
|
|
|
|
|
|
}
|
2026-04-17 17:31:08 +02:00
|
|
|
|
@media (max-width: 520px) {
|
2026-04-17 21:54:04 +02:00
|
|
|
|
/* App-Icon auf engen Screens komplett aus — die Suche bekommt den Platz. */
|
2026-04-17 17:31:08 +02:00
|
|
|
|
.brand {
|
2026-04-17 21:54:04 +02:00
|
|
|
|
display: none;
|
2026-04-17 17:31:08 +02:00
|
|
|
|
}
|
|
|
|
|
|
.nav-link {
|
|
|
|
|
|
width: 36px;
|
|
|
|
|
|
height: 36px;
|
|
|
|
|
|
font-size: 1.05rem;
|
|
|
|
|
|
}
|
2026-04-17 17:52:51 +02:00
|
|
|
|
/* Beim Tippen auf engen Screens nach rechts ausdehnen
|
|
|
|
|
|
und die Action-Icons dahinter verschwinden lassen. */
|
|
|
|
|
|
.nav-search-wrap:focus-within {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 0.6rem;
|
|
|
|
|
|
bottom: 0.6rem;
|
2026-04-17 21:54:04 +02:00
|
|
|
|
left: 1rem;
|
2026-04-17 17:52:51 +02:00
|
|
|
|
right: 1rem;
|
|
|
|
|
|
z-index: 60;
|
|
|
|
|
|
}
|
|
|
|
|
|
.nav-search-wrap:focus-within .nav-search input {
|
|
|
|
|
|
background: white;
|
|
|
|
|
|
}
|
2026-04-17 15:35:20 +02:00
|
|
|
|
}
|
2026-04-17 15:28:22 +02:00
|
|
|
|
</style>
|