Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4bec78597b | ||
|
|
b0be66990f | ||
|
|
cbb4a9e8ef | ||
|
|
02a0163d60 | ||
|
|
7933e35fc3 | ||
|
|
9fd28d6059 | ||
|
|
cf6090d588 | ||
|
|
bae032aa75 | ||
|
|
8cf6ca8cb5 | ||
|
|
595769ced0 | ||
|
|
ffa8766540 | ||
|
|
bcec7ee8dc | ||
|
|
58a71d0bef | ||
|
|
ceac688fa8 | ||
|
|
c82c0f2108 | ||
|
|
14e2f73db9 | ||
|
|
2bd7da0839 | ||
|
|
da2c0113e0 | ||
|
|
0d924e36ef | ||
|
|
b30430a1ea | ||
|
|
8fc95c3cab |
No files matched your search
+232
@@ -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>
|
||||||
|
```
|
||||||
@@ -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>
|
||||||
@@ -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.
@@ -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>
|
||||||
@@ -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>
|
||||||
@@ -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>
|
||||||
@@ -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>
|
||||||
@@ -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>
|
||||||
@@ -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>
|
||||||
@@ -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&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>
|
||||||
@@ -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&display=swap">
|
||||||
|
<link id="gfont-Merriweather" rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Merriweather:wght@300;400;500;600;700&display=swap">
|
||||||
|
<link id="gfont-Abril-Fatface" rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Abril+Fatface:wght@300;400;500;600;700&display=swap">
|
||||||
|
<link id="gfont-Permanent-Marker" rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Permanent+Marker:wght@300;400;500;600;700&display=swap">
|
||||||
|
<link id="gfont-Comfortaa" rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Comfortaa:wght@300;400;500;600;700&display=swap">
|
||||||
|
<link id="gfont-Rubik" rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700&display=swap">
|
||||||
|
<link id="gfont-Roboto" rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;600;700&display=swap">
|
||||||
|
<link id="gfont-Open-Sans" rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;500;600;700&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
@@ -36,6 +36,8 @@
|
|||||||
"createSplit": "Create split bill",
|
"createSplit": "Create split bill",
|
||||||
"joinSplit": "Join table {table}'s bill",
|
"joinSplit": "Join table {table}'s bill",
|
||||||
"splitDetected": "Table {table} already has a split bill",
|
"splitDetected": "Table {table} already has a split bill",
|
||||||
|
"whoAreYou": "Who are you?",
|
||||||
|
"imNew": "I'm new",
|
||||||
"yourSubaccount": "Your subaccount",
|
"yourSubaccount": "Your subaccount",
|
||||||
"yourSubtotal": "What you owe",
|
"yourSubtotal": "What you owe",
|
||||||
"tableTotal": "Table total",
|
"tableTotal": "Table total",
|
||||||
@@ -50,9 +52,17 @@
|
|||||||
"macroLegend": "Macro color code",
|
"macroLegend": "Macro color code",
|
||||||
"tapToFlip": "Tap to see macros",
|
"tapToFlip": "Tap to see macros",
|
||||||
"viewCards": "Cards",
|
"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": {
|
"macros": {
|
||||||
|
"title": "Macros",
|
||||||
"protein": "Protein",
|
"protein": "Protein",
|
||||||
"carbs": "Carbs",
|
"carbs": "Carbs",
|
||||||
"sugar": "Sugars",
|
"sugar": "Sugars",
|
||||||
@@ -61,8 +71,8 @@
|
|||||||
"kcal": "Calories"
|
"kcal": "Calories"
|
||||||
},
|
},
|
||||||
"ai": {
|
"ai": {
|
||||||
"title": "Menu consultant",
|
"title": "Virtual waiter",
|
||||||
"placeholder": "What do you recommend if I'm diabetic?",
|
"placeholder": "What's the most popular dish?",
|
||||||
"thinking": "Thinking…",
|
"thinking": "Thinking…",
|
||||||
"intro": "Tell me what you're after and I'll recommend dishes from the menu.",
|
"intro": "Tell me what you're after and I'll recommend dishes from the menu.",
|
||||||
"pairWith": "To pair with"
|
"pairWith": "To pair with"
|
||||||
@@ -109,6 +119,8 @@
|
|||||||
"split": "Split",
|
"split": "Split",
|
||||||
"tableTotal": "Table total",
|
"tableTotal": "Table total",
|
||||||
"completeTable": "Complete table",
|
"completeTable": "Complete table",
|
||||||
|
"waiterAlert": "ALERT at Table {table}",
|
||||||
|
"pending": "PENDING",
|
||||||
"tableSubaccount": "Table",
|
"tableSubaccount": "Table",
|
||||||
"subaccountEmpty": "No dishes yet.",
|
"subaccountEmpty": "No dishes yet.",
|
||||||
"paid": "Paid",
|
"paid": "Paid",
|
||||||
@@ -224,6 +236,33 @@
|
|||||||
"invalid": "Wrong username or password",
|
"invalid": "Wrong username or password",
|
||||||
"invalidLink": "Invalid access link"
|
"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": {
|
"admin": {
|
||||||
"title": "Collina master panel",
|
"title": "Collina master panel",
|
||||||
"newRestaurant": "New restaurant",
|
"newRestaurant": "New restaurant",
|
||||||
@@ -234,6 +273,19 @@
|
|||||||
"editorLink": "Editor link",
|
"editorLink": "Editor link",
|
||||||
"publicLink": "Public link",
|
"publicLink": "Public link",
|
||||||
"credentials": "Initial credentials",
|
"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
@@ -36,6 +36,8 @@
|
|||||||
"createSplit": "Crear cuenta dividida",
|
"createSplit": "Crear cuenta dividida",
|
||||||
"joinSplit": "Unirme a la cuenta de la mesa {table}",
|
"joinSplit": "Unirme a la cuenta de la mesa {table}",
|
||||||
"splitDetected": "La mesa {table} ya tiene una cuenta dividida",
|
"splitDetected": "La mesa {table} ya tiene una cuenta dividida",
|
||||||
|
"whoAreYou": "¿Quién eres?",
|
||||||
|
"imNew": "Soy nuevo",
|
||||||
"yourSubaccount": "Tu subcuenta",
|
"yourSubaccount": "Tu subcuenta",
|
||||||
"yourSubtotal": "Lo que debes tú",
|
"yourSubtotal": "Lo que debes tú",
|
||||||
"tableTotal": "Total de la mesa",
|
"tableTotal": "Total de la mesa",
|
||||||
@@ -50,9 +52,17 @@
|
|||||||
"macroLegend": "Código de color de macros",
|
"macroLegend": "Código de color de macros",
|
||||||
"tapToFlip": "Toca para ver macros",
|
"tapToFlip": "Toca para ver macros",
|
||||||
"viewCards": "Tarjetas",
|
"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": {
|
"macros": {
|
||||||
|
"title": "Macros",
|
||||||
"protein": "Proteína",
|
"protein": "Proteína",
|
||||||
"carbs": "Carbohidratos",
|
"carbs": "Carbohidratos",
|
||||||
"sugar": "Azúcares",
|
"sugar": "Azúcares",
|
||||||
@@ -61,8 +71,8 @@
|
|||||||
"kcal": "Calorías"
|
"kcal": "Calorías"
|
||||||
},
|
},
|
||||||
"ai": {
|
"ai": {
|
||||||
"title": "Consultor del menú",
|
"title": "Mesero virtual",
|
||||||
"placeholder": "¿Qué me recomiendas si soy diabético?",
|
"placeholder": "¿Cuál es el platillo más popular?",
|
||||||
"thinking": "Pensando…",
|
"thinking": "Pensando…",
|
||||||
"intro": "Cuéntame qué buscas y te recomiendo platillos del menú.",
|
"intro": "Cuéntame qué buscas y te recomiendo platillos del menú.",
|
||||||
"pairWith": "Para acompañar"
|
"pairWith": "Para acompañar"
|
||||||
@@ -109,6 +119,8 @@
|
|||||||
"split": "Dividida",
|
"split": "Dividida",
|
||||||
"tableTotal": "Total de la mesa",
|
"tableTotal": "Total de la mesa",
|
||||||
"completeTable": "Completar mesa",
|
"completeTable": "Completar mesa",
|
||||||
|
"waiterAlert": "ALERTA en Mesa {table}",
|
||||||
|
"pending": "PENDIENTE",
|
||||||
"tableSubaccount": "Mesa",
|
"tableSubaccount": "Mesa",
|
||||||
"subaccountEmpty": "Aún sin platillos.",
|
"subaccountEmpty": "Aún sin platillos.",
|
||||||
"paid": "Pagado",
|
"paid": "Pagado",
|
||||||
@@ -224,6 +236,33 @@
|
|||||||
"invalid": "Usuario o contraseña incorrectos",
|
"invalid": "Usuario o contraseña incorrectos",
|
||||||
"invalidLink": "Link de acceso inválido"
|
"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": {
|
"admin": {
|
||||||
"title": "Panel maestro Collina",
|
"title": "Panel maestro Collina",
|
||||||
"newRestaurant": "Nuevo restaurante",
|
"newRestaurant": "Nuevo restaurante",
|
||||||
@@ -234,6 +273,19 @@
|
|||||||
"editorLink": "Link de editor",
|
"editorLink": "Link de editor",
|
||||||
"publicLink": "Link público",
|
"publicLink": "Link público",
|
||||||
"credentials": "Credenciales iniciales",
|
"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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Generated
-1
@@ -1522,7 +1522,6 @@
|
|||||||
"version": "2.3.3",
|
"version": "2.3.3",
|
||||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
||||||
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
||||||
"dev": true,
|
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"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');
|
||||||
@@ -116,3 +116,54 @@ model Order {
|
|||||||
|
|
||||||
@@index([restaurantId, status])
|
@@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
@@ -1,7 +1,9 @@
|
|||||||
import { isAdminAuthed } from '@/lib/auth';
|
import { isAdminAuthed } from '@/lib/auth';
|
||||||
import { prisma } from '@/lib/prisma';
|
import { prisma } from '@/lib/prisma';
|
||||||
|
import { getCostDashboard } from '@/lib/costs';
|
||||||
import AdminLogin from '@/components/admin/AdminLogin';
|
import AdminLogin from '@/components/admin/AdminLogin';
|
||||||
import AdminPanel from '@/components/admin/AdminPanel';
|
import AdminPanel from '@/components/admin/AdminPanel';
|
||||||
|
import CostsDashboard from '@/components/admin/CostsDashboard';
|
||||||
|
|
||||||
export const dynamic = 'force-dynamic';
|
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 || '';
|
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>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import { NextResponse } from 'next/server';
|
import { NextResponse } from 'next/server';
|
||||||
import { prisma } from '@/lib/prisma';
|
import { prisma } from '@/lib/prisma';
|
||||||
import { getAnthropic, HAIKU_MODEL } from '@/lib/anthropic';
|
import { getAnthropic, HAIKU_MODEL } from '@/lib/anthropic';
|
||||||
|
import { recordUsage } from '@/lib/usage';
|
||||||
import { parseLenientJson } from '@/lib/json';
|
import { parseLenientJson } from '@/lib/json';
|
||||||
import { pickText } from '@/lib/text';
|
import { pickText } from '@/lib/text';
|
||||||
import type { Locale } from '@/i18n/config';
|
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' } }],
|
system: [{ type: 'text', text: cacheable, cache_control: { type: 'ephemeral' } }],
|
||||||
messages: [{ role: 'user', content: question }],
|
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 ?? '{}';
|
const text = msg.content.find((c) => c.type === 'text')?.text ?? '{}';
|
||||||
// Lenient parse (shared with import): tolerates prose/fences/truncation so a
|
// Lenient parse (shared with import): tolerates prose/fences/truncation so a
|
||||||
|
|||||||
@@ -28,7 +28,11 @@ export async function POST(req: Request, { params }: { params: { slug: string }
|
|||||||
link: String(form.get('link') ?? ''),
|
link: String(form.get('link') ?? ''),
|
||||||
text: String(form.get('text') ?? ''),
|
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) {
|
if (result.sections.length === 0) {
|
||||||
return NextResponse.json({ error: 'nothing_found' }, { status: 422 });
|
return NextResponse.json({ error: 'nothing_found' }, { status: 422 });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
import { NextResponse } from 'next/server';
|
import { NextResponse } from 'next/server';
|
||||||
import { requireEditor } from '@/lib/guard';
|
import { requireEditor } from '@/lib/guard';
|
||||||
import { publishVersion, buildSnapshot } from '@/lib/menu';
|
import { publishVersion } from '@/lib/menu';
|
||||||
import { generatePairings } from '@/lib/pairings';
|
|
||||||
|
|
||||||
export const maxDuration = 60;
|
|
||||||
|
|
||||||
export async function POST(req: Request, { params }: { params: { slug: string } }) {
|
export async function POST(req: Request, { params }: { params: { slug: string } }) {
|
||||||
const guard = await requireEditor(params.slug);
|
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 body = await req.json().catch(() => null);
|
||||||
const versionName = String(body?.versionName ?? '').trim();
|
const versionName = String(body?.versionName ?? '').trim();
|
||||||
const generateSuggestions = body?.generateSuggestions === true;
|
|
||||||
if (!versionName) return NextResponse.json({ error: 'invalid' }, { status: 400 });
|
if (!versionName) return NextResponse.json({ error: 'invalid' }, { status: 400 });
|
||||||
|
|
||||||
const version = await publishVersion(
|
const version = await publishVersion(
|
||||||
@@ -20,18 +16,7 @@ export async function POST(req: Request, { params }: { params: { slug: string }
|
|||||||
guard.restaurant.username,
|
guard.restaurant.username,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Optional: regenerate cart pairings from the just-published menu. Never let an
|
// Cart suggestions are now computed locally and deterministically at runtime
|
||||||
// AI failure break publishing.
|
// (lib/recommendations.ts) — no AI generation at publish time.
|
||||||
let suggestions = false;
|
return NextResponse.json(version);
|
||||||
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 });
|
|
||||||
}
|
}
|
||||||
@@ -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 })),
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import { NextResponse } from 'next/server';
|
import { NextResponse } from 'next/server';
|
||||||
import { requireEditor } from '@/lib/guard';
|
import { requireEditor } from '@/lib/guard';
|
||||||
import { getAnthropic, HAIKU_MODEL } from '@/lib/anthropic';
|
import { getAnthropic, HAIKU_MODEL } from '@/lib/anthropic';
|
||||||
|
import { recordUsage } from '@/lib/usage';
|
||||||
|
|
||||||
// Translate a single field with Claude Haiku to fill the missing locale.
|
// Translate a single field with Claude Haiku to fill the missing locale.
|
||||||
export async function POST(req: Request, { params }: { params: { slug: string } }) {
|
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.`,
|
`Keep it natural and appetizing. Reply with ONLY the translation, no quotes, no notes.`,
|
||||||
messages: [{ role: 'user', content: text }],
|
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() ?? '';
|
const translated = msg.content.find((c) => c.type === 'text')?.text?.trim() ?? '';
|
||||||
return NextResponse.json({ translation: translated, to });
|
return NextResponse.json({ translation: translated, to });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -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 });
|
||||||
|
}
|
||||||
@@ -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
@@ -3,11 +3,12 @@
|
|||||||
@tailwind utilities;
|
@tailwind utilities;
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
/* Default restaurant palette (overridden per-restaurant at runtime). */
|
/* Fixed brand palette — hardcoded from the design mockups. The per-restaurant
|
||||||
--bg: #f4f1ec;
|
palette feature is being retired, so these are no longer overridden at runtime. */
|
||||||
--bg-2: #e9e3da;
|
--bg: #ffffff;
|
||||||
|
--bg-2: #ffffff;
|
||||||
--surface: rgba(255, 255, 255, 0.55);
|
--surface: rgba(255, 255, 255, 0.55);
|
||||||
--accent: #b45309;
|
--accent: #dc2626;
|
||||||
--text: #2a2520;
|
--text: #2a2520;
|
||||||
--tab: rgba(255, 255, 255, 0.45);
|
--tab: rgba(255, 255, 255, 0.45);
|
||||||
}
|
}
|
||||||
@@ -21,7 +22,7 @@ body {
|
|||||||
|
|
||||||
body {
|
body {
|
||||||
color: var(--text);
|
color: var(--text);
|
||||||
font-family: var(--font-inter), system-ui, sans-serif;
|
font-family: var(--font-montserrat), system-ui, sans-serif;
|
||||||
background:
|
background:
|
||||||
radial-gradient(1200px 800px at 80% -10%, rgba(255, 255, 255, 0.6), transparent 60%),
|
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%),
|
radial-gradient(1000px 700px at -10% 110%, rgba(255, 255, 255, 0.4), transparent 55%),
|
||||||
@@ -55,7 +56,12 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.display {
|
.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);
|
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 */
|
/* hide horizontal scrollbar on section tabs */
|
||||||
.no-scrollbar::-webkit-scrollbar {
|
.no-scrollbar::-webkit-scrollbar {
|
||||||
display: none;
|
display: none;
|
||||||
@@ -93,6 +169,337 @@ body {
|
|||||||
scrollbar-width: none;
|
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).
|
/* Safe-area helpers for edge-to-edge layout (viewport-fit=cover).
|
||||||
The background covers behind the notch / dynamic island and gesture bar, while
|
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
|
interactive content is padded so it isn't covered. On devices without insets
|
||||||
|
|||||||
+9
-6
@@ -1,17 +1,20 @@
|
|||||||
import type { Metadata, Viewport } from 'next';
|
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 { NextIntlClientProvider } from 'next-intl';
|
||||||
import { getLocale, getMessages } from 'next-intl/server';
|
import { getLocale, getMessages } from 'next-intl/server';
|
||||||
import './globals.css';
|
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'],
|
subsets: ['latin'],
|
||||||
variable: '--font-fraunces',
|
variable: '--font-montserrat',
|
||||||
display: 'swap',
|
display: 'swap',
|
||||||
});
|
});
|
||||||
const inter = Inter({
|
const merriweather = Merriweather({
|
||||||
subsets: ['latin'],
|
subsets: ['latin'],
|
||||||
variable: '--font-inter',
|
weight: ['300', '400', '700', '900'],
|
||||||
|
variable: '--font-merriweather',
|
||||||
display: 'swap',
|
display: 'swap',
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -39,7 +42,7 @@ export default async function RootLayout({
|
|||||||
const messages = await getMessages();
|
const messages = await getMessages();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<html lang={locale} className={`${fraunces.variable} ${inter.variable}`}>
|
<html lang={locale} className={`${montserrat.variable} ${merriweather.variable}`}>
|
||||||
<body>
|
<body>
|
||||||
<NextIntlClientProvider locale={locale} messages={messages}>
|
<NextIntlClientProvider locale={locale} messages={messages}>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
+54
-12
@@ -1,20 +1,62 @@
|
|||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
|
|
||||||
|
// Landing premium minimalista: video de fondo + wordmark "Smart Menu" + CTA único.
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
return (
|
return (
|
||||||
<main className="flex min-h-screen flex-col items-center justify-center gap-6 p-6 text-center">
|
<main
|
||||||
<div className="glass max-w-md rounded-3xl p-8">
|
className="relative flex min-h-screen flex-col items-center justify-center overflow-hidden px-6 text-center"
|
||||||
<h1 className="display text-3xl font-semibold">Menú inteligente</h1>
|
style={{ background: '#1b1916' }}
|
||||||
<p className="mt-2 text-sm text-[var(--text)]/65">
|
>
|
||||||
Menús digitales elegantes para restaurantes · Collina Systems
|
{/* Background video */}
|
||||||
</p>
|
<video
|
||||||
<Link
|
className="absolute inset-0 h-full w-full object-cover"
|
||||||
href="/admin"
|
autoPlay
|
||||||
className="mt-6 inline-block rounded-full bg-[var(--accent)] px-6 py-3 text-sm font-medium text-white"
|
muted
|
||||||
>
|
loop
|
||||||
Panel maestro
|
playsInline
|
||||||
</Link>
|
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>
|
</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>
|
</main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -2,9 +2,12 @@
|
|||||||
|
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
|
import { useTranslations } from 'next-intl';
|
||||||
|
|
||||||
export default function AdminLogin() {
|
export default function AdminLogin() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const tAdmin = useTranslations('admin');
|
||||||
|
const tAuth = useTranslations('auth');
|
||||||
const [user, setUser] = useState('');
|
const [user, setUser] = useState('');
|
||||||
const [password, setPassword] = useState('');
|
const [password, setPassword] = useState('');
|
||||||
const [error, setError] = useState(false);
|
const [error, setError] = useState(false);
|
||||||
@@ -27,26 +30,26 @@ export default function AdminLogin() {
|
|||||||
return (
|
return (
|
||||||
<main className="flex min-h-screen items-center justify-center p-4">
|
<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">
|
<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
|
<input
|
||||||
value={user}
|
value={user}
|
||||||
onChange={(e) => setUser(e.target.value)}
|
onChange={(e) => setUser(e.target.value)}
|
||||||
placeholder="usuario"
|
placeholder={tAuth('username')}
|
||||||
className="glass-soft rounded-2xl px-4 py-3 outline-none"
|
className="glass-soft rounded-2xl px-4 py-3 outline-none"
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
type="password"
|
type="password"
|
||||||
value={password}
|
value={password}
|
||||||
onChange={(e) => setPassword(e.target.value)}
|
onChange={(e) => setPassword(e.target.value)}
|
||||||
placeholder="contraseña"
|
placeholder={tAuth('password')}
|
||||||
className="glass-soft rounded-2xl px-4 py-3 outline-none"
|
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
|
<button
|
||||||
disabled={loading}
|
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>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
import { useTranslations } from 'next-intl';
|
||||||
|
|
||||||
type Restaurant = {
|
type Restaurant = {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -27,6 +28,7 @@ export default function AdminPanel({
|
|||||||
initialRestaurants: Restaurant[];
|
initialRestaurants: Restaurant[];
|
||||||
baseUrl: string;
|
baseUrl: string;
|
||||||
}) {
|
}) {
|
||||||
|
const t = useTranslations('admin');
|
||||||
const [restaurants, setRestaurants] = useState(initialRestaurants);
|
const [restaurants, setRestaurants] = useState(initialRestaurants);
|
||||||
const [name, setName] = useState('');
|
const [name, setName] = useState('');
|
||||||
const [slug, setSlug] = useState('');
|
const [slug, setSlug] = useState('');
|
||||||
@@ -74,64 +76,64 @@ export default function AdminPanel({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="mx-auto max-w-3xl p-4 pb-16">
|
<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">
|
<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">
|
<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">
|
<label className="flex flex-1 flex-col gap-1 text-center text-sm">
|
||||||
Nombre
|
{t('name')}
|
||||||
<input
|
<input
|
||||||
value={name}
|
value={name}
|
||||||
onChange={(e) => setName(e.target.value)}
|
onChange={(e) => setName(e.target.value)}
|
||||||
className="glass-soft rounded-2xl px-4 py-2.5 outline-none"
|
className="glass-soft rounded-2xl px-4 py-2.5 outline-none"
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<label className="flex flex-1 flex-col gap-1 text-sm">
|
<label className="flex flex-1 flex-col gap-1 text-center text-sm">
|
||||||
Slug (opcional)
|
{t('slugOptional')}
|
||||||
<input
|
<input
|
||||||
value={slug}
|
value={slug}
|
||||||
onChange={(e) => setSlug(e.target.value)}
|
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"
|
className="glass-soft rounded-2xl px-4 py-2.5 outline-none"
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<label className="flex flex-col gap-1 text-sm">
|
<label className="flex flex-col gap-1 text-sm">
|
||||||
Idioma
|
{t('language')}
|
||||||
<select
|
<select
|
||||||
value={defaultLocale}
|
value={defaultLocale}
|
||||||
onChange={(e) => setDefaultLocale(e.target.value)}
|
onChange={(e) => setDefaultLocale(e.target.value)}
|
||||||
className="glass-soft rounded-2xl px-4 py-2.5 outline-none"
|
className="glass-soft rounded-2xl px-4 py-2.5 outline-none"
|
||||||
>
|
>
|
||||||
<option value="es">ES</option>
|
<option value="es">{t('localeEs')}</option>
|
||||||
<option value="en">EN</option>
|
<option value="en">{t('localeEn')}</option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<button
|
<button
|
||||||
disabled={creating}
|
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>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{justCreated && (
|
{justCreated && (
|
||||||
<div className="mt-4 rounded-2xl border border-amber-300 bg-amber-50/70 p-4 text-sm">
|
<div className="mt-4 rounded-2xl border border-amber-300 bg-amber-50/70 p-4 text-sm">
|
||||||
<p className="mb-2 font-semibold">
|
<p className="mb-2 font-semibold">
|
||||||
Restaurante «{justCreated.name}» creado. Guarda estas credenciales (se muestran una vez):
|
{t('createdNotice', { name: justCreated.name })}
|
||||||
</p>
|
</p>
|
||||||
<ul className="space-y-1">
|
<ul className="space-y-1">
|
||||||
<li>
|
<li>
|
||||||
<strong>Usuario:</strong> {justCreated.username}
|
<strong>{t('username')}:</strong> {justCreated.username}
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<strong>Contraseña:</strong> <code>{justCreated.password}</code>
|
<strong>{t('password')}:</strong> <code>{justCreated.password}</code>
|
||||||
</li>
|
</li>
|
||||||
<li className="break-all">
|
<li className="break-all">
|
||||||
<strong>Link de editor:</strong> {editorLink(justCreated)}
|
<strong>{t('editorLink')}:</strong> {editorLink(justCreated)}
|
||||||
</li>
|
</li>
|
||||||
<li className="break-all">
|
<li className="break-all">
|
||||||
<strong>Link público:</strong> {publicLink(justCreated.slug)}
|
<strong>{t('publicLink')}:</strong> {publicLink(justCreated.slug)}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -139,9 +141,11 @@ export default function AdminPanel({
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section className="glass rounded-3xl p-5">
|
<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">
|
<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) => (
|
{restaurants.map((r) => (
|
||||||
<div key={r.id} className="glass-soft rounded-2xl p-4">
|
<div key={r.id} className="glass-soft rounded-2xl p-4">
|
||||||
<div className="flex items-center justify-between gap-2">
|
<div className="flex items-center justify-between gap-2">
|
||||||
@@ -151,19 +155,19 @@ export default function AdminPanel({
|
|||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
onClick={() => toggleActive(r)}
|
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 ? 'bg-green-100 text-green-800' : 'bg-gray-200 text-gray-600'
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{r.active ? 'activo' : 'inactivo'}
|
{r.active ? t('statusActive') : t('statusInactive')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-2 space-y-1 text-xs">
|
<div className="mt-2 space-y-1 text-xs">
|
||||||
<a href={publicLink(r.slug)} target="_blank" className="block break-all text-[var(--accent)]">
|
<a href={publicLink(r.slug)} target="_blank" className="block break-all text-[#dc2626]">
|
||||||
público: {publicLink(r.slug)}
|
{t('publicPrefix')}: {publicLink(r.slug)}
|
||||||
</a>
|
</a>
|
||||||
<a href={editorLink(r)} target="_blank" className="block break-all text-[var(--accent)]">
|
<a href={editorLink(r)} target="_blank" className="block break-all text-[#dc2626]">
|
||||||
editor: {editorLink(r)}
|
{t('editorPrefix')}: {editorLink(r)}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -103,12 +103,15 @@ export default function BrandTab({
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-2 flex gap-2">
|
<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')}
|
{uploading === 'banner' ? '…' : t('uploadBanner')}
|
||||||
<input type="file" accept="image/*" hidden onChange={(e) => upload('banner', e.target.files?.[0] ?? null)} />
|
<input type="file" accept="image/*" hidden onChange={(e) => upload('banner', e.target.files?.[0] ?? null)} />
|
||||||
</label>
|
</label>
|
||||||
{banner && (
|
{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')}
|
{tc('delete')}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
@@ -128,12 +131,15 @@ export default function BrandTab({
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col gap-2">
|
<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')}
|
{uploading === 'profile' ? '…' : t('uploadLogo')}
|
||||||
<input type="file" accept="image/*" hidden onChange={(e) => upload('profile', e.target.files?.[0] ?? null)} />
|
<input type="file" accept="image/*" hidden onChange={(e) => upload('profile', e.target.files?.[0] ?? null)} />
|
||||||
</label>
|
</label>
|
||||||
{profile && (
|
{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')}
|
{tc('delete')}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
@@ -149,7 +155,7 @@ export default function BrandTab({
|
|||||||
<button
|
<button
|
||||||
key={p}
|
key={p}
|
||||||
onClick={() => addLink(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}
|
+ {p}
|
||||||
</button>
|
</button>
|
||||||
@@ -174,13 +180,16 @@ export default function BrandTab({
|
|||||||
invalid ? 'ring-1 ring-red-400' : ''
|
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>
|
</button>
|
||||||
</div>
|
</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')}
|
+ {t('addLink')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -189,7 +198,7 @@ export default function BrandTab({
|
|||||||
<button
|
<button
|
||||||
onClick={save}
|
onClick={save}
|
||||||
disabled={saving}
|
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 ? '✓ ' : ''}
|
{saved ? '✓ ' : ''}
|
||||||
{tc('save')}
|
{tc('save')}
|
||||||
|
|||||||
@@ -158,19 +158,22 @@ export default function CatalogTab({
|
|||||||
<a
|
<a
|
||||||
href={`/${slug}`}
|
href={`/${slug}`}
|
||||||
target="_blank"
|
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')}
|
👁 {t('viewMenu')}
|
||||||
</a>
|
</a>
|
||||||
<button
|
<button
|
||||||
onClick={() => setImportOpen(true)}
|
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')}
|
✨ {ti('loadMenu')}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onClick={onPublish}
|
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')}
|
{t('saveAndPublish')}
|
||||||
</button>
|
</button>
|
||||||
@@ -179,7 +182,7 @@ export default function CatalogTab({
|
|||||||
{/* Global macros toggle — lives here with catalog assembly (near Cargar menú) */}
|
{/* 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="glass flex items-center justify-between gap-3 rounded-3xl p-4">
|
||||||
<div className="min-w-0">
|
<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">
|
<div className="text-xs text-[var(--text)]/55">
|
||||||
{showMacros ? t('showMacrosHint') : t('showMacrosDisclaimer')}
|
{showMacros ? t('showMacrosHint') : t('showMacrosDisclaimer')}
|
||||||
</div>
|
</div>
|
||||||
@@ -188,7 +191,7 @@ export default function CatalogTab({
|
|||||||
onClick={toggleGlobalMacros}
|
onClick={toggleGlobalMacros}
|
||||||
aria-pressed={showMacros}
|
aria-pressed={showMacros}
|
||||||
className={`relative h-7 w-12 shrink-0 rounded-full transition ${
|
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
|
<span
|
||||||
@@ -239,7 +242,7 @@ export default function CatalogTab({
|
|||||||
<span className="text-[var(--text)]/70">{t('sectionMacros')}</span>
|
<span className="text-[var(--text)]/70">{t('sectionMacros')}</span>
|
||||||
<span
|
<span
|
||||||
className={`relative h-5 w-9 shrink-0 rounded-full transition ${
|
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
|
<span
|
||||||
@@ -308,7 +311,7 @@ export default function CatalogTab({
|
|||||||
|
|
||||||
<button
|
<button
|
||||||
onClick={() => addProduct(s.id)}
|
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')}
|
+ {t('addDish')}
|
||||||
</button>
|
</button>
|
||||||
@@ -317,7 +320,8 @@ export default function CatalogTab({
|
|||||||
|
|
||||||
<button
|
<button
|
||||||
onClick={addSection}
|
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')}
|
+ {t('newSection')}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ import { useTranslations } from 'next-intl';
|
|||||||
import type { EditorData, EditorSection } from './types';
|
import type { EditorData, EditorSection } from './types';
|
||||||
import LanguageSwitch from '@/components/LanguageSwitch';
|
import LanguageSwitch from '@/components/LanguageSwitch';
|
||||||
import CatalogTab from './CatalogTab';
|
import CatalogTab from './CatalogTab';
|
||||||
import PaletteTab from './PaletteTab';
|
|
||||||
import BrandTab from './BrandTab';
|
import BrandTab from './BrandTab';
|
||||||
import OrdersTab from './OrdersTab';
|
import OrdersTab from './OrdersTab';
|
||||||
import QrTab from './QrTab';
|
import QrTab from './QrTab';
|
||||||
import PublishModal from './PublishModal';
|
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 }) {
|
export default function Editor({ data, baseUrl }: { data: EditorData; baseUrl: string }) {
|
||||||
const t = useTranslations('editor');
|
const t = useTranslations('editor');
|
||||||
@@ -23,12 +23,11 @@ export default function Editor({ data, baseUrl }: { data: EditorData; baseUrl: s
|
|||||||
const [publishOpen, setPublishOpen] = useState(false);
|
const [publishOpen, setPublishOpen] = useState(false);
|
||||||
const [publishedName, setPublishedName] = useState(data.publishedVersionName);
|
const [publishedName, setPublishedName] = useState(data.publishedVersionName);
|
||||||
|
|
||||||
const tabs: { id: Tab; label: string; icon: string }[] = [
|
const tabs: { id: Tab; label: string; Icon: LucideIcon }[] = [
|
||||||
{ id: 'catalog', label: t('catalog'), icon: '📋' },
|
{ id: 'catalog', label: t('catalog'), Icon: ClipboardList },
|
||||||
{ id: 'palette', label: t('palette'), icon: '🎨' },
|
{ id: 'brand', label: t('brand'), Icon: Store },
|
||||||
{ id: 'brand', label: t('brand'), icon: '🏷️' },
|
{ id: 'orders', label: t('orders'), Icon: Bell },
|
||||||
{ id: 'orders', label: t('orders'), icon: '🔔' },
|
{ id: 'qr', label: t('qr'), Icon: QrCode },
|
||||||
{ id: 'qr', label: t('qr'), icon: '🔳' },
|
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -55,7 +54,6 @@ export default function Editor({ data, baseUrl }: { data: EditorData; baseUrl: s
|
|||||||
onRestored={(name) => setPublishedName(name)}
|
onRestored={(name) => setPublishedName(name)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{tab === 'palette' && <PaletteTab slug={data.slug} initialPalette={data.palette} />}
|
|
||||||
{tab === 'brand' && (
|
{tab === 'brand' && (
|
||||||
<BrandTab
|
<BrandTab
|
||||||
slug={data.slug}
|
slug={data.slug}
|
||||||
@@ -83,20 +81,24 @@ export default function Editor({ data, baseUrl }: { data: EditorData; baseUrl: s
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Bottom tab bar */}
|
{/* Bottom dock navigation */}
|
||||||
<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">
|
<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">
|
||||||
{tabs.map((x) => (
|
<div className="dock-bar">
|
||||||
<button
|
{tabs.map(({ id, label, Icon }) => (
|
||||||
key={x.id}
|
<button
|
||||||
onClick={() => setTab(x.id)}
|
key={id}
|
||||||
className={`flex flex-1 flex-col items-center gap-0.5 rounded-2xl py-2 text-[11px] font-medium transition ${
|
onClick={() => setTab(id)}
|
||||||
tab === x.id ? 'bg-white/60 text-[var(--accent)]' : 'text-[var(--text)]/60'
|
className={`dock-btn ${tab === id ? 'is-active' : ''}`}
|
||||||
}`}
|
aria-label={label}
|
||||||
>
|
>
|
||||||
<span className="text-lg">{x.icon}</span>
|
<span className="dock-tip">{label}</span>
|
||||||
{x.label}
|
<span className="dock-chip">
|
||||||
</button>
|
<Icon className="h-[26px] w-[26px]" />
|
||||||
))}
|
</span>
|
||||||
|
<span className="dock-dot" />
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
{publishOpen && (
|
{publishOpen && (
|
||||||
|
|||||||
@@ -40,11 +40,23 @@ export default function EditorLogin({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="flex min-h-screen items-center justify-center p-4">
|
<main className="relative flex min-h-screen items-center justify-center overflow-hidden p-4">
|
||||||
<form onSubmit={submit} className="glass flex w-full max-w-sm flex-col gap-3 rounded-3xl p-6">
|
<video
|
||||||
<h1 className="display text-2xl font-semibold">{name}</h1>
|
autoPlay
|
||||||
<p className="text-sm text-[var(--text)]/60">{t('login')}</p>
|
loop
|
||||||
{!secret && <p className="text-sm text-amber-700">{t('invalidLink')}</p>}
|
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
|
<input
|
||||||
value={username}
|
value={username}
|
||||||
onChange={(e) => setUsername(e.target.value)}
|
onChange={(e) => setUsername(e.target.value)}
|
||||||
@@ -59,10 +71,11 @@ export default function EditorLogin({
|
|||||||
placeholder={t('password')}
|
placeholder={t('password')}
|
||||||
className="glass-soft rounded-2xl px-4 py-3 outline-none"
|
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
|
<button
|
||||||
disabled={loading || !secret}
|
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')}
|
{t('login')}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -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 secs = Math.max(0, Math.floor((end - start) / 1000));
|
||||||
const mins = secs / 60;
|
const mins = secs / 60;
|
||||||
const label = `${Math.floor(secs / 60)}:${(secs % 60).toString().padStart(2, '0')}`;
|
const label = `${Math.floor(secs / 60)}:${(secs % 60).toString().padStart(2, '0')}`;
|
||||||
const color = it.delivered
|
// Threshold tier reused for both the timer pill color and the pulsing status pill class.
|
||||||
? '#6b7280'
|
const tier = it.delivered ? 'done' : mins < th.green ? 'green' : mins < th.yellow ? 'yellow' : 'red';
|
||||||
: mins < th.green
|
const color =
|
||||||
? '#15803d'
|
tier === 'done' ? '#6b7280' : tier === 'green' ? '#28bd1c' : tier === 'yellow' ? '#fce167' : '#ef4444';
|
||||||
: mins < th.yellow
|
const textColor = tier === 'yellow' ? 'rgba(0,0,0,.72)' : '#fff';
|
||||||
? '#b45309'
|
const pulseClass = tier === 'green' ? 'pendiente-green' : tier === 'yellow' ? 'pendiente-yellow' : 'pendiente-red';
|
||||||
: '#dc2626';
|
return { label, color, textColor, pulseClass };
|
||||||
return { label, color };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group a subaccount's items into batches (by batchId), sorted by start time.
|
// Group a subaccount's items into batches (by batchId), sorted by start time.
|
||||||
@@ -233,21 +232,21 @@ export default function OrdersTab({
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex shrink-0 items-center gap-2 text-sm">
|
<div className="flex shrink-0 items-center gap-2 text-sm">
|
||||||
<span className="flex items-center gap-1">
|
<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
|
<input
|
||||||
type="number" min={1} max={120} value={green}
|
type="number" min={1} max={120} value={green}
|
||||||
onChange={(e) => setGreen(Math.max(1, Math.min(120, Number(e.target.value) || 1)))}
|
onChange={(e) => setGreen(Math.max(1, Math.min(120, Number(e.target.value) || 1)))}
|
||||||
onBlur={() => patchSettings({ timerGreenMax: green })}
|
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>
|
||||||
<span className="flex items-center gap-1">
|
<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
|
<input
|
||||||
type="number" min={1} max={240} value={yellow}
|
type="number" min={1} max={240} value={yellow}
|
||||||
onChange={(e) => setYellow(Math.max(1, Math.min(240, Number(e.target.value) || 1)))}
|
onChange={(e) => setYellow(Math.max(1, Math.min(240, Number(e.target.value) || 1)))}
|
||||||
onBlur={() => patchSettings({ timerYellowMax: yellow })}
|
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>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -263,7 +262,7 @@ export default function OrdersTab({
|
|||||||
type="number" min={1} max={720} value={retention}
|
type="number" min={1} max={720} value={retention}
|
||||||
onChange={(e) => setRetention(Math.max(1, Math.min(720, Number(e.target.value) || 1)))}
|
onChange={(e) => setRetention(Math.max(1, Math.min(720, Number(e.target.value) || 1)))}
|
||||||
onBlur={() => patchSettings({ orderRetentionHours: retention })}
|
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>
|
<span className="text-xs text-[var(--text)]/55">{t('hours')}</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -276,8 +275,8 @@ export default function OrdersTab({
|
|||||||
{ordersEnabled && waiterCalls.length > 0 && (
|
{ordersEnabled && waiterCalls.length > 0 && (
|
||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2">
|
||||||
{waiterCalls.map((c, i) => (
|
{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">
|
<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">
|
||||||
🔔 <strong>{t('table')} {c.tableNumber}</strong>
|
<span className="font-bold">{t('waiterAlert', { table: c.tableNumber })}</span>
|
||||||
<button onClick={() => setWaiterCalls((prev) => prev.filter((_, idx) => idx !== i))} className="ml-auto">✕</button>
|
<button onClick={() => setWaiterCalls((prev) => prev.filter((_, idx) => idx !== i))} className="ml-auto">✕</button>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
@@ -338,10 +337,9 @@ function TableCard({
|
|||||||
const allPaid = subaccounts.every((o) => o.paid);
|
const allPaid = subaccounts.every((o) => o.paid);
|
||||||
|
|
||||||
return (
|
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">
|
<div className="flex items-center justify-between gap-2">
|
||||||
<span className="display text-lg font-semibold">{t('table')} {table}</span>
|
<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>
|
</div>
|
||||||
|
|
||||||
{subaccounts.map((sub) => (
|
{subaccounts.map((sub) => (
|
||||||
@@ -366,7 +364,8 @@ function TableCard({
|
|||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
onClick={() => onCompleteTable(subaccounts.map((s) => s.id))}
|
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')}
|
{t('completeTable')}
|
||||||
</button>
|
</button>
|
||||||
@@ -450,18 +449,18 @@ function SubaccountCard({
|
|||||||
{it.note && <span className="block text-xs text-[var(--accent)]">↳ {it.note}</span>}
|
{it.note && <span className="block text-xs text-[var(--accent)]">↳ {it.note}</span>}
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
className="shrink-0 rounded-full px-2 py-0.5 font-mono text-xs font-semibold text-white"
|
className="shrink-0 rounded-full px-2 py-0.5 font-mono text-xs font-semibold"
|
||||||
style={{ background: tm.color }}
|
style={{ background: tm.color, color: tm.textColor }}
|
||||||
>
|
>
|
||||||
{tm.label}
|
{tm.label}
|
||||||
</span>
|
</span>
|
||||||
<button
|
<button
|
||||||
onClick={() => it.id && onDeliver(sub.id, it.id, !it.delivered)}
|
onClick={() => it.id && onDeliver(sub.id, it.id, !it.delivered)}
|
||||||
className={`shrink-0 rounded-full px-2 py-1 text-[10px] font-medium ${
|
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>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
@@ -561,7 +560,8 @@ function ItemsEditPanel({
|
|||||||
<button
|
<button
|
||||||
onClick={async () => { if (!items.length || saving) return; setSaving(true); try { await onSave(items); } finally { setSaving(false); } }}
|
onClick={async () => { if (!items.length || saving) return; setSaving(true); try { await onSave(items); } finally { setSaving(false); } }}
|
||||||
disabled={saving || items.length === 0}
|
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')}
|
{tc('save')}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -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>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from 'next-intl';
|
||||||
import type { EditorProduct, EditorSection } from './types';
|
import type { EditorProduct, EditorSection } from './types';
|
||||||
import { MACRO_KEYS } from '@/lib/macros';
|
import { MACRO_KEYS, MACRO_COLORS } from '@/lib/macros';
|
||||||
import { api } from './api';
|
import { api } from './api';
|
||||||
|
|
||||||
const ALLERGENS = ['gluten', 'lácteos', 'frutos secos', 'mariscos', 'huevo', 'soya', 'pescado'];
|
const ALLERGENS = ['gluten', 'lácteos', 'frutos secos', 'mariscos', 'huevo', 'soya', 'pescado'];
|
||||||
@@ -26,6 +26,7 @@ export default function ProductEditor({
|
|||||||
}) {
|
}) {
|
||||||
const t = useTranslations('editor');
|
const t = useTranslations('editor');
|
||||||
const tm = useTranslations('macros');
|
const tm = useTranslations('macros');
|
||||||
|
const tc = useTranslations('common');
|
||||||
const [draft, setDraft] = useState<EditorProduct>(product);
|
const [draft, setDraft] = useState<EditorProduct>(product);
|
||||||
const [saving, setSaving] = useState(false);
|
const [saving, setSaving] = useState(false);
|
||||||
const [translating, setTranslating] = useState<string | null>(null);
|
const [translating, setTranslating] = useState<string | null>(null);
|
||||||
@@ -125,10 +126,14 @@ export default function ProductEditor({
|
|||||||
|
|
||||||
return (
|
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="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">
|
<div className="flex items-center justify-between">
|
||||||
<h3 className="display text-lg font-semibold">{t('edit')}</h3>
|
<h3 className="display text-xl font-semibold">{t('edit')}</h3>
|
||||||
<button onClick={onClose} className="glass-pill rounded-full px-3 py-1">
|
<button
|
||||||
|
onClick={onClose}
|
||||||
|
aria-label={tc('close')}
|
||||||
|
className="liquid-btn flex h-9 w-9 items-center justify-center rounded-full text-base"
|
||||||
|
>
|
||||||
✕
|
✕
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -141,19 +146,17 @@ export default function ProductEditor({
|
|||||||
value={draft.name.es ?? ''}
|
value={draft.name.es ?? ''}
|
||||||
onChange={(v) => set('name', { ...draft.name, es: v })}
|
onChange={(v) => set('name', { ...draft.name, es: v })}
|
||||||
/>
|
/>
|
||||||
<div className="flex items-center gap-2">
|
<LocaleInput
|
||||||
<LocaleInput
|
prefix="EN"
|
||||||
prefix="EN"
|
value={draft.name.en ?? ''}
|
||||||
value={draft.name.en ?? ''}
|
onChange={(v) =>
|
||||||
onChange={(v) =>
|
setDraft((d) => ({
|
||||||
setDraft((d) => ({
|
...d,
|
||||||
...d,
|
name: { ...d.name, en: v },
|
||||||
name: { ...d.name, en: v },
|
translationStatus: { ...d.translationStatus, en: 'reviewed' },
|
||||||
translationStatus: { ...d.translationStatus, en: 'reviewed' },
|
}))
|
||||||
}))
|
}
|
||||||
}
|
/>
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<TranslateRow
|
<TranslateRow
|
||||||
loading={translating === 'name'}
|
loading={translating === 'name'}
|
||||||
status={enStatus}
|
status={enStatus}
|
||||||
@@ -202,14 +205,14 @@ export default function ProductEditor({
|
|||||||
min={0}
|
min={0}
|
||||||
value={draft.price}
|
value={draft.price}
|
||||||
onChange={(e) => set('price', Number(e.target.value))}
|
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>
|
||||||
<Field label={t('section')} className="flex-1">
|
<Field label={t('section')} className="flex-1">
|
||||||
<select
|
<select
|
||||||
value={draft.sectionId}
|
value={draft.sectionId}
|
||||||
onChange={(e) => set('sectionId', e.target.value)}
|
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) => (
|
{sections.map((s) => (
|
||||||
<option key={s.id} value={s.id}>
|
<option key={s.id} value={s.id}>
|
||||||
@@ -248,7 +251,10 @@ export default function ProductEditor({
|
|||||||
</div>
|
</div>
|
||||||
</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 ? '…' : '+'}
|
{uploading ? '…' : '+'}
|
||||||
<input
|
<input
|
||||||
type="file"
|
type="file"
|
||||||
@@ -262,12 +268,14 @@ export default function ProductEditor({
|
|||||||
</Field>
|
</Field>
|
||||||
|
|
||||||
{/* Macros */}
|
{/* Macros */}
|
||||||
<Field label="Macros">
|
<Field label={tm('title')}>
|
||||||
{draft.aiEstimated.macros && <EstimatedBadge />}
|
{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) => (
|
{MACRO_KEYS.map((key) => (
|
||||||
<label key={key} className="flex flex-col gap-1 text-xs">
|
<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
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
min={0}
|
min={0}
|
||||||
@@ -283,7 +291,7 @@ export default function ProductEditor({
|
|||||||
aiEstimated: { ...d.aiEstimated, macros: false },
|
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>
|
</label>
|
||||||
))}
|
))}
|
||||||
@@ -315,17 +323,20 @@ export default function ProductEditor({
|
|||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
|
|
||||||
<div className="flex gap-2 pt-1">
|
{/* Actions */}
|
||||||
|
<div className="mt-1 flex gap-3 border-t border-white/30 pt-5">
|
||||||
<button
|
<button
|
||||||
onClick={() => onDelete(draft)}
|
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')}
|
{t('delete')}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onClick={save}
|
onClick={save}
|
||||||
disabled={saving}
|
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')}
|
{t('save')}
|
||||||
</button>
|
</button>
|
||||||
@@ -354,8 +365,8 @@ function Field({
|
|||||||
className?: string;
|
className?: string;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<div className={`flex flex-col gap-1.5 ${className}`}>
|
<div className={`flex flex-col gap-2 ${className}`}>
|
||||||
<span className="text-xs font-medium text-[var(--text)]/60">{label}</span>
|
<span className="text-sm font-medium text-[var(--text)]/70">{label}</span>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -372,7 +383,7 @@ function LocaleInput({
|
|||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<div className="glass-soft flex items-center gap-2 rounded-2xl px-3">
|
<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
|
<input
|
||||||
value={value}
|
value={value}
|
||||||
onChange={(e) => onChange(e.target.value)}
|
onChange={(e) => onChange(e.target.value)}
|
||||||
@@ -397,7 +408,8 @@ function TranslateRow({
|
|||||||
<button
|
<button
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
disabled={loading}
|
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')}`}
|
{loading ? '…' : `✨ ${t('translateAi')}`}
|
||||||
</button>
|
</button>
|
||||||
@@ -429,10 +441,10 @@ function Chips({
|
|||||||
<button
|
<button
|
||||||
key={o}
|
key={o}
|
||||||
onClick={() => onToggle(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)
|
selected.includes(o)
|
||||||
? 'bg-[var(--accent)] text-white'
|
? 'bg-neutral-900 text-white'
|
||||||
: 'glass-soft text-[var(--text)]/70'
|
: 'glass-soft text-[var(--text)]/70 hover:text-[var(--text)]'
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{o}
|
{o}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ export default function PublishModal({
|
|||||||
const t = useTranslations('editor');
|
const t = useTranslations('editor');
|
||||||
const tc = useTranslations('common');
|
const tc = useTranslations('common');
|
||||||
const [name, setName] = useState('');
|
const [name, setName] = useState('');
|
||||||
const [suggestions, setSuggestions] = useState(false);
|
|
||||||
const [publishing, setPublishing] = useState(false);
|
const [publishing, setPublishing] = useState(false);
|
||||||
const [success, setSuccess] = useState<string | null>(null);
|
const [success, setSuccess] = useState<string | null>(null);
|
||||||
|
|
||||||
@@ -26,7 +25,7 @@ export default function PublishModal({
|
|||||||
try {
|
try {
|
||||||
const res = await api<{ versionName: string }>(slug, '/publish', {
|
const res = await api<{ versionName: string }>(slug, '/publish', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
json: { versionName: name.trim(), generateSuggestions: suggestions },
|
json: { versionName: name.trim() },
|
||||||
});
|
});
|
||||||
setSuccess(res.versionName);
|
setSuccess(res.versionName);
|
||||||
onPublished(res.versionName);
|
onPublished(res.versionName);
|
||||||
@@ -62,20 +61,6 @@ export default function PublishModal({
|
|||||||
className="glass-soft rounded-2xl px-4 py-3 outline-none"
|
className="glass-soft rounded-2xl px-4 py-3 outline-none"
|
||||||
/>
|
/>
|
||||||
</label>
|
</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">
|
<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">
|
||||||
{tc('cancel')}
|
{tc('cancel')}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export default function SectionTitleEditor({
|
|||||||
value={value}
|
value={value}
|
||||||
onChange={(e) => setValue(e.target.value)}
|
onChange={(e) => setValue(e.target.value)}
|
||||||
onBlur={commit}
|
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"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -61,10 +61,10 @@ export default function VersionHistory({
|
|||||||
{versions.map((v) => (
|
{versions.map((v) => (
|
||||||
<div key={v.id} className="glass-soft flex items-center gap-2 rounded-2xl px-3 py-2">
|
<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="min-w-0 flex-1">
|
||||||
<div className="truncate text-sm font-medium">
|
<div className="flex min-w-0 items-center gap-2">
|
||||||
{v.versionName}
|
<span className="truncate text-sm font-medium">{v.versionName}</span>
|
||||||
{v.id === publishedId && (
|
{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')}
|
{t('publishedVersion')}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
@@ -79,13 +79,15 @@ export default function VersionHistory({
|
|||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button
|
{v.id !== publishedId && (
|
||||||
onClick={() => restore(v)}
|
<button
|
||||||
disabled={restoring === v.id}
|
onClick={() => restore(v)}
|
||||||
className="glass-pill rounded-full px-3 py-1 text-xs font-medium disabled:opacity-50"
|
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>
|
{tc('restore')}
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useState } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
import { useLocale, useTranslations } from 'next-intl';
|
import { useLocale, useTranslations } from 'next-intl';
|
||||||
import type { SnapshotProduct } from '@/lib/types';
|
import type { SnapshotProduct } from '@/lib/types';
|
||||||
import SuggestionCarousel from './SuggestionCarousel';
|
import SuggestionCarousel from './SuggestionCarousel';
|
||||||
|
import MediaThumb from './MediaThumb';
|
||||||
|
|
||||||
type Recommendation = { dish: string; reason: string; type?: 'direct' | 'complement' };
|
type Recommendation = { dish: string; reason: string; type?: 'direct' | 'complement' };
|
||||||
|
|
||||||
@@ -13,27 +14,40 @@ export default function AiConsultant({
|
|||||||
ordersEnabled,
|
ordersEnabled,
|
||||||
onAdd,
|
onAdd,
|
||||||
resolveDish,
|
resolveDish,
|
||||||
suggestions,
|
buildSuggestions,
|
||||||
}: {
|
}: {
|
||||||
slug: string;
|
slug: string;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
ordersEnabled: boolean;
|
ordersEnabled: boolean;
|
||||||
onAdd: (p: SnapshotProduct) => void;
|
onAdd: (p: SnapshotProduct) => void;
|
||||||
resolveDish: (name: string) => SnapshotProduct | undefined;
|
resolveDish: (name: string) => SnapshotProduct | undefined;
|
||||||
suggestions: SnapshotProduct[];
|
buildSuggestions: (seed: number, excludeIds?: string[]) => SnapshotProduct[];
|
||||||
}) {
|
}) {
|
||||||
const t = useTranslations('ai');
|
const t = useTranslations('ai');
|
||||||
const tm = useTranslations('menu');
|
const tm = useTranslations('menu');
|
||||||
const locale = useLocale();
|
const locale = useLocale();
|
||||||
const [question, setQuestion] = useState('');
|
const [question, setQuestion] = useState('');
|
||||||
|
const [asked, setAsked] = useState(''); // the submitted question, shown above the answer
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [answer, setAnswer] = useState<{ intro?: string; recommendations: Recommendation[] } | null>(
|
const [answer, setAnswer] = useState<{ intro?: string; recommendations: Recommendation[] } | null>(
|
||||||
null,
|
null,
|
||||||
);
|
);
|
||||||
const [error, setError] = useState(false);
|
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() {
|
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);
|
setLoading(true);
|
||||||
setError(false);
|
setError(false);
|
||||||
setAnswer(null);
|
setAnswer(null);
|
||||||
@@ -41,7 +55,7 @@ export default function AiConsultant({
|
|||||||
const res = await fetch(`/api/${slug}/ai-consult`, {
|
const res = await fetch(`/api/${slug}/ai-consult`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({ question, locale }),
|
body: JSON.stringify({ question: q, locale }),
|
||||||
});
|
});
|
||||||
if (!res.ok) throw new Error('failed');
|
if (!res.ok) throw new Error('failed');
|
||||||
setAnswer(await res.json());
|
setAnswer(await res.json());
|
||||||
@@ -54,16 +68,25 @@ export default function AiConsultant({
|
|||||||
|
|
||||||
function Card(r: Recommendation, key: number) {
|
function Card(r: Recommendation, key: number) {
|
||||||
const product = resolveDish(r.dish);
|
const product = resolveDish(r.dish);
|
||||||
|
const cover = product ? [...product.media].sort((a, b) => a.order - b.order)[0] : undefined;
|
||||||
return (
|
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="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>
|
<p className="text-sm text-[var(--text)]/80">{r.reason}</p>
|
||||||
</div>
|
</div>
|
||||||
{ordersEnabled && product && (
|
{ordersEnabled && product && (
|
||||||
<button
|
<button
|
||||||
onClick={() => onAdd(product)}
|
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')}
|
{tm('addToOrder')}
|
||||||
</button>
|
</button>
|
||||||
@@ -74,21 +97,39 @@ export default function AiConsultant({
|
|||||||
|
|
||||||
return (
|
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="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">
|
<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 onClick={onClose} className="glass-pill rounded-full px-3 py-1">
|
||||||
✕
|
✕
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="min-h-[6rem] flex-1 overflow-y-auto">
|
<div className="flex min-h-[6rem] flex-1 flex-col gap-3 overflow-y-auto no-scrollbar">
|
||||||
{!answer && !loading && <p className="text-sm text-[var(--text)]/60">{t('intro')}</p>}
|
{!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>}
|
{loading && <p className="animate-pulse text-sm text-[var(--text)]/60">{t('thinking')}</p>}
|
||||||
{error && <p className="text-sm text-red-600">⚠️</p>}
|
{error && <p className="text-sm text-red-600">⚠️</p>}
|
||||||
{answer && (
|
{answer && (
|
||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-3">
|
||||||
{answer.intro && <p className="text-sm text-[var(--text)]/80">{answer.intro}</p>}
|
{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 direct = answer.recommendations.filter((r) => r.type !== 'complement');
|
||||||
const complement = 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))}
|
{direct.map((r, i) => Card(r, i))}
|
||||||
{complement.length > 0 && (
|
{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')}
|
{t('pairWith')}
|
||||||
</p>
|
</p>
|
||||||
{complement.map((r, i) => Card(r, direct.length + i))}
|
{complement.map((r, i) => Card(r, direct.length + i))}
|
||||||
@@ -111,7 +152,7 @@ export default function AiConsultant({
|
|||||||
|
|
||||||
{/* Precomputed pairings carousel (reuses the cart component) */}
|
{/* Precomputed pairings carousel (reuses the cart component) */}
|
||||||
{ordersEnabled && suggestions.length > 0 && (
|
{ordersEnabled && suggestions.length > 0 && (
|
||||||
<div className="mt-4">
|
<div className="mt-6">
|
||||||
<SuggestionCarousel products={suggestions} onAdd={onAdd} />
|
<SuggestionCarousel products={suggestions} onAdd={onAdd} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -128,7 +169,8 @@ export default function AiConsultant({
|
|||||||
<button
|
<button
|
||||||
onClick={ask}
|
onClick={ask}
|
||||||
disabled={loading}
|
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>
|
</button>
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ export default function BrandHeader({
|
|||||||
const hasLogo = !!logo;
|
const hasLogo = !!logo;
|
||||||
|
|
||||||
const socialRow = links.length > 0 && (
|
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) => {
|
{links.map((l, i) => {
|
||||||
const Icon = iconFor(l.platform);
|
const Icon = iconFor(l.platform);
|
||||||
return (
|
return (
|
||||||
@@ -84,7 +84,7 @@ export default function BrandHeader({
|
|||||||
<header className="mb-4">
|
<header className="mb-4">
|
||||||
{/* Banner — full-bleed, extends edge-to-edge behind the island. A short
|
{/* 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. */}
|
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 ? (
|
{hasBanner ? (
|
||||||
// eslint-disable-next-line @next/next/no-img-element
|
// eslint-disable-next-line @next/next/no-img-element
|
||||||
<img src={banner!} alt="" className="h-full w-full object-cover" />
|
<img src={banner!} alt="" className="h-full w-full object-cover" />
|
||||||
@@ -100,9 +100,9 @@ export default function BrandHeader({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Logo + name + socials, the avatar centered over the banner's lower edge. */}
|
{/* Logo (left) + name + socials, below the banner. */}
|
||||||
<div className="relative z-10 -mt-12 flex flex-col items-center gap-2 px-2 text-center">
|
<div className="relative z-10 flex items-start gap-3 px-2 pt-5">
|
||||||
<div className="h-24 w-24 overflow-hidden rounded-full border-4 border-white/70 bg-white/50 shadow-lg">
|
<div className="h-24 w-24 shrink-0 overflow-hidden rounded-full border-4 border-white/70 bg-white/50 shadow-lg">
|
||||||
{hasLogo ? (
|
{hasLogo ? (
|
||||||
// eslint-disable-next-line @next/next/no-img-element
|
// eslint-disable-next-line @next/next/no-img-element
|
||||||
<img src={logo!} alt={name} className="h-full w-full object-cover" />
|
<img src={logo!} alt={name} className="h-full w-full object-cover" />
|
||||||
@@ -112,8 +112,10 @@ export default function BrandHeader({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<h1 className="display text-2xl font-semibold leading-tight">{name}</h1>
|
<div className="flex min-w-0 flex-1 flex-col gap-4 pt-1">
|
||||||
{socialRow}
|
<h1 className="display text-2xl font-semibold leading-tight">{name}</h1>
|
||||||
|
{socialRow}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -32,69 +32,68 @@ export default function DishCard({
|
|||||||
const sortedMedia = [...product.media].sort((a, b) => a.order - b.order);
|
const sortedMedia = [...product.media].sort((a, b) => a.order - b.order);
|
||||||
const cover = sortedMedia[0];
|
const cover = sortedMedia[0];
|
||||||
const hasVideo = sortedMedia.some((m) => m.type === 'video');
|
const hasVideo = sortedMedia.some((m) => m.type === 'video');
|
||||||
|
const canAdd = ordersEnabled && !!onAdd;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="flip-scene animate-fade-up"
|
className="flip-scene animate-fade-up"
|
||||||
style={{ animationDelay: `${Math.min(index * 70, 500)}ms` }}
|
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 */}
|
{/* FRONT */}
|
||||||
<div className="flip-face flip-front glass overflow-hidden rounded-3xl">
|
<div
|
||||||
<button
|
className="flip-face flip-front overflow-hidden rounded-3xl bg-white"
|
||||||
className="relative block h-40 w-full"
|
style={{
|
||||||
onClick={() => onOpenGallery(product)}
|
boxShadow:
|
||||||
aria-label={name}
|
'0 22px 40px -12px rgba(40,30,20,.35), 0 8px 16px -8px rgba(40,30,20,.25)',
|
||||||
>
|
}}
|
||||||
<MediaThumb media={cover} alt={name} className="h-40 w-full" />
|
>
|
||||||
{hasVideo && (
|
<div className="p-3 pb-0">
|
||||||
<span className="absolute right-3 top-3 h-3 w-3 animate-pulse-dot rounded-full bg-red-500 shadow" />
|
<button
|
||||||
)}
|
className="relative block w-full"
|
||||||
</button>
|
onClick={() => onOpenGallery(product)}
|
||||||
<div className="flex flex-col gap-2 p-4">
|
aria-label={name}
|
||||||
<div className="flex items-start justify-between gap-2">
|
>
|
||||||
<h3 className="display text-lg font-semibold leading-tight">{name}</h3>
|
<MediaThumb media={cover} alt={name} className="h-44 w-full rounded-2xl" />
|
||||||
<span className="shrink-0 text-base font-bold text-[var(--accent)]">
|
{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)}
|
${product.price.toFixed(2)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{description && (
|
{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">
|
{(showMacros || canAdd) && (
|
||||||
{product.dietTags.map((tag) => (
|
<div className="mt-1 flex w-full items-stretch gap-3">
|
||||||
<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 && (
|
{showMacros && (
|
||||||
<button
|
<button
|
||||||
onClick={() => setFlipped(true)}
|
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>
|
</button>
|
||||||
)}
|
)}
|
||||||
{ordersEnabled && onAdd && (
|
{canAdd && (
|
||||||
<button
|
<button
|
||||||
onClick={() => onAdd(product)}
|
onClick={() => onAdd!(product)}
|
||||||
aria-label={t('addToOrder')}
|
aria-label={t('addToOrder')}
|
||||||
className={`rounded-full bg-[var(--accent)] px-4 py-2 text-sm font-medium text-white ${
|
className="flex-1 rounded-2xl px-3 py-2 text-sm font-semibold leading-tight text-white"
|
||||||
showMacros ? '' : 'flex-1'
|
style={{ background: '#dc2626' }}
|
||||||
}`}
|
|
||||||
>
|
>
|
||||||
{showMacros ? '+' : t('addToOrder')}
|
{t('addToOrderLong')}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -103,17 +102,22 @@ export default function DishCard({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* BACK */}
|
{/* BACK */}
|
||||||
<div className="flip-face flip-back glass flex flex-col gap-3 rounded-3xl p-4">
|
<div
|
||||||
<div className="flex items-center justify-between">
|
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>
|
<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>
|
</div>
|
||||||
<MacrosBack macros={product.macros} />
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -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>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -11,19 +11,26 @@ export default function MacrosBack({ macros }: { macros: Macros }) {
|
|||||||
{MACRO_KEYS.map((key) => {
|
{MACRO_KEYS.map((key) => {
|
||||||
const value = macros[key];
|
const value = macros[key];
|
||||||
return (
|
return (
|
||||||
<div key={key} className="glass-soft flex items-center gap-2 rounded-xl px-3 py-2">
|
<div
|
||||||
<span
|
key={key}
|
||||||
className="h-3 w-3 shrink-0 rounded-full"
|
className="macro-cell flex flex-col items-start justify-center gap-1 rounded-xl px-4 py-3.5"
|
||||||
style={{ background: MACRO_COLORS[key] }}
|
style={{ ['--c' as string]: MACRO_COLORS[key] } as React.CSSProperties}
|
||||||
aria-hidden
|
>
|
||||||
/>
|
<div
|
||||||
<div className="min-w-0">
|
className="text-[13px] font-semibold leading-tight"
|
||||||
<div className="text-[11px] leading-tight text-[var(--text)]/60">{t(key)}</div>
|
style={{ color: MACRO_COLORS[key] }}
|
||||||
<div className="text-sm font-semibold" style={{ color: MACRO_COLORS[key] }}>
|
>
|
||||||
{value != null ? `${value}${MACRO_UNIT[key] === 'g' ? ' g' : ''}` : '—'}
|
{t(key)}
|
||||||
{key === 'kcal' && value != null ? ' kcal' : ''}
|
|
||||||
</div>
|
|
||||||
</div>
|
</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>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
|
import { useState } from 'react';
|
||||||
import type { MediaItem } from '@/lib/types';
|
import type { MediaItem } from '@/lib/types';
|
||||||
|
|
||||||
// Renders the first media item as a thumbnail (image or muted video poster).
|
// Renders the first media item as a thumbnail (image or muted video poster).
|
||||||
@@ -12,7 +13,10 @@ export default function MediaThumb({
|
|||||||
alt: string;
|
alt: string;
|
||||||
className?: 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 (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`flex items-center justify-center bg-gradient-to-br from-white/40 to-white/10 text-3xl ${className}`}
|
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
|
loop
|
||||||
playsInline
|
playsInline
|
||||||
preload="metadata"
|
preload="metadata"
|
||||||
|
onError={() => setBroken(true)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line @next/next/no-img-element
|
// 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)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { useLocale, useTranslations } from 'next-intl';
|
import { useLocale, useTranslations } from 'next-intl';
|
||||||
import type { Locale } from '@/i18n/config';
|
import type { Locale } from '@/i18n/config';
|
||||||
import type { MenuSnapshot, SnapshotProduct } from '@/lib/types';
|
import type { MenuSnapshot, SnapshotProduct } from '@/lib/types';
|
||||||
@@ -8,11 +8,13 @@ import { pickText } from '@/lib/text';
|
|||||||
import BrandHeader from './BrandHeader';
|
import BrandHeader from './BrandHeader';
|
||||||
import DishCard from './DishCard';
|
import DishCard from './DishCard';
|
||||||
import ListRow from './ListRow';
|
import ListRow from './ListRow';
|
||||||
import MacroLegend from './MacroLegend';
|
|
||||||
import Gallery from './Gallery';
|
import Gallery from './Gallery';
|
||||||
|
import MediaThumb from './MediaThumb';
|
||||||
import AiConsultant from './AiConsultant';
|
import AiConsultant from './AiConsultant';
|
||||||
import SuggestionCarousel from './SuggestionCarousel';
|
import SuggestionCarousel from './SuggestionCarousel';
|
||||||
import SplitPanel, { type SplitSession } from './SplitPanel';
|
import SplitPanel, { type SplitSession } from './SplitPanel';
|
||||||
|
import { getRecommendations } from '@/lib/recommendations';
|
||||||
|
import { LayoutGrid, List as ListIcon } from 'lucide-react';
|
||||||
|
|
||||||
type ViewMode = 'cards' | 'list';
|
type ViewMode = 'cards' | 'list';
|
||||||
|
|
||||||
@@ -47,7 +49,6 @@ export default function PublicMenu({ menu, slug }: { menu: MenuSnapshot; slug: s
|
|||||||
null,
|
null,
|
||||||
);
|
);
|
||||||
const [aiOpen, setAiOpen] = useState(false);
|
const [aiOpen, setAiOpen] = useState(false);
|
||||||
const [actionsOpen, setActionsOpen] = useState(false);
|
|
||||||
const [cart, setCart] = useState<CartLine[]>([]);
|
const [cart, setCart] = useState<CartLine[]>([]);
|
||||||
const [orderOpen, setOrderOpen] = useState(false);
|
const [orderOpen, setOrderOpen] = useState(false);
|
||||||
const [waiterOpen, setWaiterOpen] = 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.
|
// View preference is intentionally not persisted — always starts on cards.
|
||||||
const [view, setView] = useState<ViewMode>('cards');
|
const [view, setView] = useState<ViewMode>('cards');
|
||||||
const sectionRefs = useRef<Record<string, HTMLElement | null>>({});
|
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
|
// Flat index of active products for pairing lookups (by id) and consultant
|
||||||
// add-to-cart resolution (by normalized name in either locale).
|
// 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;
|
return map;
|
||||||
}, [sections]);
|
}, [sections]);
|
||||||
const pairings = menu.restaurant.pairings ?? {};
|
|
||||||
|
|
||||||
const ordersEnabled = menu.restaurant.ordersEnabled;
|
const ordersEnabled = menu.restaurant.ordersEnabled;
|
||||||
const splitEnabled = ordersEnabled && !!menu.restaurant.splitEnabled;
|
const splitEnabled = ordersEnabled && !!menu.restaurant.splitEnabled;
|
||||||
// Macros hierarchy: global flag AND the section's own flag. The legend appears
|
// Macros hierarchy: shown only if the global flag AND the section's flag are on.
|
||||||
// only if at least one visible section actually shows macros.
|
|
||||||
const globalMacros = menu.restaurant.showMacros;
|
const globalMacros = menu.restaurant.showMacros;
|
||||||
const sectionShowsMacros = (s: { showMacros?: boolean }) => globalMacros && s.showMacros !== false;
|
const sectionShowsMacros = (s: { showMacros?: boolean }) => globalMacros && s.showMacros !== false;
|
||||||
const anyMacros = globalMacros && sections.some((s) => s.showMacros !== false);
|
|
||||||
|
|
||||||
function scrollToSection(id: string) {
|
function scrollToSection(id: string) {
|
||||||
setActiveSection(id);
|
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);
|
const cartCount = cart.reduce((n, l) => n + l.qty, 0);
|
||||||
|
|
||||||
// Contextual pairings for what's in the cart (excluding items already added).
|
// Suggestions are computed locally (no API/tokens) from the menu + cart, as a
|
||||||
// Shared by the cart sheet and the consultant carousel — computed once here.
|
// RANDOM sample re-seeded per carousel open. Consumers pass their own seed (so
|
||||||
const cartSuggestions = useMemo(() => {
|
// reopening reshuffles) and extra excludeIds (e.g. the consultant's own picks).
|
||||||
const inCart = new Set(cart.map((l) => l.product.id));
|
const buildSuggestions = useCallback(
|
||||||
const ids = new Set<string>();
|
(seed: number, excludeIds: string[] = []) =>
|
||||||
for (const line of cart) {
|
getRecommendations(menu, cart.map((l) => l.product.id), { limit: 6, seed, excludeIds }),
|
||||||
for (const id of pairings[line.product.id] ?? []) {
|
[menu, cart],
|
||||||
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]);
|
|
||||||
|
|
||||||
const resolveDish = (dishName: string) => nameIndex.get(normName(dishName));
|
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 (
|
return (
|
||||||
<div className="mx-auto min-h-screen max-w-2xl px-4 pb-48">
|
<div className="mx-auto min-h-screen max-w-2xl px-4 pb-48">
|
||||||
{/* Brand header (banner + logo + name + social icons) */}
|
{/* 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}
|
socialLinks={menu.restaurant.socialLinks}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* Section tabs */}
|
{/* View toggle (Cards / List) + Ask Claude */}
|
||||||
{sections.length > 0 && (
|
<div className="mb-6 mt-2 flex flex-nowrap items-stretch justify-start gap-2">
|
||||||
<nav className="safe-top-sticky sticky z-20 -mx-1 mb-4 flex gap-2 overflow-x-auto px-1 py-1 no-scrollbar">
|
<div className="inline-flex shrink-0 items-stretch gap-1 rounded-full bg-black/5 p-0.5">
|
||||||
{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">
|
|
||||||
<button
|
<button
|
||||||
onClick={() => setView('cards')}
|
onClick={() => setView('cards')}
|
||||||
className={`rounded-full px-3 py-1 font-medium transition ${
|
className={`seg-btn flex items-center gap-1.5 rounded-full px-3 py-2 ${
|
||||||
view === 'cards' ? 'bg-white/70 text-[var(--text)] shadow' : 'text-[var(--text)]/60'
|
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>
|
||||||
<button
|
<button
|
||||||
onClick={() => setView('list')}
|
onClick={() => setView('list')}
|
||||||
className={`rounded-full px-3 py-1 font-medium transition ${
|
className={`seg-btn flex items-center gap-1.5 rounded-full px-3 py-2 ${
|
||||||
view === 'list' ? 'bg-white/70 text-[var(--text)] shadow' : 'text-[var(--text)]/60'
|
view === 'list' ? 'is-active' : ''
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{t('viewList')}
|
<ListIcon className="h-5 w-5 shrink-0" />
|
||||||
|
<span className="text-sm font-semibold">{t('viewList')}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</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>
|
</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 */}
|
||||||
{sections.map((s) => (
|
{sections.map((s) => (
|
||||||
<section
|
<section
|
||||||
@@ -198,7 +299,7 @@ export default function PublicMenu({ menu, slug }: { menu: MenuSnapshot; slug: s
|
|||||||
))}
|
))}
|
||||||
</div>
|
</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) => (
|
{s.products.map((p, i) => (
|
||||||
<DishCard
|
<DishCard
|
||||||
key={p.id}
|
key={p.id}
|
||||||
@@ -217,89 +318,57 @@ export default function PublicMenu({ menu, slug }: { menu: MenuSnapshot; slug: s
|
|||||||
</section>
|
</section>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
{/* Floating actions — ordered vertical stack in the bottom-right corner so
|
{/* Floating actions — vertical stack, bottom-right. */}
|
||||||
they never overlap each other or cover dish names/prices. */}
|
|
||||||
<div className="safe-bottom-fab fixed right-4 z-40 flex flex-col items-end gap-2.5">
|
<div className="safe-bottom-fab fixed right-4 z-40 flex flex-col items-end gap-2.5">
|
||||||
{actionsOpen && (
|
{/* In a split session the cart IS the diner's subaccount → 'My account'.
|
||||||
<div className="animate-spawn flex flex-col items-end gap-2">
|
Otherwise the red 'Order' button (when ordering is enabled). */}
|
||||||
<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. */}
|
|
||||||
{splitSession ? (
|
{splitSession ? (
|
||||||
<button
|
<button
|
||||||
onClick={() => setSplitOpen(true)}
|
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 && (
|
{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}
|
{cartCount}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
) : (
|
) : (
|
||||||
<>
|
ordersEnabled && (
|
||||||
{ordersEnabled && (
|
<button
|
||||||
<button
|
onClick={() => setOrderOpen(true)}
|
||||||
onClick={() => setOrderOpen(true)}
|
aria-label={t('order')}
|
||||||
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('cart')}
|
{t('order')}
|
||||||
{cartCount > 0 && (
|
{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}
|
{cartCount}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</button>
|
</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>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
{/* 'More' (waiter / back to top) — distinct ⋯ icon, not a '+', to avoid
|
|
||||||
confusion with the add-to-cart '+' inside each dish. */}
|
|
||||||
<button
|
<button
|
||||||
onClick={() => setActionsOpen((o) => !o)}
|
onClick={() => setWaiterOpen(true)}
|
||||||
className="glass flex h-11 w-11 items-center justify-center rounded-full text-xl shadow-lg"
|
className="flex h-11 items-center justify-center rounded-full px-5 text-sm font-semibold text-white shadow-lg"
|
||||||
aria-label={t('actions')}
|
style={{ background: '#1e3a5f' }}
|
||||||
>
|
>
|
||||||
{actionsOpen ? '✕' : '⋯'}
|
{t('callWaiter')}
|
||||||
</button>
|
</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>
|
</div>
|
||||||
|
|
||||||
{/* Modals */}
|
{/* Modals */}
|
||||||
@@ -319,7 +388,7 @@ export default function PublicMenu({ menu, slug }: { menu: MenuSnapshot; slug: s
|
|||||||
addToCart(p);
|
addToCart(p);
|
||||||
}}
|
}}
|
||||||
resolveDish={resolveDish}
|
resolveDish={resolveDish}
|
||||||
suggestions={cartSuggestions}
|
buildSuggestions={buildSuggestions}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{orderOpen && (
|
{orderOpen && (
|
||||||
@@ -327,15 +396,11 @@ export default function PublicMenu({ menu, slug }: { menu: MenuSnapshot; slug: s
|
|||||||
slug={slug}
|
slug={slug}
|
||||||
cart={cart}
|
cart={cart}
|
||||||
setCart={setCart}
|
setCart={setCart}
|
||||||
suggestions={cartSuggestions}
|
buildSuggestions={buildSuggestions}
|
||||||
onAdd={addToCart}
|
onAdd={addToCart}
|
||||||
splitEnabled={splitEnabled}
|
splitEnabled={splitEnabled}
|
||||||
onJoinSplit={(tbl) => {
|
onPickSubaccount={joinExistingSubaccount}
|
||||||
// Normal-cart diner discovered the table is in split → switch to split.
|
onCreateSubaccount={createNewSubaccount}
|
||||||
setOrderOpen(false);
|
|
||||||
setSplitPrefillTable(tbl);
|
|
||||||
setSplitOpen(true);
|
|
||||||
}}
|
|
||||||
onClose={() => setOrderOpen(false)}
|
onClose={() => setOrderOpen(false)}
|
||||||
onSent={() => {
|
onSent={() => {
|
||||||
setCart([]);
|
setCart([]);
|
||||||
@@ -386,7 +451,7 @@ function TableInput({ value, onChange }: { value: string; onChange: (v: string)
|
|||||||
value={value}
|
value={value}
|
||||||
onChange={(e) => onChange(e.target.value)}
|
onChange={(e) => onChange(e.target.value)}
|
||||||
placeholder={t('tableNumber')}
|
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,
|
slug,
|
||||||
cart,
|
cart,
|
||||||
setCart,
|
setCart,
|
||||||
suggestions,
|
buildSuggestions,
|
||||||
onAdd,
|
onAdd,
|
||||||
splitEnabled,
|
splitEnabled,
|
||||||
onJoinSplit,
|
onPickSubaccount,
|
||||||
|
onCreateSubaccount,
|
||||||
onClose,
|
onClose,
|
||||||
onSent,
|
onSent,
|
||||||
}: {
|
}: {
|
||||||
slug: string;
|
slug: string;
|
||||||
cart: CartLine[];
|
cart: CartLine[];
|
||||||
setCart: React.Dispatch<React.SetStateAction<CartLine[]>>;
|
setCart: React.Dispatch<React.SetStateAction<CartLine[]>>;
|
||||||
suggestions: SnapshotProduct[];
|
buildSuggestions: (seed: number, excludeIds?: string[]) => SnapshotProduct[];
|
||||||
onAdd: (p: SnapshotProduct) => void;
|
onAdd: (p: SnapshotProduct) => void;
|
||||||
splitEnabled: boolean;
|
splitEnabled: boolean;
|
||||||
onJoinSplit: (table: number) => void;
|
onPickSubaccount: (id: string, name: string | null, table: number) => void;
|
||||||
|
onCreateSubaccount: (name: string, table: number) => void;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
onSent: () => void;
|
onSent: () => void;
|
||||||
}) {
|
}) {
|
||||||
@@ -418,17 +485,35 @@ function OrderPanel({
|
|||||||
const [generalNote, setGeneralNote] = useState('');
|
const [generalNote, setGeneralNote] = useState('');
|
||||||
const [sending, setSending] = useState(false);
|
const [sending, setSending] = useState(false);
|
||||||
const [tableInSplit, setTableInSplit] = 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(() => {
|
useEffect(() => {
|
||||||
if (!splitEnabled || !table) {
|
if (!splitEnabled || !table) {
|
||||||
setTableInSplit(false);
|
setTableInSplit(false);
|
||||||
|
setSubaccounts([]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let cancelled = false;
|
let cancelled = false;
|
||||||
fetch(`/api/${slug}/table-status?table=${Number(table)}`)
|
fetch(`/api/${slug}/table-status?table=${Number(table)}`)
|
||||||
.then((r) => r.json())
|
.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(() => {});
|
.catch(() => {});
|
||||||
return () => {
|
return () => {
|
||||||
cancelled = true;
|
cancelled = true;
|
||||||
@@ -480,20 +565,38 @@ function OrderPanel({
|
|||||||
{cart.length === 0 && <p className="text-sm text-[var(--text)]/60">{t('cartEmpty')}</p>}
|
{cart.length === 0 && <p className="text-sm text-[var(--text)]/60">{t('cartEmpty')}</p>}
|
||||||
{cart.map((l) => (
|
{cart.map((l) => (
|
||||||
<div key={l.product.id} className="glass-soft flex flex-col gap-2 rounded-2xl px-3 py-2">
|
<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">
|
<span className="min-w-0 flex-1 text-sm font-medium">
|
||||||
{pickText(l.product.name, locale)}
|
{pickText(l.product.name, locale)}
|
||||||
</span>
|
</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)}
|
${(l.product.price * l.qty).toFixed(2)}
|
||||||
</span>
|
</span>
|
||||||
<button onClick={() => setQty(l.product.id, -1)} className="px-2 text-lg" aria-label="−">
|
<div
|
||||||
−
|
className="flex shrink-0 items-center gap-1 rounded-full bg-white px-1.5 py-1"
|
||||||
</button>
|
style={{ boxShadow: '0 2px 8px rgba(40,30,20,.15)' }}
|
||||||
<span className="w-5 text-center">{l.qty}</span>
|
>
|
||||||
<button onClick={() => setQty(l.product.id, 1)} className="px-2 text-lg" aria-label="+">
|
<button
|
||||||
+
|
onClick={() => setQty(l.product.id, -1)}
|
||||||
</button>
|
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>
|
</div>
|
||||||
<input
|
<input
|
||||||
value={l.note ?? ''}
|
value={l.note ?? ''}
|
||||||
@@ -508,7 +611,7 @@ function OrderPanel({
|
|||||||
{suggestions.length > 0 && <SuggestionCarousel products={suggestions} onAdd={onAdd} />}
|
{suggestions.length > 0 && <SuggestionCarousel products={suggestions} onAdd={onAdd} />}
|
||||||
|
|
||||||
{cart.length > 0 && (
|
{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>{t('total')}</span>
|
||||||
<span>${total.toFixed(2)}</span>
|
<span>${total.toFixed(2)}</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -528,18 +631,47 @@ function OrderPanel({
|
|||||||
<p className="rounded-2xl bg-amber-50/70 px-3 py-2 text-xs text-amber-800">
|
<p className="rounded-2xl bg-amber-50/70 px-3 py-2 text-xs text-amber-800">
|
||||||
{t('splitDetected', { table: Number(table) })}
|
{t('splitDetected', { table: Number(table) })}
|
||||||
</p>
|
</p>
|
||||||
<button
|
<p className="text-sm font-medium">{t('whoAreYou')}</p>
|
||||||
onClick={() => onJoinSplit(Number(table))}
|
{subaccounts.map((s) => (
|
||||||
className="rounded-2xl bg-[var(--accent)] py-3 font-medium text-white"
|
<button
|
||||||
>
|
key={s.id}
|
||||||
{t('joinSplit', { table: Number(table) })}
|
onClick={() => onPickSubaccount(s.id, s.name, Number(table))}
|
||||||
</button>
|
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>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<button
|
<button
|
||||||
onClick={send}
|
onClick={send}
|
||||||
disabled={!table || cart.length === 0 || sending}
|
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')}
|
{t('confirmOrder')}
|
||||||
</button>
|
</button>
|
||||||
@@ -582,7 +714,7 @@ function WaiterPanel({
|
|||||||
<button
|
<button
|
||||||
onClick={send}
|
onClick={send}
|
||||||
disabled={!table || sending}
|
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')}
|
{t('send')}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { useLocale, useTranslations } from 'next-intl';
|
|||||||
import type { Locale } from '@/i18n/config';
|
import type { Locale } from '@/i18n/config';
|
||||||
import type { SnapshotProduct } from '@/lib/types';
|
import type { SnapshotProduct } from '@/lib/types';
|
||||||
import { pickText } from '@/lib/text';
|
import { pickText } from '@/lib/text';
|
||||||
|
import MediaThumb from './MediaThumb';
|
||||||
|
|
||||||
export type SplitSession = { id: string; name: string; table: number };
|
export type SplitSession = { id: string; name: string; table: number };
|
||||||
type CartLine = { product: SnapshotProduct; qty: number; note?: string };
|
type CartLine = { product: SnapshotProduct; qty: number; note?: string };
|
||||||
@@ -167,7 +168,7 @@ export default function SplitPanel({
|
|||||||
<button
|
<button
|
||||||
onClick={join}
|
onClick={join}
|
||||||
disabled={!name.trim() || !table || busy}
|
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')}
|
{mode === 'split' && table ? t('joinSplit', { table: Number(table) }) : t('createSplit')}
|
||||||
</button>
|
</button>
|
||||||
@@ -185,19 +186,37 @@ export default function SplitPanel({
|
|||||||
{cart.map((l) => (
|
{cart.map((l) => (
|
||||||
<div key={l.product.id} className="glass-soft flex flex-col gap-2 rounded-2xl px-3 py-2">
|
<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-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">
|
<span className="min-w-0 flex-1 text-sm font-medium">
|
||||||
{pickText(l.product.name, locale)}
|
{pickText(l.product.name, locale)}
|
||||||
</span>
|
</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)}
|
${(l.product.price * l.qty).toFixed(2)}
|
||||||
</span>
|
</span>
|
||||||
<button onClick={() => setQty(l.product.id, -1)} className="px-2 text-lg" aria-label="−">
|
<div
|
||||||
−
|
className="flex shrink-0 items-center gap-1 rounded-full bg-white px-1.5 py-1"
|
||||||
</button>
|
style={{ boxShadow: '0 2px 8px rgba(40,30,20,.15)' }}
|
||||||
<span className="w-5 text-center">{l.qty}</span>
|
>
|
||||||
<button onClick={() => setQty(l.product.id, 1)} className="px-2 text-lg" aria-label="+">
|
<button
|
||||||
+
|
onClick={() => setQty(l.product.id, -1)}
|
||||||
</button>
|
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>
|
</div>
|
||||||
<input
|
<input
|
||||||
value={l.note ?? ''}
|
value={l.note ?? ''}
|
||||||
@@ -209,23 +228,26 @@ export default function SplitPanel({
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center justify-between px-1 text-sm">
|
<div className="flex items-center justify-between px-1 text-base">
|
||||||
<span className="font-medium">{t('yourSubtotal')}</span>
|
<span className="font-bold">{t('yourSubtotal')}</span>
|
||||||
<span className="font-semibold">${yourSubtotal.toFixed(2)}</span>
|
<span className="font-semibold">${yourSubtotal.toFixed(2)}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center justify-between px-1 text-sm">
|
<div className="flex items-center justify-between px-1 text-base">
|
||||||
<span className="text-[var(--text)]/70">{t('tableTotal')}</span>
|
<span className="font-bold text-[#dc2626]">{t('tableTotal')}</span>
|
||||||
<span className="font-semibold text-[var(--accent)]">${tableTotal.toFixed(2)}</span>
|
<span className="font-semibold text-[var(--accent)]">${tableTotal.toFixed(2)}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex gap-2">
|
<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')}
|
{t('addDishes')}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onClick={sync}
|
onClick={sync}
|
||||||
disabled={busy}
|
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')}
|
{t('updateSubaccount')}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -62,10 +62,11 @@ export default function SuggestionCarousel({
|
|||||||
<span className="line-clamp-2 text-xs font-medium leading-tight">
|
<span className="line-clamp-2 text-xs font-medium leading-tight">
|
||||||
{pickText(p.name, locale)}
|
{pickText(p.name, locale)}
|
||||||
</span>
|
</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
|
<button
|
||||||
onClick={() => onAdd(p)}
|
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')}
|
{t('addToOrder')}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -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,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -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
@@ -2,6 +2,7 @@ import * as XLSX from 'xlsx';
|
|||||||
import Anthropic from '@anthropic-ai/sdk';
|
import Anthropic from '@anthropic-ai/sdk';
|
||||||
import { getAnthropic, HAIKU_MODEL, SONNET_MODEL } from './anthropic';
|
import { getAnthropic, HAIKU_MODEL, SONNET_MODEL } from './anthropic';
|
||||||
import { parseLenientJson } from './json';
|
import { parseLenientJson } from './json';
|
||||||
|
import { recordUsage } from './usage';
|
||||||
import type { Locale } from '@/i18n/config';
|
import type { Locale } from '@/i18n/config';
|
||||||
|
|
||||||
// Structure returned for review (NOT yet applied to the draft).
|
// Structure returned for review (NOT yet applied to the draft).
|
||||||
@@ -153,6 +154,7 @@ export async function resolveSource(input: {
|
|||||||
export async function extractMenu(
|
export async function extractMenu(
|
||||||
source: Source,
|
source: Source,
|
||||||
defaultLocale: Locale,
|
defaultLocale: Locale,
|
||||||
|
restaurantId?: string,
|
||||||
): Promise<ImportResult> {
|
): Promise<ImportResult> {
|
||||||
const client = getAnthropic();
|
const client = getAnthropic();
|
||||||
|
|
||||||
@@ -173,12 +175,14 @@ export async function extractMenu(
|
|||||||
content.push({ type: 'text', text: `MENU SOURCE:\n${source.text}` });
|
content.push({ type: 'text', text: `MENU SOURCE:\n${source.text}` });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const model = source.visual ? SONNET_MODEL : HAIKU_MODEL;
|
||||||
const msg = await client.messages.create({
|
const msg = await client.messages.create({
|
||||||
model: source.visual ? SONNET_MODEL : HAIKU_MODEL,
|
model,
|
||||||
max_tokens: 8000,
|
max_tokens: 8000,
|
||||||
system: systemPrompt(defaultLocale),
|
system: systemPrompt(defaultLocale),
|
||||||
messages: [{ role: 'user', content }],
|
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 text = msg.content.find((c) => c.type === 'text')?.text ?? '{}';
|
||||||
const parsed = parseLenientJson<{ sections?: unknown }>(text);
|
const parsed = parseLenientJson<{ sections?: unknown }>(text);
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
// Universal macro color code — FIXED across all restaurants (product standard).
|
// Universal macro color code — FIXED across all restaurants (product standard).
|
||||||
// Diners learn it once and recognize it in any menu. Never make this configurable.
|
// Diners learn it once and recognize it in any menu. Never make this configurable.
|
||||||
export const MACRO_COLORS = {
|
export const MACRO_COLORS = {
|
||||||
protein: '#C2410C', // terracotta
|
protein: '#dc2626', // red
|
||||||
carbs: '#B45309', // toasted amber
|
carbs: '#B45309', // toasted amber
|
||||||
sugar: '#BE185D', // magenta
|
sugar: '#BE185D', // magenta
|
||||||
fat: '#CA8A04', // gold
|
fat: '#CA8A04', // gold
|
||||||
|
|||||||
@@ -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
@@ -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.
|
// Kept for signature compatibility with the pages that still call it; the passed
|
||||||
export function paletteToCssVars(palette?: Palette): string {
|
// palette is intentionally ignored now that colors are fixed.
|
||||||
const p = { ...DEFAULT, ...(palette ?? {}) };
|
export function paletteToCssVars(_palette?: Palette): string {
|
||||||
return [
|
return FIXED_VARS;
|
||||||
`--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));
|
|
||||||
}
|
}
|
||||||
@@ -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(/ /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;
|
||||||
|
}
|
||||||
@@ -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);
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
@@ -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
@@ -7,13 +7,14 @@ const config: Config = {
|
|||||||
theme: {
|
theme: {
|
||||||
extend: {
|
extend: {
|
||||||
fontFamily: {
|
fontFamily: {
|
||||||
display: ['var(--font-fraunces)', 'Georgia', 'serif'],
|
display: ['var(--font-montserrat)', 'system-ui', 'sans-serif'],
|
||||||
body: ['var(--font-inter)', 'system-ui', 'sans-serif'],
|
body: ['var(--font-montserrat)', 'system-ui', 'sans-serif'],
|
||||||
|
serif: ['var(--font-merriweather)', 'Georgia', 'serif'],
|
||||||
},
|
},
|
||||||
colors: {
|
colors: {
|
||||||
// Universal, non-configurable macro color code (product standard).
|
// Universal, non-configurable macro color code (product standard).
|
||||||
macro: {
|
macro: {
|
||||||
protein: '#C2410C',
|
protein: '#dc2626',
|
||||||
carbs: '#B45309',
|
carbs: '#B45309',
|
||||||
sugar: '#BE185D',
|
sugar: '#BE185D',
|
||||||
fat: '#CA8A04',
|
fat: '#CA8A04',
|
||||||
|
|||||||
Reference in new issue
Block a user