import Link from 'next/link'; import { useCart } from '../context/CartContext'; const FALLBACK_IMAGE = 'https://images.unsplash.com/photo-1608198093002-ad4e005484ec?auto=format&fit=crop&w=1200&q=80'; export default function ProductCard({ product }) { const { addItem } = useCart(); const imageUrl = product?.imageUrl || product?.hero_image || FALLBACK_IMAGE; const price = Number(product?.price || 0).toFixed(2); const canPurchase = Boolean(product?.id) && !product?.isSample; const hasDetail = Boolean(product?.slug) && !product?.isSample; return (
{product?.name

{product?.name || 'Menu item'}

{product?.short_description ?

{product.short_description}

: null}
${price} {product?.inventory_quantity ?? '—'} available
Max {product?.max_per_order ?? '—'} / order {product?.allergens ? {product.allergens} : null}
{canPurchase ? ( ) : ( Sample listing )} {hasDetail ? ( View details ) : null}
); }