// ── Reservierungs-Modal ────────────────────────────────────────────────────── function dayLabel(offset) { const d = new Date(); d.setDate(d.getDate() + offset); const wd = ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"][d.getDay()]; if (offset === 0) return { key: offset, top: "Heute", sub: `${wd}. ${d.getDate()}.${d.getMonth() + 1}.`, dow: d.getDay() }; if (offset === 1) return { key: offset, top: "Morgen", sub: `${wd}. ${d.getDate()}.${d.getMonth() + 1}.`, dow: d.getDay() }; return { key: offset, top: wd, sub: `${d.getDate()}.${d.getMonth() + 1}.`, dow: d.getDay() }; } function ReserveModal({ open, onClose }) { const days = React.useMemo(() => Array.from({ length: 7 }, (_, i) => dayLabel(i)), [open]); const [day, setDay] = React.useState(days[0]); const [people, setPeople] = React.useState(2); const [time, setTime] = React.useState(null); const [form, setForm] = React.useState({ name: "", phone: "" }); const [touched, setTouched] = React.useState(false); const [done, setDone] = React.useState(null); React.useEffect(() => { if (open) { setDone(null); setTouched(false); setTime(null); setDay(days[0]); setPeople(2); } }, [open]); React.useEffect(() => { const on = (e) => e.key === "Escape" && onClose(); if (open) { document.addEventListener("keydown", on); document.body.style.overflow = "hidden"; } return () => { document.removeEventListener("keydown", on); document.body.style.overflow = ""; }; }, [open]); if (!open) return null; // 7 Tage geöffnet; Mittagsservice Mo–Fr, Abendservice täglich bis 24 Uhr const closed = false; const lunch = [1, 2, 3, 4, 5].includes(day.dow) ? ["11:00", "11:30", "12:00", "12:30", "13:00", "13:30"] : []; const dinner = ["17:00", "17:30", "18:00", "18:30", "19:00", "19:30", "20:00", "20:30", "21:00", "21:30", "22:00"]; const nameOk = form.name.trim().length >= 2; const phoneOk = form.phone.replace(/\D/g, "").length >= 9; const ready = !closed && time && nameOk && phoneOk; const submit = () => { setTouched(true); if (!ready) return; setDone({ num: "RV-" + String(Math.floor(1000 + Math.random() * 9000)), day, people, time, name: form.name.trim() }); }; return (
{/* Header */}
Prenotazione

{done ? "Reserviert" : "Tisch reservieren"}

{done ? (

A presto, {done.name.split(" ")[0]}!

Wir freuen uns auf deinen Besuch.

Reservierung{done.num}
{done.day.top}, {done.time} Uhr
{done.people} {done.people === 1 ? "Person" : "Personen"} · {done.day.sub}

{RESTAURANT.address.street}, {RESTAURANT.address.city}

Bei Änderungen erreichst du uns unter {RESTAURANT.phone}.

) : (
{/* Personen */}
Wie viele Personen?
{[1, 2, 3, 4, 5, 6].map((n) => ( ))}
{/* Datum */}
An welchem Tag?
{days.map((d) => ( ))}
{/* Uhrzeit */}
Um wie viel Uhr?
{closed ? (
Am Montag ist Ruhetag. Bitte wähle einen anderen Tag. 🌿
) : (
{lunch.length > 0 && (
Mittag
{lunch.map((t) => ( ))}
)}
Abend
{dinner.map((t) => ( ))}
)}
{/* Kontakt */}
setForm((f) => ({ ...f, name: e.target.value }))} placeholder="Vor- und Nachname" autoComplete="name" className={cx("w-full h-13 py-3.5 px-4 rounded-xl border bg-card text-[15px] text-ink placeholder:text-muted/60 outline-none transition-colors", touched && !nameOk ? "border-terra" : "border-line focus:border-terra")} />
setForm((f) => ({ ...f, phone: e.target.value }))} placeholder="079 123 45 67" inputMode="tel" autoComplete="tel" className={cx("w-full h-13 py-3.5 px-4 rounded-xl border bg-card text-[15px] text-ink placeholder:text-muted/60 outline-none transition-colors", touched && !phoneOk ? "border-terra" : "border-line focus:border-terra")} />
)}
{/* Footer */}
{done ? ( ) : ( )}
); } Object.assign(window, { ReserveModal });