// MendiArt — Página de producto function ProductPage({ p, products, qty, onBack, onAdd, onRemove, onConsult, onOpenProduct, onCartClick, cartCount }) { const { C, Icon, ProductImage, ProductImg, MEDIA } = window; const [tab, setTab] = React.useState(0); const [fotoIdx, setFotoIdx] = React.useState(0); const outOfStock = !p.stock; const related = products.filter(x => x.id !== p.id && x.cat === p.cat).slice(0, 4); const compatList = p.compat.split('·').map(s => s.trim()).filter(Boolean); const fotos = Array.isArray(p.fotos) ? p.fotos : []; return (
{/* Scroll body */}
{/* Sticky top chrome */}
{/* Gallery */}
{fotos.length > 0 ? ( {p.name} ) : ( )} {outOfStock && ( SIN STOCK )}
{/* Miniaturas si hay más de una foto */} {fotos.length > 1 && (
{fotos.map((f, i) => ( ))}
)} {/* dots si solo hay una foto o placeholder */} {fotos.length <= 1 && (
)}
{/* Info */}
{p.cat} {!outOfStock && ( En stock )}

{p.name}

${p.price.toLocaleString('es-AR')} IVA incluido
Sin IVA: ${p.price_sin_iva.toLocaleString('es-AR')}
{/* Payment hint */}
3 cuotas sin interés de ${Math.round(p.price/3).toLocaleString('es-AR')}
{/* Tabs */}
{['Descripción', 'Compatibilidad', 'Especif.'].map((t, i) => ( ))}
{/* Tab content */}
{tab === 0 && (

{p.descripcion || 'Sin descripción disponible.'}

)} {tab === 1 && (
{compatList.length > 1 ? compatList.map(m => ( {m} )) : ( {p.compat} )}
)} {tab === 2 && (
{[ p.marca && ['Marca', p.marca], p.cantidad_por_unidad && ['Contenido', p.cantidad_por_unidad], p.calidad && ['Calidad', p.calidad], p.color_tinta && ['Color', p.color_tinta], ].filter(Boolean).map(([k, v]) => (
{k} {v}
))} {!p.marca && !p.cantidad_por_unidad && !p.calidad && !p.color_tinta && ( Sin especificaciones cargadas. )}
)}
{/* Related */} {related.length > 0 && (

También te puede interesar

{related.map(r => ( ))}
)}
{/* Sticky bottom CTA */}
{!outOfStock ? ( qty > 0 ? (
{qty}
) : ( ) ) : ( )}
); } const chromeBtn = { width: 40, height: 40, borderRadius: 999, border: 'none', background: '#fff', cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center', boxShadow: '0 2px 8px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04)', }; const qtyBtnLg = { width: 32, height: 32, borderRadius: 999, border: 'none', cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center', boxShadow: '0 1px 3px rgba(0,0,0,0.08)', }; const ctaBtn = { flex: 1, height: 48, borderRadius: 999, border: 'none', background: 'linear-gradient(180deg, #F66218 0%, #E04D00 100%)', color: '#fff', cursor: 'pointer', fontFamily: 'inherit', fontSize: 14.5, fontWeight: 700, letterSpacing: 0.2, display: 'flex', alignItems: 'center', justifyContent: 'center', boxShadow: '0 6px 16px rgba(240,90,10,0.35)', }; Object.assign(window, { ProductPage });