Compare commits

...
21 Commits
Author SHA1 Message Date
Jorem Juárez 4bec78597b Consultant: recolor the user question bubble to navy
The asked-question bubble used the red accent, which clashed with the sage-green
assistant bubble. Use navy #1e3a5f (brand blue, already used elsewhere) for a
harmonious chat look; the red accent stays on the CTAs (Add / send).
2026-06-29 13:30:36 -06:00
Jorem Juárez b0be66990f Cart: unify font size of bottom controls
The table-number input was text-lg and the dark action buttons (Confirm order,
split-subaccount buttons) had no size class (text-base), clashing with the text-sm
general-note field. Set all to text-sm so the bottom of the cart reads consistently.
2026-06-29 12:55:08 -06:00
Jorem Juárez cbb4a9e8ef Split panel: match font size of the two action buttons
'Actualizar mi subcuenta' had no text-size class (fell back to text-base) while
'Agregar platillos' was text-sm, so they looked inconsistent and the longer label
overflowed. Both are now text-sm font-medium.
2026-06-29 12:52:09 -06:00
Jorem Juárez 02a0163d60 Show dish thumbnail in split-bill subaccount line items
Same fix as the regular cart: the split-bill subaccount rows showed only name +
price + quantity. Render the dish photo as a thumbnail (MediaThumb, with the
plate-icon fallback).
2026-06-29 12:33:49 -06:00
Jorem Juárez 7933e35fc3 Show dish thumbnail in cart line items
The cart ('Tu pedido') line showed only name + price + quantity, no image. Render
the dish photo as a thumbnail (MediaThumb, with the plate-icon fallback when media
is missing or fails to load).
2026-06-29 12:29:30 -06:00
Jorem Juárez 9fd28d6059 Rename consultant CTA to 'mesero virtual' and use a neutral example prompt
- Button label: 'Preguntar a Claude' -> 'Preguntar al mesero virtual' (es) /
  'Ask the virtual waiter' (en).
- Consultant placeholder example: the diabetic example can be counterproductive for
  some restaurants -> neutral '¿Qué me recomiendas para hoy?' / 'What do you
  recommend today?'. es/en parity kept.
2026-06-29 11:49:11 -06:00
Collina SystemsandClaude Opus 4.8 cf6090d588 Restyle AI consultant ("Virtual waiter") to match new mockup
- Rename the consultant title to "Mesero virtual" / "Virtual waiter"
  (uppercased in the UI via CSS).
- Answer intro now shown in a sage-green card; recommendation dish names use
  the palette text color.
- Replace hardcoded navy (#1e3a5f) with var(--accent) across the consultant
  (asked bubble, recommendation "Add" button, send arrow) and the
  SuggestionCarousel "Add" button — all red under the current palette.
- More opaque modal surface for readability over the dimmed menu; dish
  thumbnails preserved in recommendations.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-26 20:05:37 -06:00
Jorem Juárez bae032aa75 Consultant: clear input on send and show the asked question above the answer
The question stayed in the input after sending. Now it clears automatically and the
submitted question appears as a chat bubble above the response, so the panel reads
like a normal prompt/chat (your message on top, the assistant's answer below).
2026-06-26 18:38:11 -06:00
Jorem Juárez 8cf6ca8cb5 Show dish thumbnails in AI consultant recommendations
The consultant cards (both direct recommendations and the 'Para acompañar'
complements) showed only name + reason. Each card already resolves the real
product for its Add button, so render its photo as a thumbnail (MediaThumb, which
falls back to the plate icon when media is missing or fails to load).
2026-06-26 18:33:59 -06:00
Jorem Juárez 595769ced0 Remove the Palette tab from the editor
The per-restaurant palette was retired in the redesign (menu colors are fixed), so
the Palette editor tab no longer affected anything. Removed the tab and its
PaletteTab component; the editor now has 4 tabs (Catalog, Brand, Orders, QR). The
Restaurant.palette value is kept because the QR tab still uses it for its color
templates.
2026-06-26 11:24:15 -06:00
Collina SystemsandClaude Opus 4.8 ffa8766540 Match popup panels exactly to mockups (3-color action system)
The button-triggered panels followed a coarse "primary = red" rule; the mockups
actually use: black for confirm actions, navy #1e3a5f for suggestions/AI recs,
khaki #e2db8d for "Translate", grey-blue #c8cbd8 for delete, red only for total
text and add-to-order/FAB/CTA.

- OrderPanel: Confirm/order/split-create buttons -> black #111; Total -> red;
  cart item qty stepper -> white pill (matches mockup).
- SuggestionCarousel: "Add" -> navy #1e3a5f; price -> black.
- AiConsultant: recommendation name + "Add" + send arrow -> navy #1e3a5f.
- SplitPanel: join/create + order buttons -> black #111.
- ProductEditor: Save -> black #111; Delete -> grey-blue #c8cbd8;
  "Translate with AI" -> khaki #e2db8d.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 18:02:21 -06:00
Collina SystemsandClaude Opus 4.8 bcec7ee8dc Hardcode fixed brand palette (retire per-restaurant palette)
Colors are now fixed from the design mockups instead of the per-restaurant
palette: white background, red #dc2626 accent. paletteToCssVars() ignores the
stored palette and always emits the fixed tokens (covers both the public and
editor pages), and globals.css :root matches. The palette editor section will
be removed separately.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 14:22:42 -06:00
Collina SystemsandClaude Opus 4.8 58a71d0bef Apply full frontend redesign (Montserrat, red accent, glass + dock UI)
Fonts switched to Montserrat (UI) + Merriweather (landing wordmark). Macro
protein standard color updated to #dc2626; primary actions hardcoded red.
New globals.css primitives: ai-smoke gradient buttons, seg-btn, sticky
cat-bar, editor dock-*, macro shimmer, delivery-timer pulses, liquid-btn,
aurora, editable-num.

- Public: landing (video bg + red CTA), PublicMenu (segmented toggle +
  "Preguntar a Claude" + sticky category bar w/ scroll-spy + Order/Waiter/
  Split FABs), DishCard flip, MacrosBack shimmer, BrandHeader, SplitPanel,
  AiConsultant.
- Editor: bottom dock navigation, EditorLogin video background, BrandTab,
  CatalogTab (+SectionTitleEditor), VersionHistory, OrdersTab, ProductEditor.
- Admin: AdminLogin, AdminPanel.
- Add landing/editor background videos under public/videos.
- ES/EN i18n keys added; FRONTEND.md updated; design mockups included.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 14:03:06 -06:00
Jorem Juárez ceac688fa8 Add cost dashboard to the master panel (tokens + storage, USD/MXN)
Superadmin view in /admin showing operating cost with per-restaurant breakdown.

Models (migration 0012):
- TokenUsage(restaurantId?, model, feature, inputTokens, outputTokens, createdAt)
- ModelPrice(model, inputPricePerMTok, outputPricePerMTok, updatedAt) — seeded
  Haiku 4.5 1/5, Sonnet 4.6 3/15, Opus 4.8 5/25 (USD per million)
- PriceUpdateLog(model, old/new input+output, source, createdAt)
- ExchangeRate(date, rate) — daily USD→MXN cache
- AppConfig(key,value) — seeded costPerGb=0

B1 Instrumentation: recordUsage() (fire-and-forget) logs every Anthropic call with
its model/feature/restaurant and the response usage tokens — wired into the
consultor (ai-consult), translation, and menu import. restaurantId null = Collina
operational.

B2 Price update: 'Update prices from Anthropic' button → fetches the public pricing
page, Haiku extracts prices FROM THE PAGE TEXT ONLY (omits any not found), updates
ModelPrice and writes a PriceUpdateLog (old→new). If the fetch is blocked, the UI
offers a manual paste box processed the same way. These calls log as
feature 'precios-update', restaurantId null.

B3 Exchange: getUsdMxn() caches once/day via Frankfurter (no key); on failure falls
back to the last stored rate, then a constant — never /bin/zsh; shows the rate's date.

B4 Storage: measures GB per restaurant from /data/uploads/{slug}; configurable
costPerGb (editable) projects a storage cost.

B5 Dashboard (CostsDashboard): month total in USD + MXN, per-restaurant token cost
(USD/MXN) + GB + projected storage cost, average per active restaurant, a separate
'Operativo Collina' line for restaurantId-null calls, and context (exchange rate +
date, last price update). i18n es/en at parity.

Verified (build passes; migration 0012 applies; seeds present): a usage row records
model/tokens/restaurant; dashboard shows USD + MXN with the day's rate (Frankfurter
live 17.21, cached); token cost math correct (/bin/zsh.04 for 20k/4k Haiku); storage GB +
projected cost with cost/GB=0.10; operational calls isolated; price endpoint guarded
(401) and graceful without key (502); PriceUpdateLog records old→new.
2026-06-18 07:27:46 -06:00
Jorem Juárez c82c0f2108 Show full dish description on public cards (no truncation)
The card description was clamped to 2 lines with an ellipsis. Removed the
line-clamp so it shows in full and the card grows to fit (the flip front face is
in normal flow, so it already drives card height; the back is the absolute
overlay). Added whitespace-pre-line to honor line breaks.

Grid uses items-start so cards of different heights render at their natural height
(rows align to the tallest) instead of being stretched with awkward gaps. List
view already shows the full description on expand — unchanged.
2026-06-16 12:50:07 -06:00
Jorem Juárez 14e2f73db9 Carousel: random sample (reshuffles per open), dedup vs consultant, broken-image fallback
1) getRecommendations is now a RANDOM sample of the whole active menu, lightly
   refined by complement rules (a +0.25 nudge toward wanted categories that can't
   beat a strong random draw — variety dominates, all sections surface). New
   opts.seed re-randomizes per open; opts.excludeIds filters extra ids. Signature
   and the CoOccurrence Phase-2 seam are unchanged. Never returns empty unless the
   whole menu is excluded.
2) PublicMenu passes a buildSuggestions(seed, excludeIds) callback instead of a
   memoized list. OrderPanel and AiConsultant each seed on mount (Date.now()), so
   reopening reshuffles. The consultant excludes the dishes it already showed above
   (answer.recommendations resolved to ids) → no more carousel/answer duplicates
   (fixes the Combo Aguacate dup).
3) MediaThumb adds onError on <img>/<video> → a 404/broken file falls back to the
   🍽️ icon, same as missing media.

Verified: build passes; reopening yields a different sample (same seed stable);
sample spans all sections; consultant picks + cart items excluded; never empty.
2026-06-15 21:36:37 -06:00
Jorem Juárez 2bd7da0839 Remove macro color-code legend from the public menu
The 'Código de color de macros' collapsible bar took prominent space for secondary
info that's already self-explanatory on each card's back (full text labels like
'Proteína 19g' next to their color). Removed it from the toggle row in both views;
the row is justify-end so the cards/list view toggle reflows cleanly with no gap.
Dropped the now-unused MacroLegend component and the anyMacros computation. The
macro text labels on the card backs are unchanged.

Build passes.
2026-06-15 21:13:10 -06:00
Jorem Juárez da2c0113e0 Tweak landing subtitle copy
'Menús digitales que tus comensales reconocen en cualquier restaurante.' ->
'Menús digitales que entienden a tus comensales.'
2026-06-15 20:48:14 -06:00
Jorem Juárez 0d924e36ef Replace AI pairings with a deterministic local recommendation engine
The cart/consultant suggestion carousel no longer depends on Claude-generated
pairings. It now computes suggestions locally and instantly from the menu
structure + cart — always available, zero API calls, zero cost, no failure point.

- New lib/recommendations.ts: getRecommendations(menu, cartItemIds, opts) — a pure
  function. Section-complement rules (main+no drink -> drinks; food+no dessert ->
  desserts; drink-only -> food/snacks) classified by flexible keywords (es/en,
  whole-word match so 'te'/tea doesn't match 'fuertes'), then featured fill
  (unrepresented sections first, then price desc). Excludes cart items + inactive;
  empty cart -> featured so the carousel is never empty.
- Phase-2 seam: opts.coOccurrence?(cartIds) => Map<productId, score> lets a future
  market-basket signal blend in WITHOUT changing the carousel — it still only calls
  getRecommendations(menu, cart). Documented where it plugs in.
- PublicMenu computes cartSuggestions via getRecommendations (was the pairings map);
  carousel shows whenever there's >=1 suggestion and orders are enabled, in both the
  cart sheet and the consultant. SuggestionCarousel reused unchanged.
- Removed the Claude generation: publish no longer calls generatePairings and the
  'Generar sugerencias' checkbox is gone; deleted lib/pairings.ts. Restaurant.pairings
  column kept (unused, no migration churn).

i18n parity kept. Glassmorphism/mobile-first/safe-areas untouched. Cart, consultant,
SSE, split all intact.

Verified (build passes, no Anthropic import in the carousel/publish path):
1 fresh publish (nothing generated) -> carousel shows; 2 main+no drink -> drinks
surface first; 3 cart items never suggested; 4 empty cart -> featured; 5 zero
Anthropic calls in the carousel flow; 6 carousel in both cart and consultant.
2026-06-15 20:47:20 -06:00
Jorem Juárez b30430a1ea Premium minimalist landing page (brand + single CTA)
Replaces the generic card at / with a single-screen, centered brand moment:

- Brand animation: 'SmartMenu' rises in as the protagonist (bold sans, Smart in
  ink + Menu in terracotta), then a delicate Fraunces-italic 'by Collina'
  signature fades in surrounded by soft twinkling SVG sparkles (Magic-UI style),
  over a slow radial brand glow. Pure CSS keyframes + inline SVG — no animation
  libs, no extra deps; stays light (first thing a prospect loads).
- Single sales CTA 'Solicita una demo' → /demo placeholder (flow designed later).
- Easter egg: the admin panel has no visible button; tapping the 'by Collina'
  signature navigates to /admin (discreet <a aria-label=Collina href=/admin>).
- Accessible: prefers-reduced-motion shows the final state (no sequence, sparkles
  static). Responsive mobile→desktop. Uses the existing warm Collina palette.

Verified: build passes; / returns 200 with the wordmark, sparkles, demo CTA, and
the Collina→/admin link; reduced-motion CSS present in the bundle.
2026-06-15 20:36:00 -06:00
Jorem Juárez 8fc95c3cab Split re-identification: pick subaccount when re-ordering on a split table
When a diner confirms an order on a table that's already split, the cart now asks
which subaccount they belong to instead of blindly creating a parallel one.

- New GET /split/subaccounts?table — lists active subaccounts (id + full name).
- New GET /split/mine?id — returns a subaccount's items so the client can rebuild
  its cart.
- OrderPanel (normal cart) on a split table shows '¿Quién eres?' with a tappable
  button per active subaccount + 'Soy nuevo':
  * pick existing → load that subaccount's items, merge the new items, and sync;
    reconcileItems keeps the existing batches and turns the new items into a fresh
    batch (independent timer). Existing items' timers are not reset.
  * 'Soy nuevo' → name input → creates a new subaccount seeded with the cart.
- Continuity: once a diner has a split session, the normal cart FAB is replaced by
  'Mi cuenta' (existing behavior), so the selector never reappears for that session
  — no localStorage, just in-memory session state.

i18n es/en (whoAreYou, imNew) at parity. Build passes.

Verified criterion 7: table 5 with Ana+Beto → a third order lists [Ana][Beto]
[Soy nuevo]; tapping Ana adds the order to Ana as a NEW batch (2 distinct batchIds,
the new batch starts now, Ana's prior item keeps its ~30-min-old start).
2026-06-15 20:01:14 -06:00
69 changed files with 5034 additions and 728 deletions

No files matched your search

+232
View File
@@ -0,0 +1,232 @@
# FRONTEND.md — Guía de modificación del frontend
> Documento de control para dirigir cambios **solo de frontend** en SmartMenu Collina.
> Léelo (humano y Claude) antes de cada tarea. Si un cambio te obliga a salir del
> alcance definido aquí, **detente y avisa** antes de continuar.
---
## 1. Objetivo y alcance
**Solo modificamos la capa de presentación.** UI, estilos, layout, animaciones,
textos visibles, accesibilidad y comportamiento de cliente (estado local,
interacciones). No tocamos contratos de API, base de datos, autenticación ni lógica
de servidor.
### ✅ Permitido (zona de trabajo)
| Área | Rutas |
| --- | --- |
| Componentes públicos (menú QR) | `src/components/public/**` |
| Componentes del editor | `src/components/editor/**` *(solo UI, no la firma de `api.ts`)* |
| Componentes del admin | `src/components/admin/**` |
| Componente compartido | `src/components/LanguageSwitch.tsx` |
| Estilos globales / tokens | `src/app/globals.css`, `tailwind.config.ts`, `postcss.config.mjs` |
| Layout y páginas (solo JSX/estilos) | `src/app/layout.tsx`, `src/app/page.tsx`, `src/app/**/page.tsx` |
| Textos de interfaz (i18n) | `messages/es.json`, `messages/en.json` |
| Assets estáticos | `public/**` |
### ⛔ Prohibido sin autorización explícita
- `src/app/api/**` — endpoints (contrato HTTP).
- `prisma/**` — esquema, migraciones, seed.
- `src/lib/**` — lógica de dominio (auth, prisma, orders-bus, menu, palette, upload,
import, anthropic, guard…). **Excepción de solo lectura:** puedes *leer*
`macros.ts`, `palette.ts`, `contrast.ts`, `types.ts` para respetar sus tipos y
constantes, pero no los modificas.
- `src/components/editor/api.ts` y `src/components/editor/types.ts` — son el puente
con el backend; cambiar su forma rompe el contrato.
- `src/i18n/**`, `next.config.mjs`, `Dockerfile`, `docker-compose.yml`,
`docker-entrypoint.sh`, `.env*`.
> Si un cambio de UI parece exigir tocar un endpoint o `src/lib`, casi siempre hay
> una alternativa de presentación. Propónla primero.
---
## 2. Mapa rápido del frontend
```
src/
├─ app/
│ ├─ layout.tsx # fuentes (Fraunces/Inter), <html>, providers
│ ├─ globals.css # tokens CSS, .glass, flip 3D, safe-area
│ ├─ page.tsx # landing raíz (premium minimalista: marca + CTA único)
│ ├─ [slug]/page.tsx # menú público (server) → PublicMenu
│ ├─ [slug]/editor/... # editor protegido
│ └─ admin/page.tsx # panel maestro
└─ components/
├─ public/ → Gallery, AiConsultant, BrandHeader, DishCard, ListRow,
│ SplitPanel, MediaThumb, PublicMenu (615 L, núcleo), MacrosBack,
│ SuggestionCarousel
├─ editor/ → Editor, CatalogTab, OrdersTab (717 L), ProductEditor, QrTab,
│ PaletteTab, BrandTab, VersionHistory, PublishModal, ImportModal,
│ EditorLogin, SectionTitleEditor
└─ admin/ → AdminLogin, AdminPanel
```
Archivos núcleo (cámbialos con cuidado, son grandes y muy referenciados):
`PublicMenu.tsx`, `OrdersTab.tsx`, `ProductEditor.tsx`, `QrTab.tsx`, `CatalogTab.tsx`.
Cuenta dividida unificada (cuentas de mesa, batches, timers de entrega): UI en
`editor/OrdersTab.tsx` y `public/SplitPanel.tsx`; sus endpoints
`api/[slug]/split/{mine,subaccounts,sync}` viven en la zona ⛔ (no se tocan).
Motor de recomendaciones determinista local: `src/lib/recommendations.ts`
(reemplazó a `lib/pairings.ts`) — solo lectura, alimenta `SuggestionCarousel`.
Assets de video del rediseño en `public/videos/`: `landing-bg.mp4` (fondo de la landing)
y `panel-restaurante.mp4` (fondo del login del editor). El dock inferior del editor vive
en `Editor.tsx` (clases `.dock-*`).
---
## 3. Sistema de diseño (respetar siempre)
La estética es **glassmorphism claro/transparente con animaciones high-end**. No
introducir un look nuevo sin pedirlo.
### Tokens de color (CSS vars en `globals.css`) — FIJOS (paleta retirada)
Los colores son **fijos** (hardcodeados del mockup); ya **no** se configuran por
restaurante. Definidos en `:root` (`globals.css`) y forzados por `paletteToCssVars()`
(que ignora la paleta guardada). Úsalos vía `var(--…)`:
```
--bg #ffffff --bg-2 #ffffff --surface rgba(255,255,255,.55)
--accent #dc2626 (rojo) --text #2a2520 --tab rgba(255,255,255,.45)
```
> La sección de Paleta del editor se eliminará por completo (lo hará el dueño del repo).
> **Acción primaria = rojo `#dc2626` hardcodeado** (rediseño): botones "Agregar a mi
> orden", FAB "Orden", CTA de la landing, "Guardar y publicar", login, etc. NO usan
> `--accent` (la sección de Paleta se retirará después). Acentos secundarios del FAB:
> azul `#1e3a5f` (mesero), negro `#111` (dividir cuenta).
### Tipografía (rediseño)
- **Montserrat** = UI + display (cuerpo y títulos). Cargada en `layout.tsx` (`next/font`,
var `--font-montserrat`); `.display` la usa.
- **Merriweather** = SOLO el wordmark "Smart Menu" de la landing (`.wordmark`, var
`--font-merriweather`).
### Colores de macros — ESTÁNDAR FIJO (no configurable)
Definidos en `tailwind.config.ts` (`colors.macro`) y `src/lib/macros.ts`. **Nunca**
los cambies ni los sustituyas por colores de paleta:
| Macro | Token Tailwind | Hex |
| --- | --- | --- |
| Proteína | `macro-protein` | `#dc2626` |
| Carbohidratos | `macro-carbs` | `#B45309` |
| Azúcares | `macro-sugar` | `#BE185D` |
| Grasas | `macro-fat` | `#CA8A04` |
| Fibra | `macro-fiber` | `#15803D` |
| Calorías | `macro-kcal` | `#1D4ED8` |
### Clases utilitarias propias
- `.glass`, `.glass-soft`, `.glass-pill` — superficies de cristal.
- `.liquid-btn` — botón "cristal líquido" (opt-in).
- `.ai-smoke` / `.ai-smoke-red` / `.ai-smoke-green` — botones de gradiente animado (IA / orden / split).
- `.seg-btn`(`.is-active`) — control segmentado (Tarjetas/Lista).
- `.cat-btn` / `.cat-bar`(`.is-stuck`) / `.stuck-name` / `.cat-row` — tabs de sección sticky del menú público.
- `.dock-bar` / `.dock-btn` / `.dock-chip` / `.dock-dot` / `.dock-tip` — dock inferior del editor (en `Editor.tsx`).
- `.macro-cell` / `.macro-num` — celdas de macros (cara trasera de la tarjeta), con brillo.
- `.pendiente-green` / `.pendiente-yellow` / `.pendiente-red` — cronómetros de entrega (OrdersTab).
- `.editable-num` — input numérico sin spinner.
- `.aurora` — fondo aurora animado (disponible para la landing).
- `.display` — tipografía Montserrat para títulos; `.wordmark` — Merriweather (landing).
- `.flip-scene` / `.flip-card` / `.flip-face` — flip 3D de macros (perspective 1400px).
- `.no-scrollbar` — tabs horizontales.
- `safe-*` — respeto de safe-area (notch / barra de gestos). **Úsalas** en headers,
FABs, tab bars y modales en vez de paddings fijos.
### Animaciones disponibles (Tailwind)
`animate-fade-up`, `animate-spawn`, `animate-pulse-dot`. Reúsalas antes de crear
keyframes nuevos. Curva estándar: `cubic-bezier(0.22, 1, 0.36, 1)`.
---
## 4. Reglas de internacionalización (i18n)
- **Bilingüe ES/EN obligatorio.** Todo texto visible sale de `messages/es.json` y
`messages/en.json` vía `next-intl` (`useTranslations`). **Nunca** hardcodees
cadenas en el JSX.
- Si agregas una clave, **agrégala en ambos** archivos con el mismo path.
- **Sentence case** en toda la UI (no Title Case): "Realizar orden", no "Realizar Orden".
- Contenido dinámico (nombres/descripciones de platillos) ya viene como `{ es, en }`;
selecciona el idioma activo, no lo traduzcas en el cliente.
---
## 5. Reglas de oro (guardrails)
1. **Mobile-first.** El público y el editor son móviles primero. Verifica en ancho
~390px antes que en desktop.
2. **No romper el contrato de datos.** Consume las props/tipos existentes
(`components/editor/types.ts`, `lib/types.ts`); no cambies su forma.
3. **Sin dependencias nuevas** salvo autorización. Ya hay `lucide-react` (iconos),
`clsx`, `qr-code-styling`. Úsalas.
4. **Cambios mínimos y localizados.** Toca solo lo necesario para el objetivo; imita
el estilo del código vecino (naming, densidad de comentarios, idioma).
5. **Accesibilidad:** contraste suficiente sobre cristal (hay helper `lib/contrast.ts`),
`aria-label` en botones de solo icono, foco visible, `alt` en imágenes.
6. **Sin estados de servidor nuevos.** Estado local de UI (useState/useReducer) sí;
nuevos fetch/endpoints no.
7. **Reduce motion:** si agregas animación fuerte, respeta `prefers-reduced-motion`.
---
## 6. Flujo de trabajo por cada cambio
1. **Definir** el cambio en una línea (ver §8, tabla de tareas).
2. **Localizar** los componentes afectados (§2). Leer antes de editar.
3. **Confirmar alcance:** ¿toca algo de la zona ⛔? → avisar y proponer alternativa.
4. **Implementar** usando tokens, clases utilitarias e i18n existentes.
5. **Verificar** (§7).
6. **Reportar:** qué archivos cambiaron y por qué, en una frase.
### Comandos
```bash
npm install # primera vez
npm run dev # http://localhost:3000 — desarrollo en vivo
npm run lint # ESLint (next lint)
npm run build # prisma generate + next build (chequeo de tipos/SSR)
```
> Las rutas reales: menú `/{slug}`, editor `/{slug}/editor?k={secret}`, admin `/admin`.
> El seed (`npm run db:seed`) imprime el link con secreto y `admin / demo1234`.
---
## 7. Checklist de verificación (antes de dar por hecho un cambio)
- [ ] Se ve bien en móvil (~390px) y no se rompe en desktop.
- [ ] Todo texto nuevo está en `es.json` **y** `en.json`, en sentence case.
- [ ] Usa tokens de paleta (`--accent`, etc.), no hex de marca hardcodeados.
- [ ] Colores de macros intactos (§3).
- [ ] `npm run lint` y `npm run build` sin errores nuevos.
- [ ] No se modificó nada de la zona ⛔ (api, prisma, lib, contratos).
- [ ] safe-area respetada en headers/FABs/tab bars/modales.
- [ ] Contraste y `aria-label` correctos.
---
## 8. Registro de tareas (lo llena el humano que dirige)
> Una fila por cambio solicitado. Claude la toma de arriba hacia abajo.
| # | Cambio (qué y dónde) | Componente(s) objetivo | Estado | Notas |
| - | --- | --- | --- | --- |
| 1 | _ej. Aumentar el tamaño del precio en la tarjeta de platillo_ | `public/DishCard.tsx` | pendiente | |
| 2 | | | | |
| 3 | | | | |
---
## 9. Plantilla para pedir un cambio
```
Objetivo: <qué quiero ver distinto, en una frase>
Pantalla/ruta: <público | editor | admin> · <ruta>
Componente(s): <archivo(s) probable(s)>
Detalle: <espaciado, color de paleta, copy, animación, layout…>
Restricciones: solo frontend · respetar glass + macros + i18n + mobile-first
Aceptación: <cómo sé que quedó bien>
```
+63
View File
@@ -0,0 +1,63 @@
<!doctype html>
<!--
PANTALLA: Editor — admin · login (AdminLogin.tsx)
Reproduce: acceso al panel maestro Collina.
Mockup editable — Tailwind CDN + tokens portados de globals.css.
-->
<html lang="es">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Admin · login — SmartMenu</title>
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = { theme: { extend: { fontFamily: { display: ['Montserrat','system-ui','sans-serif'], body: ['Montserrat','system-ui','sans-serif'] } } } }
</script>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
<style>
:root { --bg:#ffffff; --bg-2:#ffffff; --surface:rgba(255,255,255,.55); --accent:#dc2626; --text:#2a2520; --tab:rgba(255,255,255,.45); --font-fraunces:'Montserrat'; --font-inter:'Montserrat'; }
body { margin:0; background:#1b1916; font-family:var(--font-inter),system-ui,sans-serif; color:var(--text); }
.display { font-family:var(--font-fraunces),Georgia,serif; }
/* ===== Identidad de botones (de menu-publico) ===== */
button { font-family:'Montserrat',system-ui,sans-serif; }
.seg-btn { color:rgba(42,37,32,.5); background:transparent; border:none; cursor:pointer; transition:background .2s ease, color .2s ease, box-shadow .2s ease; }
.seg-btn.is-active { color:#111; background:#fff; box-shadow:0 2px 8px rgba(40,30,20,.14), 0 0 0 1px rgba(0,0,0,.04); }
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke) {
position:relative;
background: linear-gradient(135deg, rgba(255,255,255,.65), rgba(245,242,237,.25) 55%, rgba(180,83,9,.06)), rgba(255,255,255,.4);
backdrop-filter:blur(10px) saturate(160%); -webkit-backdrop-filter:blur(10px) saturate(160%);
border:1px solid rgba(255,255,255,.9);
box-shadow: 0 10px 24px -6px rgba(40,30,20,.22), 0 2px 6px rgba(40,30,20,.10), inset 0 2px 2px rgba(255,255,255,1), inset 0 -6px 12px rgba(180,160,140,.18), inset 0 0 0 1px rgba(255,255,255,.5);
overflow:hidden; transition:box-shadow .25s ease, transform .25s ease;
}
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke)::before {
content:""; position:absolute; left:6%; right:6%; top:2px; height:42%; border-radius:999px; pointer-events:none;
background:linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,0)); filter:blur(.5px); opacity:.9;
}
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke):hover {
box-shadow: 0 14px 30px -6px rgba(40,30,20,.28), 0 3px 8px rgba(40,30,20,.14), inset 0 2px 3px rgba(255,255,255,1), inset 0 -7px 14px rgba(180,160,140,.22), inset 0 0 0 1px rgba(255,255,255,.6);
transform:translateY(-1px);
}
@keyframes ai-smoke { 0%{background-position:0% 50%;} 50%{background-position:100% 50%;} 100%{background-position:0% 50%;} }
button.ai-smoke { background:linear-gradient(120deg,#D97757,#E89B7D,#C2410C,#E08A5F,#D97757); background-size:300% 300%; color:#fff; animation:ai-smoke 6s ease-in-out infinite; }
button.cat-btn { display:flex; align-items:center; gap:8px; background:#f0f0f0; color:#111; transition:background .2s ease, color .2s ease; }
button.cat-btn.is-active { background:#111; color:#fff; }
.menu-bg { background: radial-gradient(1200px 800px at 80% -10%, rgba(255,255,255,.6), transparent 60%), radial-gradient(1000px 700px at -10% 110%, rgba(255,255,255,.4), transparent 55%), linear-gradient(160deg, var(--bg), var(--bg-2)); }
.glass { background:var(--surface); backdrop-filter:blur(18px) saturate(140%); -webkit-backdrop-filter:blur(18px) saturate(140%); border:1px solid rgba(255,255,255,.6); box-shadow:0 8px 32px rgba(31,38,135,.08), inset 0 1px 0 rgba(255,255,255,.7); }
.glass-soft { background:rgba(255,255,255,.35); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); border:1px solid rgba(255,255,255,.5); }
.device { position:relative; width:390px; height:844px; border-radius:2.75rem; overflow:hidden; box-shadow:0 40px 80px -20px rgba(0,0,0,.55), 0 0 0 11px #0c0b0a, 0 0 0 13px #2a2724; }
</style>
</head>
<body class="min-h-screen flex items-center justify-center p-6">
<div class="device">
<main class="menu-bg flex h-full items-center justify-center p-4">
<form class="glass flex w-full max-w-sm flex-col gap-3 rounded-3xl p-6">
<h1 class="display text-2xl font-semibold">Panel maestro Collina</h1>
<input value="admin" placeholder="usuario" class="glass-soft rounded-2xl px-4 py-3 outline-none" />
<input type="password" value="demo1234" placeholder="contraseña" class="glass-soft rounded-2xl px-4 py-3 outline-none" />
<button class="solid-btn rounded-2xl bg-[var(--accent)] py-3 font-medium text-white">Iniciar sesión</button>
</form>
</main>
</div>
</body>
</html>
+113
View File
@@ -0,0 +1,113 @@
<!doctype html>
<!--
PANTALLA: Admin — Panel maestro (AdminPanel.tsx)
Reproduce: alta de restaurante (nombre/slug/idioma), credenciales recién creadas,
y lista de restaurantes con links público/editor y toggle activo/inactivo.
Mockup editable — Tailwind CDN + tokens portados de globals.css. Datos de ejemplo.
(Pantalla de escritorio: max-w-3xl, no enmarcada en teléfono.)
-->
<html lang="es">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Admin · panel — SmartMenu</title>
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = { theme: { extend: { fontFamily: { display: ['Montserrat','system-ui','sans-serif'], body: ['Montserrat','system-ui','sans-serif'] } } } }
</script>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
<style>
:root { --bg:#ffffff; --bg-2:#ffffff; --surface:rgba(255,255,255,.55); --accent:#dc2626; --text:#2a2520; --tab:rgba(255,255,255,.45); --font-fraunces:'Montserrat'; --font-inter:'Montserrat'; }
body { margin:0; min-height:100vh; font-family:var(--font-inter),system-ui,sans-serif; color:var(--text);
background: radial-gradient(1200px 800px at 80% -10%, rgba(255,255,255,.6), transparent 60%), radial-gradient(1000px 700px at -10% 110%, rgba(255,255,255,.4), transparent 55%), linear-gradient(160deg, var(--bg), var(--bg-2)); background-attachment:fixed; }
.display { font-family:var(--font-fraunces),Georgia,serif; }
/* ===== Identidad de botones (de menu-publico) ===== */
button { font-family:'Montserrat',system-ui,sans-serif; }
.seg-btn { color:rgba(42,37,32,.5); background:transparent; border:none; cursor:pointer; transition:background .2s ease, color .2s ease, box-shadow .2s ease; }
.seg-btn.is-active { color:#111; background:#fff; box-shadow:0 2px 8px rgba(40,30,20,.14), 0 0 0 1px rgba(0,0,0,.04); }
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke) {
position:relative;
background: linear-gradient(135deg, rgba(255,255,255,.65), rgba(245,242,237,.25) 55%, rgba(180,83,9,.06)), rgba(255,255,255,.4);
backdrop-filter:blur(10px) saturate(160%); -webkit-backdrop-filter:blur(10px) saturate(160%);
border:1px solid rgba(255,255,255,.9);
box-shadow: 0 10px 24px -6px rgba(40,30,20,.22), 0 2px 6px rgba(40,30,20,.10), inset 0 2px 2px rgba(255,255,255,1), inset 0 -6px 12px rgba(180,160,140,.18), inset 0 0 0 1px rgba(255,255,255,.5);
overflow:hidden; transition:box-shadow .25s ease, transform .25s ease;
}
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke)::before {
content:""; position:absolute; left:6%; right:6%; top:2px; height:42%; border-radius:999px; pointer-events:none;
background:linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,0)); filter:blur(.5px); opacity:.9;
}
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke):hover {
box-shadow: 0 14px 30px -6px rgba(40,30,20,.28), 0 3px 8px rgba(40,30,20,.14), inset 0 2px 3px rgba(255,255,255,1), inset 0 -7px 14px rgba(180,160,140,.22), inset 0 0 0 1px rgba(255,255,255,.6);
transform:translateY(-1px);
}
@keyframes ai-smoke { 0%{background-position:0% 50%;} 50%{background-position:100% 50%;} 100%{background-position:0% 50%;} }
button.ai-smoke { background:linear-gradient(120deg,#D97757,#E89B7D,#C2410C,#E08A5F,#D97757); background-size:300% 300%; color:#fff; animation:ai-smoke 6s ease-in-out infinite; }
button.cat-btn { display:flex; align-items:center; gap:8px; background:#f0f0f0; color:#111; transition:background .2s ease, color .2s ease; }
button.cat-btn.is-active { background:#111; color:#fff; }
.glass { background:var(--surface); backdrop-filter:blur(18px) saturate(140%); -webkit-backdrop-filter:blur(18px) saturate(140%); border:1px solid rgba(255,255,255,.6); box-shadow:0 8px 32px rgba(31,38,135,.08), inset 0 1px 0 rgba(255,255,255,.7); }
.glass-soft { background:rgba(255,255,255,.35); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); border:1px solid rgba(255,255,255,.5); }
</style>
</head>
<body>
<main class="mx-auto max-w-3xl p-4 pb-16">
<h1 class="display mb-6 text-3xl font-semibold">Panel maestro Collina</h1>
<section class="glass mb-6 rounded-3xl p-5">
<h2 class="display mb-3 text-xl font-semibold" style="text-align: center">Nuevo restaurante</h2>
<form class="flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-end">
<label class="flex flex-1 flex-col gap-1 text-sm" style="text-align: center">Nombre<input value="Café del Parque" class="glass-soft rounded-2xl px-4 py-2.5 outline-none" /></label>
<label class="flex flex-1 flex-col gap-1 text-sm" style="text-align: center">Slug (opcional)<input placeholder="se genera del nombre" class="glass-soft rounded-2xl px-4 py-2.5 outline-none" /></label>
<label class="flex flex-col gap-1 text-sm">Idioma<select class="glass-soft rounded-2xl px-4 py-2.5 outline-none"><option>ES</option><option>EN</option></select></label>
<button class="solid-btn rounded-2xl bg-[var(--accent)] px-5 py-2.5 font-medium text-white">Crear restaurante</button>
</form>
<div class="mt-4 rounded-2xl border border-amber-300 bg-amber-50/70 p-4 text-sm">
<p class="mb-2 font-semibold">Restaurante «Café del Parque» creado. Guarda estas credenciales (se muestran una vez):</p>
<ul class="space-y-1">
<li><strong>Usuario:</strong> cafedelparque</li>
<li><strong>Contraseña:</strong> <code>x7Kp9mQ2</code></li>
<li class="break-all"><strong>Link de editor:</strong> https://menu.collina.mx/cafedelparque/editor?k=9f3a1c7e</li>
<li class="break-all"><strong>Link público:</strong> https://menu.collina.mx/cafedelparque</li>
</ul>
</div>
</section>
<section class="glass rounded-3xl p-5">
<h2 class="display mb-3 text-xl font-semibold">Restaurantes</h2>
<div class="flex flex-col gap-3">
<div class="glass-soft rounded-2xl p-4">
<div class="flex items-center justify-between gap-2">
<div><div class="font-semibold">Trattoria della Collina</div><div class="text-xs text-[var(--text)]/60">/trattoria</div></div>
<button class="solid-btn rounded-full bg-green-100 px-3 py-1 text-xs font-medium text-green-800">activo</button>
</div>
<div class="mt-2 space-y-1 text-xs">
<a class="block break-all text-[var(--accent)]">público: https://menu.collina.mx/trattoria</a>
<a class="block break-all text-[var(--accent)]">editor: https://menu.collina.mx/trattoria/editor?k=a1b2c3d4</a>
</div>
</div>
<div class="glass-soft rounded-2xl p-4">
<div class="flex items-center justify-between gap-2">
<div><div class="font-semibold">Café del Parque</div><div class="text-xs text-[var(--text)]/60">/cafedelparque</div></div>
<button class="solid-btn rounded-full bg-green-100 px-3 py-1 text-xs font-medium text-green-800">activo</button>
</div>
<div class="mt-2 space-y-1 text-xs">
<a class="block break-all text-[var(--accent)]">público: https://menu.collina.mx/cafedelparque</a>
<a class="block break-all text-[var(--accent)]">editor: https://menu.collina.mx/cafedelparque/editor?k=9f3a1c7e</a>
</div>
</div>
<div class="glass-soft rounded-2xl p-4">
<div class="flex items-center justify-between gap-2">
<div><div class="font-semibold">Sushi Hama</div><div class="text-xs text-[var(--text)]/60">/sushihama</div></div>
<button class="solid-btn rounded-full bg-gray-200 px-3 py-1 text-xs font-medium text-gray-600">inactivo</button>
</div>
<div class="mt-2 space-y-1 text-xs">
<a class="block break-all text-[var(--accent)]">público: https://menu.collina.mx/sushihama</a>
<a class="block break-all text-[var(--accent)]">editor: https://menu.collina.mx/sushihama/editor?k=5e6f7a8b</a>
</div>
</div>
</div>
</section>
</main>
</body>
</html>
Binary file not shown.
Binary file not shown.
+259
View File
@@ -0,0 +1,259 @@
<!doctype html>
<!--
PANTALLA: Editor — Catálogo (CatalogTab.tsx, dentro de Editor.tsx)
Reproduce: acciones (Ver menú · Cargar menú · Guardar y publicar), toggle global de
macros, secciones con productos (arrastrables), estado completo/falta info, activo/inactivo,
+ Agregar platillo / + Nueva sección, y la barra de tabs inferior del editor.
Mockup editable — Tailwind CDN + tokens portados de globals.css. Datos de ejemplo.
-->
<html lang="es">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Editor · catálogo — SmartMenu</title>
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = { theme: { extend: { fontFamily: { display: ['Montserrat','system-ui','sans-serif'], body: ['Montserrat','system-ui','sans-serif'] } } } }
</script>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
<style>
:root { --bg:#ffffff; --bg-2:#ffffff; --surface:rgba(255,255,255,.55); --accent:#dc2626; --text:#2a2520; --tab:rgba(255,255,255,.45); --font-fraunces:'Montserrat'; --font-inter:'Montserrat'; }
body { margin:0; background:#1b1916; font-family:var(--font-inter),system-ui,sans-serif; color:var(--text); }
.display { font-family:var(--font-fraunces),Georgia,serif; }
/* ===== Identidad de botones (de menu-publico) ===== */
button { font-family:'Montserrat',system-ui,sans-serif; }
.seg-btn { color:rgba(42,37,32,.5); background:transparent; border:none; cursor:pointer; transition:background .2s ease, color .2s ease, box-shadow .2s ease; }
.seg-btn.is-active { color:#111; background:#fff; box-shadow:0 2px 8px rgba(40,30,20,.14), 0 0 0 1px rgba(0,0,0,.04); }
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke):not(.dock-btn) {
position:relative;
background: linear-gradient(135deg, rgba(255,255,255,.65), rgba(245,242,237,.25) 55%, rgba(180,83,9,.06)), rgba(255,255,255,.4);
backdrop-filter:blur(10px) saturate(160%); -webkit-backdrop-filter:blur(10px) saturate(160%);
border:1px solid rgba(255,255,255,.9);
box-shadow: 0 10px 24px -6px rgba(40,30,20,.22), 0 2px 6px rgba(40,30,20,.10), inset 0 2px 2px rgba(255,255,255,1), inset 0 -6px 12px rgba(180,160,140,.18), inset 0 0 0 1px rgba(255,255,255,.5);
overflow:hidden; transition:box-shadow .25s ease, transform .25s ease;
}
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke):not(.dock-btn)::before {
content:""; position:absolute; left:6%; right:6%; top:2px; height:42%; border-radius:999px; pointer-events:none;
background:linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,0)); filter:blur(.5px); opacity:.9;
}
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke):not(.dock-btn):hover {
box-shadow: 0 14px 30px -6px rgba(40,30,20,.28), 0 3px 8px rgba(40,30,20,.14), inset 0 2px 3px rgba(255,255,255,1), inset 0 -7px 14px rgba(180,160,140,.22), inset 0 0 0 1px rgba(255,255,255,.6);
transform:translateY(-1px);
}
@keyframes ai-smoke { 0%{background-position:0% 50%;} 50%{background-position:100% 50%;} 100%{background-position:0% 50%;} }
button.ai-smoke { background:linear-gradient(120deg,#D97757,#E89B7D,#C2410C,#E08A5F,#D97757); background-size:300% 300%; color:#fff; animation:ai-smoke 6s ease-in-out infinite; }
button.cat-btn { display:flex; align-items:center; gap:8px; background:#f0f0f0; color:#111; transition:background .2s ease, color .2s ease; }
button.cat-btn.is-active { background:#111; color:#fff; }
.menu-bg { background: radial-gradient(1200px 800px at 80% -10%, rgba(255,255,255,.6), transparent 60%), radial-gradient(1000px 700px at -10% 110%, rgba(255,255,255,.4), transparent 55%), linear-gradient(160deg, var(--bg), var(--bg-2)); }
.glass { background:var(--surface); backdrop-filter:blur(18px) saturate(140%); -webkit-backdrop-filter:blur(18px) saturate(140%); border:1px solid rgba(255,255,255,.6); box-shadow:0 8px 32px rgba(31,38,135,.08), inset 0 1px 0 rgba(255,255,255,.7); }
.glass-soft { background:rgba(255,255,255,.35); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); border:1px solid rgba(255,255,255,.5); }
.glass-pill { background:var(--tab); backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px); border:1px solid rgba(255,255,255,.55); }
.device { position:relative; width:390px; height:844px; border-radius:2.75rem; overflow:hidden; box-shadow:0 40px 80px -20px rgba(0,0,0,.55), 0 0 0 11px #0c0b0a, 0 0 0 13px #2a2724; }
.screen { position:absolute; inset:0; overflow-y:auto; }
.screen::-webkit-scrollbar { display:none; } .screen { scrollbar-width:none; }
/* ===== Dock (barra blanca tipo pill) ===== */
.dock-wrap { position:absolute; bottom:24px; left:14px; right:14px; z-index:30; display:flex; justify-content:center; }
.dock-bar {
display:flex; align-items:center; justify-content:space-between; gap:4px;
width:100%; padding:20px 18px 14px; border-radius:32px;
background:#fff; border:1px solid rgba(0,0,0,.05);
box-shadow:0 16px 36px -10px rgba(0,0,0,.20), 0 4px 12px rgba(0,0,0,.08);
}
.dock-btn {
position:relative; flex:1 1 0; height:46px; border:none; background:transparent; cursor:pointer;
display:flex; align-items:center; justify-content:center; padding:0;
}
.dock-chip {
display:flex; align-items:center; justify-content:center; width:46px; height:46px; border-radius:16px;
color:#1b1916; background:transparent;
transition:transform .4s cubic-bezier(.34,1.56,.5,1), background .25s ease, box-shadow .25s ease;
}
.dock-chip svg { width:26px; height:26px; }
.dock-btn:hover .dock-chip { transform:translateY(-3px); }
.dock-btn:active .dock-chip { transform:scale(.92); }
.dock-btn.is-active .dock-chip {
background:#ececec; transform:translateY(-12px) scale(1.06);
box-shadow:0 8px 16px rgba(0,0,0,.12), inset 0 0 0 1px rgba(0,0,0,.03);
}
.dock-dot {
position:absolute; bottom:-4px; left:50%; transform:translateX(-50%) scale(0);
width:6px; height:6px; border-radius:999px; background:#111;
transition:transform .35s cubic-bezier(.34,1.56,.5,1);
}
.dock-btn.is-active .dock-dot { transform:translateX(-50%) scale(1); }
.dock-tip {
position:absolute; bottom:calc(100% + 6px); left:50%; transform-origin:bottom center;
padding:7px 16px; border-radius:14px; background:#fff; color:#1b1916; font-size:14px; font-weight:500;
white-space:nowrap; opacity:0; transform:translateX(-50%) translateY(6px) scale(.95); pointer-events:none; z-index:6;
border:1px solid rgba(0,0,0,.05);
box-shadow:0 12px 28px rgba(0,0,0,.16), 0 3px 8px rgba(0,0,0,.08);
transition:opacity .2s ease, transform .2s ease;
}
.dock-btn:hover .dock-tip { opacity:1; transform:translateX(-50%) translateY(0) scale(1); }
.dock-btn.is-active .dock-tip { opacity:0; }
.dock-btn.is-active:hover .dock-tip { opacity:1; transform:translateX(-50%) translateY(0) scale(1); }
</style>
</head>
<body class="min-h-screen flex items-center justify-center p-6">
<div class="device">
<div class="screen menu-bg px-4 pb-28 pt-14">
<!-- Header del editor -->
<header class="mb-3 flex items-center justify-between gap-2 px-4">
<div>
<h1 class="display text-xl font-semibold leading-tight">Trattoria della Collina</h1>
<p class="text-xs text-[var(--text)]/55">Versión publicada: Carta primavera 2026</p>
</div>
<button class="glass-pill whitespace-nowrap rounded-full px-3 py-1 text-sm font-medium">ES / EN</button>
</header>
<div class="flex flex-col gap-4">
<!-- Acciones -->
<div class="flex items-center gap-2">
<a class="glass-pill rounded-full px-4 py-2 text-sm font-medium" style="background-color: rgba(179, 203, 232, 0.45); text-align: center">Ver menú</a>
<button class="solid-btn rounded-full px-4 py-2 text-sm font-medium" style="background-color: rgba(179, 203, 232, 0.45)">Cargar menú</button>
<button class="solid-btn ml-auto rounded-full bg-[var(--accent)] px-5 py-2 text-sm font-semibold text-white shadow">Guardar y publicar</button>
</div>
<!-- Toggle global de macros -->
<div class="glass flex items-center justify-between gap-3 rounded-3xl p-4">
<div class="min-w-0">
<div class="text-sm font-medium" style="text-align: left">Mostrar datos nutrimentales en el menú</div>
<div class="text-xs text-[var(--text)]/55">Cada sección puede ocultar sus macros individualmente.</div>
</div>
<span class="relative h-7 w-12 shrink-0 rounded-full bg-black"><span class="absolute left-6 top-1 h-5 w-5 rounded-full bg-white"></span></span>
</div>
<!-- Sección: Entradas -->
<section class="glass rounded-3xl p-4">
<div class="mb-3 flex items-center gap-2">
<span class="cursor-grab text-[var(--text)]/30">⋮⋮</span>
<span class="display flex-1 text-base font-semibold">Entradas</span>
<button class="ml-auto text-sm text-red-500/70" aria-label="Eliminar">✕</button>
</div>
<button class="solid-btn mb-3 flex w-full items-center justify-between gap-2 rounded-2xl bg-white/30 px-3 py-2 text-xs">
<span class="text-[var(--text)]/70">Macros en esta sección</span>
<span class="relative h-5 w-9 shrink-0 rounded-full bg-black"><span class="absolute left-[1.125rem] top-0.5 h-4 w-4 rounded-full bg-white"></span></span>
</button>
<div class="flex flex-col gap-2">
<div class="glass-soft flex items-center gap-3 rounded-2xl p-2">
<span class="cursor-grab text-[var(--text)]/30">⋮⋮</span>
<div class="h-12 w-12 shrink-0 overflow-hidden rounded-xl bg-white/40"><img src="https://images.unsplash.com/photo-1572695157366-5e585ab2b69f?auto=format&fit=crop&w=120&q=70" alt="" class="h-full w-full object-cover" /></div>
<div class="min-w-0 flex-1 text-left">
<div class="truncate text-sm font-medium">Bruschetta al pomodoro</div>
<div class="text-xs text-[var(--text)]/55">$8.50</div>
</div>
<span class="h-2.5 w-2.5 rounded-full bg-green-500" title="Completo"></span>
<button class="solid-btn rounded-full bg-green-100 px-2 py-1 text-[10px] font-medium text-green-700">Activo</button>
</div>
<div class="glass-soft flex items-center gap-3 rounded-2xl p-2">
<span class="cursor-grab text-[var(--text)]/30">⋮⋮</span>
<div class="h-12 w-12 shrink-0 overflow-hidden rounded-xl bg-white/40"><img src="https://images.unsplash.com/photo-1432139555190-58524dae6a55?auto=format&fit=crop&w=120&q=70" alt="" class="h-full w-full object-cover" /></div>
<div class="min-w-0 flex-1 text-left">
<div class="truncate text-sm font-medium">Carpaccio de res</div>
<div class="text-xs text-[var(--text)]/55">$14.00</div>
</div>
<span class="h-2.5 w-2.5 rounded-full bg-amber-500" title="Falta info"></span>
<button class="solid-btn rounded-full bg-gray-200 px-2 py-1 text-[10px] font-medium text-gray-500">Inactivo</button>
</div>
</div>
<button class="solid-btn mt-3 w-full rounded-2xl bg-black py-2 text-sm font-medium text-white">+ Agregar platillo</button>
</section>
<!-- Sección: Platos fuertes -->
<section class="glass rounded-3xl p-4">
<div class="mb-3 flex items-center gap-2">
<span class="cursor-grab text-[var(--text)]/30">⋮⋮</span>
<span class="display flex-1 text-base font-semibold">Platos fuertes</span>
<button class="ml-auto text-sm text-red-500/70" aria-label="Eliminar">✕</button>
</div>
<button class="solid-btn mb-3 flex w-full items-center justify-between gap-2 rounded-2xl bg-white/30 px-3 py-2 text-xs">
<span class="text-[var(--text)]/70">Macros en esta sección</span>
<span class="relative h-5 w-9 shrink-0 rounded-full bg-black"><span class="absolute left-[1.125rem] top-0.5 h-4 w-4 rounded-full bg-white"></span></span>
</button>
<div class="flex flex-col gap-2">
<div class="glass-soft flex items-center gap-3 rounded-2xl p-2">
<span class="cursor-grab text-[var(--text)]/30">⋮⋮</span>
<div class="h-12 w-12 shrink-0 overflow-hidden rounded-xl bg-white/40"><img src="https://images.unsplash.com/photo-1476124369491-e7addf5db371?auto=format&fit=crop&w=120&q=70" alt="" class="h-full w-full object-cover" /></div>
<div class="min-w-0 flex-1 text-left">
<div class="truncate text-sm font-medium">Risotto ai funghi</div>
<div class="text-xs text-[var(--text)]/55">$18.50</div>
</div>
<span class="h-2.5 w-2.5 rounded-full bg-green-500" title="Completo"></span>
<button class="solid-btn rounded-full bg-green-100 px-2 py-1 text-[10px] font-medium text-green-700">Activo</button>
</div>
</div>
<button class="solid-btn mt-3 w-full rounded-2xl bg-black py-2 text-sm font-medium text-white">+ Agregar platillo</button>
</section>
<button class="solid-btn rounded-2xl py-3 text-sm font-medium text-white" style="background-color:#1e3a5f">+ Nueva sección</button>
<!-- Historial de versiones (sección al pie del catálogo) -->
<section class="glass rounded-3xl p-4">
<h2 class="display mb-1 text-lg font-semibold">Historial de versiones</h2>
<p class="mb-3 text-xs text-[var(--text)]/55">Puedes ver tus últimas 5 versiones</p>
<div class="flex flex-col gap-2">
<div class="glass-soft flex items-center gap-3 rounded-2xl px-3 py-2.5">
<div class="min-w-0 flex-1">
<div class="truncate text-sm font-medium">Carta primavera 2026</div>
<div class="mt-1 flex items-center gap-2">
<span class="text-[11px] text-[var(--text)]/55">14 mar 2026, 18:40</span>
<span class="shrink-0 whitespace-nowrap rounded-full bg-green-100 px-2 py-0.5 text-[10px] font-medium text-green-700">Versión publicada</span>
</div>
</div>
<button class="solid-btn shrink-0 rounded-full bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-white" style="background-color: rgba(153, 69, 167, 0.604)">Restaurar</button>
</div>
<div class="glass-soft flex items-center gap-3 rounded-2xl px-3 py-2.5">
<div class="min-w-0 flex-1">
<div class="truncate text-sm font-medium">Carta invierno 2025</div>
<div class="mt-1 text-[11px] text-[var(--text)]/55">2 dic 2025, 11:05</div>
</div>
<button class="solid-btn shrink-0 rounded-full bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-white" style="background-color: rgba(153, 69, 167, 0.604)">Restaurar</button>
</div>
</div>
</section>
</div>
</div>
<!-- Barra de tabs inferior -->
<nav class="dock-wrap">
<div class="dock-bar" id="dock">
<button class="dock-btn is-active" data-i="0">
<span class="dock-chip"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect x="8" y="2" width="8" height="4" rx="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/><path d="M8 11h.01M8 16h.01"/><path d="M12 11h4M12 16h4"/></svg></span>
<span class="dock-tip">Catálogo</span><span class="dock-dot"></span>
</button>
<button class="dock-btn" data-i="1">
<span class="dock-chip"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><circle cx="13.5" cy="6.5" r="1.3"/><circle cx="17.5" cy="10.5" r="1.3"/><circle cx="8.5" cy="7.5" r="1.3"/><circle cx="6.5" cy="12.5" r="1.3"/><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.93 0 1.65-.75 1.65-1.69 0-.44-.18-.83-.44-1.12-.29-.29-.44-.65-.44-1.13a1.64 1.64 0 0 1 1.67-1.66h1.99c3.05 0 5.56-2.5 5.56-5.56C21.96 6.01 17.46 2 12 2z"/></svg></span>
<span class="dock-tip">Paleta</span><span class="dock-dot"></span>
</button>
<button class="dock-btn" data-i="2">
<span class="dock-chip"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M12.59 2.59A2 2 0 0 0 11.17 2H4a2 2 0 0 0-2 2v7.17a2 2 0 0 0 .59 1.42l8.7 8.7a2.43 2.43 0 0 0 3.42 0l6.58-6.58a2.43 2.43 0 0 0 0-3.42z"/><circle cx="7.5" cy="7.5" r=".9"/></svg></span>
<span class="dock-tip">Marca</span><span class="dock-dot"></span>
</button>
<button class="dock-btn" data-i="3">
<span class="dock-chip"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/></svg></span>
<span class="dock-tip">Órdenes</span><span class="dock-dot"></span>
</button>
<button class="dock-btn" data-i="4">
<span class="dock-chip"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><path d="M14 14h3v3h-3zM20 14v.01M14 20v.01M20 20v.01M20 17v.01M17 20v.01"/></svg></span>
<span class="dock-tip">QR</span><span class="dock-dot"></span>
</button>
</div>
</nav>
</div>
<script>
(function(){
var dock = document.getElementById('dock');
if (!dock) return;
var btns = [].slice.call(dock.querySelectorAll('.dock-btn'));
btns.forEach(function(btn){
btn.addEventListener('click', function(){
btns.forEach(function(b){ b.classList.remove('is-active'); });
btn.classList.add('is-active');
});
});
})();
</script>
</body>
</html>
+192
View File
@@ -0,0 +1,192 @@
<!doctype html>
<!--
PANTALLA: Editor — Historial de versiones (VersionHistory.tsx, al pie del Catálogo)
Reproduce: lista de las últimas 5 versiones publicadas con fecha, etiqueta de versión
publicada y botón "Restaurar".
Mockup editable — Tailwind CDN + tokens portados de globals.css. Datos de ejemplo.
-->
<html lang="es">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Editor · historial — SmartMenu</title>
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = { theme: { extend: { fontFamily: { display: ['Montserrat','system-ui','sans-serif'], body: ['Montserrat','system-ui','sans-serif'] } } } }
</script>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
<style>
:root { --bg:#ffffff; --bg-2:#ffffff; --surface:rgba(255,255,255,.55); --accent:#dc2626; --text:#2a2520; --tab:rgba(255,255,255,.45); --font-fraunces:'Montserrat'; --font-inter:'Montserrat'; }
body { margin:0; background:#1b1916; font-family:var(--font-inter),system-ui,sans-serif; color:var(--text); }
.display { font-family:var(--font-fraunces),Georgia,serif; }
/* ===== Identidad de botones (de menu-publico) ===== */
button { font-family:'Montserrat',system-ui,sans-serif; }
.seg-btn { color:rgba(42,37,32,.5); background:transparent; border:none; cursor:pointer; transition:background .2s ease, color .2s ease, box-shadow .2s ease; }
.seg-btn.is-active { color:#111; background:#fff; box-shadow:0 2px 8px rgba(40,30,20,.14), 0 0 0 1px rgba(0,0,0,.04); }
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke):not(.dock-btn) {
position:relative;
background: linear-gradient(135deg, rgba(255,255,255,.65), rgba(245,242,237,.25) 55%, rgba(180,83,9,.06)), rgba(255,255,255,.4);
backdrop-filter:blur(10px) saturate(160%); -webkit-backdrop-filter:blur(10px) saturate(160%);
border:1px solid rgba(255,255,255,.9);
box-shadow: 0 10px 24px -6px rgba(40,30,20,.22), 0 2px 6px rgba(40,30,20,.10), inset 0 2px 2px rgba(255,255,255,1), inset 0 -6px 12px rgba(180,160,140,.18), inset 0 0 0 1px rgba(255,255,255,.5);
overflow:hidden; transition:box-shadow .25s ease, transform .25s ease;
}
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke):not(.dock-btn)::before {
content:""; position:absolute; left:6%; right:6%; top:2px; height:42%; border-radius:999px; pointer-events:none;
background:linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,0)); filter:blur(.5px); opacity:.9;
}
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke):not(.dock-btn):hover {
box-shadow: 0 14px 30px -6px rgba(40,30,20,.28), 0 3px 8px rgba(40,30,20,.14), inset 0 2px 3px rgba(255,255,255,1), inset 0 -7px 14px rgba(180,160,140,.22), inset 0 0 0 1px rgba(255,255,255,.6);
transform:translateY(-1px);
}
@keyframes ai-smoke { 0%{background-position:0% 50%;} 50%{background-position:100% 50%;} 100%{background-position:0% 50%;} }
button.ai-smoke { background:linear-gradient(120deg,#D97757,#E89B7D,#C2410C,#E08A5F,#D97757); background-size:300% 300%; color:#fff; animation:ai-smoke 6s ease-in-out infinite; }
button.cat-btn { display:flex; align-items:center; gap:8px; background:#f0f0f0; color:#111; transition:background .2s ease, color .2s ease; }
button.cat-btn.is-active { background:#111; color:#fff; }
.menu-bg { background: radial-gradient(1200px 800px at 80% -10%, rgba(255,255,255,.6), transparent 60%), radial-gradient(1000px 700px at -10% 110%, rgba(255,255,255,.4), transparent 55%), linear-gradient(160deg, var(--bg), var(--bg-2)); }
.glass { background:var(--surface); backdrop-filter:blur(18px) saturate(140%); -webkit-backdrop-filter:blur(18px) saturate(140%); border:1px solid rgba(255,255,255,.6); box-shadow:0 8px 32px rgba(31,38,135,.08), inset 0 1px 0 rgba(255,255,255,.7); }
.glass-soft { background:rgba(255,255,255,.35); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); border:1px solid rgba(255,255,255,.5); }
.glass-pill { background:var(--tab); backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px); border:1px solid rgba(255,255,255,.55); }
.device { position:relative; width:390px; height:844px; border-radius:2.75rem; overflow:hidden; box-shadow:0 40px 80px -20px rgba(0,0,0,.55), 0 0 0 11px #0c0b0a, 0 0 0 13px #2a2724; }
.screen { position:absolute; inset:0; overflow-y:auto; } .screen::-webkit-scrollbar { display:none; } .screen { scrollbar-width:none; }
/* ===== Dock (barra blanca tipo pill — estilo del screenshot) ===== */
.dock-wrap { position:absolute; bottom:24px; left:14px; right:14px; z-index:30; display:flex; justify-content:center; }
.dock-bar {
display:flex; align-items:center; justify-content:space-between; gap:4px;
width:100%; padding:20px 18px 14px; border-radius:32px;
background:#fff; border:1px solid rgba(0,0,0,.05);
box-shadow:0 16px 36px -10px rgba(0,0,0,.20), 0 4px 12px rgba(0,0,0,.08);
}
.dock-btn {
position:relative; flex:1 1 0; height:46px; border:none; background:transparent; cursor:pointer;
display:flex; align-items:center; justify-content:center; padding:0;
}
.dock-chip {
display:flex; align-items:center; justify-content:center; width:46px; height:46px; border-radius:16px;
color:#1b1916; background:transparent;
transition:transform .4s cubic-bezier(.34,1.56,.5,1), background .25s ease, box-shadow .25s ease;
}
.dock-chip svg { width:26px; height:26px; }
.dock-btn:hover .dock-chip { transform:translateY(-3px); }
.dock-btn:active .dock-chip { transform:scale(.92); }
.dock-btn.is-active .dock-chip {
background:#ececec; transform:translateY(-12px) scale(1.06);
box-shadow:0 8px 16px rgba(0,0,0,.12), inset 0 0 0 1px rgba(0,0,0,.03);
}
/* Punto indicador (debajo del activo) */
.dock-dot {
position:absolute; bottom:-4px; left:50%; transform:translateX(-50%) scale(0);
width:6px; height:6px; border-radius:999px; background:#111;
transition:transform .35s cubic-bezier(.34,1.56,.5,1);
}
.dock-btn.is-active .dock-dot { transform:translateX(-50%) scale(1); }
/* Tooltip */
.dock-tip {
position:absolute; bottom:calc(100% + 6px); left:50%; transform-origin:bottom center;
padding:7px 16px; border-radius:14px; background:#fff; color:#1b1916; font-size:14px; font-weight:500;
white-space:nowrap; opacity:0; transform:translateX(-50%) translateY(6px) scale(.95); pointer-events:none; z-index:6;
border:1px solid rgba(0,0,0,.05);
box-shadow:0 12px 28px rgba(0,0,0,.16), 0 3px 8px rgba(0,0,0,.08);
transition:opacity .2s ease, transform .2s ease;
}
.dock-btn:hover .dock-tip { opacity:1; transform:translateX(-50%) translateY(0) scale(1); }
.dock-btn.is-active .dock-tip { opacity:0; }
.dock-btn.is-active:hover .dock-tip { opacity:1; transform:translateX(-50%) translateY(0) scale(1); }
</style>
</head>
<body class="min-h-screen flex items-center justify-center p-6">
<div class="device">
<div class="screen menu-bg px-4 pb-28 pt-14">
<header class="mb-3 flex items-center justify-between gap-2 px-4">
<div>
<h1 class="display text-xl font-semibold leading-tight">Trattoria della Collina</h1>
<p class="text-xs text-[var(--text)]/55">Versión publicada: Carta primavera 2026</p>
</div>
<button class="glass-pill whitespace-nowrap rounded-full px-3 py-1 text-sm font-medium">ES / EN</button>
</header>
<section class="glass rounded-3xl p-4">
<h2 class="display mb-1 text-lg font-semibold">Historial de versiones</h2>
<p class="mb-3 text-xs text-[var(--text)]/55">Puedes ver tus últimas 5 versiones</p>
<div class="flex flex-col gap-2">
<div class="glass-soft flex items-center gap-2 rounded-2xl px-3 py-2">
<div class="min-w-0 flex-1">
<div class="truncate text-sm font-medium">Carta primavera 2026 <span class="ml-2 rounded-full bg-green-100 px-2 py-0.5 text-[10px] text-green-700">Versión publicada</span></div>
<div class="text-[11px] text-[var(--text)]/55">14 mar 2026, 18:40</div>
</div>
<button class="glass-pill rounded-full px-3 py-1 text-xs font-medium">Restaurar</button>
</div>
<div class="glass-soft flex items-center gap-2 rounded-2xl px-3 py-2">
<div class="min-w-0 flex-1">
<div class="truncate text-sm font-medium">Carta invierno 2025</div>
<div class="text-[11px] text-[var(--text)]/55">2 dic 2025, 11:05</div>
</div>
<button class="glass-pill rounded-full px-3 py-1 text-xs font-medium">Restaurar</button>
</div>
<div class="glass-soft flex items-center gap-2 rounded-2xl px-3 py-2">
<div class="min-w-0 flex-1">
<div class="truncate text-sm font-medium">Menú degustación oct 2025</div>
<div class="text-[11px] text-[var(--text)]/55">18 oct 2025, 09:30</div>
</div>
<button class="glass-pill rounded-full px-3 py-1 text-xs font-medium">Restaurar</button>
</div>
<div class="glass-soft flex items-center gap-2 rounded-2xl px-3 py-2">
<div class="min-w-0 flex-1">
<div class="truncate text-sm font-medium">Carta verano 2025</div>
<div class="text-[11px] text-[var(--text)]/55">5 jul 2025, 16:12</div>
</div>
<button class="glass-pill rounded-full px-3 py-1 text-xs font-medium">Restaurar</button>
</div>
<div class="glass-soft flex items-center gap-2 rounded-2xl px-3 py-2">
<div class="min-w-0 flex-1">
<div class="truncate text-sm font-medium">Carta inicial</div>
<div class="text-[11px] text-[var(--text)]/55">1 abr 2025, 12:00</div>
</div>
<button class="glass-pill rounded-full px-3 py-1 text-xs font-medium">Restaurar</button>
</div>
</div>
</section>
</div>
<nav class="dock-wrap">
<div class="dock-bar" id="dock">
<button class="dock-btn is-active" data-i="0">
<span class="dock-chip"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect x="8" y="2" width="8" height="4" rx="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/><path d="M8 11h.01M8 16h.01"/><path d="M12 11h4M12 16h4"/></svg></span>
<span class="dock-tip">Catálogo</span><span class="dock-dot"></span>
</button>
<button class="dock-btn" data-i="1">
<span class="dock-chip"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><circle cx="13.5" cy="6.5" r="1.3"/><circle cx="17.5" cy="10.5" r="1.3"/><circle cx="8.5" cy="7.5" r="1.3"/><circle cx="6.5" cy="12.5" r="1.3"/><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.93 0 1.65-.75 1.65-1.69 0-.44-.18-.83-.44-1.12-.29-.29-.44-.65-.44-1.13a1.64 1.64 0 0 1 1.67-1.66h1.99c3.05 0 5.56-2.5 5.56-5.56C21.96 6.01 17.46 2 12 2z"/></svg></span>
<span class="dock-tip">Paleta</span><span class="dock-dot"></span>
</button>
<button class="dock-btn" data-i="2">
<span class="dock-chip"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M12.59 2.59A2 2 0 0 0 11.17 2H4a2 2 0 0 0-2 2v7.17a2 2 0 0 0 .59 1.42l8.7 8.7a2.43 2.43 0 0 0 3.42 0l6.58-6.58a2.43 2.43 0 0 0 0-3.42z"/><circle cx="7.5" cy="7.5" r=".9"/></svg></span>
<span class="dock-tip">Marca</span><span class="dock-dot"></span>
</button>
<button class="dock-btn" data-i="3">
<span class="dock-chip"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/></svg></span>
<span class="dock-tip">Órdenes</span><span class="dock-dot"></span>
</button>
<button class="dock-btn" data-i="4">
<span class="dock-chip"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><path d="M14 14h3v3h-3zM20 14v.01M14 20v.01M20 20v.01M20 17v.01M17 20v.01"/></svg></span>
<span class="dock-tip">QR</span><span class="dock-dot"></span>
</button>
</div>
</nav>
</div>
<script>
(function(){
var dock = document.getElementById('dock');
var btns = [].slice.call(dock.querySelectorAll('.dock-btn'));
btns.forEach(function(btn){
btn.addEventListener('click', function(){
btns.forEach(function(b){ b.classList.remove('is-active'); });
btn.classList.add('is-active');
});
});
})();
</script>
</body>
</html>
+68
View File
@@ -0,0 +1,68 @@
<!doctype html>
<!--
PANTALLA: Editor — login (EditorLogin.tsx)
Reproduce: formulario de acceso protegido del editor (usuario + contraseña).
Mockup editable — Tailwind CDN + tokens portados de globals.css.
-->
<html lang="es">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Editor · login — SmartMenu</title>
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = { theme: { extend: { fontFamily: { display: ['Montserrat','system-ui','sans-serif'], body: ['Montserrat','system-ui','sans-serif'] } } } }
</script>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
<style>
:root { --bg:#ffffff; --bg-2:#ffffff; --surface:rgba(255,255,255,.55); --accent:#dc2626; --text:#2a2520; --tab:rgba(255,255,255,.45); --font-fraunces:'Montserrat'; --font-inter:'Montserrat'; }
body { margin:0; background:#1b1916; font-family:var(--font-inter),system-ui,sans-serif; color:var(--text); }
.display { font-family:var(--font-fraunces),Georgia,serif; }
/* ===== Identidad de botones (de menu-publico) ===== */
button { font-family:'Montserrat',system-ui,sans-serif; }
.seg-btn { color:rgba(42,37,32,.5); background:transparent; border:none; cursor:pointer; transition:background .2s ease, color .2s ease, box-shadow .2s ease; }
.seg-btn.is-active { color:#111; background:#fff; box-shadow:0 2px 8px rgba(40,30,20,.14), 0 0 0 1px rgba(0,0,0,.04); }
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke) {
position:relative;
background: linear-gradient(135deg, rgba(255,255,255,.65), rgba(245,242,237,.25) 55%, rgba(180,83,9,.06)), rgba(255,255,255,.4);
backdrop-filter:blur(10px) saturate(160%); -webkit-backdrop-filter:blur(10px) saturate(160%);
border:1px solid rgba(255,255,255,.9);
box-shadow: 0 10px 24px -6px rgba(40,30,20,.22), 0 2px 6px rgba(40,30,20,.10), inset 0 2px 2px rgba(255,255,255,1), inset 0 -6px 12px rgba(180,160,140,.18), inset 0 0 0 1px rgba(255,255,255,.5);
overflow:hidden; transition:box-shadow .25s ease, transform .25s ease;
}
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke)::before {
content:""; position:absolute; left:6%; right:6%; top:2px; height:42%; border-radius:999px; pointer-events:none;
background:linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,0)); filter:blur(.5px); opacity:.9;
}
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke):hover {
box-shadow: 0 14px 30px -6px rgba(40,30,20,.28), 0 3px 8px rgba(40,30,20,.14), inset 0 2px 3px rgba(255,255,255,1), inset 0 -7px 14px rgba(180,160,140,.22), inset 0 0 0 1px rgba(255,255,255,.6);
transform:translateY(-1px);
}
@keyframes ai-smoke { 0%{background-position:0% 50%;} 50%{background-position:100% 50%;} 100%{background-position:0% 50%;} }
button.ai-smoke { background:linear-gradient(120deg,#D97757,#E89B7D,#C2410C,#E08A5F,#D97757); background-size:300% 300%; color:#fff; animation:ai-smoke 6s ease-in-out infinite; }
button.cat-btn { display:flex; align-items:center; gap:8px; background:#f0f0f0; color:#111; transition:background .2s ease, color .2s ease; }
button.cat-btn.is-active { background:#111; color:#fff; }
.menu-bg { background: radial-gradient(1200px 800px at 80% -10%, rgba(255,255,255,.6), transparent 60%), radial-gradient(1000px 700px at -10% 110%, rgba(255,255,255,.4), transparent 55%), linear-gradient(160deg, var(--bg), var(--bg-2)); }
.glass { background:var(--surface); backdrop-filter:blur(18px) saturate(140%); -webkit-backdrop-filter:blur(18px) saturate(140%); border:1px solid rgba(255,255,255,.6); box-shadow:0 8px 32px rgba(31,38,135,.08), inset 0 1px 0 rgba(255,255,255,.7); }
.glass-soft { background:rgba(255,255,255,.35); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); border:1px solid rgba(255,255,255,.5); }
.device { position:relative; width:390px; height:844px; border-radius:2.75rem; overflow:hidden; box-shadow:0 40px 80px -20px rgba(0,0,0,.55), 0 0 0 11px #0c0b0a, 0 0 0 13px #2a2724; }
</style>
</head>
<body class="min-h-screen flex items-center justify-center p-6">
<div class="device">
<main class="relative flex h-full items-center justify-center overflow-hidden p-4">
<video class="absolute inset-0 h-full w-full object-cover" autoplay loop muted playsinline>
<source src="assets/panel-restaurante.mp4" type="video/mp4" />
</video>
<div class="absolute inset-0 bg-black/45"></div>
<form class="glass relative z-10 flex w-full max-w-sm flex-col gap-3 rounded-3xl p-6">
<h1 class="display text-2xl font-semibold" style="text-align: center">Trattoria della Collina</h1>
<p class="text-sm text-[var(--text)]/60" style="text-align: center">Iniciar sesión</p>
<input value="admin" placeholder="Usuario" class="glass-soft rounded-2xl px-4 py-3 outline-none" />
<input type="password" value="demo1234" placeholder="Contraseña" class="glass-soft rounded-2xl px-4 py-3 outline-none" />
<button class="solid-btn rounded-2xl bg-[var(--accent)] py-3 font-medium text-white" style="background-color: rgba(220, 38, 38, 0.78)">Iniciar sesión</button>
</form>
</main>
</div>
</body>
</html>
+202
View File
@@ -0,0 +1,202 @@
<!doctype html>
<!--
PANTALLA: Editor — Marca (BrandTab.tsx, dentro de Editor.tsx)
Reproduce: banner (subir/borrar), logo/foto de perfil, redes sociales (sugerencias +
pares plataforma/URL con validación), guardar.
Mockup editable — Tailwind CDN + tokens portados de globals.css.
-->
<html lang="es">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Editor · marca — SmartMenu</title>
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = { theme: { extend: { fontFamily: { display: ['Montserrat','system-ui','sans-serif'], body: ['Montserrat','system-ui','sans-serif'] } } } }
</script>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
<style>
:root { --bg:#ffffff; --bg-2:#ffffff; --surface:rgba(255,255,255,.55); --accent:#dc2626; --text:#2a2520; --tab:rgba(255,255,255,.45); --font-fraunces:'Montserrat'; --font-inter:'Montserrat'; }
body { margin:0; background:#1b1916; font-family:var(--font-inter),system-ui,sans-serif; color:var(--text); }
.display { font-family:var(--font-fraunces),Georgia,serif; }
/* ===== Identidad de botones (de menu-publico) ===== */
button { font-family:'Montserrat',system-ui,sans-serif; }
.seg-btn { color:rgba(42,37,32,.5); background:transparent; border:none; cursor:pointer; transition:background .2s ease, color .2s ease, box-shadow .2s ease; }
.seg-btn.is-active { color:#111; background:#fff; box-shadow:0 2px 8px rgba(40,30,20,.14), 0 0 0 1px rgba(0,0,0,.04); }
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke):not(.plain-btn):not(.dock-btn) {
position:relative;
background: linear-gradient(135deg, rgba(255,255,255,.65), rgba(245,242,237,.25) 55%, rgba(180,83,9,.06)), rgba(255,255,255,.4);
backdrop-filter:blur(10px) saturate(160%); -webkit-backdrop-filter:blur(10px) saturate(160%);
border:1px solid rgba(255,255,255,.9);
box-shadow: 0 10px 24px -6px rgba(40,30,20,.22), 0 2px 6px rgba(40,30,20,.10), inset 0 2px 2px rgba(255,255,255,1), inset 0 -6px 12px rgba(180,160,140,.18), inset 0 0 0 1px rgba(255,255,255,.5);
overflow:hidden; transition:box-shadow .25s ease, transform .25s ease;
}
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke):not(.plain-btn):not(.dock-btn)::before {
content:""; position:absolute; left:6%; right:6%; top:2px; height:42%; border-radius:999px; pointer-events:none;
background:linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,0)); filter:blur(.5px); opacity:.9;
}
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke):not(.plain-btn):not(.dock-btn):hover {
box-shadow: 0 14px 30px -6px rgba(40,30,20,.28), 0 3px 8px rgba(40,30,20,.14), inset 0 2px 3px rgba(255,255,255,1), inset 0 -7px 14px rgba(180,160,140,.22), inset 0 0 0 1px rgba(255,255,255,.6);
transform:translateY(-1px);
}
@keyframes ai-smoke { 0%{background-position:0% 50%;} 50%{background-position:100% 50%;} 100%{background-position:0% 50%;} }
button.ai-smoke { background:linear-gradient(120deg,#D97757,#E89B7D,#C2410C,#E08A5F,#D97757); background-size:300% 300%; color:#fff; animation:ai-smoke 6s ease-in-out infinite; }
button.cat-btn { display:flex; align-items:center; gap:8px; background:#f0f0f0; color:#111; transition:background .2s ease, color .2s ease; }
button.cat-btn.is-active { background:#111; color:#fff; }
.menu-bg { background: radial-gradient(1200px 800px at 80% -10%, rgba(255,255,255,.6), transparent 60%), radial-gradient(1000px 700px at -10% 110%, rgba(255,255,255,.4), transparent 55%), linear-gradient(160deg, var(--bg), var(--bg-2)); }
.glass { background:var(--surface); backdrop-filter:blur(18px) saturate(140%); -webkit-backdrop-filter:blur(18px) saturate(140%); border:1px solid rgba(255,255,255,.6); box-shadow:0 8px 32px rgba(31,38,135,.08), inset 0 1px 0 rgba(255,255,255,.7); }
.glass-soft { background:rgba(255,255,255,.35); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); border:1px solid rgba(255,255,255,.5); }
.glass-pill { background:var(--tab); backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px); border:1px solid rgba(255,255,255,.55); }
.device { position:relative; width:390px; height:844px; border-radius:2.75rem; overflow:hidden; box-shadow:0 40px 80px -20px rgba(0,0,0,.55), 0 0 0 11px #0c0b0a, 0 0 0 13px #2a2724; }
.screen { position:absolute; inset:0; overflow-y:auto; } .screen::-webkit-scrollbar { display:none; } .screen { scrollbar-width:none; }
/* ===== Dock (barra blanca tipo pill) ===== */
.dock-wrap { position:absolute; bottom:24px; left:14px; right:14px; z-index:30; display:flex; justify-content:center; }
.dock-bar {
display:flex; align-items:center; justify-content:space-between; gap:4px;
width:100%; padding:20px 18px 14px; border-radius:32px;
background:#fff; border:1px solid rgba(0,0,0,.05);
box-shadow:0 16px 36px -10px rgba(0,0,0,.20), 0 4px 12px rgba(0,0,0,.08);
}
.dock-btn {
position:relative; flex:1 1 0; height:46px; border:none; background:transparent; cursor:pointer;
display:flex; align-items:center; justify-content:center; padding:0;
}
.dock-chip {
display:flex; align-items:center; justify-content:center; width:46px; height:46px; border-radius:16px;
color:#1b1916; background:transparent;
transition:transform .4s cubic-bezier(.34,1.56,.5,1), background .25s ease, box-shadow .25s ease;
}
.dock-chip svg { width:26px; height:26px; }
.dock-btn:hover .dock-chip { transform:translateY(-3px); }
.dock-btn:active .dock-chip { transform:scale(.92); }
.dock-btn.is-active .dock-chip {
background:#ececec; transform:translateY(-12px) scale(1.06);
box-shadow:0 8px 16px rgba(0,0,0,.12), inset 0 0 0 1px rgba(0,0,0,.03);
}
.dock-dot {
position:absolute; bottom:-4px; left:50%; transform:translateX(-50%) scale(0);
width:6px; height:6px; border-radius:999px; background:#111;
transition:transform .35s cubic-bezier(.34,1.56,.5,1);
}
.dock-btn.is-active .dock-dot { transform:translateX(-50%) scale(1); }
.dock-tip {
position:absolute; bottom:calc(100% + 6px); left:50%; transform-origin:bottom center;
padding:7px 16px; border-radius:14px; background:#fff; color:#1b1916; font-size:14px; font-weight:500;
white-space:nowrap; opacity:0; transform:translateX(-50%) translateY(6px) scale(.95); pointer-events:none; z-index:6;
border:1px solid rgba(0,0,0,.05);
box-shadow:0 12px 28px rgba(0,0,0,.16), 0 3px 8px rgba(0,0,0,.08);
transition:opacity .2s ease, transform .2s ease;
}
.dock-btn:hover .dock-tip { opacity:1; transform:translateX(-50%) translateY(0) scale(1); }
.dock-btn.is-active .dock-tip { opacity:0; }
.dock-btn.is-active:hover .dock-tip { opacity:1; transform:translateX(-50%) translateY(0) scale(1); }
</style>
</head>
<body class="min-h-screen flex items-center justify-center p-6">
<div class="device">
<div class="screen menu-bg px-4 pb-28 pt-5">
<header class="mb-3 mt-6 flex items-center justify-between gap-2 px-4">
<div>
<h1 class="display text-xl font-semibold leading-tight">Trattoria della Collina</h1>
<p class="text-xs text-[var(--text)]/55">Versión publicada: Carta primavera 2026</p>
</div>
<button class="glass-pill shrink-0 whitespace-nowrap rounded-full px-3 py-1 text-sm font-medium">ES / EN</button>
</header>
<div class="flex flex-col gap-4">
<!-- Banner -->
<section class="glass rounded-3xl p-4">
<h3 class="display mb-2 text-sm font-semibold">Imagen de banner</h3>
<div class="relative h-28 w-full overflow-hidden rounded-2xl bg-white/30">
<img src="https://images.unsplash.com/photo-1414235077428-338989a2e8c0?auto=format&fit=crop&w=700&q=70" alt="" class="h-full w-full object-cover" />
</div>
<div class="mt-2 flex gap-2">
<label class="glass-pill cursor-pointer rounded-full px-4 py-2 text-sm font-medium" style="background-color: rgb(3, 3, 3); color: rgb(255, 255, 255)">Subir banner</label>
<button class="plain-btn rounded-full px-4 py-2 text-sm font-medium bg-black/[0.06] text-[var(--text)]/60 hover:bg-black/[0.1] transition-colors" style="color: rgb(255, 0, 0)">Eliminar</button>
</div>
</section>
<!-- Logo -->
<section class="glass rounded-3xl p-4">
<h3 class="display mb-2 text-sm font-semibold">Logo / foto de perfil</h3>
<div class="flex items-center gap-3">
<div class="h-20 w-20 shrink-0 overflow-hidden rounded-full bg-white/30"><img src="https://images.unsplash.com/photo-1517248135467-4c7edcad34c4?auto=format&fit=crop&w=160&q=70" alt="" class="h-full w-full object-cover" /></div>
<div class="flex flex-col gap-2">
<label class="glass-pill cursor-pointer rounded-full px-4 py-2 text-sm font-medium" style="background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)">Subir logo</label>
<button class="plain-btn self-start rounded-full px-4 py-2 text-sm font-medium bg-black/[0.06] text-[var(--text)]/60 hover:bg-black/[0.1] transition-colors" style="color: rgb(255, 0, 0)">Eliminar</button>
</div>
</div>
</section>
<!-- Redes sociales -->
<section class="glass rounded-3xl p-4">
<h3 class="display mb-2 text-sm font-semibold">Redes sociales</h3>
<div class="mb-3 flex flex-wrap gap-2">
<button class="plain-btn rounded-full px-3 py-1 text-xs bg-white/55 border border-black/[0.06] text-[var(--text)]/70 hover:bg-white/80 transition-colors">+ Instagram</button>
<button class="plain-btn rounded-full px-3 py-1 text-xs bg-white/55 border border-black/[0.06] text-[var(--text)]/70 hover:bg-white/80 transition-colors">+ Facebook</button>
<button class="plain-btn rounded-full px-3 py-1 text-xs bg-white/55 border border-black/[0.06] text-[var(--text)]/70 hover:bg-white/80 transition-colors">+ TikTok</button>
<button class="plain-btn rounded-full px-3 py-1 text-xs bg-white/55 border border-black/[0.06] text-[var(--text)]/70 hover:bg-white/80 transition-colors">+ WhatsApp</button>
<button class="plain-btn rounded-full px-3 py-1 text-xs bg-white/55 border border-black/[0.06] text-[var(--text)]/70 hover:bg-white/80 transition-colors">+ Sitio web</button>
<button class="plain-btn rounded-full px-3 py-1 text-xs bg-white/55 border border-black/[0.06] text-[var(--text)]/70 hover:bg-white/80 transition-colors">+ X</button>
<button class="plain-btn rounded-full px-3 py-1 text-xs bg-white/55 border border-black/[0.06] text-[var(--text)]/70 hover:bg-white/80 transition-colors">+ YouTube</button>
</div>
<div class="flex flex-col gap-2">
<div class="flex items-center gap-2">
<input value="Instagram" placeholder="Plataforma" class="glass-soft w-28 rounded-xl px-3 py-2 text-sm outline-none" />
<input value="instagram.com/trattoria" placeholder="https://…" class="glass-soft min-w-0 flex-1 rounded-xl px-3 py-2 text-sm outline-none" />
<button class="plain-btn px-1 text-red-500" aria-label="Eliminar">✕</button>
</div>
<div class="flex items-center gap-2">
<input value="Sitio web" placeholder="Plataforma" class="glass-soft w-28 rounded-xl px-3 py-2 text-sm outline-none" />
<input value="trattoria.mx" placeholder="https://…" class="glass-soft min-w-0 flex-1 rounded-xl px-3 py-2 text-sm outline-none" />
<button class="plain-btn px-1 text-red-500" aria-label="Eliminar">✕</button>
</div>
<button class="plain-btn rounded-2xl py-2 text-sm font-medium bg-black text-white hover:bg-black/90 transition-colors">+ Agregar enlace</button>
</div>
</section>
<button class="solid-btn rounded-2xl bg-[var(--accent)] py-3 font-medium text-white">Guardar</button>
</div>
</div>
<nav class="dock-wrap">
<div class="dock-bar" id="dock">
<button class="dock-btn" data-i="0">
<span class="dock-chip"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect x="8" y="2" width="8" height="4" rx="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/><path d="M8 11h.01M8 16h.01"/><path d="M12 11h4M12 16h4"/></svg></span>
<span class="dock-tip">Catálogo</span><span class="dock-dot"></span>
</button>
<button class="dock-btn" data-i="1">
<span class="dock-chip"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><circle cx="13.5" cy="6.5" r="1.3"/><circle cx="17.5" cy="10.5" r="1.3"/><circle cx="8.5" cy="7.5" r="1.3"/><circle cx="6.5" cy="12.5" r="1.3"/><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.93 0 1.65-.75 1.65-1.69 0-.44-.18-.83-.44-1.12-.29-.29-.44-.65-.44-1.13a1.64 1.64 0 0 1 1.67-1.66h1.99c3.05 0 5.56-2.5 5.56-5.56C21.96 6.01 17.46 2 12 2z"/></svg></span>
<span class="dock-tip">Paleta</span><span class="dock-dot"></span>
</button>
<button class="dock-btn is-active" data-i="2">
<span class="dock-chip"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M12.59 2.59A2 2 0 0 0 11.17 2H4a2 2 0 0 0-2 2v7.17a2 2 0 0 0 .59 1.42l8.7 8.7a2.43 2.43 0 0 0 3.42 0l6.58-6.58a2.43 2.43 0 0 0 0-3.42z"/><circle cx="7.5" cy="7.5" r=".9"/></svg></span>
<span class="dock-tip">Marca</span><span class="dock-dot"></span>
</button>
<button class="dock-btn" data-i="3">
<span class="dock-chip"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/></svg></span>
<span class="dock-tip">Órdenes</span><span class="dock-dot"></span>
</button>
<button class="dock-btn" data-i="4">
<span class="dock-chip"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><path d="M14 14h3v3h-3zM20 14v.01M14 20v.01M20 20v.01M20 17v.01M17 20v.01"/></svg></span>
<span class="dock-tip">QR</span><span class="dock-dot"></span>
</button>
</div>
</nav>
</div>
<script>
(function(){
var dock = document.getElementById('dock');
if (!dock) return;
var btns = [].slice.call(dock.querySelectorAll('.dock-btn'));
btns.forEach(function(btn){
btn.addEventListener('click', function(){
btns.forEach(function(b){ b.classList.remove('is-active'); });
btn.classList.add('is-active');
});
});
})();
</script>
</body>
</html>
+297
View File
@@ -0,0 +1,297 @@
<!doctype html>
<!--
PANTALLA: Editor — Órdenes (OrdersTab.tsx, dentro de Editor.tsx)
Reproduce: ajustes (habilitar órdenes/split, umbrales de cronómetro, conservación),
aviso de "llamar al mesero", y tarjetas por mesa con subcuentas, lotes, timers de entrega
por ítem (verde/ámbar/rojo), marcar entregado/pagado y completar mesa.
Mockup editable — Tailwind CDN + tokens portados de globals.css. Datos de ejemplo.
-->
<html lang="es">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Editor · órdenes — SmartMenu</title>
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = { theme: { extend: { fontFamily: { display: ['Montserrat','system-ui','sans-serif'], body: ['Montserrat','system-ui','sans-serif'] } } } }
</script>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
<style>
:root { --bg:#ffffff; --bg-2:#ffffff; --surface:rgba(255,255,255,.55); --accent:#dc2626; --text:#2a2520; --tab:rgba(255,255,255,.45); --font-fraunces:'Montserrat'; --font-inter:'Montserrat'; }
body { margin:0; background:#1b1916; font-family:var(--font-inter),system-ui,sans-serif; color:var(--text); }
.display { font-family:var(--font-fraunces),Georgia,serif; }
/* ===== Identidad de botones (de menu-publico) ===== */
button { font-family:'Montserrat',system-ui,sans-serif; }
.seg-btn { color:rgba(42,37,32,.5); background:transparent; border:none; cursor:pointer; transition:background .2s ease, color .2s ease, box-shadow .2s ease; }
.seg-btn.is-active { color:#111; background:#fff; box-shadow:0 2px 8px rgba(40,30,20,.14), 0 0 0 1px rgba(0,0,0,.04); }
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke):not(.dock-btn) {
position:relative;
background: linear-gradient(135deg, rgba(255,255,255,.65), rgba(245,242,237,.25) 55%, rgba(180,83,9,.06)), rgba(255,255,255,.4);
backdrop-filter:blur(10px) saturate(160%); -webkit-backdrop-filter:blur(10px) saturate(160%);
border:1px solid rgba(255,255,255,.9);
box-shadow: 0 10px 24px -6px rgba(40,30,20,.22), 0 2px 6px rgba(40,30,20,.10), inset 0 2px 2px rgba(255,255,255,1), inset 0 -6px 12px rgba(180,160,140,.18), inset 0 0 0 1px rgba(255,255,255,.5);
overflow:hidden; transition:box-shadow .25s ease, transform .25s ease;
}
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke):not(.dock-btn)::before {
content:""; position:absolute; left:6%; right:6%; top:2px; height:42%; border-radius:999px; pointer-events:none;
background:linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,0)); filter:blur(.5px); opacity:.9;
}
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke):not(.dock-btn):hover {
box-shadow: 0 14px 30px -6px rgba(40,30,20,.28), 0 3px 8px rgba(40,30,20,.14), inset 0 2px 3px rgba(255,255,255,1), inset 0 -7px 14px rgba(180,160,140,.22), inset 0 0 0 1px rgba(255,255,255,.6);
transform:translateY(-1px);
}
@keyframes ai-smoke { 0%{background-position:0% 50%;} 50%{background-position:100% 50%;} 100%{background-position:0% 50%;} }
button.ai-smoke { background:linear-gradient(120deg,#D97757,#E89B7D,#C2410C,#E08A5F,#D97757); background-size:300% 300%; color:#fff; animation:ai-smoke 6s ease-in-out infinite; }
button.cat-btn { display:flex; align-items:center; gap:8px; background:#f0f0f0; color:#111; transition:background .2s ease, color .2s ease; }
button.cat-btn.is-active { background:#111; color:#fff; }
.menu-bg { background: radial-gradient(1200px 800px at 80% -10%, rgba(255,255,255,.6), transparent 60%), radial-gradient(1000px 700px at -10% 110%, rgba(255,255,255,.4), transparent 55%), linear-gradient(160deg, var(--bg), var(--bg-2)); }
.glass { background:var(--surface); backdrop-filter:blur(18px) saturate(140%); -webkit-backdrop-filter:blur(18px) saturate(140%); border:1px solid rgba(255,255,255,.6); box-shadow:0 8px 32px rgba(31,38,135,.08), inset 0 1px 0 rgba(255,255,255,.7); }
.glass-soft { background:rgba(255,255,255,.35); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); border:1px solid rgba(255,255,255,.5); }
.glass-pill { background:var(--tab); backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px); border:1px solid rgba(255,255,255,.55); }
.device { position:relative; width:390px; height:844px; border-radius:2.75rem; overflow:hidden; box-shadow:0 40px 80px -20px rgba(0,0,0,.55), 0 0 0 11px #0c0b0a, 0 0 0 13px #2a2724; }
.screen { position:absolute; inset:0; overflow-y:auto; } .screen::-webkit-scrollbar { display:none; } .screen { scrollbar-width:none; }
@keyframes pendiente-pulse {
0%,100% { background-color:#fb923c; box-shadow:0 0 0 0 rgba(249,115,22,0); border-color:#c2410c; }
50% { background-color:#f97316; box-shadow:0 0 0 4px rgba(249,115,22,.5); border-color:#9a3412; }
}
.pendiente-pulse { animation:pendiente-pulse 1.2s ease-in-out infinite; }
/* Variantes de PENDIENTE que igualan el color del contador de al lado */
@keyframes pendiente-pulse-green {
0%,100% { background-color:#28bd1c; box-shadow:0 0 0 0 rgba(40,189,28,0); border-color:#1f9416; }
50% { background-color:#22a417; box-shadow:0 0 0 4px rgba(40,189,28,.5); border-color:#15760f; }
}
@keyframes pendiente-pulse-yellow {
0%,100% { background-color:#fce167; box-shadow:0 0 0 0 rgba(252,225,103,0); border-color:#e0bd3a; }
50% { background-color:#f6d543; box-shadow:0 0 0 4px rgba(252,225,103,.6); border-color:#c9a423; }
}
@keyframes pendiente-pulse-red {
0%,100% { background-color:#ef4444; box-shadow:0 0 0 0 rgba(220,38,38,0); border-color:#991b1b; }
50% { background-color:#dc2626; box-shadow:0 0 0 4px rgba(220,38,38,.5); border-color:#7f1d1d; }
}
.pendiente-green { animation:pendiente-pulse-green 1.2s ease-in-out infinite; color:#fff; border:1px solid #1f9416; }
.pendiente-yellow { animation:pendiente-pulse-yellow 1.2s ease-in-out infinite; color:rgba(0,0,0,.78); border:1px solid #e0bd3a; }
.pendiente-red { animation:pendiente-pulse-red 1.2s ease-in-out infinite; color:#fff; border:1px solid #991b1b; }
.editable-num { -moz-appearance:textfield; appearance:textfield; }
.editable-num::-webkit-inner-spin-button, .editable-num::-webkit-outer-spin-button { -webkit-appearance:none; margin:0; }
/* ===== Dock (barra blanca tipo pill) ===== */
.dock-wrap { position:absolute; bottom:24px; left:14px; right:14px; z-index:30; display:flex; justify-content:center; }
.dock-bar {
display:flex; align-items:center; justify-content:space-between; gap:4px;
width:100%; padding:20px 18px 14px; border-radius:32px;
background:#fff; border:1px solid rgba(0,0,0,.05);
box-shadow:0 16px 36px -10px rgba(0,0,0,.20), 0 4px 12px rgba(0,0,0,.08);
}
.dock-btn {
position:relative; flex:1 1 0; height:46px; border:none; background:transparent; cursor:pointer;
display:flex; align-items:center; justify-content:center; padding:0;
}
.dock-chip {
display:flex; align-items:center; justify-content:center; width:46px; height:46px; border-radius:16px;
color:#1b1916; background:transparent;
transition:transform .4s cubic-bezier(.34,1.56,.5,1), background .25s ease, box-shadow .25s ease;
}
.dock-chip svg { width:26px; height:26px; }
.dock-btn:hover .dock-chip { transform:translateY(-3px); }
.dock-btn:active .dock-chip { transform:scale(.92); }
.dock-btn.is-active .dock-chip {
background:#ececec; transform:translateY(-12px) scale(1.06);
box-shadow:0 8px 16px rgba(0,0,0,.12), inset 0 0 0 1px rgba(0,0,0,.03);
}
.dock-dot {
position:absolute; bottom:-4px; left:50%; transform:translateX(-50%) scale(0);
width:6px; height:6px; border-radius:999px; background:#111;
transition:transform .35s cubic-bezier(.34,1.56,.5,1);
}
.dock-btn.is-active .dock-dot { transform:translateX(-50%) scale(1); }
.dock-tip {
position:absolute; bottom:calc(100% + 6px); left:50%; transform-origin:bottom center;
padding:7px 16px; border-radius:14px; background:#fff; color:#1b1916; font-size:14px; font-weight:500;
white-space:nowrap; opacity:0; transform:translateX(-50%) translateY(6px) scale(.95); pointer-events:none; z-index:6;
border:1px solid rgba(0,0,0,.05);
box-shadow:0 12px 28px rgba(0,0,0,.16), 0 3px 8px rgba(0,0,0,.08);
transition:opacity .2s ease, transform .2s ease;
}
.dock-btn:hover .dock-tip { opacity:1; transform:translateX(-50%) translateY(0) scale(1); }
.dock-btn.is-active .dock-tip { opacity:0; }
.dock-btn.is-active:hover .dock-tip { opacity:1; transform:translateX(-50%) translateY(0) scale(1); }
</style>
</head>
<body class="min-h-screen flex items-center justify-center p-6">
<div class="device">
<div class="screen menu-bg px-4 pb-28 pt-14">
<header class="mb-3 flex items-center justify-between gap-2 px-4">
<div class="min-w-0">
<h1 class="display truncate text-xl font-semibold leading-tight">Trattoria della Collina</h1>
<p class="text-xs text-[var(--text)]/55">Versión publicada: Carta primavera 2026</p>
</div>
<button class="glass-pill shrink-0 whitespace-nowrap rounded-full px-3 py-1 text-sm font-medium">ES / EN</button>
</header>
<div class="flex flex-col gap-4">
<!-- Ajustes -->
<div class="glass flex items-center justify-between rounded-3xl p-4">
<span class="text-sm font-medium">Habilitar toma de órdenes</span>
<span class="relative h-7 w-12 shrink-0 rounded-full bg-black"><span class="absolute left-6 top-1 h-5 w-5 rounded-full bg-white"></span></span>
</div>
<div class="glass flex items-center justify-between gap-3 rounded-3xl p-4">
<div class="min-w-0"><div class="text-sm font-medium">Habilitar cuenta dividida</div><div class="text-xs text-[var(--text)]/55">Los comensales arman una cuenta compartida por mesa, con subcuenta por persona.</div></div>
<span class="relative h-7 w-12 shrink-0 rounded-full bg-black"><span class="absolute left-6 top-1 h-5 w-5 rounded-full bg-white"></span></span>
</div>
<div class="glass flex items-center justify-between gap-3 rounded-3xl p-4">
<div class="min-w-0"><div class="text-sm font-medium">Umbrales del cronómetro (min)</div><div class="text-xs text-[var(--text)]/55">Verde / amarillo por minutos; rojo después.</div></div>
<div class="flex shrink-0 items-center gap-2 text-sm">
<span class="flex items-center gap-1"><span class="h-3 w-3 rounded-full bg-green-600" style="background-color: rgb(40, 189, 28)"></span><input type="number" value="10" class="editable-num w-12 rounded-xl border border-black/10 bg-white/60 px-1 py-1 text-center outline-none focus:border-black/30 focus:bg-white" /></span>
<span class="flex items-center gap-1"><span class="h-3 w-3 rounded-full bg-amber-500" style="background-color: rgb(252, 225, 103)"></span><input type="number" value="20" class="editable-num w-12 rounded-xl border border-black/10 bg-white/60 px-1 py-1 text-center outline-none focus:border-black/30 focus:bg-white" /></span>
</div>
</div>
<div class="glass flex items-center justify-between gap-3 rounded-3xl p-4">
<div class="min-w-0"><div class="text-sm font-medium">Conservar órdenes completadas</div><div class="text-xs text-[var(--text)]/55">Las órdenes completadas más viejas se eliminan automáticamente.</div></div>
<div class="flex shrink-0 items-center gap-1"><input type="number" value="24" class="editable-num w-16 rounded-xl border border-black/10 bg-white/60 px-2 py-1.5 text-center text-sm outline-none focus:border-black/30 focus:bg-white" /><span class="text-xs text-[var(--text)]/55">horas</span></div>
</div>
<!-- Aviso de mesero -->
<div class="flex items-center justify-between gap-2 rounded-2xl bg-amber-100/80 px-4 py-2 text-sm text-amber-800">
<span class="font-bold">ALERTA en Mesa 7</span>
<span class="ml-auto">✕</span></div>
<!-- Tarjeta de mesa (split: 2 subcuentas) -->
<div class="glass relative flex flex-col gap-2 rounded-3xl border-2 border-[#9ca3af] p-4" style="background-color: rgba(255, 255, 255, 0.55)">
<div class="flex items-center justify-between gap-2">
<span class="display text-lg font-semibold">Mesa 12</span>
</div>
<!-- Subcuenta Lucía -->
<div class="glass-soft rounded-2xl p-3">
<div class="flex items-center justify-between gap-2">
<button class="flex items-center gap-1.5 text-left font-medium">Lucía</button>
<span class="flex shrink-0 items-center gap-2"><span class="text-sm font-semibold">$41.00</span></span>
</div>
<div class="mt-2 flex flex-col gap-2">
<div class="rounded-xl bg-white/30 p-2">
<div class="mb-1 text-[10px] font-medium uppercase tracking-wide text-[var(--text)]/45">Lote · 20:14</div>
<ul class="space-y-1.5 text-sm">
<li class="flex items-center justify-between gap-2">
<span class="min-w-0 flex-1">Bruschetta al pomodoro <span class="text-[var(--text)]/50">×1</span></span>
<span class="shrink-0 rounded-full px-2 py-0.5 font-mono text-xs font-semibold text-white" style="background: rgb(40, 189, 28)">4:12</span>
<button class="solid-btn pendiente-green shrink-0 rounded-full px-2 py-1 text-[10px] font-medium">PENDIENTE</button>
</li>
<li class="flex items-center justify-between gap-2">
<span class="min-w-0 flex-1">Risotto ai funghi <span class="text-[var(--text)]/50">×1</span><span class="block text-xs text-[var(--accent)]">↳ sin cebolla</span></span>
<span class="shrink-0 rounded-full px-2 py-0.5 font-mono text-xs font-semibold text-white" style="background: rgb(252, 225, 103); color: rgba(0, 0, 0, 0.72)">12:30</span>
<button class="solid-btn pendiente-yellow shrink-0 rounded-full px-2 py-1 text-[10px] font-medium">PENDIENTE</button>
</li>
</ul>
</div>
</div>
<div class="mt-2 flex gap-2">
<button class="glass-pill flex-1 rounded-xl py-1.5 text-xs font-medium">Editar</button>
<button class="solid-btn flex-1 rounded-xl bg-green-600 py-1.5 text-xs font-medium text-white" style="background-color: rgb(0, 0, 0)">Marcar pagado</button>
</div>
</div>
<!-- Subcuenta Marco (pagada) -->
<div class="glass-soft rounded-2xl p-3 opacity-80">
<div class="flex items-center justify-between gap-2">
<button class="flex items-center gap-1.5 text-left font-medium">Marco</button>
<span class="flex shrink-0 items-center gap-2"><span class="rounded-full bg-green-100 px-2 py-0.5 text-[10px] font-semibold text-green-700" style="background-color: rgb(107, 114, 128); color: rgb(255, 255, 255)">PAGADO</span><span class="text-sm font-semibold">$77.50</span></span>
</div>
<div class="mt-2 flex flex-col gap-2">
<div class="rounded-xl bg-white/30 p-2">
<div class="mb-1 text-[10px] font-medium uppercase tracking-wide text-[var(--text)]/45">Lote · 20:02</div>
<ul class="space-y-1.5 text-sm">
<li class="flex items-center justify-between gap-2">
<span class="min-w-0 flex-1 text-[var(--text)]/50 line-through">Salmón a la parrilla <span class="text-[var(--text)]/50">×2</span></span>
<span class="shrink-0 rounded-full px-2 py-0.5 font-mono text-xs font-semibold text-white" style="background:#6b7280">9:48</span>
<button class="solid-btn shrink-0 rounded-full bg-gray-200 px-2 py-1 text-[10px] font-medium text-gray-600" style="color: rgb(255, 255, 255); background-color: rgb(107, 114, 128)">ENTREGADO</button>
</li>
<li class="flex items-center justify-between gap-2">
<span class="min-w-0 flex-1 text-[var(--text)]/50 line-through">Tiramisú <span class="text-[var(--text)]/50">×1</span></span>
<span class="shrink-0 rounded-full px-2 py-0.5 font-mono text-xs font-semibold text-white" style="background:#6b7280">7:20</span>
<button class="solid-btn shrink-0 rounded-full bg-gray-200 px-2 py-1 text-[10px] font-medium text-gray-600" style="background-color: rgb(107, 114, 128); color: rgb(255, 255, 255)">ENTREGADO</button>
</li>
</ul>
</div>
</div>
<div class="mt-2 flex gap-2">
<button class="glass-pill flex-1 rounded-xl py-1.5 text-xs font-medium">Editar</button>
<button class="solid-btn flex-1 rounded-xl bg-gray-200 py-1.5 text-xs font-medium text-gray-600">Marcar no pagado</button>
</div>
</div>
<div class="flex items-center justify-between border-t border-white/40 pt-2 text-sm font-semibold"><span>Total de la mesa</span><span>$118.50</span></div>
<button class="solid-btn rounded-2xl bg-[var(--accent)] py-2 text-sm font-medium text-white">Completar mesa</button>
</div>
<!-- Tarjeta de mesa simple (sin split) -->
<div class="glass relative flex flex-col gap-2 rounded-3xl border-2 border-[#9ca3af] p-4">
<div class="flex items-center justify-between gap-2">
<span class="display text-lg font-semibold">Mesa 5</span>
</div>
<div class="glass-soft rounded-2xl p-3">
<div class="flex items-center justify-between gap-2">
<button class="flex items-center gap-1.5 text-left font-medium">Mesa</button>
<span class="text-sm font-semibold">$32.50</span>
</div>
<div class="mt-2 rounded-xl bg-white/30 p-2">
<div class="mb-1 text-[10px] font-medium uppercase tracking-wide text-[var(--text)]/45">Lote · 20:25</div>
<ul class="space-y-1.5 text-sm">
<li class="flex items-center justify-between gap-2">
<span class="min-w-0 flex-1">Carpaccio de res <span class="text-[var(--text)]/50">×1</span></span>
<span class="shrink-0 rounded-full px-2 py-0.5 font-mono text-xs font-semibold text-white" style="background:#dc2626">22:05</span>
<button class="solid-btn pendiente-red shrink-0 rounded-full px-2 py-1 text-[10px] font-medium">PENDIENTE</button>
</li>
</ul>
</div>
<div class="mt-2 flex gap-2">
<button class="glass-pill flex-1 rounded-xl py-1.5 text-xs font-medium">Editar</button>
<button class="solid-btn flex-1 rounded-xl bg-green-600 py-1.5 text-xs font-medium text-white" style="background-color: rgb(0, 0, 0)">Marcar pagado</button>
</div>
</div>
<div class="flex items-center justify-between border-t border-white/40 pt-2 text-sm font-semibold"><span>Total de la mesa</span><span>$32.50</span></div>
<button class="solid-btn rounded-2xl bg-[var(--accent)] py-2 text-sm font-medium text-white">Completar mesa</button>
</div>
</div>
</div>
<nav class="dock-wrap">
<div class="dock-bar" id="dock">
<button class="dock-btn" data-i="0">
<span class="dock-chip"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect x="8" y="2" width="8" height="4" rx="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/><path d="M8 11h.01M8 16h.01"/><path d="M12 11h4M12 16h4"/></svg></span>
<span class="dock-tip">Catálogo</span><span class="dock-dot"></span>
</button>
<button class="dock-btn" data-i="1">
<span class="dock-chip"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><circle cx="13.5" cy="6.5" r="1.3"/><circle cx="17.5" cy="10.5" r="1.3"/><circle cx="8.5" cy="7.5" r="1.3"/><circle cx="6.5" cy="12.5" r="1.3"/><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.93 0 1.65-.75 1.65-1.69 0-.44-.18-.83-.44-1.12-.29-.29-.44-.65-.44-1.13a1.64 1.64 0 0 1 1.67-1.66h1.99c3.05 0 5.56-2.5 5.56-5.56C21.96 6.01 17.46 2 12 2z"/></svg></span>
<span class="dock-tip">Paleta</span><span class="dock-dot"></span>
</button>
<button class="dock-btn" data-i="2">
<span class="dock-chip"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M12.59 2.59A2 2 0 0 0 11.17 2H4a2 2 0 0 0-2 2v7.17a2 2 0 0 0 .59 1.42l8.7 8.7a2.43 2.43 0 0 0 3.42 0l6.58-6.58a2.43 2.43 0 0 0 0-3.42z"/><circle cx="7.5" cy="7.5" r=".9"/></svg></span>
<span class="dock-tip">Marca</span><span class="dock-dot"></span>
</button>
<button class="dock-btn is-active" data-i="3">
<span class="dock-chip"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/></svg></span>
<span class="dock-tip">Órdenes</span><span class="dock-dot"></span>
</button>
<button class="dock-btn" data-i="4">
<span class="dock-chip"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><path d="M14 14h3v3h-3zM20 14v.01M14 20v.01M20 20v.01M20 17v.01M17 20v.01"/></svg></span>
<span class="dock-tip">QR</span><span class="dock-dot"></span>
</button>
</div>
</nav>
</div>
<script>
(function(){
var dock = document.getElementById('dock');
if (!dock) return;
var btns = [].slice.call(dock.querySelectorAll('.dock-btn'));
btns.forEach(function(btn){
btn.addEventListener('click', function(){
btns.forEach(function(b){ b.classList.remove('is-active'); });
btn.classList.add('is-active');
});
});
})();
</script>
</body>
</html>
+168
View File
@@ -0,0 +1,168 @@
<!doctype html>
<!--
PANTALLA: Editor — Editor de producto (ProductEditor.tsx, modal)
Reproduce: nombre/descr ES-EN + "Traducir con IA", precio + sección, fotos/videos,
macros (6 campos, badge "Estimado por IA"), alérgenos y tags de dieta (chips), eliminar/guardar.
Mockup editable — Tailwind CDN + tokens portados de globals.css. Datos de ejemplo.
-->
<html lang="es">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Editor · producto — SmartMenu</title>
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = { theme: { extend: { fontFamily: { display: ['Montserrat','system-ui','sans-serif'], body: ['Montserrat','system-ui','sans-serif'] } } } }
</script>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap" rel="stylesheet" />
<style>
:root { --bg:#ffffff; --bg-2:#ffffff; --surface:rgba(255,255,255,.55); --accent:#dc2626; --text:#2a2520; --tab:rgba(255,255,255,.45); --font-fraunces:'Montserrat'; --font-inter:'Montserrat'; }
body { margin:0; background:#1b1916; font-family:var(--font-inter),system-ui,sans-serif; color:var(--text); }
.display { font-family:var(--font-fraunces),Georgia,serif; }
/* ===== Identidad de botones (de menu-publico) ===== */
button { font-family:'Montserrat',system-ui,sans-serif; }
.seg-btn { color:rgba(42,37,32,.5); background:transparent; border:none; cursor:pointer; transition:background .2s ease, color .2s ease, box-shadow .2s ease; }
.seg-btn.is-active { color:#111; background:#fff; box-shadow:0 2px 8px rgba(40,30,20,.14), 0 0 0 1px rgba(0,0,0,.04); }
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke) {
position:relative;
background: linear-gradient(135deg, rgba(255,255,255,.65), rgba(245,242,237,.25) 55%, rgba(180,83,9,.06)), rgba(255,255,255,.4);
backdrop-filter:blur(10px) saturate(160%); -webkit-backdrop-filter:blur(10px) saturate(160%);
border:1px solid rgba(255,255,255,.9);
box-shadow: 0 10px 24px -6px rgba(40,30,20,.22), 0 2px 6px rgba(40,30,20,.10), inset 0 2px 2px rgba(255,255,255,1), inset 0 -6px 12px rgba(180,160,140,.18), inset 0 0 0 1px rgba(255,255,255,.5);
overflow:hidden; transition:box-shadow .25s ease, transform .25s ease;
}
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke)::before {
content:""; position:absolute; left:6%; right:6%; top:2px; height:42%; border-radius:999px; pointer-events:none;
background:linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,0)); filter:blur(.5px); opacity:.9;
}
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke):hover {
box-shadow: 0 14px 30px -6px rgba(40,30,20,.28), 0 3px 8px rgba(40,30,20,.14), inset 0 2px 3px rgba(255,255,255,1), inset 0 -7px 14px rgba(180,160,140,.22), inset 0 0 0 1px rgba(255,255,255,.6);
transform:translateY(-1px);
}
@keyframes ai-smoke { 0%{background-position:0% 50%;} 50%{background-position:100% 50%;} 100%{background-position:0% 50%;} }
button.ai-smoke { background:linear-gradient(120deg,#D97757,#E89B7D,#C2410C,#E08A5F,#D97757); background-size:300% 300%; color:#fff; animation:ai-smoke 6s ease-in-out infinite; }
button.cat-btn { display:flex; align-items:center; gap:8px; background:#f0f0f0; color:#111; transition:background .2s ease, color .2s ease; }
button.cat-btn.is-active { background:#111; color:#fff; }
.menu-bg { background: radial-gradient(1200px 800px at 80% -10%, rgba(255,255,255,.6), transparent 60%), radial-gradient(1000px 700px at -10% 110%, rgba(255,255,255,.4), transparent 55%), linear-gradient(160deg, var(--bg), var(--bg-2)); }
.glass { background:var(--surface); backdrop-filter:blur(18px) saturate(140%); -webkit-backdrop-filter:blur(18px) saturate(140%); border:1px solid rgba(255,255,255,.6); box-shadow:0 8px 32px rgba(31,38,135,.08), inset 0 1px 0 rgba(255,255,255,.7); }
.glass-soft { background:rgba(255,255,255,.35); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); border:1px solid rgba(255,255,255,.5); }
.glass-pill { background:var(--tab); backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px); border:1px solid rgba(255,255,255,.55); }
.device { position:relative; width:390px; height:844px; border-radius:2.75rem; overflow:hidden; box-shadow:0 40px 80px -20px rgba(0,0,0,.55), 0 0 0 11px #0c0b0a, 0 0 0 13px #2a2724; }
.sheet { -ms-overflow-style:none; scrollbar-width:none; } .sheet::-webkit-scrollbar { display:none; }
</style>
</head>
<body class="min-h-screen flex items-center justify-center p-6">
<div class="device">
<div class="menu-bg absolute inset-0"></div>
<div class="absolute inset-0 bg-black/40 backdrop-blur-sm"></div>
<!-- Modal -->
<div class="absolute inset-0 flex items-end justify-center p-5">
<div class="glass sheet flex max-h-full w-full max-w-lg flex-col gap-6 overflow-y-auto rounded-3xl p-5" style="color: rgb(0, 0, 0); background-color: rgba(255, 255, 255, 0.757)">
<div class="flex items-center justify-between">
<h3 class="display text-lg font-semibold" style="font-size: 23px; text-align: center">Editar</h3>
<button class="glass-pill rounded-full px-3 py-1">✕</button>
</div>
<!-- Nombre ES/EN -->
<div class="flex flex-col gap-2">
<span class="text-xs font-medium text-black/70" style="font-size: 15px">Nombre</span>
<div class="flex flex-col gap-2">
<div class="glass-soft flex items-center gap-2 rounded-2xl px-3">
<span class="text-xs font-bold text-black/50">ES</span>
<input value="Risotto ai funghi" class="flex-1 bg-transparent py-2 text-sm outline-none" />
</div>
<div class="glass-soft flex items-center gap-2 rounded-2xl px-3">
<span class="text-xs font-bold text-black/50">EN</span>
<input value="Mushroom risotto" class="flex-1 bg-transparent py-2 text-sm outline-none" />
</div>
<div class="flex items-center gap-2">
<button class="solid-btn rounded-full px-3 py-2 text-sm font-semibold leading-tight flex items-center justify-center gap-2 whitespace-nowrap" style="color: rgb(0, 0, 0); background-color: rgb(226, 219, 141); font-size: 11px">Traducir con IA</button>
</div>
</div>
</div>
<!-- Descripción ES/EN -->
<div class="flex flex-col gap-2">
<span class="text-xs font-medium text-black/70" style="font-size: 15px">Descripción</span>
<div class="flex flex-col gap-2">
<textarea rows="2" class="glass-soft rounded-2xl px-3 py-2 text-sm outline-none">Arroz arborio cremoso con hongos porcini y parmesano reggiano.</textarea>
<textarea rows="2" placeholder="EN" class="glass-soft rounded-2xl px-3 py-2 text-sm outline-none">Creamy arborio rice with porcini mushrooms and parmesan.</textarea>
<div class="flex items-center gap-2">
<button class="solid-btn rounded-full px-3 py-2 text-sm font-semibold leading-tight flex items-center justify-center gap-2 whitespace-nowrap" style="color: rgb(0, 0, 0); background-color: rgb(226, 219, 141); font-size: 11px">Traducir con IA</button>
</div>
</div>
</div>
<!-- Precio + Sección -->
<div class="flex gap-3">
<div class="flex flex-1 flex-col gap-1.5">
<span class="text-xs font-medium text-black/70" style="font-size: 15px">Precio</span>
<input type="number" value="18.50" class="glass-soft w-full rounded-2xl px-3 py-2 text-sm outline-none" />
</div>
<div class="flex flex-1 flex-col gap-1.5">
<span class="text-xs font-medium text-black/70" style="font-size: 15px">Sección</span>
<select class="glass-soft w-full rounded-2xl px-3 py-2 text-sm outline-none"><option>Platos fuertes</option><option>Entradas</option><option>Postres</option></select>
</div>
</div>
<!-- Fotos y videos -->
<div class="flex flex-col gap-2">
<span class="text-xs font-medium text-black/70" style="font-size: 15px">Fotos y videos</span>
<div class="flex flex-wrap gap-2">
<label class="flex h-20 w-20 cursor-pointer items-center justify-center rounded-xl border-2 border-gray-400 text-2xl text-[var(--accent)]" style="color: rgb(0, 0, 0)">+</label>
</div>
</div>
<!-- Macros -->
<div class="flex flex-col gap-2">
<span class="text-xs font-medium text-black/70" style="font-size: 15px">Macros</span>
<div class="grid grid-cols-3 gap-x-3 gap-y-2.5">
<label class="flex flex-col gap-1 text-xs">Proteína<input type="number" value="12" class="glass-soft rounded-xl px-2 py-1.5 text-sm outline-none" /></label>
<label class="flex flex-col gap-1 text-xs">Carbohidratos<input type="number" value="54" class="glass-soft rounded-xl px-2 py-1.5 text-sm outline-none" /></label>
<label class="flex flex-col gap-1 text-xs">Azúcares<input type="number" value="5" class="glass-soft rounded-xl px-2 py-1.5 text-sm outline-none" /></label>
<label class="flex flex-col gap-1 text-xs">Grasas<input type="number" value="18" class="glass-soft rounded-xl px-2 py-1.5 text-sm outline-none" /></label>
<label class="flex flex-col gap-1 text-xs">Fibra<input type="number" value="4" class="glass-soft rounded-xl px-2 py-1.5 text-sm outline-none" /></label>
<label class="flex flex-col gap-1 text-xs">Calorías<input type="number" value="480" class="glass-soft rounded-xl px-2 py-1.5 text-sm outline-none" /></label>
</div>
</div>
<!-- Alérgenos -->
<div class="flex flex-col gap-2">
<span class="text-xs font-medium text-black/70" style="font-size: 15px">Alérgenos</span>
<div class="flex flex-wrap gap-2">
<button class="solid-btn rounded-lg px-3 py-1 text-xs bg-white text-black">gluten</button>
<button class="solid-btn rounded-lg px-3 py-1 text-xs bg-neutral-900 text-white" style="background-color: rgb(0, 0, 0)">lácteos</button>
<button class="solid-btn rounded-lg px-3 py-1 text-xs bg-white text-black">frutos secos</button>
<button class="solid-btn rounded-lg px-3 py-1 text-xs bg-white text-black">mariscos</button>
<button class="solid-btn rounded-lg px-3 py-1 text-xs bg-white text-black">huevo</button>
<button class="solid-btn rounded-lg px-3 py-1 text-xs bg-white text-black">soya</button>
<button class="solid-btn rounded-lg px-3 py-1 text-xs bg-white text-black">pescado</button>
</div>
</div>
<!-- Tags de dieta -->
<div class="flex flex-col gap-2">
<span class="text-xs font-medium text-black/70" style="font-size: 15px">Tags de dieta</span>
<div class="flex flex-wrap gap-2">
<button class="solid-btn rounded-lg px-3 py-1 text-xs bg-neutral-900 text-white" style="background-color: rgb(0, 0, 0)">vegetariano</button>
<button class="solid-btn rounded-lg px-3 py-1 text-xs bg-white text-black">vegano</button>
<button class="solid-btn rounded-lg px-3 py-1 text-xs bg-white text-black">sin gluten</button>
<button class="solid-btn rounded-lg px-3 py-1 text-xs bg-white text-black">sin lácteos</button>
<button class="solid-btn rounded-lg px-3 py-1 text-xs bg-white text-black">keto</button>
<button class="solid-btn rounded-lg px-3 py-1 text-xs bg-white text-black">picante</button>
</div>
</div>
<div class="flex gap-3 border-t border-white/30 pt-5 mt-1">
<button class="solid-btn rounded-2xl bg-red-100 px-5 py-3 text-sm font-medium text-red-700" style="color: rgb(0, 0, 0); background-color: rgb(200, 203, 216)">Eliminar</button>
<button class="solid-btn flex-1 rounded-2xl bg-[var(--accent)] py-3 text-sm font-medium text-white" style="background-color: rgb(0, 0, 0)">Guardar</button>
</div>
</div>
</div>
</div>
</body>
</html>
@@ -0,0 +1,201 @@
<!doctype html>
<!--
PANTALLA: Carrito ("Tu pedido") + "Mi cuenta" del split
Reproduce: OrderPanel (PublicMenu.tsx) y SplitPanel.tsx — lista de ítems, total,
confirmar orden, subtotal propio / total de la mesa, con timers de entrega por ítem.
Mockup editable — Tailwind CDN + tokens portados de globals.css. Datos de ejemplo.
(Colores de timer portados de OrdersTab: verde <10 min · ámbar <20 · rojo después.)
-->
<html lang="es">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Carrito y split — SmartMenu</title>
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = { theme: { extend: {
fontFamily: { display: ['Montserrat','system-ui','sans-serif'], body: ['Montserrat','system-ui','sans-serif'] },
} } }
</script>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
<style>
:root {
--bg:#ffffff; --bg-2:#ffffff; --surface:rgba(255,255,255,.55);
--accent:#dc2626; --text:#2a2520; --tab:rgba(255,255,255,.45);
--font-fraunces:'Montserrat'; --font-inter:'Montserrat';
}
body { margin:0; background:#1b1916; font-family:var(--font-inter),system-ui,sans-serif; color:var(--text); }
.display { font-family:var(--font-fraunces),Georgia,serif; }
/* ===== Identidad de botones (de menu-publico) ===== */
button { font-family:'Montserrat',system-ui,sans-serif; }
.seg-btn { color:rgba(42,37,32,.5); background:transparent; border:none; cursor:pointer; transition:background .2s ease, color .2s ease, box-shadow .2s ease; }
.seg-btn.is-active { color:#111; background:#fff; box-shadow:0 2px 8px rgba(40,30,20,.14), 0 0 0 1px rgba(0,0,0,.04); }
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke) {
position:relative;
background: linear-gradient(135deg, rgba(255,255,255,.65), rgba(245,242,237,.25) 55%, rgba(180,83,9,.06)), rgba(255,255,255,.4);
backdrop-filter:blur(10px) saturate(160%); -webkit-backdrop-filter:blur(10px) saturate(160%);
border:1px solid rgba(255,255,255,.9);
box-shadow: 0 10px 24px -6px rgba(40,30,20,.22), 0 2px 6px rgba(40,30,20,.10), inset 0 2px 2px rgba(255,255,255,1), inset 0 -6px 12px rgba(180,160,140,.18), inset 0 0 0 1px rgba(255,255,255,.5);
overflow:hidden; transition:box-shadow .25s ease, transform .25s ease;
}
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke)::before {
content:""; position:absolute; left:6%; right:6%; top:2px; height:42%; border-radius:999px; pointer-events:none;
background:linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,0)); filter:blur(.5px); opacity:.9;
}
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke):hover {
box-shadow: 0 14px 30px -6px rgba(40,30,20,.28), 0 3px 8px rgba(40,30,20,.14), inset 0 2px 3px rgba(255,255,255,1), inset 0 -7px 14px rgba(180,160,140,.22), inset 0 0 0 1px rgba(255,255,255,.6);
transform:translateY(-1px);
}
@keyframes ai-smoke { 0%{background-position:0% 50%;} 50%{background-position:100% 50%;} 100%{background-position:0% 50%;} }
button.ai-smoke { background:linear-gradient(120deg,#D97757,#E89B7D,#C2410C,#E08A5F,#D97757); background-size:300% 300%; color:#fff; animation:ai-smoke 6s ease-in-out infinite; }
button.cat-btn { display:flex; align-items:center; gap:8px; background:#f0f0f0; color:#111; transition:background .2s ease, color .2s ease; }
button.cat-btn.is-active { background:#111; color:#fff; }
.menu-bg {
background:
radial-gradient(1200px 800px at 80% -10%, rgba(255,255,255,.6), transparent 60%),
radial-gradient(1000px 700px at -10% 110%, rgba(255,255,255,.4), transparent 55%),
linear-gradient(160deg, var(--bg), var(--bg-2));
}
.glass { background:var(--surface); backdrop-filter:blur(18px) saturate(140%); -webkit-backdrop-filter:blur(18px) saturate(140%);
border:1px solid rgba(255,255,255,.6); box-shadow:0 8px 32px rgba(31,38,135,.08), inset 0 1px 0 rgba(255,255,255,.7); }
.glass-soft { background:rgba(255,255,255,.35); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); border:1px solid rgba(255,255,255,.5); }
.glass-pill { background:var(--tab); backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px); border:1px solid rgba(255,255,255,.55); }
.frame-label { font:600 12px/1 var(--font-inter); letter-spacing:.08em; text-transform:uppercase; color:rgba(255,255,255,.45); }
</style>
</head>
<body class="min-h-screen flex flex-wrap items-start justify-center gap-12 p-10">
<!-- ===== Frame A: Carrito "Tu pedido" (OrderPanel) ===== -->
<div class="flex flex-col items-center gap-3">
<span class="frame-label">Carrito · «Tu pedido»</span>
<div class="menu-bg w-[390px] rounded-[2rem] p-4">
<div class="glass flex flex-col gap-3 rounded-3xl p-4">
<div class="flex items-center justify-between">
<h3 class="display text-lg font-semibold">Tu pedido</h3>
<button class="glass-pill rounded-full px-3 py-1">✕</button>
</div>
<div class="flex flex-col gap-2">
<!-- línea -->
<div class="glass-soft flex flex-col gap-2 rounded-2xl px-3 py-2">
<div class="flex items-center gap-3">
<span class="min-w-0 flex-1 text-sm font-medium">Risotto ai funghi</span>
<span class="w-16 shrink-0 text-right text-sm text-[var(--text)]/60">$18.50</span>
<div class="flex shrink-0 items-center gap-1 rounded-full bg-white px-1.5 py-1" style="box-shadow:0 2px 8px rgba(40,30,20,.15)">
<button class="solid-btn flex h-7 w-7 items-center justify-center rounded-full text-xl leading-none" aria-label="−" style="font-size: 18px">−</button>
<span class="w-6 text-center text-base font-medium" style="font-size: 14px">1</span>
<button class="solid-btn flex h-7 w-7 items-center justify-center rounded-full text-xl leading-none" aria-label="+" style="font-size: 18px">+</button>
</div>
</div>
<input value="Sin cebolla" placeholder="Nota (ej. sin cebolla)" class="rounded-xl bg-white/40 px-3 py-1.5 text-xs outline-none" />
</div>
<div class="glass-soft flex flex-col gap-2 rounded-2xl px-3 py-2">
<div class="flex items-center gap-3">
<span class="min-w-0 flex-1 text-sm font-medium">Salmón a la parrilla</span>
<span class="w-16 shrink-0 text-right text-sm text-[var(--text)]/60">$48.00</span>
<div class="flex shrink-0 items-center gap-1 rounded-full bg-white px-1.5 py-1" style="box-shadow:0 2px 8px rgba(40,30,20,.15)">
<button class="solid-btn flex h-7 w-7 items-center justify-center rounded-full text-xl leading-none" aria-label="−" style="font-size: 18px">−</button>
<span class="w-6 text-center text-base font-medium" style="font-size: 14px">2</span>
<button class="solid-btn flex h-7 w-7 items-center justify-center rounded-full text-xl leading-none" aria-label="+" style="font-size: 18px">+</button>
</div>
</div>
<input value="" placeholder="Nota (ej. sin cebolla)" class="rounded-xl bg-white/40 px-3 py-1.5 text-xs outline-none" />
</div>
</div>
<!-- mini carrusel de sugerencias -->
<div class="flex flex-col gap-2">
<p class="text-xs font-semibold uppercase tracking-wide text-[var(--text)]/55">También te puede gustar</p>
<div class="flex gap-3 overflow-x-auto pb-1">
<div class="glass-soft flex w-36 shrink-0 flex-col overflow-hidden rounded-2xl">
<img src="https://images.unsplash.com/photo-1571877227200-a0d98ea607e9?auto=format&fit=crop&w=400&q=70" alt="Tiramisú" class="h-20 w-full object-cover" />
<div class="flex flex-1 flex-col gap-1 p-2">
<span class="text-xs font-medium leading-tight">Tiramisú</span>
<span class="text-xs text-[var(--accent)]" style="color: rgb(0, 0, 0)">$9.00</span>
<button class="solid-btn mt-auto rounded-full bg-[var(--accent)] py-1 text-xs font-medium text-white" style="background-color: rgb(30, 58, 95)">Agregar</button>
</div>
</div>
<div class="glass-soft flex w-36 shrink-0 flex-col overflow-hidden rounded-2xl">
<img src="https://images.unsplash.com/photo-1572695157366-5e585ab2b69f?auto=format&fit=crop&w=400&q=70" alt="Bruschetta" class="h-20 w-full object-cover" />
<div class="flex flex-1 flex-col gap-1 p-2">
<span class="text-xs font-medium leading-tight">Bruschetta al pomodoro</span>
<span class="text-xs text-[var(--accent)]" style="color: rgb(0, 0, 0)">$8.50</span>
<button class="solid-btn mt-auto rounded-full bg-[var(--accent)] py-1 text-xs font-medium text-white" style="background-color: rgb(30, 58, 95)">Agregar</button>
</div>
</div>
</div>
</div>
<div class="flex items-center justify-between px-1 text-sm font-semibold">
<span style="color: rgb(255, 0, 0)">Total</span>
<span style="color: rgb(255, 0, 0)">$66.50</span>
</div>
<textarea rows="2" placeholder="Nota general de la orden (opcional)" class="glass-soft rounded-2xl px-3 py-2 text-sm outline-none"></textarea>
<input type="number" value="12" placeholder="Número de mesa" class="glass-soft w-full rounded-2xl px-4 py-3 text-center text-sm outline-none" />
<button class="solid-btn rounded-2xl bg-[var(--accent)] py-3 font-medium text-white" style="background-color: rgb(0, 0, 0)">Confirmar orden</button>
</div>
</div>
</div>
<!-- ===== Frame B: "Mi cuenta" del split (SplitPanel · sesión activa) ===== -->
<div class="flex flex-col items-center gap-3">
<span class="frame-label">Split · «Mi cuenta» (timers de entrega)</span>
<div class="menu-bg w-[390px] rounded-[2rem] p-4">
<div class="glass flex flex-col gap-3 rounded-3xl p-4">
<div class="flex items-center justify-between">
<h3 class="display text-lg font-semibold">Cuenta dividida</h3>
<button class="glass-pill rounded-full px-3 py-1">✕</button>
</div>
<div class="text-sm text-[var(--text)]/70">Tu subcuenta: <strong>Lucía</strong> · Mesa 12</div>
<div class="flex flex-col gap-2">
<!-- ítem con timer (verde) -->
<div class="glass-soft flex flex-col gap-2 rounded-2xl px-3 py-2">
<div class="flex items-center gap-2">
<span class="min-w-0 flex-1 text-sm font-medium">Bruschetta al pomodoro</span>
<span class="shrink-0 rounded-full px-2 py-0.5 font-mono text-xs font-semibold text-white" style="background: rgb(40, 189, 28)">4:12</span>
<span class="shrink-0 text-sm text-[var(--text)]/60">$8.50</span>
</div>
<input value="" placeholder="Nota (ej. sin cebolla)" class="rounded-xl bg-white/40 px-3 py-1.5 text-xs outline-none" />
</div>
<!-- ítem con timer (ámbar) -->
<div class="glass-soft flex flex-col gap-2 rounded-2xl px-3 py-2">
<div class="flex items-center gap-2">
<span class="min-w-0 flex-1 text-sm font-medium">Risotto ai funghi</span>
<span class="shrink-0 rounded-full px-2 py-0.5 font-mono text-xs font-semibold text-white" style="background: rgb(252, 225, 103); color: rgb(0, 0, 0)">12:30</span>
<span class="shrink-0 text-sm text-[var(--text)]/60">$18.50</span>
</div>
<input value="" placeholder="Nota (ej. sin cebolla)" class="rounded-xl bg-white/40 px-3 py-1.5 text-xs outline-none" />
</div>
<!-- ítem entregado (gris) -->
<div class="glass-soft flex flex-col gap-2 rounded-2xl px-3 py-2 opacity-90">
<div class="flex items-center gap-2">
<span class="min-w-0 flex-1 text-sm font-medium text-[var(--text)]/50 line-through">Carpaccio de res</span>
<span class="shrink-0 rounded-full px-2 py-0.5 font-mono text-xs font-semibold text-white" style="background:#6b7280">6:48</span>
<span class="shrink-0 text-sm text-[var(--text)]/60">$14.00</span>
</div>
</div>
</div>
<div class="flex items-center justify-between px-1 text-sm">
<span class="font-medium" style="font-size: 16px; font-weight: 700">Tu consumo</span>
<span class="font-semibold" style="font-size: 16px">$41.00</span>
</div>
<div class="flex items-center justify-between px-1 text-sm">
<span class="font-bold text-[var(--text)]/70" style="color: rgb(255, 0, 0); font-size: 16px">Total de la mesa</span>
<span class="font-semibold text-[var(--accent)]" style="font-size: 16px">$118.50</span>
</div>
<div class="flex gap-2">
<button class="glass-pill flex-1 rounded-2xl py-3 text-sm">Agregar platillos</button>
<button class="solid-btn flex-1 rounded-2xl bg-[var(--accent)] py-3 font-medium text-white" style="background-color: rgb(0, 0, 0)">Ordenar</button>
</div>
</div>
</div>
</div>
</body>
</html>
@@ -0,0 +1,168 @@
<!doctype html>
<!--
PANTALLA: Consultor del menú (modal de IA)
Reproduce: AiConsultant.tsx — intro + recomendaciones, bloque "Para acompañar",
carrusel "También te puede gustar" (SuggestionCarousel) e input con botón →.
Mockup editable — Tailwind CDN + tokens portados de globals.css. Datos de ejemplo.
-->
<html lang="es">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Consultor IA — SmartMenu</title>
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = { theme: { extend: {
fontFamily: { display: ['Montserrat','system-ui','sans-serif'], body: ['Montserrat','system-ui','sans-serif'] },
colors: { macro: { protein:'#C2410C', carbs:'#B45309', sugar:'#BE185D', fat:'#CA8A04', fiber:'#15803D', kcal:'#1D4ED8' } },
} } }
</script>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
<style>
:root {
--bg:#ffffff; --bg-2:#ffffff; --surface:rgba(255,255,255,.55);
--accent:#dc2626; --text:#2a2520; --tab:rgba(255,255,255,.45);
--font-fraunces:'Montserrat'; --font-inter:'Montserrat';
}
body { margin:0; background:#1b1916; font-family:var(--font-inter),system-ui,sans-serif; color:var(--text); }
.display { font-family:var(--font-fraunces),Georgia,serif; }
/* ===== Identidad de botones (de menu-publico) ===== */
button { font-family:'Montserrat',system-ui,sans-serif; }
.seg-btn { color:rgba(42,37,32,.5); background:transparent; border:none; cursor:pointer; transition:background .2s ease, color .2s ease, box-shadow .2s ease; }
.seg-btn.is-active { color:#111; background:#fff; box-shadow:0 2px 8px rgba(40,30,20,.14), 0 0 0 1px rgba(0,0,0,.04); }
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke) {
position:relative;
background: linear-gradient(135deg, rgba(255,255,255,.65), rgba(245,242,237,.25) 55%, rgba(180,83,9,.06)), rgba(255,255,255,.4);
backdrop-filter:blur(10px) saturate(160%); -webkit-backdrop-filter:blur(10px) saturate(160%);
border:1px solid rgba(255,255,255,.9);
box-shadow: 0 10px 24px -6px rgba(40,30,20,.22), 0 2px 6px rgba(40,30,20,.10), inset 0 2px 2px rgba(255,255,255,1), inset 0 -6px 12px rgba(180,160,140,.18), inset 0 0 0 1px rgba(255,255,255,.5);
overflow:hidden; transition:box-shadow .25s ease, transform .25s ease;
}
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke)::before {
content:""; position:absolute; left:6%; right:6%; top:2px; height:42%; border-radius:999px; pointer-events:none;
background:linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,0)); filter:blur(.5px); opacity:.9;
}
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke):hover {
box-shadow: 0 14px 30px -6px rgba(40,30,20,.28), 0 3px 8px rgba(40,30,20,.14), inset 0 2px 3px rgba(255,255,255,1), inset 0 -7px 14px rgba(180,160,140,.22), inset 0 0 0 1px rgba(255,255,255,.6);
transform:translateY(-1px);
}
@keyframes ai-smoke { 0%{background-position:0% 50%;} 50%{background-position:100% 50%;} 100%{background-position:0% 50%;} }
button.ai-smoke { background:linear-gradient(120deg,#D97757,#E89B7D,#C2410C,#E08A5F,#D97757); background-size:300% 300%; color:#fff; animation:ai-smoke 6s ease-in-out infinite; }
button.cat-btn { display:flex; align-items:center; gap:8px; background:#f0f0f0; color:#111; transition:background .2s ease, color .2s ease; }
button.cat-btn.is-active { background:#111; color:#fff; }
.menu-bg {
background:
radial-gradient(1200px 800px at 80% -10%, rgba(255,255,255,.6), transparent 60%),
radial-gradient(1000px 700px at -10% 110%, rgba(255,255,255,.4), transparent 55%),
linear-gradient(160deg, var(--bg), var(--bg-2));
}
.glass { background:var(--surface); backdrop-filter:blur(18px) saturate(140%); -webkit-backdrop-filter:blur(18px) saturate(140%);
border:1px solid rgba(255,255,255,.6); box-shadow:0 8px 32px rgba(31,38,135,.08), inset 0 1px 0 rgba(255,255,255,.7); }
.glass-soft { background:rgba(255,255,255,.35); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); border:1px solid rgba(255,255,255,.5); }
.glass-pill { background:var(--tab); backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px); border:1px solid rgba(255,255,255,.55); }
.no-scrollbar::-webkit-scrollbar { display:none; }
.no-scrollbar { -ms-overflow-style:none; scrollbar-width:none; }
.device { position:relative; width:390px; height:844px; border-radius:2.75rem; overflow:hidden;
box-shadow:0 40px 80px -20px rgba(0,0,0,.55), 0 0 0 11px #0c0b0a, 0 0 0 13px #2a2724; }
</style>
</head>
<body class="min-h-screen flex items-center justify-center p-6">
<div class="device">
<!-- Menú tenue de fondo -->
<div class="menu-bg absolute inset-0 px-4 pt-6 opacity-60">
<div class="h-28 -mx-4 mb-10 bg-gradient-to-t from-black/10 to-transparent"></div>
<div class="grid grid-cols-2 gap-3 px-1">
<div class="glass h-44 rounded-3xl"></div>
<div class="glass h-44 rounded-3xl"></div>
<div class="glass h-44 rounded-3xl"></div>
<div class="glass h-44 rounded-3xl"></div>
</div>
</div>
<!-- Backdrop -->
<div class="absolute inset-0 bg-black/40 backdrop-blur-sm"></div>
<!-- ===== Modal Consultor ===== -->
<div class="absolute inset-0 flex items-end justify-center px-3 pb-4 pt-8">
<div class="glass flex max-h-full w-full max-w-md flex-col gap-5 rounded-3xl p-5">
<div class="flex items-center justify-between">
<h3 class="display text-lg font-semibold">Consultor del menú</h3>
<button class="glass-pill rounded-full px-3 py-1">✕</button>
</div>
<div class="min-h-[6rem] flex-1 overflow-y-auto no-scrollbar">
<!-- intro de la respuesta -->
<p class="mb-4 text-sm text-[var(--text)]/80">Para una opción ligera y alta en proteína, estas dos te van perfecto. Y si quieres redondear la comida, mira lo de «para acompañar».</p>
<div class="flex flex-col gap-3">
<!-- recomendaciones directas -->
<div class="glass-soft flex items-start gap-3 rounded-2xl p-4">
<div class="min-w-0 flex-1">
<div class="font-semibold text-[var(--accent)]" style="color: rgb(30, 58, 95)">Salmón a la parrilla</div>
<p class="text-sm text-[var(--text)]/80">Alto en proteína y omega-3, con guarnición de verduras. Ideal si buscas algo ligero.</p>
</div>
<button class="solid-btn shrink-0 rounded-full bg-[var(--accent)] px-3 py-1.5 text-xs font-medium text-white" style="background-color: rgb(30, 58, 95)">Agregar</button>
</div>
<div class="glass-soft flex items-start gap-3 rounded-2xl p-4">
<div class="min-w-0 flex-1">
<div class="font-semibold text-[var(--accent)]" style="color: rgb(30, 58, 95)">Carpaccio de res</div>
<p class="text-sm text-[var(--text)]/80">Entrada ligera, baja en carbohidratos y rica en proteína magra.</p>
</div>
<button class="solid-btn shrink-0 rounded-full bg-[var(--accent)] px-3 py-1.5 text-xs font-medium text-white" style="background-color: rgb(30, 58, 95)">Agregar</button>
</div>
<!-- Para acompañar -->
<p class="mt-2 text-xs font-semibold uppercase tracking-wide text-[var(--text)]/50">Para acompañar</p>
<div class="glass-soft flex items-start gap-3 rounded-2xl p-4">
<div class="min-w-0 flex-1">
<div class="font-semibold text-[var(--accent)]" style="color: rgb(30, 58, 95)">Bruschetta al pomodoro</div>
<p class="text-sm text-[var(--text)]/80">Un entrante fresco que equilibra el plato sin pesar.</p>
</div>
<button class="solid-btn shrink-0 rounded-full bg-[var(--accent)] px-3 py-1.5 text-xs font-medium text-white" style="background-color: rgb(30, 58, 95)">Agregar</button>
</div>
</div>
<!-- ===== Carrusel "También te puede gustar" ===== -->
<div class="mt-6 flex flex-col gap-3">
<p class="text-xs font-semibold uppercase tracking-wide text-[var(--text)]/55">También te puede gustar</p>
<div class="flex snap-x gap-3 overflow-x-auto pb-1 no-scrollbar">
<div class="glass-soft flex w-36 shrink-0 snap-start flex-col overflow-hidden rounded-2xl">
<img src="https://images.unsplash.com/photo-1476124369491-e7addf5db371?auto=format&fit=crop&w=400&q=70" alt="Risotto ai funghi" class="h-20 w-full object-cover" />
<div class="flex flex-1 flex-col gap-1 p-2">
<span class="line-clamp-2 text-xs font-medium leading-tight">Risotto ai funghi</span>
<span class="text-xs text-[var(--accent)]" style="color: rgb(0, 0, 0)">$18.50</span>
<button class="solid-btn mt-auto rounded-full bg-[var(--accent)] py-1 text-xs font-medium text-white" style="background-color: rgb(30, 58, 95)">Agregar</button>
</div>
</div>
<div class="glass-soft flex w-36 shrink-0 snap-start flex-col overflow-hidden rounded-2xl">
<img src="https://images.unsplash.com/photo-1571877227200-a0d98ea607e9?auto=format&fit=crop&w=400&q=70" alt="Tiramisú" class="h-20 w-full object-cover" />
<div class="flex flex-1 flex-col gap-1 p-2">
<span class="line-clamp-2 text-xs font-medium leading-tight">Tiramisú</span>
<span class="text-xs text-[var(--accent)]" style="color: rgb(0, 0, 0)">$9.00</span>
<button class="solid-btn mt-auto rounded-full bg-[var(--accent)] py-1 text-xs font-medium text-white" style="background-color: rgb(30, 58, 95)">Agregar</button>
</div>
</div>
<div class="glass-soft flex w-36 shrink-0 snap-start flex-col overflow-hidden rounded-2xl">
<img src="https://images.unsplash.com/photo-1572695157366-5e585ab2b69f?auto=format&fit=crop&w=400&q=70" alt="Bruschetta al pomodoro" class="h-20 w-full object-cover" />
<div class="flex flex-1 flex-col gap-1 p-2">
<span class="line-clamp-2 text-xs font-medium leading-tight">Bruschetta al pomodoro</span>
<span class="text-xs text-[var(--accent)]" style="color: rgb(0, 0, 0)">$8.50</span>
<button class="solid-btn mt-auto rounded-full bg-[var(--accent)] py-1 text-xs font-medium text-white" style="background-color: rgb(30, 58, 95)">Agregar</button>
</div>
</div>
</div>
</div>
</div>
<!-- input + botón → -->
<div class="flex gap-2">
<input value="¿Qué me recomiendas si soy diabético?" class="glass-soft flex-1 rounded-full px-4 py-2 text-sm outline-none" />
<button class="solid-btn rounded-full bg-[var(--accent)] px-4 py-2 text-sm font-medium text-white" style="background-color: rgb(255, 255, 255); color: rgba(0, 0, 0, 0.35)">→</button>
</div>
</div>
</div>
</div>
</body>
</html>
+145
View File
@@ -0,0 +1,145 @@
<!doctype html>
<!--
PANTALLA: Landing premium minimalista (raíz "/")
Reproduce: src/app/page.tsx — wordmark SmartMenu, firma "by Collina" con destellos,
CTA único "Solicita una demo". Animaciones lp-* portadas de globals.css.
Mockup editable — Tailwind CDN + tokens portados de globals.css.
-->
<html lang="es">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Landing — SmartMenu</title>
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = { theme: { extend: {
fontFamily: { display: ['Montserrat','system-ui','sans-serif'], body: ['Montserrat','system-ui','sans-serif'] },
} } }
</script>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
<style>
:root {
--bg:#ffffff; --bg-2:#ffffff; --surface:rgba(255,255,255,.55);
--accent:#dc2626; --text:#2a2520; --tab:rgba(255,255,255,.45);
--font-fraunces:'Montserrat'; --font-inter:'Montserrat';
}
body { margin:0; background:#1b1916; font-family:var(--font-inter),system-ui,sans-serif; color:var(--text); }
.display { font-family:var(--font-fraunces),Georgia,serif; }
/* ===== Identidad de botones (de menu-publico) ===== */
button { font-family:'Montserrat',system-ui,sans-serif; }
.seg-btn { color:rgba(42,37,32,.5); background:transparent; border:none; cursor:pointer; transition:background .2s ease, color .2s ease, box-shadow .2s ease; }
.seg-btn.is-active { color:#111; background:#fff; box-shadow:0 2px 8px rgba(40,30,20,.14), 0 0 0 1px rgba(0,0,0,.04); }
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke) {
position:relative;
background: linear-gradient(135deg, rgba(255,255,255,.65), rgba(245,242,237,.25) 55%, rgba(180,83,9,.06)), rgba(255,255,255,.4);
backdrop-filter:blur(10px) saturate(160%); -webkit-backdrop-filter:blur(10px) saturate(160%);
border:1px solid rgba(255,255,255,.9);
box-shadow: 0 10px 24px -6px rgba(40,30,20,.22), 0 2px 6px rgba(40,30,20,.10), inset 0 2px 2px rgba(255,255,255,1), inset 0 -6px 12px rgba(180,160,140,.18), inset 0 0 0 1px rgba(255,255,255,.5);
overflow:hidden; transition:box-shadow .25s ease, transform .25s ease;
}
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke)::before {
content:""; position:absolute; left:6%; right:6%; top:2px; height:42%; border-radius:999px; pointer-events:none;
background:linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,0)); filter:blur(.5px); opacity:.9;
}
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke):hover {
box-shadow: 0 14px 30px -6px rgba(40,30,20,.28), 0 3px 8px rgba(40,30,20,.14), inset 0 2px 3px rgba(255,255,255,1), inset 0 -7px 14px rgba(180,160,140,.22), inset 0 0 0 1px rgba(255,255,255,.6);
transform:translateY(-1px);
}
@keyframes ai-smoke { 0%{background-position:0% 50%;} 50%{background-position:100% 50%;} 100%{background-position:0% 50%;} }
button.ai-smoke { background:linear-gradient(120deg,#D97757,#E89B7D,#C2410C,#E08A5F,#D97757); background-size:300% 300%; color:#fff; animation:ai-smoke 6s ease-in-out infinite; }
button.cat-btn { display:flex; align-items:center; gap:8px; background:#f0f0f0; color:#111; transition:background .2s ease, color .2s ease; }
button.cat-btn.is-active { background:#111; color:#fff; }
.menu-bg { background:#fafafa; } /* zinc-50 base */
/* ---- Aurora background (portado de aurora-background.tsx) ---- */
.aurora {
--white-gradient:repeating-linear-gradient(100deg,#fff 0%,#fff 7%,transparent 10%,transparent 12%,#fff 16%);
--aurora:repeating-linear-gradient(100deg,#3b82f6 10%,#a5b4fc 15%,#93c5fd 20%,#ddd6fe 25%,#60a5fa 30%);
position:absolute; inset:-10px; pointer-events:none; opacity:.5; will-change:transform;
background-image:var(--white-gradient),var(--aurora);
background-size:300% 200%;
background-position:50% 50%,50% 50%;
filter:blur(10px) invert(1);
-webkit-mask-image:radial-gradient(ellipse at 100% 0%, #000 10%, transparent 70%);
mask-image:radial-gradient(ellipse at 100% 0%, #000 10%, transparent 70%);
}
.aurora::after {
content:""; position:absolute; inset:0;
background-image:var(--white-gradient),var(--aurora);
background-size:200% 100%;
background-attachment:fixed;
mix-blend-mode:difference;
animation:aurora 60s linear infinite;
}
@keyframes aurora {
from { background-position:50% 50%, 50% 50%; }
to { background-position:350% 50%, 350% 50%; }
}
@media (prefers-reduced-motion: reduce) { .aurora::after { animation:none; } }
.device { position:relative; width:390px; height:844px; border-radius:2.75rem; overflow:hidden;
box-shadow:0 40px 80px -20px rgba(0,0,0,.55), 0 0 0 11px #0c0b0a, 0 0 0 13px #2a2724; }
/* ---- Animaciones de landing portadas de globals.css ---- */
@keyframes lp-rise { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }
@keyframes lp-sparkle { 0%,100% { opacity:0; transform:scale(.2) rotate(0deg); } 50% { opacity:1; transform:scale(1) rotate(90deg); } }
@keyframes lp-glow { 0%,100% { opacity:.45; transform:scale(1); } 50% { opacity:.7; transform:scale(1.08); } }
.lp-smart, .lp-sign, .lp-cta { opacity:0; }
.lp-go .lp-smart { animation:lp-rise .9s cubic-bezier(0.22,1,0.36,1) both; }
.lp-go .lp-sign { animation:lp-rise .8s cubic-bezier(0.22,1,0.36,1) .4s both; }
.lp-go .lp-cta { animation:lp-rise .8s cubic-bezier(0.22,1,0.36,1) .7s both; }
.lp-glow { animation:lp-glow 6s ease-in-out infinite; }
.lp-sparkle { animation:lp-sparkle 2.6s ease-in-out infinite both; animation-delay:.7s; }
@media (prefers-reduced-motion: reduce) {
.lp-smart, .lp-sign, .lp-cta { animation:none; opacity:1; transform:none; }
.lp-glow { animation:none; }
.lp-sparkle { animation:none; opacity:.55; }
}
</style>
<link id="gfont-Merriweather" rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Merriweather:wght@300;400;500;600;700&amp;display=swap">
</head>
<body class="min-h-screen flex items-center justify-center p-6">
<div class="device">
<main class="relative flex h-full flex-col items-center justify-center overflow-hidden px-6 text-center" style="background:#1b1916">
<!-- video de fondo -->
<video id="bg-video" class="absolute inset-0 h-full w-full object-cover" autoplay muted loop playsinline preload="auto">
<source src="assets/landing-bg.mp4" type="video/mp4" />
</video>
<!-- glow suave detrás del wordmark -->
<div aria-hidden class="lp-glow pointer-events-none absolute h-[42rem] w-[42rem] rounded-full blur-3xl"
style="background:radial-gradient(circle, rgba(180,83,9,0.16), rgba(217,119,6,0.07) 45%, transparent 70%)"></div>
<div class="relative flex flex-col items-center">
<!-- SmartMenu -->
<h1 class="lp-smart text-5xl font-extrabold tracking-tight">
<span class="text-[var(--text)]" style="color: rgb(255, 255, 255); font-family: Merriweather">Smart </span><span class="text-[var(--accent)]" style="color: rgba(255, 255, 255, 0.808); font-family: Merriweather">Menu</span>
</h1>
<!-- by Collina -->
<div class="lp-sign relative mt-4">
<a href="#" aria-label="Collina" class="display relative select-none text-lg font-light italic text-[var(--text)]/55 transition hover:text-[var(--text)]/80" style="color: rgb(255, 255, 255)">by Collina Systems</a>
</div>
</div>
<!-- CTA único -->
<a href="#" class="lp-cta mt-14 rounded-full bg-[var(--accent)] px-8 py-4 text-sm font-semibold tracking-wide text-white shadow-lg transition hover:-translate-y-0.5 hover:shadow-xl" style="box-shadow: 0 10px 30px -8px rgba(180,83,9,.4); background-color: rgba(255, 0, 0, 0.77)">Solicita una demo</a>
</main>
</div>
<script>
(function () {
var v = document.getElementById('bg-video');
var go = function () { document.body.classList.add('lp-go'); };
if (!v) { go(); return; }
if (v.readyState >= 3) { go(); }
else { v.addEventListener('playing', go, { once: true }); v.addEventListener('canplay', go, { once: true }); }
// respaldo: nunca dejar el texto oculto indefinidamente
setTimeout(go, 2500);
})();
</script>
</body>
</html>
+508
View File
@@ -0,0 +1,508 @@
<!doctype html>
<!--
PANTALLA: Menú público (QR) — vista "Tarjetas"
Reproduce: PublicMenu.tsx + BrandHeader + DishCard + FABs (✨ IA · 🛒 Carrito · 🧾 Split · ⋯)
Mockup editable — Tailwind CDN + tokens portados de globals.css. Datos de ejemplo.
-->
<html lang="es">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Menú público — SmartMenu</title>
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = {
theme: { extend: {
fontFamily: { display: ['Fraunces','Georgia','serif'], body: ['Inter','system-ui','sans-serif'] },
colors: { macro: { protein:'#C2410C', carbs:'#B45309', sugar:'#BE185D', fat:'#CA8A04', fiber:'#15803D', kcal:'#1D4ED8' } },
keyframes: {
'fade-up': { '0%': { opacity:'0', transform:'translateY(16px)' }, '100%': { opacity:'1', transform:'translateY(0)' } },
'spawn': { '0%': { opacity:'0', transform:'scale(0.92) translateY(8px)' }, '100%': { opacity:'1', transform:'scale(1) translateY(0)' } },
'pulse-dot': { '0%,100%': { opacity:'1', transform:'scale(1)' }, '50%': { opacity:'0.4', transform:'scale(0.85)' } },
},
animation: {
'fade-up': 'fade-up 0.5s cubic-bezier(0.22,1,0.36,1) both',
'spawn': 'spawn 0.4s cubic-bezier(0.22,1,0.36,1) both',
'pulse-dot': 'pulse-dot 1.4s ease-in-out infinite',
},
} }
}
</script>
<link href="https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;1,9..144,400&family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet" />
<style>
/* ---- Tokens portados de globals.css (paleta "Arena" por defecto) ---- */
:root {
--bg:#ffffff; --bg-2:#ffffff; --surface:rgba(255,255,255,.55);
--accent:#b45309; --text:#2a2520; --tab:rgba(255,255,255,.45);
--font-fraunces:'Fraunces'; --font-inter:'Inter';
}
body { margin:0; background:#ffffff; font-family:'Montserrat',system-ui,sans-serif; color:var(--text); }
.display { font-family:'Montserrat',system-ui,sans-serif; }
/* fondo de cristal del menú (porta el gradiente del body) */
.menu-bg {
background:
radial-gradient(1200px 800px at 80% -10%, rgba(255,255,255,.6), transparent 60%),
radial-gradient(1000px 700px at -10% 110%, rgba(255,255,255,.4), transparent 55%),
linear-gradient(160deg, var(--bg), var(--bg-2));
}
.glass { background:var(--surface); backdrop-filter:blur(18px) saturate(140%); -webkit-backdrop-filter:blur(18px) saturate(140%);
border:1px solid rgba(255,255,255,.6); box-shadow:0 8px 32px rgba(31,38,135,.08), inset 0 1px 0 rgba(255,255,255,.7); }
.glass-soft { background:rgba(255,255,255,.35); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); border:1px solid rgba(255,255,255,.5); }
.glass-pill { background:var(--tab); backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px); border:1px solid rgba(255,255,255,.55); }
.no-scrollbar::-webkit-scrollbar { display:none; }
.no-scrollbar { -ms-overflow-style:none; scrollbar-width:none; }
/* ---- Marco de teléfono ~390px ---- */
.device { position:relative; width:390px; height:844px; border-radius:2.75rem; overflow:hidden;
box-shadow:0 40px 80px -20px rgba(0,0,0,.55), 0 0 0 11px #0c0b0a, 0 0 0 13px #2a2724; }
.screen { position:absolute; inset:0; overflow-y:auto; }
.screen::-webkit-scrollbar { display:none; }
.screen { -ms-overflow-style:none; scrollbar-width:none; }
button { font-family:'Montserrat',system-ui,sans-serif; }
/* ---- Control segmentado (Delivery/Pickup style) ---- */
.seg-btn { color:rgba(42,37,32,.5); background:transparent; border:none; cursor:pointer;
transition:background .2s ease, color .2s ease, box-shadow .2s ease; }
.seg-btn.is-active { color:#111; background:#fff;
box-shadow:0 2px 8px rgba(40,30,20,.14), 0 0 0 1px rgba(0,0,0,.04); }
/* ---- Efecto glass-water (cristal líquido) en botones ---- */
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke) {
position:relative;
background:
linear-gradient(135deg, rgba(255,255,255,.65), rgba(245,242,237,.25) 55%, rgba(180,83,9,.06)),
rgba(255,255,255,.4);
backdrop-filter:blur(10px) saturate(160%); -webkit-backdrop-filter:blur(10px) saturate(160%);
border:1px solid rgba(255,255,255,.9);
box-shadow:
0 10px 24px -6px rgba(40,30,20,.22),
0 2px 6px rgba(40,30,20,.10),
inset 0 2px 2px rgba(255,255,255,1),
inset 0 -6px 12px rgba(180,160,140,.18),
inset 0 0 0 1px rgba(255,255,255,.5);
overflow:hidden;
transition:box-shadow .25s ease, transform .25s ease;
}
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke)::before {
content:""; position:absolute; left:6%; right:6%; top:2px; height:42%; border-radius:999px; pointer-events:none;
background:linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,0));
filter:blur(.5px); opacity:.9;
}
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke):hover {
box-shadow:
0 14px 30px -6px rgba(40,30,20,.28),
0 3px 8px rgba(40,30,20,.14),
inset 0 2px 3px rgba(255,255,255,1),
inset 0 -7px 14px rgba(180,160,140,.22),
inset 0 0 0 1px rgba(255,255,255,.6);
transform:translateY(-1px);
}
@keyframes ai-smoke {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
button.ai-smoke {
background:linear-gradient(120deg, #D97757, #E89B7D, #C2410C, #E08A5F, #D97757);
background-size:300% 300%;
color:#fff;
animation:ai-smoke 6s ease-in-out infinite;
}
button.ai-smoke-red {
background:linear-gradient(120deg, #dc2626, #f05252, #991b1b, #ef4444, #dc2626);
background-size:300% 300%;
color:#fff;
animation:ai-smoke 6s ease-in-out infinite;
}
button.ai-smoke-green {
background:linear-gradient(120deg, #4c1d95, #6d28d9, #3b0764, #5b21b6, #4c1d95);
background-size:300% 300%;
color:#fff;
animation:ai-smoke 6s ease-in-out infinite;
}
/* ---- Categorías (negro=activo, gris claro=inactivo) ---- */
button.cat-btn { display:flex; align-items:center; gap:8px; background:#f0f0f0; color:#111; transition:background .2s ease, color .2s ease; }
button.cat-btn.is-active { background:#111; color:#fff; }
/* Barra blanca que acompaña a las pestañas al fijarse */
.cat-bar { background:#ffffff; display:flex; flex-direction:column; transition:box-shadow .25s ease, background .25s ease; }
.cat-bar.is-stuck { box-shadow:0 6px 16px -6px rgba(40,30,20,.18), 0 1px 0 rgba(0,0,0,.04); }
.cat-row { display:flex; gap:8px; justify-content:center; overflow-x:auto; }
.stuck-name { display:none; font-weight:700; font-size:18px; color:#111; margin-bottom:12px; padding-left:2px; }
/* Al fijarse: nombre del negocio + pestañas con subrayado */
.cat-bar.is-stuck .stuck-name { display:block; }
.cat-bar.is-stuck .cat-row { justify-content:flex-start; gap:22px; }
.cat-bar.is-stuck .cat-btn { background:transparent !important; color:rgba(42,37,32,.45) !important; border-radius:0 !important; padding:0 0 9px !important; position:relative; font-weight:600; }
.cat-bar.is-stuck .cat-btn.is-active { background:transparent !important; color:#111 !important; }
.cat-bar.is-stuck .cat-btn.is-active::after { content:""; position:absolute; left:0; right:0; bottom:0; height:3px; border-radius:3px; background:#111; }
/* ---- Flip 3D de tarjetas (porta tarjeta-flip) ---- */
.flip-scene { perspective:1400px; position:relative; }
.flip-card { position:relative; transform-style:preserve-3d; transition:transform .7s cubic-bezier(0.22,1,0.36,1); }
.flip-card.is-flipped { transform:rotateY(180deg); }
.flip-face { backface-visibility:hidden; -webkit-backface-visibility:hidden; position:absolute; inset:0; }
.flip-front { position:relative; box-shadow:0 22px 40px -12px rgba(40,30,20,.35), 0 8px 16px -8px rgba(40,30,20,.25); }
.flip-back { transform:rotateY(180deg); }
.macro-cell { background:#fff; border:1px solid rgba(0,0,0,.04); box-shadow:0 1px 3px rgba(40,30,20,.06); }
@keyframes macro-shine { 0% { background-position:250% 0; } 100% { background-position:-150% 0; } }
.macro-num {
background-image: linear-gradient(100deg, var(--c) 0%, var(--c) 42%, color-mix(in srgb, var(--c) 35%, #ffffff) 50%, var(--c) 58%, var(--c) 100%);
background-size: 250% 100%;
-webkit-background-clip: text; background-clip: text;
-webkit-text-fill-color: transparent; color: transparent;
animation: macro-shine 5.5s linear infinite;
}
</style>
<link id="gfont-Montserrat" rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&amp;display=swap">
<link id="gfont-Merriweather" rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Merriweather:wght@300;400;500;600;700&amp;display=swap">
<link id="gfont-Abril-Fatface" rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Abril+Fatface:wght@300;400;500;600;700&amp;display=swap">
<link id="gfont-Permanent-Marker" rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Permanent+Marker:wght@300;400;500;600;700&amp;display=swap">
<link id="gfont-Comfortaa" rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Comfortaa:wght@300;400;500;600;700&amp;display=swap">
<link id="gfont-Rubik" rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700&amp;display=swap">
<link id="gfont-Roboto" rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;600;700&amp;display=swap">
<link id="gfont-Open-Sans" rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;500;600;700&amp;display=swap">
</head>
<body class="min-h-screen flex items-center justify-center p-6">
<div class="device">
<div class="screen menu-bg overflow-x-hidden px-4 pb-44">
<!-- ===== BrandHeader: banner + logo + nombre + redes ===== -->
<header class="mb-4">
<div class="relative -mx-4 h-52 overflow-hidden">
<img src="https://images.unsplash.com/photo-1414235077428-338989a2e8c0?auto=format&fit=crop&w=900&q=70" alt="" class="h-full w-full object-cover" />
<div class="absolute inset-0 bg-gradient-to-t from-black/25 to-transparent"></div>
<div class="absolute right-3 top-5">
<button class="solid-btn rounded-full px-3 py-1 text-sm font-medium" style="background:#fff; color:#111">ES / EN</button>
</div>
</div>
<div class="relative z-10 flex items-start gap-3 px-2 pt-5">
<div class="h-24 w-24 shrink-0 overflow-hidden rounded-full border-4 border-white/70 bg-white/50 shadow-lg">
<img src="https://images.unsplash.com/photo-1517248135467-4c7edcad34c4?auto=format&fit=crop&w=200&q=70" alt="Trattoria della Collina" class="h-full w-full object-cover" />
</div>
<div class="flex min-w-0 flex-1 flex-col items-stretch gap-4 pt-1">
<h1 class="display text-2xl font-semibold leading-tight" style="text-align: left; font-family: Montserrat">Trattoria della Collina</h1>
<div class="flex w-full flex-wrap items-center justify-center gap-2" style="flex-direction: row; justify-content: flex-start">
<a class="glass-pill flex h-9 w-9 items-center justify-center rounded-full" aria-label="Instagram">
<svg class="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="2" width="20" height="20" rx="5"/><circle cx="12" cy="12" r="4"/><circle cx="17.5" cy="6.5" r="1"/></svg>
</a>
<a class="glass-pill flex h-9 w-9 items-center justify-center rounded-full" aria-label="Facebook">
<svg class="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z"/></svg>
</a>
<a class="glass-pill flex h-9 w-9 items-center justify-center rounded-full" aria-label="Sitio web">
<svg class="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M2 12h20M12 2a15 15 0 0 1 0 20 15 15 0 0 1 0-20"/></svg>
</a>
</div>
</div>
</div>
</header>
<!-- ===== Toggle de vista (segmentado tipo Delivery/Pickup) ===== -->
<div class="mb-6 mt-6 flex flex-nowrap items-stretch justify-start gap-2">
<div id="view-seg" class="inline-flex shrink-0 items-stretch gap-1 rounded-full bg-black/5 p-0.5">
<button data-view="tarjetas" class="seg-btn is-active flex items-center gap-1.5 rounded-full px-3 py-2" onclick="setView('tarjetas')">
<svg class="h-5 w-5 shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="7" height="7" rx="1.5"/><rect x="14" y="3" width="7" height="7" rx="1.5"/><rect x="3" y="14" width="7" height="7" rx="1.5"/><rect x="14" y="14" width="7" height="7" rx="1.5"/></svg>
<span class="text-sm font-semibold">Tarjetas</span>
</button>
<button data-view="lista" class="seg-btn flex items-center gap-1.5 rounded-full px-3 py-2" onclick="setView('lista')">
<svg class="h-5 w-5 shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>
<span class="text-sm font-semibold">Lista</span>
</button>
</div>
<button class="glass ai-smoke min-w-0 flex-1 rounded-full px-3 py-2 text-sm font-semibold leading-tight shadow-lg flex items-center justify-center gap-2" style="color:#fff; box-shadow:0 6px 18px rgba(217,119,87,.4)">
<span class="text-center">Preguntar<br>a Claude</span>
</button>
</div>
<!-- ===== Tabs de secciones (píldoras glass, scrollables) ===== -->
<h2 class="display mb-2 text-lg font-semibold" style="font-size: 20px; text-align: center; font-family: Montserrat">Explora nuestro menú</h2>
<nav class="cat-bar sticky top-0 z-30 -mx-4 mb-4 px-4 pt-8 pb-2 no-scrollbar">
<div class="stuck-name" style="text-align: center">Trattoria della Collina</div>
<div class="cat-row no-scrollbar">
<button class="cat-btn is-active shrink-0 rounded-full px-4 py-2 text-sm font-medium" style="box-shadow:none" data-target="sec-entradas" onclick="goCat(this)">Entradas</button>
<button class="cat-btn shrink-0 rounded-full px-4 py-2 text-sm font-medium" style="box-shadow:none" data-target="sec-platos" onclick="goCat(this)">Platos fuertes</button>
<button class="cat-btn shrink-0 rounded-full px-4 py-2 text-sm font-medium" style="box-shadow:none" data-target="sec-postres" onclick="goCat(this)">Postres</button>
</div>
</nav>
<!-- ===== Sección: Entradas ===== -->
<section id="sec-entradas" class="mb-8 scroll-mt-24">
<h2 class="display mb-3 text-xl font-semibold">Entradas</h2>
<div class="grid grid-cols-1 gap-4">
<!-- DishCard (flip) -->
<article class="animate-fade-up flip-scene">
<div class="flip-card" style="min-height:24rem">
<!-- FRONT -->
<div class="flip-face flip-front overflow-hidden rounded-3xl" style="background:#fff">
<div class="p-3 pb-0">
<img src="https://images.unsplash.com/photo-1572695157366-5e585ab2b69f?auto=format&fit=crop&w=600&q=70" alt="Bruschetta al pomodoro" class="h-44 w-full rounded-2xl object-cover" />
</div>
<div class="flex flex-col items-center gap-3 px-4 pb-4 pt-4 text-center">
<div class="flex items-center justify-center gap-2">
<h3 class="display font-bold leading-tight" style="font-size:20px;text-align:center;font-family:Montserrat">Bruschetta al pomodoro</h3>
<span class="self-stretch w-px shrink-0" style="background:rgba(42,37,32,.18)"></span>
<span class="shrink-0 self-center font-bold" style="font-size:20px;color:#000;font-family:Montserrat">$8.50</span>
</div>
<p class="text-sm text-[var(--text)]/70" style="text-align:center">Pan tostado con tomate fresco, albahaca y aceite de oliva extra virgen.</p>
<div class="mt-1 flex w-full items-stretch gap-3">
<button onclick="this.closest('.flip-card').classList.add('is-flipped')" class="solid-btn flex-1 rounded-2xl px-3 py-2 text-sm font-semibold" style="background:#f1d6ad;color:#3a2f1f;border:none;box-shadow:none">Datos nutricionales</button>
<button class="solid-btn flex-1 rounded-2xl px-3 py-2 text-base font-semibold text-white" style="background:#dc2626;border:none;box-shadow:none" aria-label="Agregar"><span class="leading-tight" style="font-size: 14px">Agregar<br>a mi orden</span></button>
</div>
</div>
</div>
<!-- BACK -->
<div class="flip-face flip-back flex flex-col gap-3 rounded-3xl p-4" style="background:#efece6">
<div class="flex items-center justify-center">
<h3 class="display text-base font-semibold">Bruschetta al pomodoro</h3>
</div>
<div class="grid grid-cols-2 gap-2">
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#dc2626"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Proteína</div><div class="text-xl font-bold macro-num whitespace-nowrap">6 g</div></div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#B45309"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Carbohidratos</div><div class="text-xl font-bold macro-num whitespace-nowrap">28 g</div></div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#BE185D"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Azúcares</div><div class="text-xl font-bold macro-num whitespace-nowrap">4 g</div></div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#CA8A04"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Grasas</div><div class="text-xl font-bold macro-num whitespace-nowrap">9 g</div></div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#15803D"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Fibra</div><div class="text-xl font-bold macro-num whitespace-nowrap">3 g</div></div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#1D4ED8"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Calorías</div><div class="text-xl font-bold macro-num whitespace-nowrap">230 kcal</div></div>
</div>
<div class="flex flex-1 items-center justify-center">
<button onclick="this.closest('.flip-card').classList.remove('is-flipped')" class="glass-pill rounded-full px-5 py-2 text-sm">REGRESAR</button>
</div>
</div>
</div>
</article>
<!-- DishCard (flip) -->
<article class="animate-fade-up flip-scene" style="animation-delay:70ms">
<div class="flip-card" style="min-height:24rem">
<!-- FRONT -->
<div class="flip-face flip-front overflow-hidden rounded-3xl" style="background:#fff">
<div class="p-3 pb-0">
<img src="https://images.unsplash.com/photo-1432139555190-58524dae6a55?auto=format&fit=crop&w=600&q=70" alt="Carpaccio de res" class="h-44 w-full rounded-2xl object-cover" />
</div>
<div class="flex flex-col items-center gap-3 px-4 pb-4 pt-4 text-center">
<div class="flex items-center justify-center gap-2">
<h3 class="display font-bold leading-tight" style="font-size:20px;text-align:center;font-family:Montserrat">Carpaccio de res</h3>
<span class="self-stretch w-px shrink-0" style="background:rgba(42,37,32,.18)"></span>
<span class="shrink-0 self-center font-bold" style="font-size:20px;color:#000;font-family:Montserrat">$14.00</span>
</div>
<p class="text-sm text-[var(--text)]/70" style="text-align:center">Láminas finas de res con rúcula, parmesano y un toque de limón.</p>
<div class="mt-1 flex w-full items-stretch gap-3">
<button onclick="this.closest('.flip-card').classList.add('is-flipped')" class="solid-btn flex-1 rounded-2xl px-3 py-2 text-sm font-semibold" style="background:#f1d6ad;color:#3a2f1f;border:none;box-shadow:none">Datos nutricionales</button>
<button class="solid-btn flex-1 rounded-2xl px-3 py-2 text-base font-semibold text-white" style="background:#dc2626;border:none;box-shadow:none" aria-label="Agregar"><span class="leading-tight" style="font-size: 14px">Agregar<br>a mi orden</span></button>
</div>
</div>
</div>
<!-- BACK -->
<div class="flip-face flip-back flex flex-col gap-3 rounded-3xl p-4" style="background:#efece6">
<div class="flex items-center justify-center">
<h3 class="display text-base font-semibold">Carpaccio de res</h3>
</div>
<div class="grid grid-cols-2 gap-2">
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#dc2626"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Proteína</div><div class="text-xl font-bold macro-num whitespace-nowrap">22 g</div></div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#B45309"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Carbohidratos</div><div class="text-xl font-bold macro-num whitespace-nowrap">3 g</div></div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#BE185D"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Azúcares</div><div class="text-xl font-bold macro-num whitespace-nowrap">1 g</div></div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#CA8A04"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Grasas</div><div class="text-xl font-bold macro-num whitespace-nowrap">14 g</div></div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#15803D"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Fibra</div><div class="text-xl font-bold macro-num whitespace-nowrap">1 g</div></div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#1D4ED8"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Calorías</div><div class="text-xl font-bold macro-num whitespace-nowrap">240 kcal</div></div>
</div>
<div class="flex flex-1 items-center justify-center">
<button onclick="this.closest('.flip-card').classList.remove('is-flipped')" class="glass-pill rounded-full px-5 py-2 text-sm">REGRESAR</button>
</div>
</div>
</div>
</article>
</div>
</section>
<!-- ===== Sección: Platos fuertes ===== -->
<section id="sec-platos" class="mb-8 scroll-mt-24">
<h2 class="display mb-3 text-xl font-bold">Platos fuertes</h2>
<div class="grid grid-cols-1 gap-4">
<!-- DishCard (flip) -->
<article class="animate-fade-up flip-scene">
<div class="flip-card" style="min-height:24rem">
<!-- FRONT -->
<div class="flip-face flip-front overflow-hidden rounded-3xl" style="background:#fff">
<div class="p-3 pb-0">
<img src="https://images.unsplash.com/photo-1476124369491-e7addf5db371?auto=format&fit=crop&w=600&q=70" alt="Risotto ai funghi" class="h-44 w-full rounded-2xl object-cover" />
</div>
<div class="flex flex-col items-center gap-3 px-4 pb-4 pt-4 text-center">
<div class="flex items-center justify-center gap-2">
<h3 class="display font-bold leading-tight" style="font-size:20px;text-align:center;font-family:Montserrat">Risotto ai funghi</h3>
<span class="self-stretch w-px shrink-0" style="background:rgba(42,37,32,.18)"></span>
<span class="shrink-0 self-center font-bold" style="font-size:20px;color:#000;font-family:Montserrat">$18.50</span>
</div>
<p class="text-sm text-[var(--text)]/70" style="text-align:center">Arroz arborio cremoso con hongos porcini y parmesano reggiano.</p>
<div class="mt-1 flex w-full items-stretch gap-3">
<button onclick="this.closest('.flip-card').classList.add('is-flipped')" class="solid-btn flex-1 rounded-2xl px-3 py-2 text-sm font-semibold" style="background:#f1d6ad;color:#3a2f1f;border:none;box-shadow:none">Datos nutricionales</button>
<button class="solid-btn flex-1 rounded-2xl px-3 py-2 text-base font-semibold text-white" style="background:#dc2626;border:none;box-shadow:none" aria-label="Agregar"><span class="leading-tight" style="font-size: 14px">Agregar<br>a mi orden</span></button>
</div>
</div>
</div>
<!-- BACK -->
<div class="flip-face flip-back flex flex-col gap-3 rounded-3xl p-4" style="background:#efece6">
<div class="flex items-center justify-center">
<h3 class="display text-base font-semibold">Risotto ai funghi</h3>
</div>
<div class="grid grid-cols-2 gap-2">
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#dc2626"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Proteína</div><div class="text-xl font-bold macro-num whitespace-nowrap">11 g</div></div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#B45309"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Carbohidratos</div><div class="text-xl font-bold macro-num whitespace-nowrap">58 g</div></div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#BE185D"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Azúcares</div><div class="text-xl font-bold macro-num whitespace-nowrap">3 g</div></div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#CA8A04"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Grasas</div><div class="text-xl font-bold macro-num whitespace-nowrap">16 g</div></div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#15803D"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Fibra</div><div class="text-xl font-bold macro-num whitespace-nowrap">4 g</div></div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#1D4ED8"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Calorías</div><div class="text-xl font-bold macro-num whitespace-nowrap">430 kcal</div></div>
</div>
<div class="flex flex-1 items-center justify-center">
<button onclick="this.closest('.flip-card').classList.remove('is-flipped')" class="glass-pill rounded-full px-5 py-2 text-sm">REGRESAR</button>
</div>
</div>
</div>
</article>
<!-- DishCard (flip) -->
<article class="animate-fade-up flip-scene" style="animation-delay:70ms">
<div class="flip-card" style="min-height:24rem">
<!-- FRONT -->
<div class="flip-face flip-front overflow-hidden rounded-3xl" style="background:#fff">
<div class="p-3 pb-0">
<img src="https://images.unsplash.com/photo-1467003909585-2f8a72700288?auto=format&fit=crop&w=600&q=70" alt="Salmón a la parrilla" class="h-44 w-full rounded-2xl object-cover" />
</div>
<div class="flex flex-col items-center gap-3 px-4 pb-4 pt-4 text-center">
<div class="flex items-center justify-center gap-2">
<h3 class="display font-bold leading-tight" style="font-size:20px;text-align:center;font-family:Montserrat">Salmón a la parrilla</h3>
<span class="self-stretch w-px shrink-0" style="background:rgba(42,37,32,.18)"></span>
<span class="shrink-0 self-center font-bold" style="font-size:20px;color:#000;font-family:Montserrat">$24.00</span>
</div>
<p class="text-sm text-[var(--text)]/70" style="text-align:center">Filete de salmón con espárragos asados y salsa ligera de eneldo.</p>
<div class="mt-1 flex w-full items-stretch gap-3">
<button onclick="this.closest('.flip-card').classList.add('is-flipped')" class="solid-btn flex-1 rounded-2xl px-3 py-2 text-sm font-semibold" style="background:#f1d6ad;color:#3a2f1f;border:none;box-shadow:none">Datos nutricionales</button>
<button class="solid-btn flex-1 rounded-2xl px-3 py-2 text-base font-semibold text-white" style="background:#dc2626;border:none;box-shadow:none" aria-label="Agregar"><span class="leading-tight" style="font-size: 14px">Agregar<br>a mi orden</span></button>
</div>
</div>
</div>
<!-- BACK -->
<div class="flip-face flip-back flex flex-col gap-3 rounded-3xl p-4" style="background:#efece6">
<div class="flex items-center justify-center">
<h3 class="display text-base font-semibold">Salmón a la parrilla</h3>
</div>
<div class="grid grid-cols-2 gap-2">
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#dc2626"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Proteína</div><div class="text-xl font-bold macro-num whitespace-nowrap">34 g</div></div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#B45309"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Carbohidratos</div><div class="text-xl font-bold macro-num whitespace-nowrap">8 g</div></div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#BE185D"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Azúcares</div><div class="text-xl font-bold macro-num whitespace-nowrap">3 g</div></div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#CA8A04"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Grasas</div><div class="text-xl font-bold macro-num whitespace-nowrap">22 g</div></div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#15803D"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Fibra</div><div class="text-xl font-bold macro-num whitespace-nowrap">4 g</div></div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#1D4ED8"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Calorías</div><div class="text-xl font-bold macro-num whitespace-nowrap">380 kcal</div></div>
</div>
<div class="flex flex-1 items-center justify-center">
<button onclick="this.closest('.flip-card').classList.remove('is-flipped')" class="glass-pill rounded-full px-5 py-2 text-sm">REGRESAR</button>
</div>
</div>
</div>
</article>
</div>
</section>
<!-- ===== Sección: Postres ===== -->
<section id="sec-postres" class="mb-8 scroll-mt-24">
<h2 class="display mb-3 text-xl font-bold">Postres</h2>
<div class="grid grid-cols-1 gap-4">
<!-- DishCard (flip) -->
<article class="animate-fade-up flip-scene">
<div class="flip-card" style="min-height:24rem">
<!-- FRONT -->
<div class="flip-face flip-front overflow-hidden rounded-3xl" style="background:#fff">
<div class="p-3 pb-0">
<img src="https://images.unsplash.com/photo-1571877227200-a0d98ea607e9?auto=format&fit=crop&w=600&q=70" alt="Tiramisú" class="h-44 w-full rounded-2xl object-cover" />
</div>
<div class="flex flex-col items-center gap-3 px-4 pb-4 pt-4 text-center">
<div class="flex items-center justify-center gap-2">
<h3 class="display font-bold leading-tight" style="font-size:20px;text-align:center;font-family:Montserrat">Tiramisú</h3>
<span class="self-stretch w-px shrink-0" style="background:rgba(42,37,32,.18)"></span>
<span class="shrink-0 self-center font-bold" style="font-size:20px;color:#000;font-family:Montserrat">$9.00</span>
</div>
<p class="text-sm text-[var(--text)]/70" style="text-align:center">Clásico con mascarpone, café espresso y un velo de cacao amargo.</p>
<div class="mt-1 flex w-full items-stretch gap-3">
<button onclick="this.closest('.flip-card').classList.add('is-flipped')" class="solid-btn flex-1 rounded-2xl px-3 py-2 text-sm font-semibold" style="background:#f1d6ad;color:#3a2f1f;border:none;box-shadow:none">Datos nutricionales</button>
<button class="solid-btn flex-1 rounded-2xl px-3 py-2 text-base font-semibold text-white" style="background:#dc2626;border:none;box-shadow:none" aria-label="Agregar"><span class="leading-tight" style="font-size: 14px">Agregar<br>a mi orden</span></button>
</div>
</div>
</div>
<!-- BACK -->
<div class="flip-face flip-back flex flex-col gap-3 rounded-3xl p-4" style="background:#efece6">
<div class="flex items-center justify-center">
<h3 class="display text-base font-semibold">Tiramisú</h3>
</div>
<div class="grid grid-cols-2 gap-2">
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#dc2626"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Proteína</div><div class="text-xl font-bold macro-num whitespace-nowrap">7 g</div></div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#B45309"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Carbohidratos</div><div class="text-xl font-bold macro-num whitespace-nowrap">42 g</div></div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#BE185D"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Azúcares</div><div class="text-xl font-bold macro-num whitespace-nowrap">30 g</div></div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#CA8A04"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Grasas</div><div class="text-xl font-bold macro-num whitespace-nowrap">24 g</div></div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#15803D"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Fibra</div><div class="text-xl font-bold macro-num whitespace-nowrap">1 g</div></div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#1D4ED8"><div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Calorías</div><div class="text-xl font-bold macro-num whitespace-nowrap">420 kcal</div></div>
</div>
<div class="flex flex-1 items-center justify-center">
<button onclick="this.closest('.flip-card').classList.remove('is-flipped')" class="glass-pill rounded-full px-5 py-2 text-sm">REGRESAR</button>
</div>
</div>
</div>
</article>
</div>
</section>
</div>
<!-- ===== Botones (stack vertical, izquierda abajo) ===== -->
<div class="absolute right-4 bottom-6 z-40 flex flex-col items-end gap-2.5">
<button class="ai-smoke-red relative flex items-center gap-2 rounded-full px-6 py-3 text-sm font-semibold text-white shadow-lg" style="box-shadow:0 6px 18px rgba(220,38,38,.4)" aria-label="Agregar">Orden<span class="absolute -right-1.5 -top-1.5 flex h-6 min-w-6 items-center justify-center rounded-full bg-white px-1.5 text-xs font-bold" style="color:#dc2626">2</span></button>
<button class="solid-btn flex h-11 items-center justify-center rounded-full px-5 text-sm font-semibold text-white shadow-lg" aria-label="Mesero" style="background: rgb(30, 58, 95)">Llamar Mesero</button>
<button class="solid-btn flex items-center gap-2 rounded-full px-6 py-3 text-sm font-semibold text-white shadow-lg" style="background:#111">Dividir Cuenta</button>
</div>
</div>
<script>
function setView(view){
document.querySelectorAll('#view-seg .seg-btn').forEach(function(b){
b.classList.toggle('is-active', b.dataset.view === view);
});
}
function setCat(btn){
document.querySelectorAll('.cat-btn').forEach(function(b){
b.classList.toggle('is-active', b === btn);
});
}
function activateCat(id){
document.querySelectorAll('.cat-btn').forEach(function(b){
b.classList.toggle('is-active', b.dataset.target === id);
});
}
function goCat(btn){
var sec = document.getElementById(btn.dataset.target);
var scroller = document.querySelector('.screen');
if (sec && scroller){
scroller.scrollTo({ top: sec.offsetTop - 90, behavior: 'smooth' });
}
activateCat(btn.dataset.target);
}
(function(){
var scroller = document.querySelector('.screen');
var secs = ['sec-entradas','sec-platos','sec-postres'].map(function(id){ return document.getElementById(id); }).filter(Boolean);
if (!scroller || !secs.length) return;
function onScroll(){
var nav = document.querySelector('.cat-bar');
if (nav){ nav.classList.toggle('is-stuck', scroller.scrollTop >= nav.offsetTop - 1); }
if (scroller.scrollTop + scroller.clientHeight >= scroller.scrollHeight - 4){
activateCat(secs[secs.length - 1].id);
return;
}
var line = scroller.scrollTop + 120;
var current = secs[0].id;
secs.forEach(function(s){ if (s.offsetTop <= line) current = s.id; });
activateCat(current);
}
scroller.addEventListener('scroll', onScroll, { passive: true });
onScroll();
})();
</script>
</body>
</html>
@@ -0,0 +1,204 @@
<!doctype html>
<!--
PANTALLA: Tarjeta de platillo con flip 3D de macros
Reproduce: DishCard.tsx (cara frontal) + MacrosBack.tsx (cara trasera, 6 macros · colores FIJOS)
Mockup editable — Tailwind CDN + tokens portados de globals.css. Toca la tarjeta para girarla.
-->
<html lang="es">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Tarjeta flip — SmartMenu</title>
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = {
theme: { extend: {
fontFamily: { display: ['Montserrat','system-ui','sans-serif'], body: ['Montserrat','system-ui','sans-serif'] },
colors: { macro: { protein:'#C2410C', carbs:'#B45309', sugar:'#BE185D', fat:'#CA8A04', fiber:'#15803D', kcal:'#1D4ED8' } },
keyframes: { 'fade-up': { '0%': { opacity:'0', transform:'translateY(16px)' }, '100%': { opacity:'1', transform:'translateY(0)' } } },
animation: { 'fade-up': 'fade-up 0.5s cubic-bezier(0.22,1,0.36,1) both' },
} }
}
</script>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
<style>
:root {
--bg:#ffffff; --bg-2:#ffffff; --surface:rgba(255,255,255,.55);
--accent:#dc2626; --text:#2a2520; --tab:rgba(255,255,255,.45);
--font-fraunces:'Montserrat'; --font-inter:'Montserrat';
}
body { margin:0; background:#1b1916; font-family:var(--font-inter),system-ui,sans-serif; color:var(--text); }
.display { font-family:var(--font-fraunces),Georgia,serif; }
/* ===== Identidad de botones (de menu-publico) ===== */
button { font-family:'Montserrat',system-ui,sans-serif; }
.seg-btn { color:rgba(42,37,32,.5); background:transparent; border:none; cursor:pointer; transition:background .2s ease, color .2s ease, box-shadow .2s ease; }
.seg-btn.is-active { color:#111; background:#fff; box-shadow:0 2px 8px rgba(40,30,20,.14), 0 0 0 1px rgba(0,0,0,.04); }
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke) {
position:relative;
background: linear-gradient(135deg, rgba(255,255,255,.65), rgba(245,242,237,.25) 55%, rgba(180,83,9,.06)), rgba(255,255,255,.4);
backdrop-filter:blur(10px) saturate(160%); -webkit-backdrop-filter:blur(10px) saturate(160%);
border:1px solid rgba(255,255,255,.9);
box-shadow: 0 10px 24px -6px rgba(40,30,20,.22), 0 2px 6px rgba(40,30,20,.10), inset 0 2px 2px rgba(255,255,255,1), inset 0 -6px 12px rgba(180,160,140,.18), inset 0 0 0 1px rgba(255,255,255,.5);
overflow:hidden; transition:box-shadow .25s ease, transform .25s ease;
}
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke)::before {
content:""; position:absolute; left:6%; right:6%; top:2px; height:42%; border-radius:999px; pointer-events:none;
background:linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,0)); filter:blur(.5px); opacity:.9;
}
button:not([aria-label="Agregar"]):not(.seg-btn):not(.solid-btn):not(.cat-btn):not(.ai-smoke):hover {
box-shadow: 0 14px 30px -6px rgba(40,30,20,.28), 0 3px 8px rgba(40,30,20,.14), inset 0 2px 3px rgba(255,255,255,1), inset 0 -7px 14px rgba(180,160,140,.22), inset 0 0 0 1px rgba(255,255,255,.6);
transform:translateY(-1px);
}
@keyframes ai-smoke { 0%{background-position:0% 50%;} 50%{background-position:100% 50%;} 100%{background-position:0% 50%;} }
button.ai-smoke { background:linear-gradient(120deg,#D97757,#E89B7D,#C2410C,#E08A5F,#D97757); background-size:300% 300%; color:#fff; animation:ai-smoke 6s ease-in-out infinite; }
button.cat-btn { display:flex; align-items:center; gap:8px; background:#f0f0f0; color:#111; transition:background .2s ease, color .2s ease; }
button.cat-btn.is-active { background:#111; color:#fff; }
/* Brillo en movimiento sobre los números de macros (tipo botón Claude) */
@keyframes macro-shine { 0% { background-position:250% 0; } 100% { background-position:-150% 0; } }
.macro-num {
background-image: linear-gradient(100deg, var(--c) 0%, var(--c) 42%, color-mix(in srgb, var(--c) 35%, #ffffff) 50%, var(--c) 58%, var(--c) 100%);
background-size: 250% 100%;
-webkit-background-clip: text; background-clip: text;
-webkit-text-fill-color: transparent; color: transparent;
animation: macro-shine 5.5s linear infinite;
}
.menu-bg {
background:
radial-gradient(1200px 800px at 80% -10%, rgba(255,255,255,.6), transparent 60%),
radial-gradient(1000px 700px at -10% 110%, rgba(255,255,255,.4), transparent 55%),
linear-gradient(160deg, var(--bg), var(--bg-2));
}
.glass { background:var(--surface); backdrop-filter:blur(18px) saturate(140%); -webkit-backdrop-filter:blur(18px) saturate(140%);
border:1px solid rgba(255,255,255,.6); box-shadow:0 8px 32px rgba(31,38,135,.08), inset 0 1px 0 rgba(255,255,255,.7); }
.glass-soft { background:#ffffff; backdrop-filter:none; -webkit-backdrop-filter:none; border:1px solid rgba(0,0,0,.04); box-shadow:0 1px 3px rgba(40,30,20,.06); }
.glass-pill { background:var(--tab); backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px); border:1px solid rgba(255,255,255,.55); }
/* ---- Flip 3D (igual que menu-publico: estática, sin flotación) ---- */
.flip-scene { perspective:1400px; position:relative; }
.flip-card { position:relative; transform-style:preserve-3d; transition:transform .7s cubic-bezier(0.22,1,0.36,1); }
.flip-card.is-flipped { transform:rotateY(180deg); }
.flip-face { backface-visibility:hidden; -webkit-backface-visibility:hidden; position:absolute; inset:0; }
.flip-front { position:relative; box-shadow:0 22px 40px -12px rgba(40,30,20,.35), 0 8px 16px -8px rgba(40,30,20,.25); border-radius:1.5rem; }
.flip-back { transform:rotateY(180deg); }
.macro-cell { background:#fff; border:1px solid rgba(0,0,0,.04); box-shadow:0 1px 3px rgba(40,30,20,.06); }
.frame-label { font:600 12px/1 var(--font-inter); letter-spacing:.08em; text-transform:uppercase; color:#9a948b; }
</style>
</head>
<body class="min-h-screen flex flex-col items-center justify-center gap-10 p-10">
<p class="max-w-md text-center text-sm text-white/40">Toca la tarjeta de la izquierda (botón «Toca para ver macros» / ✕) para ver el giro 3D. La derecha muestra la cara trasera fija.</p>
<div class="flex flex-wrap items-start justify-center gap-12">
<!-- ===== Tarjeta interactiva ===== -->
<div class="flex flex-col items-center gap-3">
<span class="frame-label text-white/45">Tarjeta · flip interactivo</span>
<div class="menu-bg rounded-[2rem] p-6">
<div class="flip-scene w-72">
<div id="card" class="flip-card min-h-[22rem]">
<!-- FRONT -->
<div class="flip-face flip-front overflow-hidden rounded-3xl" style="background:#fff;box-shadow:0 22px 40px -12px rgba(40,30,20,.35), 0 8px 16px -8px rgba(40,30,20,.25)">
<div class="p-3 pb-0">
<img src="https://images.unsplash.com/photo-1572695157366-5e585ab2b69f?auto=format&fit=crop&w=600&q=70" alt="Bruschetta al pomodoro" class="h-44 w-full rounded-2xl object-cover" />
</div>
<div class="flex flex-col items-center gap-3 px-4 pb-4 pt-4 text-center">
<div class="flex items-baseline justify-center gap-2">
<h3 class="display text-lg font-bold leading-tight" style="font-size: 20px; text-align: center">Bruschetta al pomodoro</h3>
<span class="self-stretch w-px shrink-0" style="background:rgba(42,37,32,.18)"></span>
<span class="shrink-0 self-center font-bold" style="font-size: 20px; color: rgb(0, 0, 0)">$15.23</span>
</div>
<p class="text-sm text-[var(--text)]/70" style="text-align: center">Pan tostado con tomate fresco, albahaca y aceite de oliva extra virgen.</p>
<div class="mt-1 flex w-full items-stretch gap-3">
<button onclick="document.getElementById('card').classList.add('is-flipped')" class="solid-btn flex-1 rounded-2xl px-3 py-2 text-sm font-semibold" style="background:#f1d6ad; color:#3a2f1f; border:none; box-shadow:none">Datos nutricionales</button>
<button class="solid-btn flex-1 rounded-2xl px-3 py-2 text-base font-semibold text-white" style="background:#dc2626; border:none; box-shadow:none" aria-label="Agregar"><span class="leading-tight" style="font-size: 14px">Agregar<br>a mi orden</span></button>
</div>
</div>
</div>
<!-- BACK -->
<div class="flip-face flip-back flex flex-col gap-3 rounded-3xl p-4" style="background:#efece6">
<div class="flex items-center justify-center">
<h3 class="display text-base font-semibold">Bruschetta al pomodoro</h3>
</div>
<div class="grid grid-cols-2 gap-2">
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#dc2626">
<div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Proteína</div>
<div class="text-xl font-bold macro-num whitespace-nowrap">12 g</div>
</div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#B45309">
<div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Carbohidratos</div>
<div class="text-xl font-bold macro-num whitespace-nowrap">54 g</div>
</div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#BE185D">
<div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Azúcares</div>
<div class="text-xl font-bold macro-num whitespace-nowrap">5 g</div>
</div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#CA8A04">
<div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Grasas</div>
<div class="text-xl font-bold macro-num whitespace-nowrap">18 g</div>
</div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#15803D">
<div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Fibra</div>
<div class="text-xl font-bold macro-num whitespace-nowrap">4 g</div>
</div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#1D4ED8">
<div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Calorías</div>
<div class="text-xl font-bold macro-num whitespace-nowrap">480 kcal</div>
</div>
</div>
<div class="flex flex-1 items-center justify-center">
<button onclick="document.getElementById('card').classList.remove('is-flipped')" class="glass-pill rounded-full px-5 py-2 text-sm">REGRESAR</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- ===== Cara trasera (estática, para revisar macros) ===== -->
<div class="flex flex-col items-center gap-3">
<span class="frame-label text-white/45">Cara trasera · macros (colores fijos)</span>
<div class="menu-bg rounded-[2rem] p-6">
<div class="w-72">
<div class="flex min-h-[22rem] flex-col gap-3 rounded-3xl p-4" style="background:#efece6;border:1px solid rgba(0,0,0,.04);box-shadow:0 1px 3px rgba(40,30,20,.06)">
<div class="flex items-center justify-center">
<h3 class="display text-base font-semibold">Bruschetta al pomodoro</h3>
</div>
<div class="grid grid-cols-2 gap-2">
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#dc2626">
<div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Proteína</div>
<div class="text-xl font-bold macro-num whitespace-nowrap">12 g</div>
</div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#B45309">
<div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Carbohidratos</div>
<div class="text-xl font-bold macro-num whitespace-nowrap">54 g</div>
</div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#BE185D">
<div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Azúcares</div>
<div class="text-xl font-bold macro-num whitespace-nowrap">5 g</div>
</div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#CA8A04">
<div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Grasas</div>
<div class="text-xl font-bold macro-num whitespace-nowrap">18 g</div>
</div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#15803D">
<div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Fibra</div>
<div class="text-xl font-bold macro-num whitespace-nowrap">4 g</div>
</div>
<div class="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5" style="--c:#1D4ED8">
<div class="text-[13px] font-semibold leading-tight" style="color:var(--c)">Calorías</div>
<div class="text-xl font-bold macro-num whitespace-nowrap">480 kcal</div>
</div>
</div>
<div class="flex flex-1 items-center justify-center">
<button class="glass-pill rounded-full px-5 py-2 text-sm">REGRESAR</button>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
+56 -4
View File
@@ -36,6 +36,8 @@
"createSplit": "Create split bill",
"joinSplit": "Join table {table}'s bill",
"splitDetected": "Table {table} already has a split bill",
"whoAreYou": "Who are you?",
"imNew": "I'm new",
"yourSubaccount": "Your subaccount",
"yourSubtotal": "What you owe",
"tableTotal": "Table total",
@@ -50,9 +52,17 @@
"macroLegend": "Macro color code",
"tapToFlip": "Tap to see macros",
"viewCards": "Cards",
"viewList": "List"
"viewList": "List",
"nutrition": "Nutrition facts",
"addToOrderLong": "Add to my order",
"explore": "Explore our menu",
"askClaude": "Ask the virtual waiter",
"order": "Order",
"splitAction": "Split bill",
"flipBack": "Back"
},
"macros": {
"title": "Macros",
"protein": "Protein",
"carbs": "Carbs",
"sugar": "Sugars",
@@ -61,8 +71,8 @@
"kcal": "Calories"
},
"ai": {
"title": "Menu consultant",
"placeholder": "What do you recommend if I'm diabetic?",
"title": "Virtual waiter",
"placeholder": "What's the most popular dish?",
"thinking": "Thinking…",
"intro": "Tell me what you're after and I'll recommend dishes from the menu.",
"pairWith": "To pair with"
@@ -109,6 +119,8 @@
"split": "Split",
"tableTotal": "Table total",
"completeTable": "Complete table",
"waiterAlert": "ALERT at Table {table}",
"pending": "PENDING",
"tableSubaccount": "Table",
"subaccountEmpty": "No dishes yet.",
"paid": "Paid",
@@ -224,6 +236,33 @@
"invalid": "Wrong username or password",
"invalidLink": "Invalid access link"
},
"costs": {
"title": "Costs",
"exchangeRate": "Exchange rate",
"stale": "last available",
"pricesUpdated": "Prices updated",
"never": "never",
"totalMonth": "Month total",
"restaurantsTokens": "Restaurant tokens",
"storage": "Storage",
"avgPerRestaurant": "Average per restaurant",
"operativo": "Collina operational",
"operativoHint": "calls not attributable to a restaurant",
"costPerGb": "Cost per GB",
"save": "Save",
"updatePrices": "Update prices from Anthropic",
"updating": "Updating…",
"pricesUpdatedN": "Prices updated: {n} changes",
"pricesNoChange": "No price changes",
"fetchFailed": "Couldn't read the page. Paste the pricing text below:",
"updateFailed": "Couldn't update",
"pastePlaceholder": "Paste Anthropic's pricing page text here…",
"processText": "Process text",
"restaurant": "Restaurant",
"tokens": "Tokens",
"projected": "Projected storage",
"inactive": "inactive"
},
"admin": {
"title": "Collina master panel",
"newRestaurant": "New restaurant",
@@ -234,6 +273,19 @@
"editorLink": "Editor link",
"publicLink": "Public link",
"credentials": "Initial credentials",
"active": "Active"
"active": "Active",
"slugOptional": "Slug (optional)",
"slugPlaceholder": "generated from the name",
"language": "Language",
"localeEs": "ES",
"localeEn": "EN",
"createdNotice": "Restaurant «{name}» created. Save these credentials (shown only once):",
"username": "Username",
"password": "Password",
"empty": "No restaurants yet.",
"statusActive": "active",
"statusInactive": "inactive",
"publicPrefix": "public",
"editorPrefix": "editor"
}
}
+56 -4
View File
@@ -36,6 +36,8 @@
"createSplit": "Crear cuenta dividida",
"joinSplit": "Unirme a la cuenta de la mesa {table}",
"splitDetected": "La mesa {table} ya tiene una cuenta dividida",
"whoAreYou": "¿Quién eres?",
"imNew": "Soy nuevo",
"yourSubaccount": "Tu subcuenta",
"yourSubtotal": "Lo que debes tú",
"tableTotal": "Total de la mesa",
@@ -50,9 +52,17 @@
"macroLegend": "Código de color de macros",
"tapToFlip": "Toca para ver macros",
"viewCards": "Tarjetas",
"viewList": "Lista"
"viewList": "Lista",
"nutrition": "Datos nutricionales",
"addToOrderLong": "Agregar a mi orden",
"explore": "Explora nuestro menú",
"askClaude": "Preguntar al mesero virtual",
"order": "Orden",
"splitAction": "Dividir cuenta",
"flipBack": "Regresar"
},
"macros": {
"title": "Macros",
"protein": "Proteína",
"carbs": "Carbohidratos",
"sugar": "Azúcares",
@@ -61,8 +71,8 @@
"kcal": "Calorías"
},
"ai": {
"title": "Consultor del menú",
"placeholder": "¿Qué me recomiendas si soy diabético?",
"title": "Mesero virtual",
"placeholder": "¿Cuál es el platillo más popular?",
"thinking": "Pensando…",
"intro": "Cuéntame qué buscas y te recomiendo platillos del menú.",
"pairWith": "Para acompañar"
@@ -109,6 +119,8 @@
"split": "Dividida",
"tableTotal": "Total de la mesa",
"completeTable": "Completar mesa",
"waiterAlert": "ALERTA en Mesa {table}",
"pending": "PENDIENTE",
"tableSubaccount": "Mesa",
"subaccountEmpty": "Aún sin platillos.",
"paid": "Pagado",
@@ -224,6 +236,33 @@
"invalid": "Usuario o contraseña incorrectos",
"invalidLink": "Link de acceso inválido"
},
"costs": {
"title": "Costos",
"exchangeRate": "Tipo de cambio",
"stale": "último disponible",
"pricesUpdated": "Precios actualizados",
"never": "nunca",
"totalMonth": "Total del mes",
"restaurantsTokens": "Tokens restaurantes",
"storage": "Almacenamiento",
"avgPerRestaurant": "Promedio por restaurante",
"operativo": "Operativo Collina",
"operativoHint": "llamadas no atribuibles a un restaurante",
"costPerGb": "Costo por GB",
"save": "Guardar",
"updatePrices": "Actualizar precios desde Anthropic",
"updating": "Actualizando…",
"pricesUpdatedN": "Precios actualizados: {n} cambios",
"pricesNoChange": "Sin cambios en los precios",
"fetchFailed": "No se pudo leer la página. Pega el texto de precios abajo:",
"updateFailed": "No se pudo actualizar",
"pastePlaceholder": "Pega aquí el texto de la página de precios de Anthropic…",
"processText": "Procesar texto",
"restaurant": "Restaurante",
"tokens": "Tokens",
"projected": "Proyectado almacenamiento",
"inactive": "inactivo"
},
"admin": {
"title": "Panel maestro Collina",
"newRestaurant": "Nuevo restaurante",
@@ -234,6 +273,19 @@
"editorLink": "Link de editor",
"publicLink": "Link público",
"credentials": "Credenciales iniciales",
"active": "Activo"
"active": "Activo",
"slugOptional": "Slug (opcional)",
"slugPlaceholder": "se genera del nombre",
"language": "Idioma",
"localeEs": "ES",
"localeEn": "EN",
"createdNotice": "Restaurante «{name}» creado. Guarda estas credenciales (se muestran una vez):",
"username": "Usuario",
"password": "Contraseña",
"empty": "Aún no hay restaurantes.",
"statusActive": "activo",
"statusInactive": "inactivo",
"publicPrefix": "público",
"editorPrefix": "editor"
}
}
-1
View File
@@ -1522,7 +1522,6 @@
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"optional": true,
@@ -0,0 +1,60 @@
-- CreateTable
CREATE TABLE "TokenUsage" (
"id" TEXT NOT NULL,
"restaurantId" TEXT,
"model" TEXT NOT NULL,
"feature" TEXT NOT NULL,
"inputTokens" INTEGER NOT NULL DEFAULT 0,
"outputTokens" INTEGER NOT NULL DEFAULT 0,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "TokenUsage_pkey" PRIMARY KEY ("id")
);
CREATE INDEX "TokenUsage_createdAt_idx" ON "TokenUsage"("createdAt");
CREATE INDEX "TokenUsage_restaurantId_createdAt_idx" ON "TokenUsage"("restaurantId", "createdAt");
-- CreateTable
CREATE TABLE "ModelPrice" (
"model" TEXT NOT NULL,
"inputPricePerMTok" DOUBLE PRECISION NOT NULL,
"outputPricePerMTok" DOUBLE PRECISION NOT NULL,
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "ModelPrice_pkey" PRIMARY KEY ("model")
);
-- CreateTable
CREATE TABLE "PriceUpdateLog" (
"id" TEXT NOT NULL,
"model" TEXT NOT NULL,
"oldInput" DOUBLE PRECISION,
"newInput" DOUBLE PRECISION,
"oldOutput" DOUBLE PRECISION,
"newOutput" DOUBLE PRECISION,
"source" TEXT NOT NULL DEFAULT 'anthropic',
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "PriceUpdateLog_pkey" PRIMARY KEY ("id")
);
CREATE INDEX "PriceUpdateLog_createdAt_idx" ON "PriceUpdateLog"("createdAt");
-- CreateTable
CREATE TABLE "ExchangeRate" (
"date" TEXT NOT NULL,
"rate" DOUBLE PRECISION NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "ExchangeRate_pkey" PRIMARY KEY ("date")
);
-- CreateTable
CREATE TABLE "AppConfig" (
"key" TEXT NOT NULL,
"value" TEXT NOT NULL,
CONSTRAINT "AppConfig_pkey" PRIMARY KEY ("key")
);
-- Seed current verified model prices (USD per million tokens).
INSERT INTO "ModelPrice" ("model","inputPricePerMTok","outputPricePerMTok","updatedAt") VALUES
('claude-haiku-4-5', 1, 5, CURRENT_TIMESTAMP),
('claude-sonnet-4-6', 3, 15, CURRENT_TIMESTAMP),
('claude-opus-4-8', 5, 25, CURRENT_TIMESTAMP);
-- Seed configurable cost per GB (default 0 = no projected storage cost yet).
INSERT INTO "AppConfig" ("key","value") VALUES ('costPerGb', '0');
+51
View File
@@ -116,3 +116,54 @@ model Order {
@@index([restaurantId, status])
}
// ── Cost dashboard (superadmin) ──────────────────────────────────────────────
// One row per Anthropic API call. restaurantId null = Collina operational calls.
model TokenUsage {
id String @id @default(cuid())
restaurantId String? // null = operational (e.g. price-update button)
model String
feature String // consultor | traduccion | import | precios-update
inputTokens Int @default(0)
outputTokens Int @default(0)
createdAt DateTime @default(now())
@@index([createdAt])
@@index([restaurantId, createdAt])
}
// Editable per-model pricing (USD per million tokens).
model ModelPrice {
model String @id
inputPricePerMTok Float
outputPricePerMTok Float
updatedAt DateTime @default(now())
}
// Audit trail of price changes (old → new).
model PriceUpdateLog {
id String @id @default(cuid())
model String
oldInput Float?
newInput Float?
oldOutput Float?
newOutput Float?
source String @default("anthropic") // anthropic | manual
createdAt DateTime @default(now())
@@index([createdAt])
}
// Daily USD→MXN exchange rate cache.
model ExchangeRate {
date String @id // YYYY-MM-DD
rate Float
createdAt DateTime @default(now())
}
// Generic key/value app config (e.g. costPerGb).
model AppConfig {
key String @id
value String
}
Binary file not shown.
Binary file not shown.
+23 -1
View File
@@ -1,7 +1,9 @@
import { isAdminAuthed } from '@/lib/auth';
import { prisma } from '@/lib/prisma';
import { getCostDashboard } from '@/lib/costs';
import AdminLogin from '@/components/admin/AdminLogin';
import AdminPanel from '@/components/admin/AdminPanel';
import CostsDashboard from '@/components/admin/CostsDashboard';
export const dynamic = 'force-dynamic';
@@ -22,6 +24,26 @@ export default async function AdminPage() {
},
});
// Cost dashboard data (computed server-side). Never block the panel on it.
let costs = null;
try {
costs = await getCostDashboard();
} catch (err) {
console.error('cost dashboard error', err);
}
const baseUrl = process.env.APP_BASE_URL || '';
return <AdminPanel initialRestaurants={restaurants.map((r) => ({ ...r, createdAt: r.createdAt.toISOString() }))} baseUrl={baseUrl} />;
return (
<>
<AdminPanel
initialRestaurants={restaurants.map((r) => ({ ...r, createdAt: r.createdAt.toISOString() }))}
baseUrl={baseUrl}
/>
{costs && (
<div className="mx-auto max-w-3xl px-4 pb-16">
<CostsDashboard data={costs} />
</div>
)}
</>
);
}
+2
View File
@@ -1,6 +1,7 @@
import { NextResponse } from 'next/server';
import { prisma } from '@/lib/prisma';
import { getAnthropic, HAIKU_MODEL } from '@/lib/anthropic';
import { recordUsage } from '@/lib/usage';
import { parseLenientJson } from '@/lib/json';
import { pickText } from '@/lib/text';
import type { Locale } from '@/i18n/config';
@@ -120,6 +121,7 @@ export async function POST(req: Request, { params }: { params: { slug: string }
system: [{ type: 'text', text: cacheable, cache_control: { type: 'ephemeral' } }],
messages: [{ role: 'user', content: question }],
});
await recordUsage({ restaurantId: restaurant.id, model: HAIKU_MODEL, feature: 'consultor', usage: msg.usage });
const text = msg.content.find((c) => c.type === 'text')?.text ?? '{}';
// Lenient parse (shared with import): tolerates prose/fences/truncation so a
+5 -1
View File
@@ -28,7 +28,11 @@ export async function POST(req: Request, { params }: { params: { slug: string }
link: String(form.get('link') ?? ''),
text: String(form.get('text') ?? ''),
});
const result = await extractMenu(source, guard.restaurant.defaultLocale as Locale);
const result = await extractMenu(
source,
guard.restaurant.defaultLocale as Locale,
guard.restaurant.id,
);
if (result.sections.length === 0) {
return NextResponse.json({ error: 'nothing_found' }, { status: 422 });
}
+4 -19
View File
@@ -1,9 +1,6 @@
import { NextResponse } from 'next/server';
import { requireEditor } from '@/lib/guard';
import { publishVersion, buildSnapshot } from '@/lib/menu';
import { generatePairings } from '@/lib/pairings';
export const maxDuration = 60;
import { publishVersion } from '@/lib/menu';
export async function POST(req: Request, { params }: { params: { slug: string } }) {
const guard = await requireEditor(params.slug);
@@ -11,7 +8,6 @@ export async function POST(req: Request, { params }: { params: { slug: string }
const body = await req.json().catch(() => null);
const versionName = String(body?.versionName ?? '').trim();
const generateSuggestions = body?.generateSuggestions === true;
if (!versionName) return NextResponse.json({ error: 'invalid' }, { status: 400 });
const version = await publishVersion(
@@ -20,18 +16,7 @@ export async function POST(req: Request, { params }: { params: { slug: string }
guard.restaurant.username,
);
// Optional: regenerate cart pairings from the just-published menu. Never let an
// AI failure break publishing.
let suggestions = false;
if (generateSuggestions) {
try {
const snapshot = await buildSnapshot(guard.restaurant.id);
const result = await generatePairings(guard.restaurant.id, snapshot);
suggestions = result !== null;
} catch (err) {
console.error('publish pairings error', err);
}
}
return NextResponse.json({ ...version, suggestions });
// Cart suggestions are now computed locally and deterministically at runtime
// (lib/recommendations.ts) — no AI generation at publish time.
return NextResponse.json(version);
}
+35
View File
@@ -0,0 +1,35 @@
import { NextResponse } from 'next/server';
import { prisma } from '@/lib/prisma';
import { subtotal } from '@/lib/orders';
import type { OrderItem } from '@/lib/types';
export const dynamic = 'force-dynamic';
// Public: fetch a diner's OWN subaccount (by the id their session holds) so the
// client can rebuild its cart — used when a returning diner picks their existing
// subaccount, so a subsequent sync sends the full, correct item list.
export async function GET(req: Request, { params }: { params: { slug: string } }) {
const restaurant = await prisma.restaurant.findUnique({
where: { slug: params.slug },
select: { id: true },
});
if (!restaurant) return NextResponse.json({ error: 'not_found' }, { status: 404 });
const id = new URL(req.url).searchParams.get('id') ?? '';
const order = await prisma.order.findFirst({
where: { id, restaurantId: restaurant.id, status: 'active' },
});
if (!order) return NextResponse.json({ error: 'not_found' }, { status: 404 });
const items = (order.items as OrderItem[]).map((it) => ({
productId: it.productId,
qty: it.qty,
note: it.note,
}));
return NextResponse.json({
id: order.id,
name: order.subaccountName,
tableNumber: order.tableNumber,
items,
});
}
@@ -0,0 +1,26 @@
import { NextResponse } from 'next/server';
import { prisma } from '@/lib/prisma';
export const dynamic = 'force-dynamic';
// Public: list the active subaccounts of a table so a returning diner can pick
// which one they belong to (full names; no privacy requirement here).
export async function GET(req: Request, { params }: { params: { slug: string } }) {
const restaurant = await prisma.restaurant.findUnique({
where: { slug: params.slug },
select: { id: true },
});
if (!restaurant) return NextResponse.json({ error: 'not_found' }, { status: 404 });
const table = Number(new URL(req.url).searchParams.get('table'));
if (!table) return NextResponse.json({ subaccounts: [] });
const orders = await prisma.order.findMany({
where: { restaurantId: restaurant.id, tableNumber: table, status: 'active' },
orderBy: { createdAt: 'asc' },
select: { id: true, subaccountName: true },
});
return NextResponse.json({
subaccounts: orders.map((o) => ({ id: o.id, name: o.subaccountName })),
});
}
+2
View File
@@ -1,6 +1,7 @@
import { NextResponse } from 'next/server';
import { requireEditor } from '@/lib/guard';
import { getAnthropic, HAIKU_MODEL } from '@/lib/anthropic';
import { recordUsage } from '@/lib/usage';
// Translate a single field with Claude Haiku to fill the missing locale.
export async function POST(req: Request, { params }: { params: { slug: string } }) {
@@ -23,6 +24,7 @@ export async function POST(req: Request, { params }: { params: { slug: string }
`Keep it natural and appetizing. Reply with ONLY the translation, no quotes, no notes.`,
messages: [{ role: 'user', content: text }],
});
await recordUsage({ restaurantId: guard.restaurant.id, model: HAIKU_MODEL, feature: 'traduccion', usage: msg.usage });
const translated = msg.content.find((c) => c.type === 'text')?.text?.trim() ?? '';
return NextResponse.json({ translation: translated, to });
} catch (err) {
+18
View File
@@ -0,0 +1,18 @@
import { NextResponse } from 'next/server';
import { isAdminAuthed } from '@/lib/auth';
import { setConfig } from '@/lib/config';
export const dynamic = 'force-dynamic';
// Update superadmin config (currently: costPerGb for projected storage cost).
export async function PATCH(req: Request) {
if (!(await isAdminAuthed())) {
return NextResponse.json({ error: 'unauthorized' }, { status: 401 });
}
const body = await req.json().catch(() => null);
if (body?.costPerGb !== undefined) {
const v = Math.max(0, Number(body.costPerGb) || 0);
await setConfig('costPerGb', String(v));
}
return NextResponse.json({ ok: true });
}
+38
View File
@@ -0,0 +1,38 @@
import { NextResponse } from 'next/server';
import { isAdminAuthed } from '@/lib/auth';
import { fetchAnthropicPricingText, updatePricesFromText } from '@/lib/prices';
export const dynamic = 'force-dynamic';
export const maxDuration = 60;
// Update model prices from Anthropic's pricing page (Haiku extracts from the page
// text), or from manually pasted text when the fetch is blocked.
export async function POST(req: Request) {
if (!(await isAdminAuthed())) {
return NextResponse.json({ error: 'unauthorized' }, { status: 401 });
}
const body = await req.json().catch(() => ({}));
const manualText = typeof body?.text === 'string' ? body.text.trim() : '';
let text = manualText;
let source: 'anthropic' | 'manual' = manualText ? 'manual' : 'anthropic';
if (!text) {
try {
text = await fetchAnthropicPricingText();
source = 'anthropic';
} catch (err) {
console.error('pricing fetch failed', err);
// Tell the UI to offer the manual-paste fallback.
return NextResponse.json({ error: 'fetch_failed' }, { status: 502 });
}
}
try {
const changes = await updatePricesFromText(text, source);
return NextResponse.json({ ok: true, changes });
} catch (err) {
console.error('price update failed', err);
return NextResponse.json({ error: 'update_failed' }, { status: 502 });
}
}
+413 -6
View File
@@ -3,11 +3,12 @@
@tailwind utilities;
:root {
/* Default restaurant palette (overridden per-restaurant at runtime). */
--bg: #f4f1ec;
--bg-2: #e9e3da;
/* Fixed brand palette — hardcoded from the design mockups. The per-restaurant
palette feature is being retired, so these are no longer overridden at runtime. */
--bg: #ffffff;
--bg-2: #ffffff;
--surface: rgba(255, 255, 255, 0.55);
--accent: #b45309;
--accent: #dc2626;
--text: #2a2520;
--tab: rgba(255, 255, 255, 0.45);
}
@@ -21,7 +22,7 @@ body {
body {
color: var(--text);
font-family: var(--font-inter), system-ui, sans-serif;
font-family: var(--font-montserrat), system-ui, sans-serif;
background:
radial-gradient(1200px 800px at 80% -10%, rgba(255, 255, 255, 0.6), transparent 60%),
radial-gradient(1000px 700px at -10% 110%, rgba(255, 255, 255, 0.4), transparent 55%),
@@ -55,7 +56,12 @@ body {
}
.display {
font-family: var(--font-fraunces), Georgia, serif;
font-family: var(--font-montserrat), system-ui, sans-serif;
}
/* Reserved for the landing "Smart Menu" wordmark. */
.wordmark {
font-family: var(--font-merriweather), Georgia, serif;
}
}
@@ -84,6 +90,76 @@ body {
transform: rotateY(180deg);
}
/* ---- Landing page brand animation (lightweight, pure CSS) ---- */
@keyframes lp-rise {
from {
opacity: 0;
transform: translateY(16px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes lp-sparkle {
0%,
100% {
opacity: 0;
transform: scale(0.2) rotate(0deg);
}
50% {
opacity: 1;
transform: scale(1) rotate(90deg);
}
}
@keyframes lp-glow {
0%,
100% {
opacity: 0.45;
transform: scale(1);
}
50% {
opacity: 0.7;
transform: scale(1.08);
}
}
.lp-smart {
animation: lp-rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.lp-sign {
animation: lp-rise 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.7s both;
}
.lp-cta {
animation: lp-rise 0.8s cubic-bezier(0.22, 1, 0.36, 1) 1.05s both;
}
.lp-glow {
animation: lp-glow 6s ease-in-out infinite;
}
.lp-sparkle {
animation: lp-sparkle 2.6s ease-in-out infinite both;
/* delay accompanies the "by Collina" entrance; staggered per-sparkle below */
animation-delay: 0.7s;
}
/* Respect reduced motion: show the final state, skip the sequence. */
@media (prefers-reduced-motion: reduce) {
.lp-smart,
.lp-sign,
.lp-cta {
animation: none;
opacity: 1;
transform: none;
}
.lp-glow {
animation: none;
}
.lp-sparkle {
animation: none;
opacity: 0.55;
}
}
/* hide horizontal scrollbar on section tabs */
.no-scrollbar::-webkit-scrollbar {
display: none;
@@ -93,6 +169,337 @@ body {
scrollbar-width: none;
}
/* ============================================================
Redesign design-system primitives (ported from the mockups)
============================================================ */
/* ---- Primary action color (hardcoded red across restaurants) ---- */
:root {
--action: #dc2626;
}
/* ---- "Liquid glass" button (opt-in via .liquid-btn) ---- */
.liquid-btn {
position: relative;
background:
linear-gradient(135deg, rgba(255, 255, 255, 0.65), rgba(245, 242, 237, 0.25) 55%, rgba(180, 83, 9, 0.06)),
rgba(255, 255, 255, 0.4);
backdrop-filter: blur(10px) saturate(160%);
-webkit-backdrop-filter: blur(10px) saturate(160%);
border: 1px solid rgba(255, 255, 255, 0.9);
box-shadow:
0 10px 24px -6px rgba(40, 30, 20, 0.22),
0 2px 6px rgba(40, 30, 20, 0.1),
inset 0 2px 2px rgba(255, 255, 255, 1),
inset 0 -6px 12px rgba(180, 160, 140, 0.18),
inset 0 0 0 1px rgba(255, 255, 255, 0.5);
overflow: hidden;
color: #2a2520;
transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.liquid-btn::before {
content: '';
position: absolute;
left: 6%;
right: 6%;
top: 2px;
height: 42%;
border-radius: 999px;
pointer-events: none;
background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0));
filter: blur(0.5px);
opacity: 0.9;
}
.liquid-btn:hover {
box-shadow:
0 14px 30px -6px rgba(40, 30, 20, 0.28),
0 3px 8px rgba(40, 30, 20, 0.14),
inset 0 2px 3px rgba(255, 255, 255, 1),
inset 0 -7px 14px rgba(180, 160, 140, 0.22),
inset 0 0 0 1px rgba(255, 255, 255, 0.6);
transform: translateY(-1px);
}
/* ---- Animated gradient "smoke" buttons (AI / order / split) ---- */
@keyframes ai-smoke {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
.ai-smoke,
.ai-smoke-red,
.ai-smoke-green {
background-size: 300% 300%;
color: #fff;
border: none;
animation: ai-smoke 6s ease-in-out infinite;
}
.ai-smoke { background-image: linear-gradient(120deg, #d97757, #e89b7d, #c2410c, #e08a5f, #d97757); }
.ai-smoke-red { background-image: linear-gradient(120deg, #dc2626, #f05252, #991b1b, #ef4444, #dc2626); }
.ai-smoke-green { background-image: linear-gradient(120deg, #4c1d95, #6d28d9, #3b0764, #5b21b6, #4c1d95); }
@media (prefers-reduced-motion: reduce) {
.ai-smoke,
.ai-smoke-red,
.ai-smoke-green { animation: none; }
}
/* ---- Segmented control (e.g. Tarjetas / Lista) ---- */
.seg-btn {
color: rgba(42, 37, 32, 0.5);
background: transparent;
border: none;
cursor: pointer;
transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.seg-btn.is-active {
color: #111;
background: #fff;
box-shadow: 0 2px 8px rgba(40, 30, 20, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.04);
}
/* ---- Category pills + sticky "stuck" bar (public menu sections) ---- */
.cat-btn {
display: flex;
align-items: center;
gap: 8px;
background: #f0f0f0;
color: #111;
border: none;
cursor: pointer;
transition: background 0.2s ease, color 0.2s ease;
}
.cat-btn.is-active {
background: #111;
color: #fff;
}
.cat-bar {
background: #ffffff;
display: flex;
flex-direction: column;
transition: box-shadow 0.25s ease, background 0.25s ease;
}
.cat-bar.is-stuck {
box-shadow: 0 6px 16px -6px rgba(40, 30, 20, 0.18), 0 1px 0 rgba(0, 0, 0, 0.04);
}
.cat-row {
display: flex;
gap: 8px;
overflow-x: auto;
}
.stuck-name {
display: none;
font-weight: 700;
font-size: 18px;
color: #111;
margin-bottom: 12px;
padding-left: 2px;
}
.cat-bar.is-stuck .stuck-name { display: block; }
.cat-bar.is-stuck .cat-row { justify-content: flex-start; gap: 22px; }
.cat-bar.is-stuck .cat-btn {
background: transparent !important;
color: rgba(42, 37, 32, 0.45) !important;
border-radius: 0 !important;
padding: 0 0 9px !important;
position: relative;
font-weight: 600;
}
.cat-bar.is-stuck .cat-btn.is-active { background: transparent !important; color: #111 !important; }
.cat-bar.is-stuck .cat-btn.is-active::after {
content: '';
position: absolute;
left: 0;
right: 0;
bottom: 0;
height: 3px;
border-radius: 3px;
background: #111;
}
/* ---- Editor bottom dock navigation ---- */
.dock-bar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 4px;
width: 100%;
padding: 20px 18px 14px;
border-radius: 32px;
background: #fff;
border: 1px solid rgba(0, 0, 0, 0.05);
box-shadow: 0 16px 36px -10px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.08);
}
.dock-btn {
flex: 1 1 0;
height: 46px;
border: none;
background: transparent;
cursor: pointer;
position: relative;
display: flex;
align-items: center;
justify-content: center;
padding: 0;
}
.dock-chip {
width: 46px;
height: 46px;
border-radius: 16px;
display: flex;
align-items: center;
justify-content: center;
color: #1b1916;
transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.5, 1), background 0.25s, box-shadow 0.25s;
}
.dock-btn:hover .dock-chip { transform: translateY(-3px); }
.dock-btn.is-active .dock-chip {
background: #ececec;
transform: translateY(-12px) scale(1.06);
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12), inset 0 0 0 1px rgba(0, 0, 0, 0.03);
}
.dock-dot {
position: absolute;
bottom: -4px;
left: 50%;
width: 6px;
height: 6px;
border-radius: 999px;
background: #111;
transform: translateX(-50%) scale(0);
transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.5, 1);
}
.dock-btn.is-active .dock-dot { transform: translateX(-50%) scale(1); }
.dock-tip {
position: absolute;
bottom: calc(100% + 6px);
left: 50%;
padding: 7px 16px;
border-radius: 14px;
background: #fff;
color: #1b1916;
font-size: 14px;
font-weight: 500;
white-space: nowrap;
opacity: 0;
transform: translateX(-50%) translateY(6px) scale(0.95);
transition: opacity 0.2s, transform 0.2s;
pointer-events: none;
box-shadow: 0 8px 20px -6px rgba(0, 0, 0, 0.2);
}
.dock-btn:hover .dock-tip { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
/* ---- Macro grid (back of dish card) + shimmering numbers ---- */
.macro-cell {
background: #fff;
border: 1px solid rgba(0, 0, 0, 0.04);
box-shadow: 0 1px 3px rgba(40, 30, 20, 0.06);
}
@keyframes macro-shine {
0% { background-position: 250% 0; }
100% { background-position: -150% 0; }
}
.macro-num {
background-image: linear-gradient(
100deg,
var(--c) 0%,
var(--c) 42%,
color-mix(in srgb, var(--c) 35%, #ffffff) 50%,
var(--c) 58%,
var(--c) 100%
);
background-size: 250% 100%;
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
color: transparent;
animation: macro-shine 5.5s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
.macro-num { animation: none; }
}
/* ---- Order delivery-timer pulses (editor orders) ---- */
@keyframes pendiente-pulse {
0%, 100% { box-shadow: 0 0 0 0 rgba(40, 189, 28, 0); }
50% { box-shadow: 0 0 0 4px rgba(40, 189, 28, 0.5); }
}
@keyframes pendiente-pulse-yellow {
0%, 100% { box-shadow: 0 0 0 0 rgba(224, 189, 58, 0); }
50% { box-shadow: 0 0 0 4px rgba(224, 189, 58, 0.5); }
}
@keyframes pendiente-pulse-red {
0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
50% { box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.5); }
}
.pendiente-green {
background: #28bd1c;
color: #fff;
border: 1px solid #1f9416;
animation: pendiente-pulse 1.2s ease-in-out infinite;
}
.pendiente-yellow {
background: #fce167;
color: #4a3c00;
border: 1px solid #e0bd3a;
animation: pendiente-pulse-yellow 1.2s ease-in-out infinite;
}
.pendiente-red {
background: #ef4444;
color: #fff;
border: 1px solid #991b1b;
animation: pendiente-pulse-red 1.2s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
.pendiente-green,
.pendiente-yellow,
.pendiente-red { animation: none; }
}
/* ---- Numeric inputs without spinner (editor thresholds) ---- */
.editable-num {
-moz-appearance: textfield;
appearance: textfield;
}
.editable-num::-webkit-outer-spin-button,
.editable-num::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
/* ---- Aurora background (landing) ---- */
.aurora {
--white-gradient: repeating-linear-gradient(100deg, #fff 0%, #fff 7%, transparent 10%, transparent 12%, #fff 16%);
--aurora: repeating-linear-gradient(100deg, #3b82f6 10%, #a5b4fc 15%, #93c5fd 20%, #ddd6fe 25%, #60a5fa 30%);
position: absolute;
inset: -10px;
pointer-events: none;
opacity: 0.5;
will-change: transform;
background-image: var(--white-gradient), var(--aurora);
background-size: 300% 200%;
background-position: 50% 50%, 50% 50%;
filter: blur(10px) invert(1);
-webkit-mask-image: radial-gradient(ellipse at 100% 0%, #000 10%, transparent 70%);
mask-image: radial-gradient(ellipse at 100% 0%, #000 10%, transparent 70%);
}
.aurora::after {
content: '';
position: absolute;
inset: 0;
background-image: var(--white-gradient), var(--aurora);
background-size: 200% 100%;
background-attachment: fixed;
mix-blend-mode: difference;
animation: aurora 60s linear infinite;
}
@keyframes aurora {
from { background-position: 50% 50%, 50% 50%; }
to { background-position: 350% 50%, 350% 50%; }
}
@media (prefers-reduced-motion: reduce) {
.aurora::after { animation: none; }
}
/* Safe-area helpers for edge-to-edge layout (viewport-fit=cover).
The background covers behind the notch / dynamic island and gesture bar, while
interactive content is padded so it isn't covered. On devices without insets
+9 -6
View File
@@ -1,17 +1,20 @@
import type { Metadata, Viewport } from 'next';
import { Fraunces, Inter } from 'next/font/google';
import { Montserrat, Merriweather } from 'next/font/google';
import { NextIntlClientProvider } from 'next-intl';
import { getLocale, getMessages } from 'next-intl/server';
import './globals.css';
const fraunces = Fraunces({
// Montserrat drives all UI + display type; Merriweather is reserved for the
// landing "Smart Menu" wordmark.
const montserrat = Montserrat({
subsets: ['latin'],
variable: '--font-fraunces',
variable: '--font-montserrat',
display: 'swap',
});
const inter = Inter({
const merriweather = Merriweather({
subsets: ['latin'],
variable: '--font-inter',
weight: ['300', '400', '700', '900'],
variable: '--font-merriweather',
display: 'swap',
});
@@ -39,7 +42,7 @@ export default async function RootLayout({
const messages = await getMessages();
return (
<html lang={locale} className={`${fraunces.variable} ${inter.variable}`}>
<html lang={locale} className={`${montserrat.variable} ${merriweather.variable}`}>
<body>
<NextIntlClientProvider locale={locale} messages={messages}>
{children}
+54 -12
View File
@@ -1,20 +1,62 @@
import Link from 'next/link';
// Landing premium minimalista: video de fondo + wordmark "Smart Menu" + CTA único.
export default function Home() {
return (
<main className="flex min-h-screen flex-col items-center justify-center gap-6 p-6 text-center">
<div className="glass max-w-md rounded-3xl p-8">
<h1 className="display text-3xl font-semibold">Menú inteligente</h1>
<p className="mt-2 text-sm text-[var(--text)]/65">
Menús digitales elegantes para restaurantes · Collina Systems
</p>
<Link
href="/admin"
className="mt-6 inline-block rounded-full bg-[var(--accent)] px-6 py-3 text-sm font-medium text-white"
>
Panel maestro
</Link>
<main
className="relative flex min-h-screen flex-col items-center justify-center overflow-hidden px-6 text-center"
style={{ background: '#1b1916' }}
>
{/* Background video */}
<video
className="absolute inset-0 h-full w-full object-cover"
autoPlay
muted
loop
playsInline
preload="auto"
aria-hidden
>
<source src="/videos/landing-bg.mp4" type="video/mp4" />
</video>
{/* Soft brand glow behind the wordmark */}
<div
aria-hidden
className="lp-glow pointer-events-none absolute h-[42rem] w-[42rem] rounded-full blur-3xl"
style={{
background:
'radial-gradient(circle, rgba(180,83,9,0.16), rgba(217,119,6,0.07) 45%, transparent 70%)',
}}
/>
<div className="relative flex flex-col items-center">
{/* SmartMenu — the protagonist (Merriweather wordmark) */}
<h1 className="lp-smart wordmark text-5xl font-extrabold tracking-tight text-white sm:text-7xl">
<span>Smart </span>
<span className="text-white/80">Menu</span>
</h1>
{/* by Collina — tapping it opens /admin. */}
<div className="lp-sign relative mt-4">
<Link
href="/admin"
aria-label="Collina"
className="display relative select-none text-lg font-light italic text-white/55 transition hover:text-white/80"
>
by Collina Systems
</Link>
</div>
</div>
{/* Single sales CTA */}
<Link
href="/demo"
className="lp-cta mt-14 rounded-full px-8 py-4 text-sm font-semibold tracking-wide text-white shadow-lg transition hover:-translate-y-0.5 hover:shadow-xl"
style={{ background: '#dc2626', boxShadow: '0 10px 30px -8px rgba(220,38,38,.4)' }}
>
Solicita una demo
</Link>
</main>
);
}
+9 -6
View File
@@ -2,9 +2,12 @@
import { useState } from 'react';
import { useRouter } from 'next/navigation';
import { useTranslations } from 'next-intl';
export default function AdminLogin() {
const router = useRouter();
const tAdmin = useTranslations('admin');
const tAuth = useTranslations('auth');
const [user, setUser] = useState('');
const [password, setPassword] = useState('');
const [error, setError] = useState(false);
@@ -27,26 +30,26 @@ export default function AdminLogin() {
return (
<main className="flex min-h-screen items-center justify-center p-4">
<form onSubmit={submit} className="glass flex w-full max-w-sm flex-col gap-3 rounded-3xl p-6">
<h1 className="display text-2xl font-semibold">Panel maestro Collina</h1>
<h1 className="display text-2xl font-semibold">{tAdmin('title')}</h1>
<input
value={user}
onChange={(e) => setUser(e.target.value)}
placeholder="usuario"
placeholder={tAuth('username')}
className="glass-soft rounded-2xl px-4 py-3 outline-none"
/>
<input
type="password"
value={password}
onChange={(e) => setPassword(e.target.value)}
placeholder="contraseña"
placeholder={tAuth('password')}
className="glass-soft rounded-2xl px-4 py-3 outline-none"
/>
{error && <p className="text-sm text-red-600">Credenciales incorrectas</p>}
{error && <p className="text-sm text-red-600">{tAuth('invalid')}</p>}
<button
disabled={loading}
className="rounded-2xl bg-[var(--accent)] py-3 font-medium text-white disabled:opacity-50"
className="rounded-2xl bg-[#dc2626] py-3 font-medium text-white disabled:opacity-50"
>
Iniciar sesión
{tAuth('login')}
</button>
</form>
</main>
+29 -25
View File
@@ -1,6 +1,7 @@
'use client';
import { useState } from 'react';
import { useTranslations } from 'next-intl';
type Restaurant = {
id: string;
@@ -27,6 +28,7 @@ export default function AdminPanel({
initialRestaurants: Restaurant[];
baseUrl: string;
}) {
const t = useTranslations('admin');
const [restaurants, setRestaurants] = useState(initialRestaurants);
const [name, setName] = useState('');
const [slug, setSlug] = useState('');
@@ -74,64 +76,64 @@ export default function AdminPanel({
return (
<main className="mx-auto max-w-3xl p-4 pb-16">
<h1 className="display mb-6 text-3xl font-semibold">Panel maestro Collina</h1>
<h1 className="display mb-6 text-3xl font-semibold">{t('title')}</h1>
<section className="glass mb-6 rounded-3xl p-5">
<h2 className="display mb-3 text-xl font-semibold">Nuevo restaurante</h2>
<h2 className="display mb-3 text-center text-xl font-semibold">{t('newRestaurant')}</h2>
<form onSubmit={create} className="flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-end">
<label className="flex flex-1 flex-col gap-1 text-sm">
Nombre
<label className="flex flex-1 flex-col gap-1 text-center text-sm">
{t('name')}
<input
value={name}
onChange={(e) => setName(e.target.value)}
className="glass-soft rounded-2xl px-4 py-2.5 outline-none"
/>
</label>
<label className="flex flex-1 flex-col gap-1 text-sm">
Slug (opcional)
<label className="flex flex-1 flex-col gap-1 text-center text-sm">
{t('slugOptional')}
<input
value={slug}
onChange={(e) => setSlug(e.target.value)}
placeholder="se genera del nombre"
placeholder={t('slugPlaceholder')}
className="glass-soft rounded-2xl px-4 py-2.5 outline-none"
/>
</label>
<label className="flex flex-col gap-1 text-sm">
Idioma
{t('language')}
<select
value={defaultLocale}
onChange={(e) => setDefaultLocale(e.target.value)}
className="glass-soft rounded-2xl px-4 py-2.5 outline-none"
>
<option value="es">ES</option>
<option value="en">EN</option>
<option value="es">{t('localeEs')}</option>
<option value="en">{t('localeEn')}</option>
</select>
</label>
<button
disabled={creating}
className="rounded-2xl bg-[var(--accent)] px-5 py-2.5 font-medium text-white disabled:opacity-50"
className="solid-btn rounded-2xl bg-[#dc2626] px-5 py-2.5 font-medium text-white disabled:opacity-50"
>
Crear restaurante
{t('create')}
</button>
</form>
{justCreated && (
<div className="mt-4 rounded-2xl border border-amber-300 bg-amber-50/70 p-4 text-sm">
<p className="mb-2 font-semibold">
Restaurante «{justCreated.name}» creado. Guarda estas credenciales (se muestran una vez):
{t('createdNotice', { name: justCreated.name })}
</p>
<ul className="space-y-1">
<li>
<strong>Usuario:</strong> {justCreated.username}
<strong>{t('username')}:</strong> {justCreated.username}
</li>
<li>
<strong>Contraseña:</strong> <code>{justCreated.password}</code>
<strong>{t('password')}:</strong> <code>{justCreated.password}</code>
</li>
<li className="break-all">
<strong>Link de editor:</strong> {editorLink(justCreated)}
<strong>{t('editorLink')}:</strong> {editorLink(justCreated)}
</li>
<li className="break-all">
<strong>Link público:</strong> {publicLink(justCreated.slug)}
<strong>{t('publicLink')}:</strong> {publicLink(justCreated.slug)}
</li>
</ul>
</div>
@@ -139,9 +141,11 @@ export default function AdminPanel({
</section>
<section className="glass rounded-3xl p-5">
<h2 className="display mb-3 text-xl font-semibold">Restaurantes</h2>
<h2 className="display mb-3 text-xl font-semibold">{t('restaurants')}</h2>
<div className="flex flex-col gap-3">
{restaurants.length === 0 && <p className="text-sm text-[var(--text)]/60">Aún no hay restaurantes.</p>}
{restaurants.length === 0 && (
<p className="text-sm text-[var(--text)]/60">{t('empty')}</p>
)}
{restaurants.map((r) => (
<div key={r.id} className="glass-soft rounded-2xl p-4">
<div className="flex items-center justify-between gap-2">
@@ -151,19 +155,19 @@ export default function AdminPanel({
</div>
<button
onClick={() => toggleActive(r)}
className={`rounded-full px-3 py-1 text-xs font-medium ${
className={`solid-btn rounded-full px-3 py-1 text-xs font-medium ${
r.active ? 'bg-green-100 text-green-800' : 'bg-gray-200 text-gray-600'
}`}
>
{r.active ? 'activo' : 'inactivo'}
{r.active ? t('statusActive') : t('statusInactive')}
</button>
</div>
<div className="mt-2 space-y-1 text-xs">
<a href={publicLink(r.slug)} target="_blank" className="block break-all text-[var(--accent)]">
público: {publicLink(r.slug)}
<a href={publicLink(r.slug)} target="_blank" className="block break-all text-[#dc2626]">
{t('publicPrefix')}: {publicLink(r.slug)}
</a>
<a href={editorLink(r)} target="_blank" className="block break-all text-[var(--accent)]">
editor: {editorLink(r)}
<a href={editorLink(r)} target="_blank" className="block break-all text-[#dc2626]">
{t('editorPrefix')}: {editorLink(r)}
</a>
</div>
</div>
+188
View File
@@ -0,0 +1,188 @@
'use client';
import { useState } from 'react';
import { useRouter } from 'next/navigation';
import { useTranslations } from 'next-intl';
import type { CostDashboard } from '@/lib/costs';
function usd(n: number): string {
return `$${n.toFixed(n >= 1 ? 2 : 4)}`;
}
function mxn(n: number, rate: number): string {
const v = n * rate;
return `$${v.toFixed(v >= 1 ? 2 : 4)}`;
}
export default function CostsDashboard({ data }: { data: CostDashboard }) {
const t = useTranslations('costs');
const router = useRouter();
const rate = data.exchange.rate;
const [costPerGb, setCostPerGb] = useState(String(data.costPerGb));
const [busy, setBusy] = useState(false);
const [msg, setMsg] = useState<string | null>(null);
const [pasteOpen, setPasteOpen] = useState(false);
const [pasteText, setPasteText] = useState('');
async function updatePrices(text?: string) {
setBusy(true);
setMsg(null);
try {
const r = await fetch('/api/admin/prices/update', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(text ? { text } : {}),
});
const d = await r.json().catch(() => ({}));
if (r.ok) {
const n = d.changes?.length ?? 0;
setMsg(n > 0 ? t('pricesUpdatedN', { n }) : t('pricesNoChange'));
setPasteOpen(false);
setPasteText('');
router.refresh();
} else if (d.error === 'fetch_failed') {
setPasteOpen(true);
setMsg(t('fetchFailed'));
} else {
setMsg(t('updateFailed'));
}
} finally {
setBusy(false);
}
}
async function saveCostPerGb() {
setBusy(true);
try {
await fetch('/api/admin/config', {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ costPerGb: Number(costPerGb) || 0 }),
});
router.refresh();
} finally {
setBusy(false);
}
}
const { totals } = data;
return (
<section className="glass mb-6 mt-2 rounded-3xl p-5">
<div className="mb-1 flex items-center justify-between gap-2">
<h2 className="display text-xl font-semibold">{t('title')}</h2>
<span className="text-xs text-[var(--text)]/55">{data.monthLabel}</span>
</div>
{/* Context */}
<p className="mb-4 text-xs text-[var(--text)]/55">
{t('exchangeRate')}: 1 USD = {rate.toFixed(2)} MXN · {data.exchange.date}
{data.exchange.stale ? ` (${t('stale')})` : ''} ·{' '}
{t('pricesUpdated')}:{' '}
{data.pricesUpdatedAt ? new Date(data.pricesUpdatedAt).toLocaleDateString() : t('never')}
</p>
{/* Global totals */}
<div className="mb-4 grid grid-cols-2 gap-2 sm:grid-cols-4">
<Stat label={t('totalMonth')} value={usd(totals.grandUsd)} sub={`${mxn(totals.grandUsd, rate)} MXN`} />
<Stat label={t('restaurantsTokens')} value={usd(totals.restaurantsTokenUsd)} sub={`${mxn(totals.restaurantsTokenUsd, rate)} MXN`} />
<Stat label={t('storage')} value={usd(totals.storageUsd)} sub={`${mxn(totals.storageUsd, rate)} MXN`} />
<Stat label={t('avgPerRestaurant')} value={usd(totals.avgPerRestaurantUsd)} sub={`${mxn(totals.avgPerRestaurantUsd, rate)} MXN`} />
</div>
{/* Operativo Collina (separate) */}
<div className="mb-4 rounded-2xl bg-amber-50/60 px-4 py-2 text-sm text-amber-800">
{t('operativo')}: <strong>{usd(totals.operativoTokenUsd)}</strong> · {mxn(totals.operativoTokenUsd, rate)} MXN
<span className="ml-1 text-xs">({t('operativoHint')})</span>
</div>
{/* Controls */}
<div className="mb-4 flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between">
<div className="flex items-end gap-2">
<label className="flex flex-col gap-1 text-xs">
{t('costPerGb')} (USD)
<input
type="number"
min={0}
step="0.01"
value={costPerGb}
onChange={(e) => setCostPerGb(e.target.value)}
className="glass-soft w-24 rounded-xl px-2 py-1.5 text-sm outline-none"
/>
</label>
<button onClick={saveCostPerGb} disabled={busy} className="glass-pill rounded-full px-4 py-2 text-sm disabled:opacity-50">
{t('save')}
</button>
</div>
<button
onClick={() => updatePrices()}
disabled={busy}
className="rounded-full bg-[var(--accent)] px-4 py-2 text-sm font-medium text-white disabled:opacity-50"
>
{busy ? t('updating') : t('updatePrices')}
</button>
</div>
{msg && <p className="mb-3 text-sm text-[var(--text)]/70">{msg}</p>}
{pasteOpen && (
<div className="mb-4 flex flex-col gap-2">
<textarea
value={pasteText}
onChange={(e) => setPasteText(e.target.value)}
rows={4}
placeholder={t('pastePlaceholder')}
className="glass-soft rounded-2xl px-3 py-2 text-sm outline-none"
/>
<button
onClick={() => pasteText.trim() && updatePrices(pasteText.trim())}
disabled={busy || !pasteText.trim()}
className="self-start rounded-full bg-[var(--accent)] px-4 py-2 text-sm font-medium text-white disabled:opacity-50"
>
{t('processText')}
</button>
</div>
)}
{/* Per-restaurant breakdown */}
<div className="overflow-x-auto">
<table className="w-full text-sm">
<thead>
<tr className="text-left text-xs text-[var(--text)]/55">
<th className="py-1">{t('restaurant')}</th>
<th className="py-1 text-right">{t('tokens')} (USD/MXN)</th>
<th className="py-1 text-right">GB</th>
<th className="py-1 text-right">{t('projected')} (USD/MXN)</th>
</tr>
</thead>
<tbody>
{data.restaurants.map((r) => (
<tr key={r.id} className="border-t border-white/40">
<td className="py-1.5">
{r.name}
{!r.active && <span className="ml-1 text-xs text-[var(--text)]/40">({t('inactive')})</span>}
</td>
<td className="py-1.5 text-right">
{usd(r.tokenCostUsd)} <span className="text-[var(--text)]/50">/ {mxn(r.tokenCostUsd, rate)}</span>
</td>
<td className="py-1.5 text-right">{r.gb.toFixed(3)}</td>
<td className="py-1.5 text-right">
{usd(r.storageCostUsd)} <span className="text-[var(--text)]/50">/ {mxn(r.storageCostUsd, rate)}</span>
</td>
</tr>
))}
</tbody>
</table>
</div>
</section>
);
}
function Stat({ label, value, sub }: { label: string; value: string; sub: string }) {
return (
<div className="glass-soft rounded-2xl px-3 py-2">
<div className="text-[11px] text-[var(--text)]/55">{label}</div>
<div className="text-lg font-semibold">{value}</div>
<div className="text-[11px] text-[var(--text)]/50">{sub}</div>
</div>
);
}
+17 -8
View File
@@ -103,12 +103,15 @@ export default function BrandTab({
)}
</div>
<div className="mt-2 flex gap-2">
<label className="glass-pill cursor-pointer rounded-full px-4 py-2 text-sm font-medium">
<label className="cursor-pointer rounded-full bg-black px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-black/90">
{uploading === 'banner' ? '…' : t('uploadBanner')}
<input type="file" accept="image/*" hidden onChange={(e) => upload('banner', e.target.files?.[0] ?? null)} />
</label>
{banner && (
<button onClick={() => setBanner(null)} className="rounded-full px-3 py-2 text-sm text-red-500/80">
<button
onClick={() => setBanner(null)}
className="rounded-full bg-black/[0.06] px-4 py-2 text-sm font-medium text-red-500 transition-colors hover:bg-black/[0.1]"
>
{tc('delete')}
</button>
)}
@@ -128,12 +131,15 @@ export default function BrandTab({
)}
</div>
<div className="flex flex-col gap-2">
<label className="glass-pill cursor-pointer rounded-full px-4 py-2 text-sm font-medium">
<label className="cursor-pointer self-start rounded-full bg-black px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-black/90">
{uploading === 'profile' ? '…' : t('uploadLogo')}
<input type="file" accept="image/*" hidden onChange={(e) => upload('profile', e.target.files?.[0] ?? null)} />
</label>
{profile && (
<button onClick={() => setProfile(null)} className="text-left text-sm text-red-500/80">
<button
onClick={() => setProfile(null)}
className="self-start rounded-full bg-black/[0.06] px-4 py-2 text-sm font-medium text-red-500 transition-colors hover:bg-black/[0.1]"
>
{tc('delete')}
</button>
)}
@@ -149,7 +155,7 @@ export default function BrandTab({
<button
key={p}
onClick={() => addLink(p)}
className="glass-soft rounded-full px-3 py-1 text-xs"
className="rounded-full border border-black/[0.06] bg-white/55 px-3 py-1 text-xs text-[var(--text)]/70 transition-colors hover:bg-white/80"
>
+ {p}
</button>
@@ -174,13 +180,16 @@ export default function BrandTab({
invalid ? 'ring-1 ring-red-400' : ''
}`}
/>
<button onClick={() => removeLink(i)} className="px-1 text-red-500/70" aria-label={tc('delete')}>
<button onClick={() => removeLink(i)} className="px-1 text-red-500" aria-label={tc('delete')}>
✕
</button>
</div>
);
})}
<button onClick={() => addLink()} className="glass-pill rounded-2xl py-2 text-sm font-medium">
<button
onClick={() => addLink()}
className="rounded-2xl bg-black py-2 text-sm font-medium text-white transition-colors hover:bg-black/90"
>
+ {t('addLink')}
</button>
</div>
@@ -189,7 +198,7 @@ export default function BrandTab({
<button
onClick={save}
disabled={saving}
className="rounded-2xl bg-[var(--accent)] py-3 font-medium text-white disabled:opacity-50"
className="rounded-2xl bg-[#dc2626] py-3 font-medium text-white transition-colors hover:bg-[#dc2626]/90 disabled:opacity-50"
>
{saved ? '✓ ' : ''}
{tc('save')}
+12 -8
View File
@@ -158,19 +158,22 @@ export default function CatalogTab({
<a
href={`/${slug}`}
target="_blank"
className="glass-pill rounded-full px-4 py-2 text-sm font-medium"
className="glass-pill rounded-full px-4 py-2 text-center text-sm font-medium"
style={{ backgroundColor: 'rgba(179, 203, 232, 0.45)' }}
>
👁 {t('viewMenu')}
</a>
<button
onClick={() => setImportOpen(true)}
className="glass-pill rounded-full px-4 py-2 text-sm font-medium"
className="rounded-full px-4 py-2 text-sm font-medium"
style={{ backgroundColor: 'rgba(179, 203, 232, 0.45)' }}
>
✨ {ti('loadMenu')}
</button>
<button
onClick={onPublish}
className="ml-auto rounded-full bg-[var(--accent)] px-5 py-2 text-sm font-semibold text-white shadow"
className="ml-auto rounded-full px-5 py-2 text-sm font-semibold text-white shadow"
style={{ backgroundColor: '#dc2626' }}
>
{t('saveAndPublish')}
</button>
@@ -179,7 +182,7 @@ export default function CatalogTab({
{/* Global macros toggle — lives here with catalog assembly (near Cargar menú) */}
<div className="glass flex items-center justify-between gap-3 rounded-3xl p-4">
<div className="min-w-0">
<div className="text-sm font-medium">{t('showMacros')}</div>
<div className="text-left text-sm font-medium">{t('showMacros')}</div>
<div className="text-xs text-[var(--text)]/55">
{showMacros ? t('showMacrosHint') : t('showMacrosDisclaimer')}
</div>
@@ -188,7 +191,7 @@ export default function CatalogTab({
onClick={toggleGlobalMacros}
aria-pressed={showMacros}
className={`relative h-7 w-12 shrink-0 rounded-full transition ${
showMacros ? 'bg-green-500' : 'bg-gray-300'
showMacros ? 'bg-black' : 'bg-gray-300'
}`}
>
<span
@@ -239,7 +242,7 @@ export default function CatalogTab({
<span className="text-[var(--text)]/70">{t('sectionMacros')}</span>
<span
className={`relative h-5 w-9 shrink-0 rounded-full transition ${
s.showMacros ? 'bg-green-500' : 'bg-gray-300'
s.showMacros ? 'bg-black' : 'bg-gray-300'
}`}
>
<span
@@ -308,7 +311,7 @@ export default function CatalogTab({
<button
onClick={() => addProduct(s.id)}
className="mt-3 w-full rounded-2xl border border-dashed border-[var(--accent)]/40 py-2 text-sm font-medium text-[var(--accent)]"
className="mt-3 w-full rounded-2xl bg-black py-2 text-sm font-medium text-white"
>
+ {t('addDish')}
</button>
@@ -317,7 +320,8 @@ export default function CatalogTab({
<button
onClick={addSection}
className="glass-pill rounded-2xl py-3 text-sm font-medium"
className="rounded-2xl py-3 text-sm font-medium text-white"
style={{ backgroundColor: '#1e3a5f' }}
>
+ {t('newSection')}
</button>
+25 -23
View File
@@ -5,13 +5,13 @@ import { useTranslations } from 'next-intl';
import type { EditorData, EditorSection } from './types';
import LanguageSwitch from '@/components/LanguageSwitch';
import CatalogTab from './CatalogTab';
import PaletteTab from './PaletteTab';
import BrandTab from './BrandTab';
import OrdersTab from './OrdersTab';
import QrTab from './QrTab';
import PublishModal from './PublishModal';
import { ClipboardList, Store, Bell, QrCode, type LucideIcon } from 'lucide-react';
type Tab = 'catalog' | 'palette' | 'brand' | 'orders' | 'qr';
type Tab = 'catalog' | 'brand' | 'orders' | 'qr';
export default function Editor({ data, baseUrl }: { data: EditorData; baseUrl: string }) {
const t = useTranslations('editor');
@@ -23,12 +23,11 @@ export default function Editor({ data, baseUrl }: { data: EditorData; baseUrl: s
const [publishOpen, setPublishOpen] = useState(false);
const [publishedName, setPublishedName] = useState(data.publishedVersionName);
const tabs: { id: Tab; label: string; icon: string }[] = [
{ id: 'catalog', label: t('catalog'), icon: '📋' },
{ id: 'palette', label: t('palette'), icon: '🎨' },
{ id: 'brand', label: t('brand'), icon: '🏷️' },
{ id: 'orders', label: t('orders'), icon: '🔔' },
{ id: 'qr', label: t('qr'), icon: '🔳' },
const tabs: { id: Tab; label: string; Icon: LucideIcon }[] = [
{ id: 'catalog', label: t('catalog'), Icon: ClipboardList },
{ id: 'brand', label: t('brand'), Icon: Store },
{ id: 'orders', label: t('orders'), Icon: Bell },
{ id: 'qr', label: t('qr'), Icon: QrCode },
];
return (
@@ -55,7 +54,6 @@ export default function Editor({ data, baseUrl }: { data: EditorData; baseUrl: s
onRestored={(name) => setPublishedName(name)}
/>
)}
{tab === 'palette' && <PaletteTab slug={data.slug} initialPalette={data.palette} />}
{tab === 'brand' && (
<BrandTab
slug={data.slug}
@@ -83,20 +81,24 @@ export default function Editor({ data, baseUrl }: { data: EditorData; baseUrl: s
/>
)}
{/* Bottom tab bar */}
<nav className="glass safe-pb-tabbar fixed bottom-0 left-1/2 z-30 flex w-full max-w-2xl -translate-x-1/2 items-stretch justify-around rounded-t-3xl px-2 pt-2">
{tabs.map((x) => (
<button
key={x.id}
onClick={() => setTab(x.id)}
className={`flex flex-1 flex-col items-center gap-0.5 rounded-2xl py-2 text-[11px] font-medium transition ${
tab === x.id ? 'bg-white/60 text-[var(--accent)]' : 'text-[var(--text)]/60'
}`}
>
<span className="text-lg">{x.icon}</span>
{x.label}
</button>
))}
{/* Bottom dock navigation */}
<nav className="safe-pb-tabbar fixed bottom-0 left-1/2 z-30 w-full max-w-md -translate-x-1/2 px-3 pb-3">
<div className="dock-bar">
{tabs.map(({ id, label, Icon }) => (
<button
key={id}
onClick={() => setTab(id)}
className={`dock-btn ${tab === id ? 'is-active' : ''}`}
aria-label={label}
>
<span className="dock-tip">{label}</span>
<span className="dock-chip">
<Icon className="h-[26px] w-[26px]" />
</span>
<span className="dock-dot" />
</button>
))}
</div>
</nav>
{publishOpen && (
+20 -7
View File
@@ -40,11 +40,23 @@ export default function EditorLogin({
}
return (
<main className="flex min-h-screen items-center justify-center p-4">
<form onSubmit={submit} className="glass flex w-full max-w-sm flex-col gap-3 rounded-3xl p-6">
<h1 className="display text-2xl font-semibold">{name}</h1>
<p className="text-sm text-[var(--text)]/60">{t('login')}</p>
{!secret && <p className="text-sm text-amber-700">{t('invalidLink')}</p>}
<main className="relative flex min-h-screen items-center justify-center overflow-hidden p-4">
<video
autoPlay
loop
muted
playsInline
src="/videos/panel-restaurante.mp4"
className="absolute inset-0 h-full w-full object-cover"
/>
<div className="absolute inset-0 bg-black/45" />
<form
onSubmit={submit}
className="glass relative z-10 flex w-full max-w-sm flex-col gap-3 rounded-3xl p-6"
>
<h1 className="display text-center text-2xl font-semibold">{name}</h1>
<p className="text-center text-sm text-[var(--text)]/60">{t('login')}</p>
{!secret && <p className="text-center text-sm text-amber-700">{t('invalidLink')}</p>}
<input
value={username}
onChange={(e) => setUsername(e.target.value)}
@@ -59,10 +71,11 @@ export default function EditorLogin({
placeholder={t('password')}
className="glass-soft rounded-2xl px-4 py-3 outline-none"
/>
{error && <p className="text-sm text-red-600">{error}</p>}
{error && <p className="text-center text-sm text-red-600">{error}</p>}
<button
disabled={loading || !secret}
className="rounded-2xl bg-[var(--accent)] py-3 font-medium text-white disabled:opacity-50"
className="rounded-2xl py-3 font-medium text-white disabled:opacity-50"
style={{ backgroundColor: '#dc2626' }}
>
{t('login')}
</button>
+23 -23
View File
@@ -35,14 +35,13 @@ function itemTimer(it: OrderItem, fallbackStart: string, now: number, th: Thresh
const secs = Math.max(0, Math.floor((end - start) / 1000));
const mins = secs / 60;
const label = `${Math.floor(secs / 60)}:${(secs % 60).toString().padStart(2, '0')}`;
const color = it.delivered
? '#6b7280'
: mins < th.green
? '#15803d'
: mins < th.yellow
? '#b45309'
: '#dc2626';
return { label, color };
// Threshold tier reused for both the timer pill color and the pulsing status pill class.
const tier = it.delivered ? 'done' : mins < th.green ? 'green' : mins < th.yellow ? 'yellow' : 'red';
const color =
tier === 'done' ? '#6b7280' : tier === 'green' ? '#28bd1c' : tier === 'yellow' ? '#fce167' : '#ef4444';
const textColor = tier === 'yellow' ? 'rgba(0,0,0,.72)' : '#fff';
const pulseClass = tier === 'green' ? 'pendiente-green' : tier === 'yellow' ? 'pendiente-yellow' : 'pendiente-red';
return { label, color, textColor, pulseClass };
}
// Group a subaccount's items into batches (by batchId), sorted by start time.
@@ -233,21 +232,21 @@ export default function OrdersTab({
</div>
<div className="flex shrink-0 items-center gap-2 text-sm">
<span className="flex items-center gap-1">
<span className="h-3 w-3 rounded-full bg-green-600" />
<span className="h-3 w-3 rounded-full" style={{ backgroundColor: 'rgb(40,189,28)' }} />
<input
type="number" min={1} max={120} value={green}
onChange={(e) => setGreen(Math.max(1, Math.min(120, Number(e.target.value) || 1)))}
onBlur={() => patchSettings({ timerGreenMax: green })}
className="glass-soft w-12 rounded-xl px-1 py-1 text-center outline-none"
className="editable-num w-12 rounded-xl border border-black/10 bg-white/60 px-1 py-1 text-center outline-none focus:border-black/30 focus:bg-white"
/>
</span>
<span className="flex items-center gap-1">
<span className="h-3 w-3 rounded-full bg-amber-500" />
<span className="h-3 w-3 rounded-full" style={{ backgroundColor: 'rgb(252,225,103)' }} />
<input
type="number" min={1} max={240} value={yellow}
onChange={(e) => setYellow(Math.max(1, Math.min(240, Number(e.target.value) || 1)))}
onBlur={() => patchSettings({ timerYellowMax: yellow })}
className="glass-soft w-12 rounded-xl px-1 py-1 text-center outline-none"
className="editable-num w-12 rounded-xl border border-black/10 bg-white/60 px-1 py-1 text-center outline-none focus:border-black/30 focus:bg-white"
/>
</span>
</div>
@@ -263,7 +262,7 @@ export default function OrdersTab({
type="number" min={1} max={720} value={retention}
onChange={(e) => setRetention(Math.max(1, Math.min(720, Number(e.target.value) || 1)))}
onBlur={() => patchSettings({ orderRetentionHours: retention })}
className="glass-soft w-16 rounded-xl px-2 py-1.5 text-center text-sm outline-none"
className="editable-num w-16 rounded-xl border border-black/10 bg-white/60 px-2 py-1.5 text-center text-sm outline-none focus:border-black/30 focus:bg-white"
/>
<span className="text-xs text-[var(--text)]/55">{t('hours')}</span>
</div>
@@ -276,8 +275,8 @@ export default function OrdersTab({
{ordersEnabled && waiterCalls.length > 0 && (
<div className="flex flex-col gap-2">
{waiterCalls.map((c, i) => (
<div key={i} className="animate-spawn flex items-center gap-2 rounded-2xl bg-amber-100/80 px-4 py-2 text-sm text-amber-800">
🔔 <strong>{t('table')} {c.tableNumber}</strong>
<div key={i} className="animate-spawn flex items-center justify-between gap-2 rounded-2xl bg-amber-100/80 px-4 py-2 text-sm text-amber-800">
<span className="font-bold">{t('waiterAlert', { table: c.tableNumber })}</span>
<button onClick={() => setWaiterCalls((prev) => prev.filter((_, idx) => idx !== i))} className="ml-auto">✕</button>
</div>
))}
@@ -338,10 +337,9 @@ function TableCard({
const allPaid = subaccounts.every((o) => o.paid);
return (
<div className="animate-spawn glass relative flex flex-col gap-2 rounded-3xl p-4">
<div className="animate-spawn glass relative flex flex-col gap-2 rounded-3xl border-2 border-[#9ca3af] p-4">
<div className="flex items-center justify-between gap-2">
<span className="display text-lg font-semibold">{t('table')} {table}</span>
<span className="text-sm font-semibold text-[var(--accent)]">${tableTotal.toFixed(2)}</span>
</div>
{subaccounts.map((sub) => (
@@ -366,7 +364,8 @@ function TableCard({
</div>
<button
onClick={() => onCompleteTable(subaccounts.map((s) => s.id))}
className={`rounded-2xl py-2 text-sm font-medium text-white ${allPaid ? 'bg-green-600' : 'bg-[var(--accent)]'}`}
className="liquid-btn rounded-2xl py-2 text-sm font-medium text-white"
style={{ backgroundColor: allPaid ? '#16a34a' : '#dc2626' }}
>
{t('completeTable')}
</button>
@@ -450,18 +449,18 @@ function SubaccountCard({
{it.note && <span className="block text-xs text-[var(--accent)]">↳ {it.note}</span>}
</span>
<span
className="shrink-0 rounded-full px-2 py-0.5 font-mono text-xs font-semibold text-white"
style={{ background: tm.color }}
className="shrink-0 rounded-full px-2 py-0.5 font-mono text-xs font-semibold"
style={{ background: tm.color, color: tm.textColor }}
>
{tm.label}
</span>
<button
onClick={() => it.id && onDeliver(sub.id, it.id, !it.delivered)}
className={`shrink-0 rounded-full px-2 py-1 text-[10px] font-medium ${
it.delivered ? 'bg-gray-200 text-gray-600' : 'bg-green-600 text-white'
it.delivered ? 'bg-gray-200 text-gray-600' : tm.pulseClass
}`}
>
{it.delivered ? t('markUndelivered') : t('markDelivered')}
{it.delivered ? t('markDelivered') : t('pending')}
</button>
</li>
);
@@ -561,7 +560,8 @@ function ItemsEditPanel({
<button
onClick={async () => { if (!items.length || saving) return; setSaving(true); try { await onSave(items); } finally { setSaving(false); } }}
disabled={saving || items.length === 0}
className="flex-1 rounded-2xl bg-[var(--accent)] py-2 text-sm font-medium text-white disabled:opacity-50"
className="liquid-btn flex-1 rounded-2xl py-2 text-sm font-medium text-white disabled:opacity-50"
style={{ backgroundColor: '#dc2626' }}
>
{tc('save')}
</button>
-114
View File
@@ -1,114 +0,0 @@
'use client';
import { useState } from 'react';
import { useTranslations } from 'next-intl';
import type { Palette } from '@/lib/types';
import { PALETTE_PRESETS } from '@/lib/palette';
import { api } from './api';
const FIELDS: { key: keyof Palette; label: string }[] = [
{ key: 'background', label: 'Fondo' },
{ key: 'accent', label: 'Acento' },
{ key: 'text', label: 'Texto' },
];
export default function PaletteTab({
slug,
initialPalette,
}: {
slug: string;
initialPalette: Palette;
}) {
const t = useTranslations('editor');
const tc = useTranslations('common');
const [palette, setPalette] = useState<Palette>({
...PALETTE_PRESETS[0].palette,
...initialPalette,
});
const [saving, setSaving] = useState(false);
const [saved, setSaved] = useState(false);
function update(next: Palette) {
setPalette(next);
setSaved(false);
}
async function save() {
setSaving(true);
try {
await api(slug, '/palette', { method: 'PATCH', json: { palette } });
setSaved(true);
} finally {
setSaving(false);
}
}
return (
<div className="flex flex-col gap-4">
{/* Live preview */}
<div
className="rounded-3xl p-5"
style={{ background: palette.background }}
>
<div
className="rounded-2xl border border-white/60 p-4"
style={{ background: palette.surface, backdropFilter: 'blur(12px)' }}
>
<h3 className="display text-lg font-semibold" style={{ color: palette.text }}>
Vista previa
</h3>
<button
className="mt-2 rounded-full px-4 py-2 text-sm text-white"
style={{ background: palette.accent }}
>
Acento
</button>
</div>
</div>
{/* Presets */}
<div className="flex flex-wrap gap-2">
{PALETTE_PRESETS.map((p) => (
<button
key={p.id}
onClick={() => update({ ...p.palette })}
className="glass-soft flex items-center gap-2 rounded-full px-3 py-2 text-sm"
>
<span
className="h-4 w-4 rounded-full border border-white/60"
style={{ background: p.palette.accent }}
/>
{p.label}
</button>
))}
</div>
{/* Custom colors */}
<div className="glass rounded-3xl p-4">
<div className="flex flex-col gap-3">
{FIELDS.map((f) => (
<label key={f.key} className="flex items-center justify-between text-sm">
{f.label}
<input
type="color"
value={palette[f.key] ?? '#ffffff'}
onChange={(e) => update({ ...palette, [f.key]: e.target.value })}
className="h-9 w-16 rounded-lg border-0 bg-transparent"
/>
</label>
))}
</div>
</div>
<p className="text-xs text-[var(--text)]/55">⚠️ {t('paletteHint')}</p>
<button
onClick={save}
disabled={saving}
className="rounded-2xl bg-[var(--accent)] py-3 font-medium text-white disabled:opacity-50"
>
{saved ? '✓ ' : ''}{tc('save')}
</button>
</div>
);
}
+46 -34
View File
@@ -3,7 +3,7 @@
import { useState } from 'react';
import { useTranslations } from 'next-intl';
import type { EditorProduct, EditorSection } from './types';
import { MACRO_KEYS } from '@/lib/macros';
import { MACRO_KEYS, MACRO_COLORS } from '@/lib/macros';
import { api } from './api';
const ALLERGENS = ['gluten', 'lácteos', 'frutos secos', 'mariscos', 'huevo', 'soya', 'pescado'];
@@ -26,6 +26,7 @@ export default function ProductEditor({
}) {
const t = useTranslations('editor');
const tm = useTranslations('macros');
const tc = useTranslations('common');
const [draft, setDraft] = useState<EditorProduct>(product);
const [saving, setSaving] = useState(false);
const [translating, setTranslating] = useState<string | null>(null);
@@ -125,10 +126,14 @@ export default function ProductEditor({
return (
<div className="fixed inset-0 z-50 flex items-end justify-center bg-black/40 p-2 backdrop-blur-sm sm:items-center">
<div className="glass flex max-h-[92vh] w-full max-w-lg flex-col gap-4 overflow-y-auto rounded-3xl p-4">
<div className="glass safe-modal flex max-h-[92vh] w-full max-w-lg flex-col gap-6 overflow-y-auto rounded-3xl p-5">
<div className="flex items-center justify-between">
<h3 className="display text-lg font-semibold">{t('edit')}</h3>
<button onClick={onClose} className="glass-pill rounded-full px-3 py-1">
<h3 className="display text-xl font-semibold">{t('edit')}</h3>
<button
onClick={onClose}
aria-label={tc('close')}
className="liquid-btn flex h-9 w-9 items-center justify-center rounded-full text-base"
>
✕
</button>
</div>
@@ -141,19 +146,17 @@ export default function ProductEditor({
value={draft.name.es ?? ''}
onChange={(v) => set('name', { ...draft.name, es: v })}
/>
<div className="flex items-center gap-2">
<LocaleInput
prefix="EN"
value={draft.name.en ?? ''}
onChange={(v) =>
setDraft((d) => ({
...d,
name: { ...d.name, en: v },
translationStatus: { ...d.translationStatus, en: 'reviewed' },
}))
}
/>
</div>
<LocaleInput
prefix="EN"
value={draft.name.en ?? ''}
onChange={(v) =>
setDraft((d) => ({
...d,
name: { ...d.name, en: v },
translationStatus: { ...d.translationStatus, en: 'reviewed' },
}))
}
/>
<TranslateRow
loading={translating === 'name'}
status={enStatus}
@@ -202,14 +205,14 @@ export default function ProductEditor({
min={0}
value={draft.price}
onChange={(e) => set('price', Number(e.target.value))}
className="glass-soft w-full rounded-2xl px-3 py-2 outline-none"
className="glass-soft w-full rounded-2xl px-3 py-2 text-sm outline-none"
/>
</Field>
<Field label={t('section')} className="flex-1">
<select
value={draft.sectionId}
onChange={(e) => set('sectionId', e.target.value)}
className="glass-soft w-full rounded-2xl px-3 py-2 outline-none"
className="glass-soft w-full rounded-2xl px-3 py-2 text-sm outline-none"
>
{sections.map((s) => (
<option key={s.id} value={s.id}>
@@ -248,7 +251,10 @@ export default function ProductEditor({
</div>
</div>
))}
<label className="flex h-20 w-20 cursor-pointer items-center justify-center rounded-xl border border-dashed border-[var(--accent)]/40 text-2xl text-[var(--accent)]">
<label
title={t('uploadMedia')}
className="flex h-20 w-20 cursor-pointer items-center justify-center rounded-xl border-2 border-dashed border-[var(--text)]/30 text-2xl text-[var(--text)]/50 transition hover:border-[var(--text)]/50 hover:text-[var(--text)]/70"
>
{uploading ? '…' : '+'}
<input
type="file"
@@ -262,12 +268,14 @@ export default function ProductEditor({
</Field>
{/* Macros */}
<Field label="Macros">
<Field label={tm('title')}>
{draft.aiEstimated.macros && <EstimatedBadge />}
<div className="grid grid-cols-3 gap-2">
<div className="grid grid-cols-3 gap-x-3 gap-y-2.5">
{MACRO_KEYS.map((key) => (
<label key={key} className="flex flex-col gap-1 text-xs">
{tm(key)}
<span className="font-medium" style={{ color: MACRO_COLORS[key] }}>
{tm(key)}
</span>
<input
type="number"
min={0}
@@ -283,7 +291,7 @@ export default function ProductEditor({
aiEstimated: { ...d.aiEstimated, macros: false },
}))
}
className="glass-soft rounded-xl px-2 py-1.5 outline-none"
className="glass-soft rounded-xl px-2 py-1.5 text-sm outline-none"
/>
</label>
))}
@@ -315,17 +323,20 @@ export default function ProductEditor({
/>
</Field>
<div className="flex gap-2 pt-1">
{/* Actions */}
<div className="mt-1 flex gap-3 border-t border-white/30 pt-5">
<button
onClick={() => onDelete(draft)}
className="rounded-2xl bg-red-100 px-4 py-3 text-sm font-medium text-red-700"
className="rounded-2xl px-5 py-3 text-sm font-medium"
style={{ backgroundColor: '#c8cbd8', color: '#000' }}
>
{t('delete')}
</button>
<button
onClick={save}
disabled={saving}
className="flex-1 rounded-2xl bg-[var(--accent)] py-3 font-medium text-white disabled:opacity-50"
className="flex-1 rounded-2xl py-3 text-sm font-semibold text-white shadow-lg transition active:scale-[0.99] disabled:opacity-50"
style={{ backgroundColor: '#111' }}
>
{t('save')}
</button>
@@ -354,8 +365,8 @@ function Field({
className?: string;
}) {
return (
<div className={`flex flex-col gap-1.5 ${className}`}>
<span className="text-xs font-medium text-[var(--text)]/60">{label}</span>
<div className={`flex flex-col gap-2 ${className}`}>
<span className="text-sm font-medium text-[var(--text)]/70">{label}</span>
{children}
</div>
);
@@ -372,7 +383,7 @@ function LocaleInput({
}) {
return (
<div className="glass-soft flex items-center gap-2 rounded-2xl px-3">
<span className="text-[10px] font-bold text-[var(--text)]/40">{prefix}</span>
<span className="text-xs font-bold text-[var(--text)]/50">{prefix}</span>
<input
value={value}
onChange={(e) => onChange(e.target.value)}
@@ -397,7 +408,8 @@ function TranslateRow({
<button
onClick={onClick}
disabled={loading}
className="glass-pill rounded-full px-3 py-1 text-xs font-medium disabled:opacity-50"
className="flex items-center gap-2 whitespace-nowrap rounded-full px-3 py-2 text-xs font-semibold disabled:opacity-50"
style={{ backgroundColor: '#e2db8d', color: '#000' }}
>
{loading ? '…' : `✨ ${t('translateAi')}`}
</button>
@@ -429,10 +441,10 @@ function Chips({
<button
key={o}
onClick={() => onToggle(o)}
className={`rounded-full px-3 py-1 text-xs transition ${
className={`rounded-lg px-3 py-1 text-xs transition ${
selected.includes(o)
? 'bg-[var(--accent)] text-white'
: 'glass-soft text-[var(--text)]/70'
? 'bg-neutral-900 text-white'
: 'glass-soft text-[var(--text)]/70 hover:text-[var(--text)]'
}`}
>
{o}
+1 -16
View File
@@ -16,7 +16,6 @@ export default function PublishModal({
const t = useTranslations('editor');
const tc = useTranslations('common');
const [name, setName] = useState('');
const [suggestions, setSuggestions] = useState(false);
const [publishing, setPublishing] = useState(false);
const [success, setSuccess] = useState<string | null>(null);
@@ -26,7 +25,7 @@ export default function PublishModal({
try {
const res = await api<{ versionName: string }>(slug, '/publish', {
method: 'POST',
json: { versionName: name.trim(), generateSuggestions: suggestions },
json: { versionName: name.trim() },
});
setSuccess(res.versionName);
onPublished(res.versionName);
@@ -62,20 +61,6 @@ export default function PublishModal({
className="glass-soft rounded-2xl px-4 py-3 outline-none"
/>
</label>
<label className="glass-soft flex items-start gap-2 rounded-2xl px-3 py-2.5 text-sm">
<input
type="checkbox"
checked={suggestions}
onChange={(e) => setSuggestions(e.target.checked)}
className="mt-0.5"
/>
<span>
<span className="font-medium">✨ {t('generateSuggestions')}</span>
<span className="block text-xs text-[var(--text)]/55">
{t('generateSuggestionsHint')}
</span>
</span>
</label>
<div className="flex gap-2">
<button onClick={onClose} className="glass-pill flex-1 rounded-2xl py-3 text-sm">
{tc('cancel')}
+1 -1
View File
@@ -31,7 +31,7 @@ export default function SectionTitleEditor({
value={value}
onChange={(e) => setValue(e.target.value)}
onBlur={commit}
className="display flex-1 bg-transparent text-lg font-semibold outline-none"
className="display flex-1 bg-transparent text-base font-semibold outline-none"
/>
);
}
+12 -10
View File
@@ -61,10 +61,10 @@ export default function VersionHistory({
{versions.map((v) => (
<div key={v.id} className="glass-soft flex items-center gap-2 rounded-2xl px-3 py-2">
<div className="min-w-0 flex-1">
<div className="truncate text-sm font-medium">
{v.versionName}
<div className="flex min-w-0 items-center gap-2">
<span className="truncate text-sm font-medium">{v.versionName}</span>
{v.id === publishedId && (
<span className="ml-2 rounded-full bg-green-100 px-2 py-0.5 text-[10px] text-green-700">
<span className="shrink-0 rounded-full bg-green-100 px-2 py-0.5 text-[10px] text-green-700">
{t('publishedVersion')}
</span>
)}
@@ -79,13 +79,15 @@ export default function VersionHistory({
})}
</div>
</div>
<button
onClick={() => restore(v)}
disabled={restoring === v.id}
className="glass-pill rounded-full px-3 py-1 text-xs font-medium disabled:opacity-50"
>
{tc('restore')}
</button>
{v.id !== publishedId && (
<button
onClick={() => restore(v)}
disabled={restoring === v.id}
className="glass-pill shrink-0 rounded-full px-3 py-1 text-xs font-medium disabled:opacity-50"
>
{tc('restore')}
</button>
)}
</div>
))}
</div>
+59 -17
View File
@@ -1,9 +1,10 @@
'use client';
import { useState } from 'react';
import { useMemo, useState } from 'react';
import { useLocale, useTranslations } from 'next-intl';
import type { SnapshotProduct } from '@/lib/types';
import SuggestionCarousel from './SuggestionCarousel';
import MediaThumb from './MediaThumb';
type Recommendation = { dish: string; reason: string; type?: 'direct' | 'complement' };
@@ -13,27 +14,40 @@ export default function AiConsultant({
ordersEnabled,
onAdd,
resolveDish,
suggestions,
buildSuggestions,
}: {
slug: string;
onClose: () => void;
ordersEnabled: boolean;
onAdd: (p: SnapshotProduct) => void;
resolveDish: (name: string) => SnapshotProduct | undefined;
suggestions: SnapshotProduct[];
buildSuggestions: (seed: number, excludeIds?: string[]) => SnapshotProduct[];
}) {
const t = useTranslations('ai');
const tm = useTranslations('menu');
const locale = useLocale();
const [question, setQuestion] = useState('');
const [asked, setAsked] = useState(''); // the submitted question, shown above the answer
const [loading, setLoading] = useState(false);
const [answer, setAnswer] = useState<{ intro?: string; recommendations: Recommendation[] } | null>(
null,
);
const [error, setError] = useState(false);
// New random sample per consultant open; excludes the dishes already shown above
// (the answer's own recommendations) so the carousel never duplicates them.
const [seed] = useState(() => Date.now());
const suggestions = useMemo(() => {
const shown = (answer?.recommendations ?? [])
.map((r) => resolveDish(r.dish)?.id)
.filter((id): id is string => !!id);
return buildSuggestions(seed, shown);
}, [buildSuggestions, seed, answer, resolveDish]);
async function ask() {
if (!question.trim() || loading) return;
const q = question.trim();
if (!q || loading) return;
setAsked(q); // show it above the answer (chat-style)
setQuestion(''); // clear the input automatically
setLoading(true);
setError(false);
setAnswer(null);
@@ -41,7 +55,7 @@ export default function AiConsultant({
const res = await fetch(`/api/${slug}/ai-consult`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ question, locale }),
body: JSON.stringify({ question: q, locale }),
});
if (!res.ok) throw new Error('failed');
setAnswer(await res.json());
@@ -54,16 +68,25 @@ export default function AiConsultant({
function Card(r: Recommendation, key: number) {
const product = resolveDish(r.dish);
const cover = product ? [...product.media].sort((a, b) => a.order - b.order)[0] : undefined;
return (
<div key={key} className="glass-soft flex items-start gap-2 rounded-2xl p-3">
<div key={key} className="glass-soft flex items-start gap-3 rounded-2xl p-4">
{product && (
<MediaThumb
media={cover}
alt={r.dish}
className="h-14 w-14 shrink-0 rounded-xl"
/>
)}
<div className="min-w-0 flex-1">
<div className="font-semibold text-[var(--accent)]">{r.dish}</div>
<div className="font-semibold text-[var(--text)]">{r.dish}</div>
<p className="text-sm text-[var(--text)]/80">{r.reason}</p>
</div>
{ordersEnabled && product && (
<button
onClick={() => onAdd(product)}
className="shrink-0 rounded-full bg-[var(--accent)] px-3 py-1.5 text-xs font-medium text-white"
style={{ backgroundColor: 'var(--accent)' }}
className="shrink-0 rounded-full px-3 py-1.5 text-xs font-medium text-white"
>
{tm('addToOrder')}
</button>
@@ -74,21 +97,39 @@ export default function AiConsultant({
return (
<div className="safe-modal fixed inset-0 z-50 flex items-end justify-center bg-black/40 px-3 backdrop-blur-sm sm:items-center">
<div className="glass flex max-h-[85vh] w-full max-w-md flex-col gap-3 rounded-3xl p-4">
<div
className="glass flex max-h-[85vh] w-full max-w-md flex-col gap-5 rounded-3xl p-5"
style={{ backgroundColor: 'rgba(255,255,255,0.886)' }}
>
<div className="flex items-center justify-between">
<h3 className="display text-lg font-semibold">{t('title')}</h3>
<h3 className="display text-lg font-semibold uppercase">{t('title')}</h3>
<button onClick={onClose} className="glass-pill rounded-full px-3 py-1">
✕
</button>
</div>
<div className="min-h-[6rem] flex-1 overflow-y-auto">
{!answer && !loading && <p className="text-sm text-[var(--text)]/60">{t('intro')}</p>}
<div className="flex min-h-[6rem] flex-1 flex-col gap-3 overflow-y-auto no-scrollbar">
{!asked && !loading && <p className="text-sm text-[var(--text)]/60">{t('intro')}</p>}
{asked && (
<div
className="max-w-[85%] self-end rounded-2xl px-4 py-2 text-sm text-white"
style={{ backgroundColor: '#1e3a5f' }}
>
{asked}
</div>
)}
{loading && <p className="animate-pulse text-sm text-[var(--text)]/60">{t('thinking')}</p>}
{error && <p className="text-sm text-red-600">⚠️</p>}
{answer && (
<div className="flex flex-col gap-2">
{answer.intro && <p className="text-sm text-[var(--text)]/80">{answer.intro}</p>}
<div className="flex flex-col gap-3">
{answer.intro && (
<div
className="rounded-2xl p-4 shadow-sm"
style={{ backgroundColor: '#bad1bc', color: '#000' }}
>
<p className="text-sm">{answer.intro}</p>
</div>
)}
{(() => {
const direct = answer.recommendations.filter((r) => r.type !== 'complement');
const complement = answer.recommendations.filter((r) => r.type === 'complement');
@@ -97,7 +138,7 @@ export default function AiConsultant({
{direct.map((r, i) => Card(r, i))}
{complement.length > 0 && (
<>
<p className="mt-1 text-xs font-semibold uppercase tracking-wide text-[var(--text)]/50">
<p className="mt-2 text-xs font-semibold uppercase tracking-wide text-[var(--text)]/50">
{t('pairWith')}
</p>
{complement.map((r, i) => Card(r, direct.length + i))}
@@ -111,7 +152,7 @@ export default function AiConsultant({
{/* Precomputed pairings carousel (reuses the cart component) */}
{ordersEnabled && suggestions.length > 0 && (
<div className="mt-4">
<div className="mt-6">
<SuggestionCarousel products={suggestions} onAdd={onAdd} />
</div>
)}
@@ -128,7 +169,8 @@ export default function AiConsultant({
<button
onClick={ask}
disabled={loading}
className="rounded-full bg-[var(--accent)] px-4 py-2 text-sm font-medium text-white disabled:opacity-50"
style={{ backgroundColor: 'var(--accent)' }}
className="rounded-full px-4 py-2 text-sm font-medium text-white disabled:opacity-50"
>
→
</button>
+9 -7
View File
@@ -48,7 +48,7 @@ export default function BrandHeader({
const hasLogo = !!logo;
const socialRow = links.length > 0 && (
<div className="flex flex-wrap items-center justify-center gap-2">
<div className="flex flex-wrap items-center gap-2">
{links.map((l, i) => {
const Icon = iconFor(l.platform);
return (
@@ -84,7 +84,7 @@ export default function BrandHeader({
<header className="mb-4">
{/* Banner — full-bleed, extends edge-to-edge behind the island. A short
palette gradient stands in when there's a logo but no banner image. */}
<div className="relative -mx-4 h-36 overflow-hidden">
<div className="relative -mx-4 h-52 overflow-hidden">
{hasBanner ? (
// eslint-disable-next-line @next/next/no-img-element
<img src={banner!} alt="" className="h-full w-full object-cover" />
@@ -100,9 +100,9 @@ export default function BrandHeader({
</div>
</div>
{/* Logo + name + socials, the avatar centered over the banner's lower edge. */}
<div className="relative z-10 -mt-12 flex flex-col items-center gap-2 px-2 text-center">
<div className="h-24 w-24 overflow-hidden rounded-full border-4 border-white/70 bg-white/50 shadow-lg">
{/* Logo (left) + name + socials, below the banner. */}
<div className="relative z-10 flex items-start gap-3 px-2 pt-5">
<div className="h-24 w-24 shrink-0 overflow-hidden rounded-full border-4 border-white/70 bg-white/50 shadow-lg">
{hasLogo ? (
// eslint-disable-next-line @next/next/no-img-element
<img src={logo!} alt={name} className="h-full w-full object-cover" />
@@ -112,8 +112,10 @@ export default function BrandHeader({
</div>
)}
</div>
<h1 className="display text-2xl font-semibold leading-tight">{name}</h1>
{socialRow}
<div className="flex min-w-0 flex-1 flex-col gap-4 pt-1">
<h1 className="display text-2xl font-semibold leading-tight">{name}</h1>
{socialRow}
</div>
</div>
</header>
);
+54 -50
View File
@@ -32,69 +32,68 @@ export default function DishCard({
const sortedMedia = [...product.media].sort((a, b) => a.order - b.order);
const cover = sortedMedia[0];
const hasVideo = sortedMedia.some((m) => m.type === 'video');
const canAdd = ordersEnabled && !!onAdd;
return (
<div
className="flip-scene animate-fade-up"
style={{ animationDelay: `${Math.min(index * 70, 500)}ms` }}
>
<div className={`flip-card min-h-[20rem] ${flipped ? 'is-flipped' : ''}`}>
<div className={`flip-card min-h-[24rem] ${flipped ? 'is-flipped' : ''}`}>
{/* FRONT */}
<div className="flip-face flip-front glass overflow-hidden rounded-3xl">
<button
className="relative block h-40 w-full"
onClick={() => onOpenGallery(product)}
aria-label={name}
>
<MediaThumb media={cover} alt={name} className="h-40 w-full" />
{hasVideo && (
<span className="absolute right-3 top-3 h-3 w-3 animate-pulse-dot rounded-full bg-red-500 shadow" />
)}
</button>
<div className="flex flex-col gap-2 p-4">
<div className="flex items-start justify-between gap-2">
<h3 className="display text-lg font-semibold leading-tight">{name}</h3>
<span className="shrink-0 text-base font-bold text-[var(--accent)]">
<div
className="flip-face flip-front overflow-hidden rounded-3xl bg-white"
style={{
boxShadow:
'0 22px 40px -12px rgba(40,30,20,.35), 0 8px 16px -8px rgba(40,30,20,.25)',
}}
>
<div className="p-3 pb-0">
<button
className="relative block w-full"
onClick={() => onOpenGallery(product)}
aria-label={name}
>
<MediaThumb media={cover} alt={name} className="h-44 w-full rounded-2xl" />
{hasVideo && (
<span className="absolute right-3 top-3 h-3 w-3 animate-pulse-dot rounded-full bg-red-500 shadow" />
)}
</button>
</div>
<div className="flex flex-col items-center gap-3 px-4 pb-4 pt-4 text-center">
<div className="flex items-center justify-center gap-2">
<h3 className="display text-[20px] font-bold leading-tight">{name}</h3>
<span
className="w-px shrink-0 self-stretch"
style={{ background: 'rgba(42,37,32,.18)' }}
aria-hidden
/>
<span className="shrink-0 self-center text-[20px] font-bold text-black">
${product.price.toFixed(2)}
</span>
</div>
{description && (
<p className="line-clamp-2 text-sm text-[var(--text)]/70">{description}</p>
<p className="whitespace-pre-line text-sm text-[var(--text)]/70">{description}</p>
)}
<div className="flex flex-wrap gap-1.5">
{product.dietTags.map((tag) => (
<span key={tag} className="glass-soft rounded-full px-2 py-0.5 text-[11px]">
{tag}
</span>
))}
{product.allergens.map((a) => (
<span
key={a}
className="rounded-full bg-amber-100/60 px-2 py-0.5 text-[11px] text-amber-800"
>
{a}
</span>
))}
</div>
{(showMacros || (ordersEnabled && onAdd)) && (
<div className="mt-1 flex items-center gap-2">
{(showMacros || canAdd) && (
<div className="mt-1 flex w-full items-stretch gap-3">
{showMacros && (
<button
onClick={() => setFlipped(true)}
className="glass-pill flex-1 rounded-full py-2 text-sm font-medium"
className="flex-1 rounded-2xl px-3 py-2 text-sm font-semibold"
style={{ background: '#f1d6ad', color: '#3a2f1f' }}
>
{t('tapToFlip')}
{t('nutrition')}
</button>
)}
{ordersEnabled && onAdd && (
{canAdd && (
<button
onClick={() => onAdd(product)}
onClick={() => onAdd!(product)}
aria-label={t('addToOrder')}
className={`rounded-full bg-[var(--accent)] px-4 py-2 text-sm font-medium text-white ${
showMacros ? '' : 'flex-1'
}`}
className="flex-1 rounded-2xl px-3 py-2 text-sm font-semibold leading-tight text-white"
style={{ background: '#dc2626' }}
>
{showMacros ? '+' : t('addToOrder')}
{t('addToOrderLong')}
</button>
)}
</div>
@@ -103,17 +102,22 @@ export default function DishCard({
</div>
{/* BACK */}
<div className="flip-face flip-back glass flex flex-col gap-3 rounded-3xl p-4">
<div className="flex items-center justify-between">
<div
className="flip-face flip-back flex flex-col gap-3 rounded-3xl p-4"
style={{ background: '#efece6' }}
>
<div className="flex items-center justify-center">
<h3 className="display text-base font-semibold">{name}</h3>
<button
onClick={() => setFlipped(false)}
className="glass-pill rounded-full px-3 py-1 text-sm"
>
✕
</button>
</div>
<MacrosBack macros={product.macros} />
<div className="flex flex-1 items-center justify-center">
<button
onClick={() => setFlipped(false)}
className="glass-pill rounded-full px-5 py-2 text-sm uppercase tracking-wide"
>
{t('flipBack')}
</button>
</div>
</div>
</div>
</div>
-39
View File
@@ -1,39 +0,0 @@
'use client';
import { useState } from 'react';
import { useTranslations } from 'next-intl';
import { MACRO_COLORS, MACRO_KEYS } from '@/lib/macros';
// Collapsible accessible legend for the universal macro color code.
export default function MacroLegend() {
const t = useTranslations('macros');
const tm = useTranslations('menu');
const [open, setOpen] = useState(false);
return (
<div className="glass rounded-2xl px-4 py-3">
<button
onClick={() => setOpen((o) => !o)}
className="flex w-full items-center justify-between text-sm font-medium"
aria-expanded={open}
>
<span>{tm('macroLegend')}</span>
<span className={`transition-transform ${open ? 'rotate-180' : ''}`}>⌄</span>
</button>
{open && (
<ul className="mt-3 grid grid-cols-2 gap-2">
{MACRO_KEYS.map((key) => (
<li key={key} className="flex items-center gap-2 text-sm">
<span
className="h-3 w-3 rounded-full"
style={{ background: MACRO_COLORS[key] }}
aria-hidden
/>
<span className="text-[var(--text)]/80">{t(key)}</span>
</li>
))}
</ul>
)}
</div>
);
}
+19 -12
View File
@@ -11,19 +11,26 @@ export default function MacrosBack({ macros }: { macros: Macros }) {
{MACRO_KEYS.map((key) => {
const value = macros[key];
return (
<div key={key} className="glass-soft flex items-center gap-2 rounded-xl px-3 py-2">
<span
className="h-3 w-3 shrink-0 rounded-full"
style={{ background: MACRO_COLORS[key] }}
aria-hidden
/>
<div className="min-w-0">
<div className="text-[11px] leading-tight text-[var(--text)]/60">{t(key)}</div>
<div className="text-sm font-semibold" style={{ color: MACRO_COLORS[key] }}>
{value != null ? `${value}${MACRO_UNIT[key] === 'g' ? ' g' : ''}` : '—'}
{key === 'kcal' && value != null ? ' kcal' : ''}
</div>
<div
key={key}
className="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5"
style={{ ['--c' as string]: MACRO_COLORS[key] } as React.CSSProperties}
>
<div
className="text-[13px] font-semibold leading-tight"
style={{ color: MACRO_COLORS[key] }}
>
{t(key)}
</div>
{value != null ? (
<div className="macro-num whitespace-nowrap text-xl font-bold">
{`${value} ${MACRO_UNIT[key]}`}
</div>
) : (
<div className="whitespace-nowrap text-xl font-bold" style={{ color: MACRO_COLORS[key] }}>
—
</div>
)}
</div>
);
})}
+15 -2
View File
@@ -1,5 +1,6 @@
'use client';
import { useState } from 'react';
import type { MediaItem } from '@/lib/types';
// Renders the first media item as a thumbnail (image or muted video poster).
@@ -12,7 +13,10 @@ export default function MediaThumb({
alt: string;
className?: string;
}) {
if (!media) {
const [broken, setBroken] = useState(false);
// Fallback icon when there's no media OR the file 404s / fails to load.
if (!media || broken) {
return (
<div
className={`flex items-center justify-center bg-gradient-to-br from-white/40 to-white/10 text-3xl ${className}`}
@@ -32,9 +36,18 @@ export default function MediaThumb({
loop
playsInline
preload="metadata"
onError={() => setBroken(true)}
/>
);
}
// eslint-disable-next-line @next/next/no-img-element
return <img src={media.path} alt={alt} className={`object-cover ${className}`} loading="lazy" />;
return (
<img
src={media.path}
alt={alt}
className={`object-cover ${className}`}
loading="lazy"
onError={() => setBroken(true)}
/>
);
}
+282 -150
View File
@@ -1,6 +1,6 @@
'use client';
import { useEffect, useMemo, useRef, useState } from 'react';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { useLocale, useTranslations } from 'next-intl';
import type { Locale } from '@/i18n/config';
import type { MenuSnapshot, SnapshotProduct } from '@/lib/types';
@@ -8,11 +8,13 @@ import { pickText } from '@/lib/text';
import BrandHeader from './BrandHeader';
import DishCard from './DishCard';
import ListRow from './ListRow';
import MacroLegend from './MacroLegend';
import Gallery from './Gallery';
import MediaThumb from './MediaThumb';
import AiConsultant from './AiConsultant';
import SuggestionCarousel from './SuggestionCarousel';
import SplitPanel, { type SplitSession } from './SplitPanel';
import { getRecommendations } from '@/lib/recommendations';
import { LayoutGrid, List as ListIcon } from 'lucide-react';
type ViewMode = 'cards' | 'list';
@@ -47,7 +49,6 @@ export default function PublicMenu({ menu, slug }: { menu: MenuSnapshot; slug: s
null,
);
const [aiOpen, setAiOpen] = useState(false);
const [actionsOpen, setActionsOpen] = useState(false);
const [cart, setCart] = useState<CartLine[]>([]);
const [orderOpen, setOrderOpen] = useState(false);
const [waiterOpen, setWaiterOpen] = useState(false);
@@ -58,6 +59,27 @@ export default function PublicMenu({ menu, slug }: { menu: MenuSnapshot; slug: s
// View preference is intentionally not persisted — always starts on cards.
const [view, setView] = useState<ViewMode>('cards');
const sectionRefs = useRef<Record<string, HTMLElement | null>>({});
const navRef = useRef<HTMLElement | null>(null);
const [stuck, setStuck] = useState(false);
// Scroll-spy: highlight the section in view and switch the category bar to its
// compact "stuck" state (business name + underlined tabs) once it pins to the top.
useEffect(() => {
function onScroll() {
const nav = navRef.current;
if (nav) setStuck(nav.getBoundingClientRect().top <= 12);
const line = 140;
let current = sections[0]?.id ?? '';
for (const s of sections) {
const el = sectionRefs.current[s.id];
if (el && el.getBoundingClientRect().top <= line) current = s.id;
}
if (current) setActiveSection(current);
}
window.addEventListener('scroll', onScroll, { passive: true });
onScroll();
return () => window.removeEventListener('scroll', onScroll);
}, [sections]);
// Flat index of active products for pairing lookups (by id) and consultant
// add-to-cart resolution (by normalized name in either locale).
@@ -75,15 +97,12 @@ export default function PublicMenu({ menu, slug }: { menu: MenuSnapshot; slug: s
}
return map;
}, [sections]);
const pairings = menu.restaurant.pairings ?? {};
const ordersEnabled = menu.restaurant.ordersEnabled;
const splitEnabled = ordersEnabled && !!menu.restaurant.splitEnabled;
// Macros hierarchy: global flag AND the section's own flag. The legend appears
// only if at least one visible section actually shows macros.
// Macros hierarchy: shown only if the global flag AND the section's flag are on.
const globalMacros = menu.restaurant.showMacros;
const sectionShowsMacros = (s: { showMacros?: boolean }) => globalMacros && s.showMacros !== false;
const anyMacros = globalMacros && sections.some((s) => s.showMacros !== false);
function scrollToSection(id: string) {
setActiveSection(id);
@@ -106,23 +125,87 @@ export default function PublicMenu({ menu, slug }: { menu: MenuSnapshot; slug: s
const cartCount = cart.reduce((n, l) => n + l.qty, 0);
// Contextual pairings for what's in the cart (excluding items already added).
// Shared by the cart sheet and the consultant carousel — computed once here.
const cartSuggestions = useMemo(() => {
const inCart = new Set(cart.map((l) => l.product.id));
const ids = new Set<string>();
for (const line of cart) {
for (const id of pairings[line.product.id] ?? []) {
if (!inCart.has(id)) ids.add(id);
}
}
return Array.from(ids)
.map((id) => productIndex.get(id))
.filter((p): p is SnapshotProduct => !!p && p.isActive);
}, [cart, pairings, productIndex]);
// Suggestions are computed locally (no API/tokens) from the menu + cart, as a
// RANDOM sample re-seeded per carousel open. Consumers pass their own seed (so
// reopening reshuffles) and extra excludeIds (e.g. the consultant's own picks).
const buildSuggestions = useCallback(
(seed: number, excludeIds: string[] = []) =>
getRecommendations(menu, cart.map((l) => l.product.id), { limit: 6, seed, excludeIds }),
[menu, cart],
);
const resolveDish = (dishName: string) => nameIndex.get(normName(dishName));
function cartPayload(lines: CartLine[]) {
return lines.map((l) => ({
productId: l.product.id,
name: pickText(l.product.name, locale),
qty: l.qty,
note: l.note,
price: l.product.price,
}));
}
function mergeLines(a: CartLine[], b: CartLine[]): CartLine[] {
const map = new Map<string, CartLine>();
for (const l of [...a, ...b]) {
const k = `${l.product.id}|${l.note ?? ''}`;
const ex = map.get(k);
if (ex) ex.qty += l.qty;
else map.set(k, { ...l });
}
return [...map.values()];
}
// #9 — returning diner picks an existing subaccount: load it, merge the new
// items, and sync (reconcile turns the new items into a fresh batch).
async function joinExistingSubaccount(saId: string, saName: string | null, table: number) {
try {
const mine = await fetch(`/api/${slug}/split/mine?id=${saId}`).then((r) => r.json());
const existing: CartLine[] = (mine.items ?? [])
.map((i: { productId: string; qty: number; note?: string }) => {
const product = productIndex.get(i.productId);
return product ? { product, qty: i.qty, note: i.note } : null;
})
.filter(Boolean) as CartLine[];
const merged = mergeLines(existing, cart);
setCart(merged);
await fetch(`/api/${slug}/split/sync`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ id: saId, items: cartPayload(merged) }),
});
setSplitSession({ id: saId, name: saName || `${t('table')} ${table}`, table });
setOrderOpen(false);
showToast(t('subaccountUpdated'));
} catch {
showToast('⚠️');
}
}
// #9 — "Soy nuevo": create a subaccount and seed it with the current cart.
async function createNewSubaccount(name: string, table: number) {
try {
const res = await fetch(`/api/${slug}/split/join`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ tableNumber: table, name }),
}).then((r) => r.json());
if (!res?.id) return;
if (cart.length > 0) {
await fetch(`/api/${slug}/split/sync`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ id: res.id, items: cartPayload(cart) }),
});
}
setSplitSession({ id: res.id, name: res.name, table });
setOrderOpen(false);
showToast(t('subaccountUpdated'));
} catch {
showToast('⚠️');
}
}
return (
<div className="mx-auto min-h-screen max-w-2xl px-4 pb-48">
{/* Brand header (banner + logo + name + social icons) */}
@@ -133,46 +216,64 @@ export default function PublicMenu({ menu, slug }: { menu: MenuSnapshot; slug: s
socialLinks={menu.restaurant.socialLinks}
/>
{/* Section tabs */}
{sections.length > 0 && (
<nav className="safe-top-sticky sticky z-20 -mx-1 mb-4 flex gap-2 overflow-x-auto px-1 py-1 no-scrollbar">
{sections.map((s) => (
<button
key={s.id}
onClick={() => scrollToSection(s.id)}
className={`glass-pill shrink-0 rounded-full px-4 py-2 text-sm font-medium transition ${
activeSection === s.id ? 'ring-2 ring-[var(--accent)]/40' : ''
}`}
>
{pickText(s.name, locale)}
</button>
))}
</nav>
)}
{/* View toggle (cards vs traditional list). Not persisted. */}
<div className="mb-4 flex items-center justify-end gap-3">
{anyMacros && <div className="min-w-0 flex-1"><MacroLegend /></div>}
<div className="glass-pill inline-flex shrink-0 rounded-full p-1 text-sm">
{/* View toggle (Cards / List) + Ask Claude */}
<div className="mb-6 mt-2 flex flex-nowrap items-stretch justify-start gap-2">
<div className="inline-flex shrink-0 items-stretch gap-1 rounded-full bg-black/5 p-0.5">
<button
onClick={() => setView('cards')}
className={`rounded-full px-3 py-1 font-medium transition ${
view === 'cards' ? 'bg-white/70 text-[var(--text)] shadow' : 'text-[var(--text)]/60'
className={`seg-btn flex items-center gap-1.5 rounded-full px-3 py-2 ${
view === 'cards' ? 'is-active' : ''
}`}
>
{t('viewCards')}
<LayoutGrid className="h-5 w-5 shrink-0" />
<span className="text-sm font-semibold">{t('viewCards')}</span>
</button>
<button
onClick={() => setView('list')}
className={`rounded-full px-3 py-1 font-medium transition ${
view === 'list' ? 'bg-white/70 text-[var(--text)] shadow' : 'text-[var(--text)]/60'
className={`seg-btn flex items-center gap-1.5 rounded-full px-3 py-2 ${
view === 'list' ? 'is-active' : ''
}`}
>
{t('viewList')}
<ListIcon className="h-5 w-5 shrink-0" />
<span className="text-sm font-semibold">{t('viewList')}</span>
</button>
</div>
<button
onClick={() => setAiOpen(true)}
className="ai-smoke flex min-w-0 flex-1 items-center justify-center gap-2 rounded-full px-3 py-2 text-sm font-semibold shadow-lg"
>
{t('askClaude')}
</button>
</div>
{/* Section heading + sticky category bar */}
{sections.length > 0 && (
<>
<h2 className="display mb-2 text-center text-xl font-semibold">{t('explore')}</h2>
<nav
ref={navRef}
className={`cat-bar safe-top-sticky sticky z-30 -mx-4 mb-4 px-4 pt-8 pb-2 no-scrollbar ${
stuck ? 'is-stuck' : ''
}`}
>
<div className="stuck-name text-center">{menu.restaurant.name}</div>
<div className="cat-row no-scrollbar justify-center">
{sections.map((s) => (
<button
key={s.id}
onClick={() => scrollToSection(s.id)}
className={`cat-btn shrink-0 rounded-full px-4 py-2 text-sm font-medium ${
activeSection === s.id ? 'is-active' : ''
}`}
>
{pickText(s.name, locale)}
</button>
))}
</div>
</nav>
</>
)}
{/* Sections */}
{sections.map((s) => (
<section
@@ -198,7 +299,7 @@ export default function PublicMenu({ menu, slug }: { menu: MenuSnapshot; slug: s
))}
</div>
) : (
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
<div className="grid grid-cols-1 items-start gap-4 sm:grid-cols-2">
{s.products.map((p, i) => (
<DishCard
key={p.id}
@@ -217,89 +318,57 @@ export default function PublicMenu({ menu, slug }: { menu: MenuSnapshot; slug: s
</section>
))}
{/* Floating actions — ordered vertical stack in the bottom-right corner so
they never overlap each other or cover dish names/prices. */}
{/* Floating actions — vertical stack, bottom-right. */}
<div className="safe-bottom-fab fixed right-4 z-40 flex flex-col items-end gap-2.5">
{actionsOpen && (
<div className="animate-spawn flex flex-col items-end gap-2">
<button
onClick={() => {
setWaiterOpen(true);
setActionsOpen(false);
}}
className="glass rounded-full px-4 py-2.5 text-sm font-medium shadow"
>
{t('callWaiter')}
</button>
<button
onClick={() => {
window.scrollTo({ top: 0, behavior: 'smooth' });
setActionsOpen(false);
}}
className="glass rounded-full px-4 py-2.5 text-sm font-medium shadow"
>
{t('viewFull')}
</button>
</div>
)}
<button
onClick={() => setAiOpen(true)}
className="glass rounded-full px-5 py-3 text-sm font-semibold shadow-lg"
>
✨ {t('askAi')}
</button>
{/* In a split session the cart IS the diner's subaccount → show one
'Mi cuenta' button (split). Otherwise show the normal cart, plus a
separate Split button when split is enabled. */}
{/* In a split session the cart IS the diner's subaccount → 'My account'.
Otherwise the red 'Order' button (when ordering is enabled). */}
{splitSession ? (
<button
onClick={() => setSplitOpen(true)}
className="relative flex items-center gap-2 rounded-full bg-[var(--accent)] px-5 py-3 text-sm font-semibold text-white shadow-lg"
className="ai-smoke-red relative flex items-center gap-2 rounded-full px-6 py-3 text-sm font-semibold text-white shadow-lg"
>
🧾 {t('myAccount')}
{t('myAccount')}
{cartCount > 0 && (
<span className="absolute -right-1 -top-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-white px-1 text-xs font-bold text-[var(--accent)] shadow">
<span className="absolute -right-1.5 -top-1.5 flex h-6 min-w-6 items-center justify-center rounded-full bg-white px-1.5 text-xs font-bold text-[#dc2626]">
{cartCount}
</span>
)}
</button>
) : (
<>
{ordersEnabled && (
<button
onClick={() => setOrderOpen(true)}
className="relative flex items-center gap-2 rounded-full bg-[var(--accent)] px-5 py-3 text-sm font-semibold text-white shadow-lg"
>
🛒 {t('cart')}
{cartCount > 0 && (
<span className="absolute -right-1 -top-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-white px-1 text-xs font-bold text-[var(--accent)] shadow">
{cartCount}
</span>
)}
</button>
)}
{splitEnabled && (
<button
onClick={() => {
setSplitPrefillTable(null);
setSplitOpen(true);
}}
className="glass rounded-full px-5 py-3 text-sm font-semibold shadow-lg"
>
🧾 {t('split')}
</button>
)}
</>
ordersEnabled && (
<button
onClick={() => setOrderOpen(true)}
aria-label={t('order')}
className="ai-smoke-red relative flex items-center gap-2 rounded-full px-6 py-3 text-sm font-semibold text-white shadow-lg"
>
{t('order')}
{cartCount > 0 && (
<span className="absolute -right-1.5 -top-1.5 flex h-6 min-w-6 items-center justify-center rounded-full bg-white px-1.5 text-xs font-bold text-[#dc2626]">
{cartCount}
</span>
)}
</button>
)
)}
{/* 'More' (waiter / back to top) — distinct ⋯ icon, not a '+', to avoid
confusion with the add-to-cart '+' inside each dish. */}
<button
onClick={() => setActionsOpen((o) => !o)}
className="glass flex h-11 w-11 items-center justify-center rounded-full text-xl shadow-lg"
aria-label={t('actions')}
onClick={() => setWaiterOpen(true)}
className="flex h-11 items-center justify-center rounded-full px-5 text-sm font-semibold text-white shadow-lg"
style={{ background: '#1e3a5f' }}
>
{actionsOpen ? '✕' : '⋯'}
{t('callWaiter')}
</button>
{splitEnabled && !splitSession && (
<button
onClick={() => {
setSplitPrefillTable(null);
setSplitOpen(true);
}}
className="flex items-center gap-2 rounded-full px-6 py-3 text-sm font-semibold text-white shadow-lg"
style={{ background: '#111' }}
>
{t('splitAction')}
</button>
)}
</div>
{/* Modals */}
@@ -319,7 +388,7 @@ export default function PublicMenu({ menu, slug }: { menu: MenuSnapshot; slug: s
addToCart(p);
}}
resolveDish={resolveDish}
suggestions={cartSuggestions}
buildSuggestions={buildSuggestions}
/>
)}
{orderOpen && (
@@ -327,15 +396,11 @@ export default function PublicMenu({ menu, slug }: { menu: MenuSnapshot; slug: s
slug={slug}
cart={cart}
setCart={setCart}
suggestions={cartSuggestions}
buildSuggestions={buildSuggestions}
onAdd={addToCart}
splitEnabled={splitEnabled}
onJoinSplit={(tbl) => {
// Normal-cart diner discovered the table is in split → switch to split.
setOrderOpen(false);
setSplitPrefillTable(tbl);
setSplitOpen(true);
}}
onPickSubaccount={joinExistingSubaccount}
onCreateSubaccount={createNewSubaccount}
onClose={() => setOrderOpen(false)}
onSent={() => {
setCart([]);
@@ -386,7 +451,7 @@ function TableInput({ value, onChange }: { value: string; onChange: (v: string)
value={value}
onChange={(e) => onChange(e.target.value)}
placeholder={t('tableNumber')}
className="glass-soft w-full rounded-2xl px-4 py-3 text-center text-lg outline-none"
className="glass-soft w-full rounded-2xl px-4 py-3 text-center text-sm outline-none"
/>
);
}
@@ -395,20 +460,22 @@ function OrderPanel({
slug,
cart,
setCart,
suggestions,
buildSuggestions,
onAdd,
splitEnabled,
onJoinSplit,
onPickSubaccount,
onCreateSubaccount,
onClose,
onSent,
}: {
slug: string;
cart: CartLine[];
setCart: React.Dispatch<React.SetStateAction<CartLine[]>>;
suggestions: SnapshotProduct[];
buildSuggestions: (seed: number, excludeIds?: string[]) => SnapshotProduct[];
onAdd: (p: SnapshotProduct) => void;
splitEnabled: boolean;
onJoinSplit: (table: number) => void;
onPickSubaccount: (id: string, name: string | null, table: number) => void;
onCreateSubaccount: (name: string, table: number) => void;
onClose: () => void;
onSent: () => void;
}) {
@@ -418,17 +485,35 @@ function OrderPanel({
const [generalNote, setGeneralNote] = useState('');
const [sending, setSending] = useState(false);
const [tableInSplit, setTableInSplit] = useState(false);
// New random sample each time the cart sheet opens (this component remounts).
const [seed] = useState(() => Date.now());
const suggestions = useMemo(() => buildSuggestions(seed), [buildSuggestions, seed]);
const [subaccounts, setSubaccounts] = useState<{ id: string; name: string | null }[]>([]);
const [pickNew, setPickNew] = useState(false);
const [newName, setNewName] = useState('');
// Detect if the entered table is already a split bill → offer to join instead.
// Detect if the entered table is already a split bill, and load its subaccounts
// so a returning diner can pick which one they belong to before confirming.
useEffect(() => {
if (!splitEnabled || !table) {
setTableInSplit(false);
setSubaccounts([]);
return;
}
let cancelled = false;
fetch(`/api/${slug}/table-status?table=${Number(table)}`)
.then((r) => r.json())
.then((d) => !cancelled && setTableInSplit(d.mode === 'split'))
.then((d) => {
if (cancelled) return;
const isSplit = d.mode === 'split';
setTableInSplit(isSplit);
if (isSplit) {
fetch(`/api/${slug}/split/subaccounts?table=${Number(table)}`)
.then((r) => r.json())
.then((s) => !cancelled && setSubaccounts(s.subaccounts ?? []))
.catch(() => {});
}
})
.catch(() => {});
return () => {
cancelled = true;
@@ -480,20 +565,38 @@ function OrderPanel({
{cart.length === 0 && <p className="text-sm text-[var(--text)]/60">{t('cartEmpty')}</p>}
{cart.map((l) => (
<div key={l.product.id} className="glass-soft flex flex-col gap-2 rounded-2xl px-3 py-2">
<div className="flex items-center gap-2">
<div className="flex items-center gap-3">
<MediaThumb
media={[...l.product.media].sort((a, b) => a.order - b.order)[0]}
alt={pickText(l.product.name, locale)}
className="h-12 w-12 shrink-0 rounded-xl"
/>
<span className="min-w-0 flex-1 text-sm font-medium">
{pickText(l.product.name, locale)}
</span>
<span className="shrink-0 text-sm text-[var(--text)]/60">
<span className="w-16 shrink-0 text-right text-sm text-[var(--text)]/60">
${(l.product.price * l.qty).toFixed(2)}
</span>
<button onClick={() => setQty(l.product.id, -1)} className="px-2 text-lg" aria-label="−">
−
</button>
<span className="w-5 text-center">{l.qty}</span>
<button onClick={() => setQty(l.product.id, 1)} className="px-2 text-lg" aria-label="+">
+
</button>
<div
className="flex shrink-0 items-center gap-1 rounded-full bg-white px-1.5 py-1"
style={{ boxShadow: '0 2px 8px rgba(40,30,20,.15)' }}
>
<button
onClick={() => setQty(l.product.id, -1)}
className="flex h-7 w-7 items-center justify-center rounded-full text-lg leading-none"
aria-label="−"
>
−
</button>
<span className="w-6 text-center text-sm font-medium">{l.qty}</span>
<button
onClick={() => setQty(l.product.id, 1)}
className="flex h-7 w-7 items-center justify-center rounded-full text-lg leading-none"
aria-label="+"
>
+
</button>
</div>
</div>
<input
value={l.note ?? ''}
@@ -508,7 +611,7 @@ function OrderPanel({
{suggestions.length > 0 && <SuggestionCarousel products={suggestions} onAdd={onAdd} />}
{cart.length > 0 && (
<div className="flex items-center justify-between px-1 text-sm font-semibold">
<div className="flex items-center justify-between px-1 text-sm font-semibold text-[#dc2626]">
<span>{t('total')}</span>
<span>${total.toFixed(2)}</span>
</div>
@@ -528,18 +631,47 @@ function OrderPanel({
<p className="rounded-2xl bg-amber-50/70 px-3 py-2 text-xs text-amber-800">
{t('splitDetected', { table: Number(table) })}
</p>
<button
onClick={() => onJoinSplit(Number(table))}
className="rounded-2xl bg-[var(--accent)] py-3 font-medium text-white"
>
{t('joinSplit', { table: Number(table) })}
</button>
<p className="text-sm font-medium">{t('whoAreYou')}</p>
{subaccounts.map((s) => (
<button
key={s.id}
onClick={() => onPickSubaccount(s.id, s.name, Number(table))}
className="glass-soft rounded-2xl px-4 py-3 text-left text-sm font-medium"
>
{s.name || `${t('table')} ${table}`}
</button>
))}
{pickNew ? (
<div className="flex flex-col gap-2">
<input
autoFocus
value={newName}
onChange={(e) => setNewName(e.target.value)}
placeholder={t('yourName')}
className="glass-soft rounded-2xl px-4 py-3 text-sm outline-none"
/>
<button
onClick={() => newName.trim() && onCreateSubaccount(newName.trim(), Number(table))}
disabled={!newName.trim()}
className="rounded-2xl bg-[#111] py-3 text-sm font-medium text-white disabled:opacity-50"
>
{t('createSplit')}
</button>
</div>
) : (
<button
onClick={() => setPickNew(true)}
className="rounded-2xl bg-[#111] py-3 text-sm font-medium text-white"
>
{t('imNew')}
</button>
)}
</div>
) : (
<button
onClick={send}
disabled={!table || cart.length === 0 || sending}
className="rounded-2xl bg-[var(--accent)] py-3 font-medium text-white disabled:opacity-50"
className="rounded-2xl bg-[#111] py-3 text-sm font-medium text-white disabled:opacity-50"
>
{t('confirmOrder')}
</button>
@@ -582,7 +714,7 @@ function WaiterPanel({
<button
onClick={send}
disabled={!table || sending}
className="rounded-2xl bg-[var(--accent)] py-3 font-medium text-white disabled:opacity-50"
className="rounded-2xl bg-[#111] py-3 text-sm font-medium text-white disabled:opacity-50"
>
{t('send')}
</button>
+37 -15
View File
@@ -5,6 +5,7 @@ import { useLocale, useTranslations } from 'next-intl';
import type { Locale } from '@/i18n/config';
import type { SnapshotProduct } from '@/lib/types';
import { pickText } from '@/lib/text';
import MediaThumb from './MediaThumb';
export type SplitSession = { id: string; name: string; table: number };
type CartLine = { product: SnapshotProduct; qty: number; note?: string };
@@ -167,7 +168,7 @@ export default function SplitPanel({
<button
onClick={join}
disabled={!name.trim() || !table || busy}
className="rounded-2xl bg-[var(--accent)] py-3 font-medium text-white disabled:opacity-50"
className="rounded-2xl bg-[#111] py-3 font-medium text-white disabled:opacity-50"
>
{mode === 'split' && table ? t('joinSplit', { table: Number(table) }) : t('createSplit')}
</button>
@@ -185,19 +186,37 @@ export default function SplitPanel({
{cart.map((l) => (
<div key={l.product.id} className="glass-soft flex flex-col gap-2 rounded-2xl px-3 py-2">
<div className="flex items-center gap-2">
<MediaThumb
media={[...l.product.media].sort((a, b) => a.order - b.order)[0]}
alt={pickText(l.product.name, locale)}
className="h-12 w-12 shrink-0 rounded-xl"
/>
<span className="min-w-0 flex-1 text-sm font-medium">
{pickText(l.product.name, locale)}
</span>
<span className="shrink-0 text-sm text-[var(--text)]/60">
<span className="w-16 shrink-0 text-right text-sm text-[var(--text)]/60">
${(l.product.price * l.qty).toFixed(2)}
</span>
<button onClick={() => setQty(l.product.id, -1)} className="px-2 text-lg" aria-label="−">
−
</button>
<span className="w-5 text-center">{l.qty}</span>
<button onClick={() => setQty(l.product.id, 1)} className="px-2 text-lg" aria-label="+">
+
</button>
<div
className="flex shrink-0 items-center gap-1 rounded-full bg-white px-1.5 py-1"
style={{ boxShadow: '0 2px 8px rgba(40,30,20,.15)' }}
>
<button
onClick={() => setQty(l.product.id, -1)}
className="flex h-7 w-7 items-center justify-center rounded-full text-lg leading-none"
aria-label="−"
>
−
</button>
<span className="w-6 text-center text-sm font-medium">{l.qty}</span>
<button
onClick={() => setQty(l.product.id, 1)}
className="flex h-7 w-7 items-center justify-center rounded-full text-lg leading-none"
aria-label="+"
>
+
</button>
</div>
</div>
<input
value={l.note ?? ''}
@@ -209,23 +228,26 @@ export default function SplitPanel({
))}
</div>
<div className="flex items-center justify-between px-1 text-sm">
<span className="font-medium">{t('yourSubtotal')}</span>
<div className="flex items-center justify-between px-1 text-base">
<span className="font-bold">{t('yourSubtotal')}</span>
<span className="font-semibold">${yourSubtotal.toFixed(2)}</span>
</div>
<div className="flex items-center justify-between px-1 text-sm">
<span className="text-[var(--text)]/70">{t('tableTotal')}</span>
<div className="flex items-center justify-between px-1 text-base">
<span className="font-bold text-[#dc2626]">{t('tableTotal')}</span>
<span className="font-semibold text-[var(--accent)]">${tableTotal.toFixed(2)}</span>
</div>
<div className="flex gap-2">
<button onClick={onClose} className="glass-pill flex-1 rounded-2xl py-3 text-sm">
<button
onClick={onClose}
className="glass-pill flex-1 rounded-2xl py-3 text-sm font-medium"
>
{t('addDishes')}
</button>
<button
onClick={sync}
disabled={busy}
className="flex-1 rounded-2xl bg-[var(--accent)] py-3 font-medium text-white disabled:opacity-50"
className="flex-1 rounded-2xl bg-[#111] py-3 text-sm font-medium text-white disabled:opacity-50"
>
{t('updateSubaccount')}
</button>
+3 -2
View File
@@ -62,10 +62,11 @@ export default function SuggestionCarousel({
<span className="line-clamp-2 text-xs font-medium leading-tight">
{pickText(p.name, locale)}
</span>
<span className="text-xs text-[var(--accent)]">${p.price.toFixed(2)}</span>
<span className="text-xs text-black">${p.price.toFixed(2)}</span>
<button
onClick={() => onAdd(p)}
className="mt-auto rounded-full bg-[var(--accent)] py-1 text-xs font-medium text-white"
style={{ backgroundColor: 'var(--accent)' }}
className="mt-auto rounded-full py-1 text-xs font-medium text-white"
>
{t('addToOrder')}
</button>
+20
View File
@@ -0,0 +1,20 @@
import { prisma } from './prisma';
// Generic key/value config helpers (AppConfig table).
export async function getConfig(key: string, fallback = ''): Promise<string> {
const row = await prisma.appConfig.findUnique({ where: { key } });
return row?.value ?? fallback;
}
export async function setConfig(key: string, value: string): Promise<void> {
await prisma.appConfig.upsert({
where: { key },
update: { value },
create: { key, value },
});
}
export async function getCostPerGb(): Promise<number> {
const v = Number(await getConfig('costPerGb', '0'));
return Number.isFinite(v) ? v : 0;
}
+110
View File
@@ -0,0 +1,110 @@
import { prisma } from './prisma';
import { getUsdMxn } from './exchange';
import { getCostPerGb } from './config';
import { storageBySlug, BYTES_PER_GB } from './storage';
export type RestaurantCost = {
id: string;
slug: string;
name: string;
active: boolean;
tokenCostUsd: number;
gb: number;
storageCostUsd: number;
};
export type CostDashboard = {
monthLabel: string; // YYYY-MM
exchange: { rate: number; date: string; stale: boolean };
costPerGb: number;
pricesUpdatedAt: string | null;
restaurants: RestaurantCost[];
totals: {
restaurantsTokenUsd: number;
storageUsd: number;
operativoTokenUsd: number;
grandUsd: number; // restaurants tokens + storage + operativo
avgPerRestaurantUsd: number; // restaurants tokens ÷ active count
};
};
function tokenCost(
inputTokens: number,
outputTokens: number,
price: { inputPricePerMTok: number; outputPricePerMTok: number } | undefined,
): number {
if (!price) return 0;
return (inputTokens / 1_000_000) * price.inputPricePerMTok + (outputTokens / 1_000_000) * price.outputPricePerMTok;
}
// Compute the current-month cost dashboard. Token cost per usage row uses the
// editable ModelPrice; storage uses measured GB × configurable cost/GB.
export async function getCostDashboard(): Promise<CostDashboard> {
const now = new Date();
const monthStart = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 1));
const monthLabel = monthStart.toISOString().slice(0, 7);
const [restaurants, usage, prices, exchange, costPerGb] = await Promise.all([
prisma.restaurant.findMany({
orderBy: { name: 'asc' },
select: { id: true, slug: true, name: true, active: true },
}),
prisma.tokenUsage.findMany({ where: { createdAt: { gte: monthStart } } }),
prisma.modelPrice.findMany(),
getUsdMxn(),
getCostPerGb(),
]);
const priceByModel = new Map(prices.map((p) => [p.model, p]));
// Token cost per restaurant (and operational for null restaurantId).
const tokenByRestaurant = new Map<string, number>();
let operativoTokenUsd = 0;
for (const u of usage) {
const cost = tokenCost(u.inputTokens, u.outputTokens, priceByModel.get(u.model));
if (u.restaurantId) {
tokenByRestaurant.set(u.restaurantId, (tokenByRestaurant.get(u.restaurantId) ?? 0) + cost);
} else {
operativoTokenUsd += cost;
}
}
const gbBySlug = await storageBySlug(restaurants.map((r) => r.slug));
const rows: RestaurantCost[] = restaurants.map((r) => {
const gb = (gbBySlug[r.slug] ?? 0) / BYTES_PER_GB;
return {
id: r.id,
slug: r.slug,
name: r.name,
active: r.active,
tokenCostUsd: tokenByRestaurant.get(r.id) ?? 0,
gb,
storageCostUsd: gb * costPerGb,
};
});
const restaurantsTokenUsd = rows.reduce((s, r) => s + r.tokenCostUsd, 0);
const storageUsd = rows.reduce((s, r) => s + r.storageCostUsd, 0);
const activeCount = rows.filter((r) => r.active).length;
const pricesUpdatedAt = prices.reduce<Date | null>(
(max, p) => (!max || p.updatedAt > max ? p.updatedAt : max),
null,
);
return {
monthLabel,
exchange,
costPerGb,
pricesUpdatedAt: pricesUpdatedAt ? pricesUpdatedAt.toISOString() : null,
restaurants: rows,
totals: {
restaurantsTokenUsd,
storageUsd,
operativoTokenUsd,
grandUsd: restaurantsTokenUsd + storageUsd + operativoTokenUsd,
avgPerRestaurantUsd: activeCount ? restaurantsTokenUsd / activeCount : 0,
},
};
}
+36
View File
@@ -0,0 +1,36 @@
import { prisma } from './prisma';
// Sane fallback if there's no cached rate AND the API fails — never show $0.
const FALLBACK_USD_MXN = 17;
function todayKey(): string {
return new Date().toISOString().slice(0, 10); // YYYY-MM-DD
}
// USD→MXN rate, cached once per day. Uses Frankfurter (no API key). On failure,
// falls back to the most recent stored rate, then to a constant. Returns the rate
// and the date it corresponds to so the dashboard can show context.
export async function getUsdMxn(): Promise<{ rate: number; date: string; stale: boolean }> {
const today = todayKey();
const cached = await prisma.exchangeRate.findUnique({ where: { date: today } });
if (cached) return { rate: cached.rate, date: cached.date, stale: false };
try {
const res = await fetch('https://api.frankfurter.app/latest?from=USD&to=MXN', {
// 24h revalidate hint; we also dedupe via the DB cache above.
next: { revalidate: 86400 },
});
if (!res.ok) throw new Error(`exchange ${res.status}`);
const data = await res.json();
const rate = Number(data?.rates?.MXN);
if (!Number.isFinite(rate) || rate <= 0) throw new Error('no rate');
await prisma.exchangeRate.create({ data: { date: today, rate } });
return { rate, date: today, stale: false };
} catch (err) {
console.error('getUsdMxn error', err);
const last = await prisma.exchangeRate.findFirst({ orderBy: { date: 'desc' } });
if (last) return { rate: last.rate, date: last.date, stale: true };
return { rate: FALLBACK_USD_MXN, date: today, stale: true };
}
}
+5 -1
View File
@@ -2,6 +2,7 @@ import * as XLSX from 'xlsx';
import Anthropic from '@anthropic-ai/sdk';
import { getAnthropic, HAIKU_MODEL, SONNET_MODEL } from './anthropic';
import { parseLenientJson } from './json';
import { recordUsage } from './usage';
import type { Locale } from '@/i18n/config';
// Structure returned for review (NOT yet applied to the draft).
@@ -153,6 +154,7 @@ export async function resolveSource(input: {
export async function extractMenu(
source: Source,
defaultLocale: Locale,
restaurantId?: string,
): Promise<ImportResult> {
const client = getAnthropic();
@@ -173,12 +175,14 @@ export async function extractMenu(
content.push({ type: 'text', text: `MENU SOURCE:\n${source.text}` });
}
const model = source.visual ? SONNET_MODEL : HAIKU_MODEL;
const msg = await client.messages.create({
model: source.visual ? SONNET_MODEL : HAIKU_MODEL,
model,
max_tokens: 8000,
system: systemPrompt(defaultLocale),
messages: [{ role: 'user', content }],
});
await recordUsage({ restaurantId: restaurantId ?? null, model, feature: 'import', usage: msg.usage });
const text = msg.content.find((c) => c.type === 'text')?.text ?? '{}';
const parsed = parseLenientJson<{ sections?: unknown }>(text);
+1 -1
View File
@@ -1,7 +1,7 @@
// Universal macro color code — FIXED across all restaurants (product standard).
// Diners learn it once and recognize it in any menu. Never make this configurable.
export const MACRO_COLORS = {
protein: '#C2410C', // terracotta
protein: '#dc2626', // red
carbs: '#B45309', // toasted amber
sugar: '#BE185D', // magenta
fat: '#CA8A04', // gold
-72
View File
@@ -1,72 +0,0 @@
import { prisma } from './prisma';
import { getAnthropic, HAIKU_MODEL } from './anthropic';
import { parseLenientJson } from './json';
import { pickText } from './text';
import type { MenuSnapshot } from './types';
export type Pairings = Record<string, string[]>;
// Generate cart pairings (complements) for a published snapshot with one cheap
// Haiku call, then store them on the restaurant. Runtime reads these — zero
// tokens per diner. Best-effort: returns null on failure so publish never breaks.
export async function generatePairings(
restaurantId: string,
snapshot: MenuSnapshot,
): Promise<Pairings | null> {
const locale = snapshot.restaurant.defaultLocale;
// Compact catalog: id, name, section, diet tags. (Macros omitted — irrelevant.)
const lines: string[] = [];
const ids = new Set<string>();
for (const section of snapshot.sections) {
const sname = pickText(section.name, locale);
for (const p of section.products) {
if (!p.isActive) continue;
ids.add(p.id);
lines.push(
`${p.id} | ${pickText(p.name, locale)} | ${sname}` +
(p.dietTags.length ? ` | ${p.dietTags.join(', ')}` : ''),
);
}
}
if (ids.size < 2) return {};
const system =
`You suggest food/drink COMPLEMENTS for a restaurant menu (pairings that go well ` +
`together — a drink with a main, a dessert, a side). Focus on complements, NOT upsell. ` +
`Each line below is "id | name | section | dietTags". For each dish, list the ids of OTHER ` +
`dishes that complement it (0 to 5; only genuine pairings, omit if none). Use ONLY the ids ` +
`provided; never invent ids; never pair a dish with itself. ` +
`Reply ONLY with JSON: {"pairings": { "<id>": ["<id>", ...] }}.\n\nMENU:\n` +
lines.join('\n');
try {
const client = getAnthropic();
const msg = await client.messages.create({
model: HAIKU_MODEL,
max_tokens: 2000,
system: [{ type: 'text', text: system }],
messages: [{ role: 'user', content: 'Generate the pairings JSON.' }],
});
const text = msg.content.find((c) => c.type === 'text')?.text ?? '{}';
const parsed = parseLenientJson<{ pairings?: Record<string, unknown> }>(text);
const rawMap = parsed?.pairings;
if (!rawMap || typeof rawMap !== 'object') return null;
// Validate: keys/values must be real ids; drop self-references; cap at 5.
const clean: Pairings = {};
for (const [key, val] of Object.entries(rawMap)) {
if (!ids.has(key) || !Array.isArray(val)) continue;
const list = val
.filter((v): v is string => typeof v === 'string' && ids.has(v) && v !== key)
.slice(0, 5);
if (list.length) clean[key] = Array.from(new Set(list));
}
await prisma.restaurant.update({ where: { id: restaurantId }, data: { pairings: clean } });
return clean;
} catch (err) {
console.error('generatePairings error', err);
return null;
}
}
+14 -28
View File
@@ -29,33 +29,19 @@ export const PALETTE_PRESETS: { id: string; label: string; palette: Palette }[]
},
];
const DEFAULT = PALETTE_PRESETS[0].palette;
// FIXED brand palette — the per-restaurant palette feature is being retired, so
// these colors are hardcoded from the approved design mockups and the argument is
// ignored. Emitted into :root (public) and [data-editor-root] (editor).
const FIXED_VARS =
'--bg:#ffffff;' +
'--bg-2:#ffffff;' +
'--surface:rgba(255,255,255,0.55);' +
'--accent:#dc2626;' +
'--text:#2a2520;' +
'--tab:rgba(255,255,255,0.45);';
// Build a CSS variable string from a palette, deriving a darker bottom gradient.
export function paletteToCssVars(palette?: Palette): string {
const p = { ...DEFAULT, ...(palette ?? {}) };
return [
`--bg:${p.background};`,
`--bg-2:${shade(p.background!, -8)};`,
`--surface:${p.surface};`,
`--accent:${p.accent};`,
`--text:${p.text};`,
`--tab:${p.tab};`,
].join('');
}
// Lighten/darken a hex color by a percentage (-100..100).
function shade(hex: string, percent: number): string {
const m = hex.replace('#', '');
if (m.length !== 6) return hex;
const num = parseInt(m, 16);
const amt = Math.round(2.55 * percent);
const r = clamp((num >> 16) + amt);
const g = clamp(((num >> 8) & 0xff) + amt);
const b = clamp((num & 0xff) + amt);
return `#${((r << 16) | (g << 8) | b).toString(16).padStart(6, '0')}`;
}
function clamp(v: number): number {
return Math.max(0, Math.min(255, v));
// Kept for signature compatibility with the pages that still call it; the passed
// palette is intentionally ignored now that colors are fixed.
export function paletteToCssVars(_palette?: Palette): string {
return FIXED_VARS;
}
+115
View File
@@ -0,0 +1,115 @@
import { prisma } from './prisma';
import { getAnthropic, HAIKU_MODEL } from './anthropic';
import { recordUsage } from './usage';
import { parseLenientJson } from './json';
export type PriceChange = {
model: string;
oldInput: number;
newInput: number;
oldOutput: number;
newOutput: number;
};
// Pretty marketing name from a model id, to help the model find it in the page.
function prettyName(model: string): string {
return model
.replace(/^claude-/, 'Claude ')
.replace(/-/g, ' ')
.replace(/\b(\w)/g, (m) => m.toUpperCase())
.replace(/(\d) (\d)/, '$1.$2'); // "4 5" -> "4.5"
}
function stripHtml(html: string): string {
return html
.replace(/<script[\s\S]*?<\/script>/gi, ' ')
.replace(/<style[\s\S]*?<\/style>/gi, ' ')
.replace(/<[^>]+>/g, ' ')
.replace(/&nbsp;/g, ' ')
.replace(/\s+/g, ' ')
.trim()
.slice(0, 24000);
}
// Try to fetch Anthropic's public pricing page text. Throws on failure so the
// caller can offer the manual-paste fallback.
export async function fetchAnthropicPricingText(): Promise<string> {
const urls = ['https://www.anthropic.com/pricing', 'https://claude.com/pricing'];
let lastErr: unknown;
for (const url of urls) {
try {
const res = await fetch(url, { headers: { 'User-Agent': 'SmartMenuPricing/1.0' } });
if (!res.ok) throw new Error(`${res.status}`);
const text = stripHtml(await res.text());
if (text.length > 200) return text;
} catch (err) {
lastErr = err;
}
}
throw lastErr ?? new Error('fetch_failed');
}
// Extract prices from the given text with Haiku (ONLY from the text, never from
// memory), update changed models, and log each change. Calls are recorded as
// operational (restaurantId null, feature 'precios-update').
export async function updatePricesFromText(
text: string,
source: 'anthropic' | 'manual',
): Promise<PriceChange[]> {
const current = await prisma.modelPrice.findMany();
if (current.length === 0) return [];
const wanted = current.map((c) => `- id "${c.model}" (marketing name: "${prettyName(c.model)}")`).join('\n');
const system =
'You extract model pricing from the provided pricing text ONLY (never from prior knowledge). ' +
'Find input and output price in USD PER MILLION TOKENS for each requested model. ' +
'If a model is NOT clearly present in the text, OMIT it (do not guess). ' +
'Reply ONLY with JSON: { "<id>": { "input": number, "output": number } } using the exact ids requested.';
const client = getAnthropic();
const msg = await client.messages.create({
model: HAIKU_MODEL,
max_tokens: 600,
system,
messages: [{ role: 'user', content: `MODELS:\n${wanted}\n\nPRICING TEXT:\n${text}` }],
});
await recordUsage({ restaurantId: null, model: HAIKU_MODEL, feature: 'precios-update', usage: msg.usage });
const reply = msg.content.find((c) => c.type === 'text')?.text ?? '{}';
const parsed = parseLenientJson<Record<string, { input?: unknown; output?: unknown }>>(reply) ?? {};
const changes: PriceChange[] = [];
for (const row of current) {
const found = parsed[row.model];
if (!found) continue;
const newInput = Number(found.input);
const newOutput = Number(found.output);
if (!Number.isFinite(newInput) || !Number.isFinite(newOutput) || newInput <= 0 || newOutput <= 0) {
continue;
}
if (newInput === row.inputPricePerMTok && newOutput === row.outputPricePerMTok) continue;
await prisma.modelPrice.update({
where: { model: row.model },
data: { inputPricePerMTok: newInput, outputPricePerMTok: newOutput, updatedAt: new Date() },
});
await prisma.priceUpdateLog.create({
data: {
model: row.model,
oldInput: row.inputPricePerMTok,
newInput,
oldOutput: row.outputPricePerMTok,
newOutput,
source,
},
});
changes.push({
model: row.model,
oldInput: row.inputPricePerMTok,
newInput,
oldOutput: row.outputPricePerMTok,
newOutput,
});
}
return changes;
}
+133
View File
@@ -0,0 +1,133 @@
import type { MenuSnapshot, SnapshotProduct } from './types';
// ─────────────────────────────────────────────────────────────────────────────
// Local recommendation engine (no API, no tokens, no latency). The carousel only
// ever calls getRecommendations(menu, cartIds, opts). Today: a RANDOM sample of
// the whole menu, lightly refined by complement rules (variety dominates). Pass
// opts.seed to re-randomize per carousel open. Phase 2 can blend a real
// market-basket CO-OCCURRENCE signal WITHOUT touching the carousel — just pass
// `opts.coOccurrence` (see the seam below).
// ─────────────────────────────────────────────────────────────────────────────
// Small seeded PRNG (mulberry32) so a given seed yields a stable shuffle within a
// render but a fresh one each time the seed changes (i.e. each carousel open).
function rng(seed: number): () => number {
let a = (seed >>> 0) || 1;
return () => {
a |= 0;
a = (a + 0x6d2b79f5) | 0;
let t = Math.imul(a ^ (a >>> 15), 1 | a);
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
};
}
type Category = 'drink' | 'dessert' | 'starter' | 'main';
// Keyword sets (es + en + common variants) to classify a section flexibly —
// never hardcode one restaurant's exact section names.
const KEYWORDS: Record<Exclude<Category, 'main'>, string[]> = {
drink: [
'bebida', 'bebidas', 'drink', 'drinks', 'beverage', 'smoothie', 'jugo', 'juice',
'cafe', 'café', 'coffee', 'agua', 'water', 'coctel', 'cóctel', 'cocktail', 'cerveza',
'beer', 'vino', 'wine', 'refresco', 'soda', 'te', 'té', 'tea', 'latte', 'malteada', 'shake',
],
dessert: ['postre', 'postres', 'dessert', 'desserts', 'dulce', 'sweet', 'helado', 'ice cream'],
starter: [
'entrada', 'entradas', 'starter', 'starters', 'appetizer', 'appetizers', 'snack', 'snacks',
'botana', 'botanas', 'aperitivo', 'side', 'guarnicion', 'guarnición',
],
};
function classifySection(name: string): Category {
const n = name.toLowerCase();
// Whole-word match so short keywords (e.g. "te"/tea) don't match inside other
// words (e.g. "fuertes"); multi-word keywords ("ice cream") use substring.
const tokens = n.split(/[^a-záéíóúñ]+/i).filter(Boolean);
const matches = (k: string) => (k.includes(' ') ? n.includes(k) : tokens.includes(k));
for (const cat of ['drink', 'dessert', 'starter'] as const) {
if (KEYWORDS[cat].some(matches)) return cat;
}
return 'main'; // anything else is treated as a main/food section
}
type Indexed = { product: SnapshotProduct; category: Category; order: number };
// Flatten active products with their section category + a stable global order.
function indexMenu(menu: MenuSnapshot): Indexed[] {
const out: Indexed[] = [];
let order = 0;
const sections = [...menu.sections].sort((a, b) => a.order - b.order);
for (const s of sections) {
const category = classifySection(`${s.name.es ?? ''} ${s.name.en ?? ''}`);
for (const p of s.products) {
if (!p.isActive) continue;
out.push({ product: p, category, order: order++ });
}
}
return out;
}
// Phase-2 seam: a function that, given the cart, returns a score per productId
// (e.g. derived from historical co-occurrence). Higher = more recommended.
export type CoOccurrenceSignal = (cartProductIds: string[]) => Map<string, number>;
export type RecoOptions = {
limit?: number;
// Re-randomize per carousel open. Same seed → same sample within a render.
seed?: number;
// Extra product ids to exclude (e.g. dishes the AI consultant already showed
// above the carousel) — on top of the cart items, which are always excluded.
excludeIds?: string[];
// When provided, co-occurrence scores are blended on top (products with a
// signal float to the front). Today: undefined → random + light rules.
coOccurrence?: CoOccurrenceSignal;
};
export function getRecommendations(
menu: MenuSnapshot,
cartProductIds: string[],
opts: RecoOptions = {},
): SnapshotProduct[] {
const limit = opts.limit ?? 6;
const indexed = indexMenu(menu); // active products only
if (indexed.length === 0) return [];
const exclude = new Set<string>([...cartProductIds, ...(opts.excludeIds ?? [])]);
const eligible = indexed.filter((i) => !exclude.has(i.product.id));
if (eligible.length === 0) return [];
// Complement rules → categories to gently favor (variety still dominates).
const cartCats = new Set(
indexed.filter((i) => cartProductIds.includes(i.product.id)).map((i) => i.category),
);
const hasFood = cartCats.has('main') || cartCats.has('starter');
const onlyDrink =
cartProductIds.length > 0 && cartCats.size > 0 && [...cartCats].every((c) => c === 'drink');
const wanted = new Set<Category>();
if (cartProductIds.length > 0) {
if (hasFood && !cartCats.has('drink')) wanted.add('drink');
if (hasFood && !cartCats.has('dessert')) wanted.add('dessert');
if (onlyDrink) {
wanted.add('starter');
wanted.add('main');
}
}
// Random sample of the WHOLE menu (high variety), with a small nudge toward
// complement categories — the nudge (+0.25) can't beat a strong random draw, so
// it only refines/orders lightly without collapsing variety.
const rand = rng(opts.seed ?? 1);
let result = eligible
.map((i) => ({ p: i.product, s: rand() + (wanted.has(i.category) ? 0.25 : 0) }))
.sort((a, b) => b.s - a.s)
.map((x) => x.p);
// Phase-2 blend (no-op today): float products with a co-occurrence signal.
if (opts.coOccurrence) {
const scores = opts.coOccurrence(cartProductIds);
result = result.sort((a, b) => (scores.get(b.id) ?? 0) - (scores.get(a.id) ?? 0));
}
return result.slice(0, limit);
}
+37
View File
@@ -0,0 +1,37 @@
import { promises as fs } from 'fs';
import path from 'path';
import { UPLOAD_DIR } from './upload';
// Recursively sum file sizes under a directory (bytes). Missing dir → 0.
async function dirSize(dir: string): Promise<number> {
let total = 0;
let entries: import('fs').Dirent[];
try {
entries = await fs.readdir(dir, { withFileTypes: true });
} catch {
return 0;
}
for (const e of entries) {
const full = path.join(dir, e.name);
try {
if (e.isDirectory()) total += await dirSize(full);
else if (e.isFile()) total += (await fs.stat(full)).size;
} catch {
/* skip unreadable entries */
}
}
return total;
}
// Bytes consumed by each restaurant's uploads, keyed by slug.
export async function storageBySlug(slugs: string[]): Promise<Record<string, number>> {
const out: Record<string, number> = {};
await Promise.all(
slugs.map(async (slug) => {
out[slug] = await dirSize(path.join(UPLOAD_DIR, slug));
}),
);
return out;
}
export const BYTES_PER_GB = 1024 ** 3;
+26
View File
@@ -0,0 +1,26 @@
import { prisma } from './prisma';
type Usage = { input_tokens?: number; output_tokens?: number } | null | undefined;
// Record one Anthropic API call's token usage. Fire-and-forget: never let logging
// break the feature that made the call. restaurantId null = Collina operational.
export async function recordUsage(params: {
restaurantId: string | null;
model: string;
feature: string;
usage: Usage;
}): Promise<void> {
try {
await prisma.tokenUsage.create({
data: {
restaurantId: params.restaurantId,
model: params.model,
feature: params.feature,
inputTokens: params.usage?.input_tokens ?? 0,
outputTokens: params.usage?.output_tokens ?? 0,
},
});
} catch (err) {
console.error('recordUsage error', err);
}
}
+4 -3
View File
@@ -7,13 +7,14 @@ const config: Config = {
theme: {
extend: {
fontFamily: {
display: ['var(--font-fraunces)', 'Georgia', 'serif'],
body: ['var(--font-inter)', 'system-ui', 'sans-serif'],
display: ['var(--font-montserrat)', 'system-ui', 'sans-serif'],
body: ['var(--font-montserrat)', 'system-ui', 'sans-serif'],
serif: ['var(--font-merriweather)', 'Georgia', 'serif'],
},
colors: {
// Universal, non-configurable macro color code (product standard).
macro: {
protein: '#C2410C',
protein: '#dc2626',
carbs: '#B45309',
sugar: '#BE185D',
fat: '#CA8A04',