import { Leaf, Sprout, Wheat, Flame, Star, ChefHat, Minus, Plus, } from 'lucide-react' // ── Money helpers ──────────────────────────────────────────────────────────── export function eur(n) { return '€' + Number(n).toFixed(2) } // The price is the QR menu's (sales point qr_table, set in normaliseProduct): since phase 3S // discounts are price rules already in it, so there is no separate discount to show. export function discountedPrice(product) { return product.price ?? 0 } export function basePrice(product) { return product.price ?? 0 } export function hasDiscount() { return false } export function discountPct() { return 0 } // ── Placeholder gradient art ───────────────────────────────────────────────── export function DishArt({ product, category, size = 'card' }) { const hue = category?.hue ?? 40 const GlyphIcon = category?.GlyphIcon ?? null const id = product?.id ?? 'x' let seed = 0 for (let i = 0; i < id.length; i++) seed += id.charCodeAt(i) const lift = (seed % 5) - 2 const c1 = `hsl(${hue} 34% ${90 + lift}%)` const c2 = `hsl(${hue} 30% ${80 + lift}%)` const glyphColor = `hsl(${hue} 32% 42%)` const firstName = product?.digital_name || product?.name || '?' const letter = typeof firstName === 'object' ? (firstName.en?.[0] ?? '?') : (firstName[0] ?? '?') const sizeClass = size === 'hero' ? 'self-stretch min-h-[100px] w-[100px]' : size === 'sm' ? 'h-16 w-16' : 'h-[92px] w-[92px]' const iconClass = size === 'sm' ? 'h-7 w-7' : 'h-9 w-9' return (
{letter} {GlyphIcon && ( )}
) } // ── Badge (Popular / Chef's pick) ──────────────────────────────────────────── export function Badge({ kind, t }) { if (kind === 'popular') { return ( {t?.popular ?? 'Popular'} ) } if (kind === 'chefs') { return ( {t?.chefs ?? "Chef's pick"} ) } return null } // ── Dietary chips (with text labels) ──────────────────────────────────────── const DIET_STYLE = { vegan: { Icon: Leaf, fg: '#3f7d4e', bg: '#e7f1e7', ring: '#c9e2cb' }, vegetarian: { Icon: Sprout, fg: '#5d7a37', bg: '#eef2e0', ring: '#d8e2bd' }, 'gluten-free': { Icon: Wheat, fg: '#a9842f', bg: '#f5edd8', ring: '#e6d6a6' }, spicy: { Icon: Flame, fg: '#c2602f', bg: '#f7e6dc', ring: '#eccab3' }, } export function DietChip({ tag, t }) { const s = DIET_STYLE[tag] if (!s) return null const { Icon } = s const label = t?.dietary?.[tag] ?? tag return ( {label} ) } // ── Compact tag icon badges (card title row) ───────────────────────────────── const TAG_BADGE = { vegan: { Icon: Leaf, fg: '#3f7d4e', bg: '#e7f1e7', ring: '#bcdcc0' }, vegetarian: { Icon: Sprout, fg: '#5d7a37', bg: '#eef2e0', ring: '#cfe0b0' }, 'gluten-free': { Icon: Wheat, fg: '#9a7726', bg: '#f6edd6', ring: '#e6d49e' }, spicy: { Icon: Flame, fg: '#c2602f', bg: '#f8e6da', ring: '#eec4ac' }, } const PRIORITY_BADGE = { popular: { Icon: Star, fg: '#a9842f', bg: '#f6edd6', ring: '#e6d49e' }, chefs: { Icon: ChefHat, fg: '#f0e9d6', bg: '#2d3b2d', ring: '#2d3b2d' }, } export function TagIcons({ product }) { const items = [] const badge = product.badge ?? product.digital_badge if (badge && PRIORITY_BADGE[badge]) items.push(PRIORITY_BADGE[badge]) const tags = product.tags ?? product.digital_tags ?? [] tags.forEach(tag => { if (TAG_BADGE[tag]) items.push(TAG_BADGE[tag]) }) const shown = items.slice(0, 3) if (!shown.length) return null return (
{shown.map((s, i) => { const { Icon } = s return ( ) })}
) } // ── Price display ───────────────────────────────────────────────────────────── export function Price({ product, large }) { const base = basePrice(product) const now = discountedPrice(product) const discounted = hasDiscount(product) return (
{discounted && ( {eur(base)} )} {eur(now)}
) } // ── Discount flag ───────────────────────────────────────────────────────────── export function DiscountFlag({ product, t }) { const pct = discountPct(product) if (!pct) return null return ( −{pct}% {t?.off ?? 'OFF'} ) } // ── Quantity stepper ───────────────────────────────────────────────────────── export function Stepper({ qty, onInc, onDec }) { return (
{qty}
) }