feat: Umschaltbarer Hinweismodus für Allergene/Zusatzstoffe

Neue Migration 0002_labeling_notice.sql: settings.labeling_mode
("detailed"/"notice") + labeling_notice(_en/_pl). Auf der Seite
"Allergene & Zusatzstoffe" (LabelingNoticeEditor) kann zwischen der
detaillierten Auswahl je Gericht und einem editierbaren Hinweistext
umgeschaltet werden. Im Hinweismodus entfällt auf der öffentlichen
Speisekarte (Desktop + Mobile) die Legende und die Kürzel an den
Gerichten, in der Gerichte-Verwaltung wird die Chip-Auswahl beim
Bearbeiten ausgeblendet. Umschalten/Bearbeiten ist für staff und admin
freigegeben, Farben in /api/settings bleiben admin-only.

Version 1.8.0.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-19 23:57:43 +02:00
co-authored by Claude Sonnet 5
parent 96eaf3989e
commit de8914f9cc
12 changed files with 376 additions and 56 deletions
+60 -31
View File
@@ -42,6 +42,7 @@ export default async function Home({
]);
const logo = logoUrl(settings?.logo_path);
const labelingDetailed = (settings?.labeling_mode ?? "detailed") !== "notice";
return (
<div className="flex-1 px-4 py-6 max-w-[1600px] mx-auto w-full">
@@ -99,7 +100,12 @@ export default async function Home({
</header>
{/* Mobil: Tag (Standard) oder Woche umschaltbar */}
<PublicMobileMenu monday={monday} sections={sections} entries={entries} />
<PublicMobileMenu
monday={monday}
sections={sections}
entries={entries}
showLabeling={labelingDetailed}
/>
{/* Ab "sm": klassische Wochentabelle */}
<div className="hidden sm:block">
@@ -148,7 +154,9 @@ export default async function Home({
<span className="font-bold">
{localized(e.dish, locale)}
</span>
{codes && <sup className="dish-codes">{codes}</sup>}
{labelingDetailed && codes && (
<sup className="dish-codes">{codes}</sup>
)}
{" – "}
{formatPrice(e.dish.price)}
</div>
@@ -163,35 +171,56 @@ export default async function Home({
</div>
</div>
{/* Allergene & Zusatzstoffe: Legende zu den Kürzeln bei den Gerichten */}
<section className="mt-8 grid gap-6 sm:grid-cols-2 text-sm text-gray-700">
<div>
<h2 className="font-bold text-[var(--c-primary)] mb-2">
{dict.publicMenu.allergens}
</h2>
<ul className="space-y-0.5">
{allergens.map((a) => (
<li key={a.code}>
<span className="font-semibold">{a.code}</span> –{" "}
{localized(a, locale)}
</li>
))}
</ul>
</div>
<div>
<h2 className="font-bold text-[var(--c-primary)] mb-2">
{dict.publicMenu.additives}
</h2>
<ul className="space-y-0.5">
{additives.map((a) => (
<li key={a.code}>
<span className="font-semibold">{a.code}</span> –{" "}
{localized(a, locale)}
</li>
))}
</ul>
</div>
</section>
{/* Allergene & Zusatzstoffe: entweder Legende zu den Kürzeln bei den
Gerichten, oder – falls im Hinweismodus – nur ein Hinweistext. */}
{labelingDetailed ? (
<section className="mt-8 grid gap-6 sm:grid-cols-2 text-sm text-gray-700">
<div>
<h2 className="font-bold text-[var(--c-primary)] mb-2">
{dict.publicMenu.allergens}
</h2>
<ul className="space-y-0.5">
{allergens.map((a) => (
<li key={a.code}>
<span className="font-semibold">{a.code}</span> –{" "}
{localized(a, locale)}
</li>
))}
</ul>
</div>
<div>
<h2 className="font-bold text-[var(--c-primary)] mb-2">
{dict.publicMenu.additives}
</h2>
<ul className="space-y-0.5">
{additives.map((a) => (
<li key={a.code}>
<span className="font-semibold">{a.code}</span> –{" "}
{localized(a, locale)}
</li>
))}
</ul>
</div>
</section>
) : (
settings && (
<section className="mt-8 text-sm text-gray-700">
<h2 className="font-bold text-[var(--c-primary)] mb-2">
{dict.publicMenu.labelingNoticeTitle}
</h2>
<p>
{localized(
{
name: settings.labeling_notice,
name_en: settings.labeling_notice_en,
name_pl: settings.labeling_notice_pl,
},
locale
)}
</p>
</section>
)
)}
</div>
);
}