Migration: Übersetzungsspalten für Inhalte + Rezeptvorschläge-Tabelle
dishes/sections/allergens/additives bekommen _en/_pl-Spalten; die 14 EU-Allergene, 11 Zusatzstoff-Kennzeichnungen und 4 Bereiche sind direkt mit Referenz-Übersetzungen befüllt. localized() liefert den Text zur aktuellen Sprache mit Fallback auf Deutsch. Neue Tabelle dish_suggestions (RLS: jeder darf einreichen, nur Staff/Admin lesen). Lokale PostgreSQL-Kopie auf den neuen Stand gebracht.
This commit is contained in:
+24
-11
@@ -12,6 +12,8 @@ export interface Profile {
|
||||
export interface Section {
|
||||
key: string;
|
||||
label: string;
|
||||
label_en: string | null;
|
||||
label_pl: string | null;
|
||||
time_range: string;
|
||||
sort: number;
|
||||
}
|
||||
@@ -19,6 +21,8 @@ export interface Section {
|
||||
export interface Dish {
|
||||
id: string;
|
||||
name: string;
|
||||
name_en: string | null;
|
||||
name_pl: string | null;
|
||||
price: number;
|
||||
allergens: string[];
|
||||
additives: string[];
|
||||
@@ -35,9 +39,29 @@ export interface MenuEntry {
|
||||
export interface CodeItem {
|
||||
code: string;
|
||||
name: string;
|
||||
name_en: string | null;
|
||||
name_pl: string | null;
|
||||
sort: number;
|
||||
}
|
||||
|
||||
export interface DishSuggestion {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string | null;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
/** Übersetzten Namen für die aktuelle Sprache liefern, sonst Deutsch als Fallback. */
|
||||
export function localized(
|
||||
item: { name?: string; label?: string; name_en?: string | null; name_pl?: string | null; label_en?: string | null; label_pl?: string | null },
|
||||
locale: string
|
||||
): string {
|
||||
const de = item.name ?? item.label ?? "";
|
||||
if (locale === "en") return item.name_en || item.label_en || de;
|
||||
if (locale === "pl") return item.name_pl || item.label_pl || de;
|
||||
return de;
|
||||
}
|
||||
|
||||
// Farb-Defaults (r-hofmann.de: Blau #003388, Navy #0d315c, Orange #ff6900)
|
||||
export const DEFAULT_COLORS: Record<string, string> = {
|
||||
primary: "#003388",
|
||||
@@ -61,17 +85,6 @@ export const COLOR_VARS: Record<string, string> = {
|
||||
deleteBtn: "--c-del",
|
||||
};
|
||||
|
||||
export const COLOR_LABELS: Record<string, string> = {
|
||||
primary: "Primärfarbe (Tabellenkopf)",
|
||||
primaryDark: "Primärfarbe dunkel (Kopfleiste intern)",
|
||||
accent: "Akzentfarbe",
|
||||
headerText: "Schriftfarbe im Tabellenkopf",
|
||||
rowBg: "Zellen-Hintergrund",
|
||||
rowBgAlt: "Zellen-Hintergrund (alternierend)",
|
||||
addBtn: "Button „Hinzufügen“",
|
||||
deleteBtn: "Button „Löschen“",
|
||||
};
|
||||
|
||||
export function logoUrl(path: string | null | undefined): string | null {
|
||||
if (!path) return null;
|
||||
return `${process.env.NEXT_PUBLIC_SUPABASE_URL}/storage/v1/object/public/branding/${path}`;
|
||||
|
||||
Reference in New Issue
Block a user