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:
+9
-1
@@ -1,14 +1,22 @@
|
||||
import "server-only";
|
||||
import { queryOne } from "@/lib/db";
|
||||
|
||||
export type LabelingMode = "detailed" | "notice";
|
||||
|
||||
export interface Settings {
|
||||
colors: Record<string, string>;
|
||||
logo_path: string | null;
|
||||
favicon_path: string | null;
|
||||
labeling_mode: LabelingMode;
|
||||
labeling_notice: string;
|
||||
labeling_notice_en: string | null;
|
||||
labeling_notice_pl: string | null;
|
||||
}
|
||||
|
||||
export async function getSettings(): Promise<Settings | null> {
|
||||
return queryOne<Settings>(
|
||||
"select colors, logo_path, favicon_path from settings where id = 1"
|
||||
`select colors, logo_path, favicon_path, labeling_mode,
|
||||
labeling_notice, labeling_notice_en, labeling_notice_pl
|
||||
from settings where id = 1`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ const de = {
|
||||
weekTab: "Woche",
|
||||
allergens: "Allergene",
|
||||
additives: "Zusatzstoffe",
|
||||
labelingNoticeTitle: "Allergene & Zusatzstoffe",
|
||||
suggestDish: "Rezept vorschlagen",
|
||||
noEntry: "–",
|
||||
rssFeed: "RSS-Feed abonnieren",
|
||||
@@ -113,6 +114,8 @@ const de = {
|
||||
importSuccess: "{created} neu angelegt, {updated} aktualisiert.",
|
||||
importSkipped: "{count} Zeile(n) übersprungen: {reasons}",
|
||||
importSkippedRow: "Zeile {row}: {reason}",
|
||||
labelingDisabledHint:
|
||||
"Allergene/Zusatzstoffe sind aktuell deaktiviert (Hinweismodus aktiv, siehe „Allergene & Zusatzstoffe“).",
|
||||
},
|
||||
codeList: {
|
||||
allergensTitle: "Allergene",
|
||||
@@ -199,6 +202,20 @@ const de = {
|
||||
confirmRemoveLogo: "Logo wirklich entfernen?",
|
||||
confirmRemoveFavicon: "Favicon wirklich entfernen?",
|
||||
},
|
||||
labelingNotice: {
|
||||
title: "Anzeige von Allergenen & Zusatzstoffen",
|
||||
hint:
|
||||
"Standardmäßig sieht jeder Gast eine detaillierte Auswahl der Allergene/Zusatzstoffe je Gericht. Alternativ kann stattdessen nur ein Hinweistext angezeigt werden – die Auswahl je Gericht wird dann auch in der Gerichte-Verwaltung ausgeblendet.",
|
||||
modeDetailed: "Detaillierte Auswahl je Gericht anzeigen",
|
||||
modeNotice: "Nur Hinweistext anzeigen",
|
||||
noticeDeLabel: "Hinweistext (Deutsch)",
|
||||
noticeEnLabel: "Hinweistext (Englisch)",
|
||||
noticePlLabel: "Hinweistext (Polnisch)",
|
||||
save: "Speichern",
|
||||
saved: "Gespeichert.",
|
||||
loadError: "Laden fehlgeschlagen: {message}",
|
||||
saveError: "Speichern fehlgeschlagen: {message}",
|
||||
},
|
||||
passkeys: {
|
||||
title: "Passkeys",
|
||||
hint: "Mit einem Passkey (Fingerabdruck, Gesichtserkennung oder Sicherheitsschlüssel) kannst du dich künftig ohne Passwort anmelden. Passkeys gelten pro Domain – nach einem Domainwechsel müssen sie neu registriert werden.",
|
||||
@@ -333,6 +350,7 @@ const en: Dict = {
|
||||
weekTab: "Week",
|
||||
allergens: "Allergens",
|
||||
additives: "Additives",
|
||||
labelingNoticeTitle: "Allergens & additives",
|
||||
suggestDish: "Suggest a dish",
|
||||
noEntry: "–",
|
||||
rssFeed: "Subscribe to RSS feed",
|
||||
@@ -383,6 +401,8 @@ const en: Dict = {
|
||||
importSuccess: "{created} created, {updated} updated.",
|
||||
importSkipped: "{count} row(s) skipped: {reasons}",
|
||||
importSkippedRow: "Row {row}: {reason}",
|
||||
labelingDisabledHint:
|
||||
"Allergens/additives are currently disabled (notice mode active, see \"Allergens & additives\").",
|
||||
},
|
||||
codeList: {
|
||||
allergensTitle: "Allergens",
|
||||
@@ -469,6 +489,20 @@ const en: Dict = {
|
||||
confirmRemoveLogo: "Really remove the logo?",
|
||||
confirmRemoveFavicon: "Really remove the favicon?",
|
||||
},
|
||||
labelingNotice: {
|
||||
title: "Allergen & additive display",
|
||||
hint:
|
||||
"By default every guest sees a detailed allergen/additive selection per dish. Alternatively, only a notice text can be shown instead – the per-dish selection is then also hidden in the dish manager.",
|
||||
modeDetailed: "Show detailed selection per dish",
|
||||
modeNotice: "Show only notice text",
|
||||
noticeDeLabel: "Notice text (German)",
|
||||
noticeEnLabel: "Notice text (English)",
|
||||
noticePlLabel: "Notice text (Polish)",
|
||||
save: "Save",
|
||||
saved: "Saved.",
|
||||
loadError: "Loading failed: {message}",
|
||||
saveError: "Saving failed: {message}",
|
||||
},
|
||||
passkeys: {
|
||||
title: "Passkeys",
|
||||
hint: "With a passkey (fingerprint, face recognition, or a security key) you can sign in without a password in the future. Passkeys are bound to a domain – after a domain change they need to be registered again.",
|
||||
@@ -601,6 +635,7 @@ const pl: Dict = {
|
||||
weekTab: "Tydzień",
|
||||
allergens: "Alergeny",
|
||||
additives: "Dodatki",
|
||||
labelingNoticeTitle: "Alergeny i dodatki",
|
||||
suggestDish: "Zaproponuj danie",
|
||||
noEntry: "–",
|
||||
rssFeed: "Subskrybuj kanał RSS",
|
||||
@@ -651,6 +686,8 @@ const pl: Dict = {
|
||||
importSuccess: "Utworzono: {created}, zaktualizowano: {updated}.",
|
||||
importSkipped: "Pominięto wierszy: {count}: {reasons}",
|
||||
importSkippedRow: "Wiersz {row}: {reason}",
|
||||
labelingDisabledHint:
|
||||
"Alergeny/dodatki są obecnie wyłączone (aktywny tryb komunikatu, patrz „Alergeny i dodatki”).",
|
||||
},
|
||||
codeList: {
|
||||
allergensTitle: "Alergeny",
|
||||
@@ -737,6 +774,20 @@ const pl: Dict = {
|
||||
confirmRemoveLogo: "Czy na pewno usunąć logo?",
|
||||
confirmRemoveFavicon: "Czy na pewno usunąć favicon?",
|
||||
},
|
||||
labelingNotice: {
|
||||
title: "Wyświetlanie alergenów i dodatków",
|
||||
hint:
|
||||
"Domyślnie każdy gość widzi szczegółowy wybór alergenów/dodatków dla każdego dania. Alternatywnie można zamiast tego wyświetlić tylko komunikat – wybór dla poszczególnych dań zostanie wtedy również ukryty w zarządzaniu daniami.",
|
||||
modeDetailed: "Pokaż szczegółowy wybór dla każdego dania",
|
||||
modeNotice: "Pokaż tylko komunikat",
|
||||
noticeDeLabel: "Tekst komunikatu (niemiecki)",
|
||||
noticeEnLabel: "Tekst komunikatu (angielski)",
|
||||
noticePlLabel: "Tekst komunikatu (polski)",
|
||||
save: "Zapisz",
|
||||
saved: "Zapisano.",
|
||||
loadError: "Wczytywanie nie powiodło się: {message}",
|
||||
saveError: "Zapisywanie nie powiodło się: {message}",
|
||||
},
|
||||
passkeys: {
|
||||
title: "Klucze dostępu",
|
||||
hint: "Dzięki kluczowi dostępu (odcisk palca, rozpoznawanie twarzy lub klucz bezpieczeństwa) możesz w przyszłości logować się bez hasła. Klucze dostępu są przypisane do domeny – po zmianie domeny trzeba je zarejestrować ponownie.",
|
||||
|
||||
Reference in New Issue
Block a user