Commit Graph
9 Commits
Author SHA1 Message Date
Jorem Juárez 084a191061 Add per-restaurant macros toggle and public list view
Feature 1 — showMacros toggle:
- Restaurant.showMacros boolean (default false) so existing menus (e.g. NOCNEX)
  never publish with empty macros (migration 0004; default applies to existing rows)
- Editor toggle in the Palette tab, saved via the existing /settings endpoint
- Read live (not from the snapshot) in the public page and /menu API so it takes
  effect immediately without republishing; old snapshots default off
- When off, the public menu hides every macro layer: card flip + 'tap to see
  macros', the gallery macros, and the macro color-code legend

Feature 2 — public list view:
- Card/list toggle in the public menu; preference is NOT persisted (always starts
  on cards)
- New ListRow: compact traditional rows (name + price + allergen tags); tap the
  name to expand image + description (accordion); tap the image to reveal macros
  (only when showMacros is on)

i18n: viewCards/viewList (menu) and showMacros/showMacrosHint (editor) in es/en at parity.
Glassmorphism, mobile-first and safe areas preserved. Existing features untouched
(versioning, import, consultant, QR, i18n).

Verified: build passes; 4 migrations apply in order; existing rows default false;
toggling via /settings updates /menu live without republish.
2026-06-15 14:32:44 -06:00
Jorem Juárez d71ede3d00 Edge-to-edge mobile layout with safe-area insets
The public menu (and editor) left a non-matching rectangular gap around the
iPhone notch / dynamic island. Make the glassmorphism background go edge-to-edge
while keeping interactive content clear of the unsafe regions.

- viewport-fit=cover so the layout uses the full screen incl. behind the island
- Safe-area utility classes (globals.css) built on env(safe-area-inset-*); they
  resolve to 0 on devices without insets, preserving previous spacing
- Public menu: header padding-top, sticky section tabs offset, and floating
  action buttons (Ask AI / +) respect top/bottom insets
- Editor: header padding-top and bottom tab bar respect top/bottom insets

Verified: build passes; all safe-area classes survive Tailwind purge; rendered
meta tag emits viewport-fit=cover.
2026-06-15 13:46:27 -06:00
Jorem Juárez 9fad1d43aa Harden menu import: tolerate truncated JSON + reject oversized files
Bug 1 (malformed/truncated JSON crashed the route with SyntaxError):
- Raise extraction max_tokens 4000 -> 8000 and ask the model for compact, complete JSON
- Parse tolerantly: extractJson() for fences/prose, plus a repair pass that closes
  open strings/brackets and drops a trailing partial entry for token-truncated output
- Wrap JSON.parse; on failure return a friendly code (parse_failed, or output_truncated
  when stop_reason was max_tokens) instead of a raw 500

Bug 2 (40MB PDF -> Anthropic 413):
- Validate visual file size BEFORE calling the API (max 4.5MB raw; base64 inflates ~33%)
- Return 413 {error:file_too_large, maxMb} so the UI shows 'max X MB, compress or use text/link'

i18n: file_too_large (with {mb}), parse_failed, output_truncated (es/en); ImportModal
interpolates the size limit.

Verified: build passes; repair recovers mid-string/mid-property/fenced/prose JSON;
oversized upload returns 413 with the limit; text path fails gracefully (no crash).
2026-06-14 02:14:40 -06:00
Jorem Juárez 9a40a988e0 Add artistic QR (templates + customization) with qr-code-styling
Editor QR tab now generates a styled, scannable QR with live preview and clean
PNG/SVG export (no frame or text — the owner lays it out).

- Restaurant.qrConfig JSON persists the styling (migration 0003)
- qr-code-styling (MIT) runs client-side in QrTab: preview + WYSIWYG PNG (2048px)
  and vector SVG export, avoiding native canvas deps in the alpine image
- Controls: dots color/gradient, background (incl. transparent), corners color,
  dot & corner shapes, optional center logo (uploaded via /upload, capped at 20%)
- Scannability: error correction forced to 'H' whenever there's a logo or color;
  WCAG contrast check warns on low contrast; persistent 'verify before printing' notice
- Templates inherit the menu palette but every value is independently editable
- QR always targets {APP_BASE_URL}/{slug}
- PATCH /api/[slug]/qr saves config; GET stays as a config-aware server fallback
- i18n (es/en) for the qr namespace; glassmorphism, mobile-first

Verified: build passes; migration 0003 applies; PATCH persists qrConfig; GET
honors saved colors/ECC (png + colored svg); auth guard returns 401.
2026-06-14 02:00:45 -06:00
Jorem Juárez d6ffbbd60b Fix missing i18n keys in editor (save/edit/delete)
ProductEditor and CatalogTab use t('save'/'edit'/'delete') from the editor
namespace, but those keys only existed in the common namespace, so the UI showed
raw keys (editor.save, editor.delete). Add them to messages/es.json and en.json.

Audited every useTranslations call across src/ against both catalogs: no other
unresolved keys, and es/en are at full key parity.
2026-06-13 20:47:00 -06:00
Jorem Juárez 112e95dc28 Add AI smart menu import (Cargar menú)
Import a menu from PDF, photo, Excel/CSV, web link, or pasted text and turn it
into draft sections + products with Claude.

- Product.aiEstimated JSON flags AI-inferred macros/allergens (migration 0002)
- POST /api/[slug]/import: resolves the source (vision via Sonnet for PDF/photo,
  Haiku for text/CSV/XLSX/web), extracts structured JSON for review only
- POST /api/[slug]/import/apply: writes to the draft in add or replace mode,
  preserving aiEstimated flags; replace wipes the draft first
- Editor: 'Cargar menú' button + glass ImportModal (method -> review -> add/replace),
  'Estimado por IA — verifica' badges, verification disclaimer; ProductEditor shows
  the badge and clears the flag when the value is edited
- Reuses anthropic.ts, upload/guard, shared extractJson (moved to lib/json.ts)
- i18n labels (es/en); adds xlsx dependency for spreadsheet parsing

Verified: build passes; migration applies; apply add/replace persist correctly
with aiEstimated; extract validation + auth guard behave as expected.
2026-06-13 20:43:06 -06:00
Jorem Juárez 24a412f793 Fix Prisma migrate deploy in standalone production image
The entrypoint invoked the node_modules/.bin/prisma symlink, so Node resolved the
CLI's bundled .wasm files relative to .bin/ and crashed with ENOENT on
prisma_schema_build_bg.wasm. Call the real CLI entry (node_modules/prisma/build/
index.js) instead so the wasm resolves under prisma/build/. Also add the
linux-musl-openssl-3.0.x binaryTarget so the runtime engine matches the alpine
runner regardless of build host arch.

Verified end-to-end in a built alpine image: migrate deploy applies, and the
Prisma client reads/writes against Postgres at runtime.
2026-06-13 20:13:21 -06:00
Jorem Juárez fc12ff5f02 Add public/ directory so Dockerfile COPY succeeds
Next.js standalone build copies /app/public; the folder was empty and untracked,
breaking the Docker build. Keep it in the repo via .gitkeep.
2026-06-13 19:59:25 -06:00
Jorem Juárez 5fb9c7a145 Initial build: Menú inteligente platform
Multi-tenant digital menu platform (Collina Systems): public QR menu with
glassmorphism + 3D macro flip cards, mobile-first editor with draft/publish
versioning (5-version history + restore), AI consultant & translation (Claude
Haiku), realtime orders via SSE, configurable palette, QR generation, superadmin
panel, and Docker/Coolify infra.
2026-06-13 19:33:00 -06:00