diff --git a/messages/en.json b/messages/en.json
index 719d78c..2fa5f67 100644
--- a/messages/en.json
+++ b/messages/en.json
@@ -27,7 +27,9 @@
"waiterCalled": "The waiter is on the way",
"orderSent": "Your order was sent",
"macroLegend": "Macro color code",
- "tapToFlip": "Tap to see macros"
+ "tapToFlip": "Tap to see macros",
+ "viewCards": "Cards",
+ "viewList": "List"
},
"macros": {
"protein": "Protein",
@@ -85,7 +87,9 @@
"publicLink": "Public link",
"copyLink": "Copy link",
"copied": "Copied",
- "paletteHint": "This does not affect the macro color code"
+ "paletteHint": "This does not affect the macro color code",
+ "showMacros": "Show macros on the menu",
+ "showMacrosHint": "When off, the public menu shows no macro layer at all."
},
"qr": {
"templates": "Templates",
diff --git a/messages/es.json b/messages/es.json
index e14b6ff..5fd9a1e 100644
--- a/messages/es.json
+++ b/messages/es.json
@@ -27,7 +27,9 @@
"waiterCalled": "El mesero va en camino",
"orderSent": "Tu orden fue enviada",
"macroLegend": "Código de color de macros",
- "tapToFlip": "Toca para ver macros"
+ "tapToFlip": "Toca para ver macros",
+ "viewCards": "Tarjetas",
+ "viewList": "Lista"
},
"macros": {
"protein": "Proteína",
@@ -85,7 +87,9 @@
"publicLink": "Link público",
"copyLink": "Copiar link",
"copied": "Copiado",
- "paletteHint": "Esto no afecta el código de color de macros"
+ "paletteHint": "Esto no afecta el código de color de macros",
+ "showMacros": "Mostrar macros en el menú",
+ "showMacrosHint": "Si está apagado, el menú público no muestra ninguna capa de macros."
},
"qr": {
"templates": "Plantillas",
diff --git a/prisma/migrations/0004_restaurant_show_macros/migration.sql b/prisma/migrations/0004_restaurant_show_macros/migration.sql
new file mode 100644
index 0000000..40ca7d1
--- /dev/null
+++ b/prisma/migrations/0004_restaurant_show_macros/migration.sql
@@ -0,0 +1,2 @@
+-- AlterTable
+ALTER TABLE "Restaurant" ADD COLUMN "showMacros" BOOLEAN NOT NULL DEFAULT false;
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index dba2ca8..ff5cdd5 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -20,6 +20,8 @@ model Restaurant {
palette Json @default("{}")
qrConfig Json @default("{}") // artistic QR styling (qr-code-styling config)
ordersEnabled Boolean @default(false)
+ showMacros Boolean @default(false) // when false, the public menu hides all macro layers
+
defaultLocale String @default("es")
active Boolean @default(true)
publishedVersionId String? @unique
diff --git a/src/app/[slug]/editor/page.tsx b/src/app/[slug]/editor/page.tsx
index 9c8faa1..d25e179 100644
--- a/src/app/[slug]/editor/page.tsx
+++ b/src/app/[slug]/editor/page.tsx
@@ -37,6 +37,7 @@ export default async function EditorPage({
slug: restaurant.slug,
name: restaurant.name,
ordersEnabled: restaurant.ordersEnabled,
+ showMacros: restaurant.showMacros,
defaultLocale: restaurant.defaultLocale as 'es' | 'en',
palette: (restaurant.palette as Palette) ?? {},
qrConfig: (restaurant.qrConfig as QrConfig) ?? {},
diff --git a/src/app/[slug]/page.tsx b/src/app/[slug]/page.tsx
index 5081bee..5269be9 100644
--- a/src/app/[slug]/page.tsx
+++ b/src/app/[slug]/page.tsx
@@ -21,11 +21,16 @@ async function getPublishedMenu(slug: string): Promise {
palette: (restaurant.palette as MenuSnapshot['restaurant']['palette']) ?? {},
ordersEnabled: restaurant.ordersEnabled,
defaultLocale: restaurant.defaultLocale as 'es' | 'en',
+ showMacros: restaurant.showMacros,
},
sections: [],
};
}
- return restaurant.publishedVersion.snapshot as unknown as MenuSnapshot;
+ const snapshot = restaurant.publishedVersion.snapshot as unknown as MenuSnapshot;
+ // showMacros is read live (not from the snapshot) so toggling it takes effect
+ // immediately without republishing — and old snapshots without the flag default off.
+ snapshot.restaurant.showMacros = restaurant.showMacros;
+ return snapshot;
}
export default async function PublicMenuPage({ params }: { params: { slug: string } }) {
diff --git a/src/app/api/[slug]/menu/route.ts b/src/app/api/[slug]/menu/route.ts
index 3d7d57a..7721636 100644
--- a/src/app/api/[slug]/menu/route.ts
+++ b/src/app/api/[slug]/menu/route.ts
@@ -16,5 +16,8 @@ export async function GET(_req: Request, { params }: { params: { slug: string }
if (!restaurant.publishedVersion) {
return NextResponse.json({ error: 'not_published' }, { status: 404 });
}
- return NextResponse.json(restaurant.publishedVersion.snapshot as unknown as MenuSnapshot);
+ const snapshot = restaurant.publishedVersion.snapshot as unknown as MenuSnapshot;
+ // Read showMacros live so the toggle applies without republishing.
+ snapshot.restaurant.showMacros = restaurant.showMacros;
+ return NextResponse.json(snapshot);
}
diff --git a/src/app/api/[slug]/settings/route.ts b/src/app/api/[slug]/settings/route.ts
index ecad385..12d93c9 100644
--- a/src/app/api/[slug]/settings/route.ts
+++ b/src/app/api/[slug]/settings/route.ts
@@ -8,8 +8,9 @@ export async function PATCH(req: Request, { params }: { params: { slug: string }
if ('error' in guard) return guard.error;
const body = await req.json().catch(() => null);
- const data: { ordersEnabled?: boolean; defaultLocale?: string } = {};
+ const data: { ordersEnabled?: boolean; defaultLocale?: string; showMacros?: boolean } = {};
if (typeof body?.ordersEnabled === 'boolean') data.ordersEnabled = body.ordersEnabled;
+ if (typeof body?.showMacros === 'boolean') data.showMacros = body.showMacros;
if (body?.defaultLocale === 'es' || body?.defaultLocale === 'en') {
data.defaultLocale = body.defaultLocale;
}
diff --git a/src/components/editor/Editor.tsx b/src/components/editor/Editor.tsx
index facf47d..d7c2ad8 100644
--- a/src/components/editor/Editor.tsx
+++ b/src/components/editor/Editor.tsx
@@ -49,7 +49,13 @@ export default function Editor({ data, baseUrl }: { data: EditorData; baseUrl: s
onRestored={(name) => setPublishedName(name)}
/>
)}
- {tab === 'palette' && }
+ {tab === 'palette' && (
+
+ )}
{tab === 'orders' && (
⚠️ {t('paletteHint')}
+ {/* Show-macros toggle (controls whether the public menu exposes any macro layer) */}
+
+
+
{t('showMacros')}
+
{t('showMacrosHint')}
+
+
+
+