Commit Graph
4 Commits
Author SHA1 Message Date
Jorem Juárez 244adaee30 Orders persistence/expiration, cart pairings, and brand header
BLOCK 1 — Orders persistence + expiration:
- New GET /api/[slug]/orders loads active orders from PostgreSQL on mount, so the
  dashboard survives reloads (SSE only carries live events); it also prunes
  completed orders older than the retention window on read (no cron)
- Restaurant.orderRetentionHours (default 24, migration 0007) + editor control in
  the Orders tab; settings PATCH accepts it

BLOCK 2 — Smart cart pairings (precomputed, zero tokens at runtime):
- Restaurant.pairings JSON (migration 0008) stores { productId: [productId] }
- Optional 'Generate smart suggestions' checkbox in the publish modal; on publish,
  one cheap Haiku call analyzes the snapshot and stores validated complements
  (lib/pairings.ts, reuses parseLenientJson). AI failure never breaks publishing
- pairings read live and exposed via the public menu; cart shows an auto-rotating,
  swipeable SuggestionCarousel of complements for what's in the cart (excluding
  items already added), each with Add — only when orders are on and pairings exist

BLOCK 3 — Brand header:
- Restaurant.bannerImage, profileImage, socialLinks (migration 0009)
- New editor Brand tab: upload banner + circular logo (reuses /upload), social
  links with common-platform suggestions and basic URL validation; saved via settings
- Public BrandHeader: full-bleed banner (edge-to-edge behind the island, safe-area
  aware), circular logo avatar, name, and clickable social icons (lucide-react).
  Graceful fallbacks (palette gradient banner, initial avatar) — no broken images.
  Images are language-independent

All read live (no republish needed). i18n es/en at parity; glassmorphism,
mobile-first and safe areas preserved. Adds lucide-react.

Verified: build passes; 9 migrations apply; orders persist + prune on read;
publish survives missing API key; pairings + brand exposed via /menu.
2026-06-15 17:25:35 -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 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 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