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';
|
|
|
|
|
import { goto } from '$app/navigation';
|
2026-04-17 15:28:22 +02:00
|
|
|
import { profileStore } from '$lib/client/profile.svelte';
|
|
|
|
|
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 15:28:22 +02:00
|
|
|
|
|
|
|
|
let { children } = $props();
|
|
|
|
|
|
2026-04-17 17:31:08 +02:00
|
|
|
let navQuery = $state('');
|
|
|
|
|
|
|
|
|
|
$effect(() => {
|
|
|
|
|
const path = $page.url.pathname;
|
|
|
|
|
if (path === '/search' || path === '/search/web') {
|
|
|
|
|
navQuery = ($page.url.searchParams.get('q') ?? '').trim();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const showHeaderSearch = $derived($page.url.pathname !== '/');
|
|
|
|
|
|
|
|
|
|
function submitNavSearch(e: SubmitEvent) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
const q = navQuery.trim();
|
|
|
|
|
if (!q) return;
|
|
|
|
|
void goto(`/search?q=${encodeURIComponent(q)}`);
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-17 15:28:22 +02:00
|
|
|
onMount(() => {
|
|
|
|
|
profileStore.load();
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
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 15:28:22 +02:00
|
|
|
<header class="bar">
|
|
|
|
|
<a href="/" class="brand">Kochwas</a>
|
2026-04-17 17:31:08 +02:00
|
|
|
{#if showHeaderSearch}
|
|
|
|
|
<form class="nav-search" onsubmit={submitNavSearch} role="search">
|
|
|
|
|
<input
|
|
|
|
|
type="search"
|
|
|
|
|
bind:value={navQuery}
|
|
|
|
|
placeholder="Rezept suchen…"
|
|
|
|
|
autocomplete="off"
|
|
|
|
|
inputmode="search"
|
|
|
|
|
aria-label="Suchbegriff"
|
|
|
|
|
/>
|
|
|
|
|
</form>
|
|
|
|
|
{/if}
|
2026-04-17 15:35:20 +02:00
|
|
|
<div class="bar-right">
|
2026-04-17 17:08:22 +02:00
|
|
|
<a href="/wishlist" class="nav-link" aria-label="Wunschliste">🍽️</a>
|
|
|
|
|
<a href="/admin" class="nav-link" aria-label="Einstellungen">⚙️</a>
|
2026-04-17 15:35:20 +02:00
|
|
|
<ProfileSwitcher />
|
|
|
|
|
</div>
|
2026-04-17 15:28:22 +02:00
|
|
|
</header>
|
|
|
|
|
|
|
|
|
|
<main>
|
|
|
|
|
{@render children()}
|
|
|
|
|
</main>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
: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;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2026-04-17 17:31:08 +02:00
|
|
|
gap: 0.6rem;
|
|
|
|
|
padding: 0.6rem 1rem;
|
2026-04-17 15:28:22 +02:00
|
|
|
background: white;
|
|
|
|
|
border-bottom: 1px solid #e4eae7;
|
|
|
|
|
}
|
|
|
|
|
.brand {
|
|
|
|
|
font-size: 1.15rem;
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
text-decoration: none;
|
|
|
|
|
color: #2b6a3d;
|
2026-04-17 17:31:08 +02:00
|
|
|
flex-shrink: 0;
|
|
|
|
|
}
|
|
|
|
|
.nav-search {
|
|
|
|
|
flex: 1;
|
|
|
|
|
min-width: 0;
|
|
|
|
|
display: flex;
|
|
|
|
|
}
|
|
|
|
|
.nav-search input {
|
|
|
|
|
width: 100%;
|
|
|
|
|
padding: 0.55rem 0.85rem;
|
|
|
|
|
font-size: 0.95rem;
|
|
|
|
|
border: 1px solid #cfd9d1;
|
|
|
|
|
border-radius: 999px;
|
|
|
|
|
background: #f4f8f5;
|
|
|
|
|
min-height: 40px;
|
|
|
|
|
}
|
|
|
|
|
.nav-search input:focus {
|
|
|
|
|
outline: 2px solid #2b6a3d;
|
|
|
|
|
outline-offset: 1px;
|
|
|
|
|
background: white;
|
2026-04-17 15:28:22 +02:00
|
|
|
}
|
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;
|
|
|
|
|
}
|
|
|
|
|
@media (max-width: 520px) {
|
|
|
|
|
.brand {
|
|
|
|
|
font-size: 0;
|
|
|
|
|
width: 1.6rem;
|
|
|
|
|
height: 1.6rem;
|
|
|
|
|
background: #2b6a3d;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
position: relative;
|
|
|
|
|
}
|
|
|
|
|
.brand::after {
|
|
|
|
|
content: '🍳';
|
|
|
|
|
font-size: 1rem;
|
|
|
|
|
position: absolute;
|
|
|
|
|
inset: 0;
|
|
|
|
|
display: grid;
|
|
|
|
|
place-items: center;
|
|
|
|
|
}
|
|
|
|
|
.nav-link {
|
|
|
|
|
width: 36px;
|
|
|
|
|
height: 36px;
|
|
|
|
|
font-size: 1.05rem;
|
|
|
|
|
}
|
2026-04-17 15:35:20 +02:00
|
|
|
}
|
2026-04-17 17:08:22 +02:00
|
|
|
.nav-link {
|
2026-04-17 15:35:20 +02:00
|
|
|
display: inline-flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
width: 40px;
|
|
|
|
|
height: 40px;
|
|
|
|
|
border-radius: 999px;
|
|
|
|
|
text-decoration: none;
|
|
|
|
|
font-size: 1.15rem;
|
|
|
|
|
}
|
2026-04-17 17:08:22 +02:00
|
|
|
.nav-link:hover {
|
2026-04-17 15:35:20 +02:00
|
|
|
background: #f4f8f5;
|
|
|
|
|
}
|
2026-04-17 15:28:22 +02:00
|
|
|
main {
|
|
|
|
|
padding: 0 1rem 4rem;
|
|
|
|
|
max-width: 760px;
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
}
|
|
|
|
|
</style>
|