'use client'; import React, { useState } from 'react'; import { Star, Zap, Truck, ShoppingBag, Layers, Palette, Sparkles } from 'lucide-react'; import { Product } from '@/types'; import { formatCOP, calculateSeparationBreakdown, getProductPriceRange } from '@/lib/pricing-engine'; import { useBrand } from '@/context/BrandContext'; import { getProductSocialProof } from '@/lib/social-proof'; interface ProductCardProps { product: Product; onOpenDetail: (product: Product) => void; onQuickAdd: (product: Product, size: string) => void; } export const ProductCard: React.FC = ({ product, onOpenDetail, }) => { const { currentBrand } = useBrand(); const [activeImage, setActiveImage] = useState(product.images[0]); const [activeColorName, setActiveColorName] = useState(product.colorName || ''); const socialProof = getProductSocialProof(product); const priceRange = getProductPriceRange(product); const discountPercent = product.originalPrice ? Math.round(((product.originalPrice - product.retailPrice) / product.originalPrice) * 100) : 28; const separation = calculateSeparationBreakdown(product.retailPrice); const colorCount = product.colors?.length || 1; return (
onOpenDetail(product)} className={`group rounded-3xl border transition-all duration-300 flex flex-col cursor-pointer overflow-hidden ${currentBrand.colors.cardBg} hover:shadow-2xl hover:border-purple-500/40`} > {/* Image Container */}
{product.name} {/* Badges */}
-{discountPercent}% OFF {product.isFlashDeal && ( FLASH )}
{/* Colors count indicator badge */} {colorCount > 1 && (
{colorCount} Colores
)}
Contraentrega {product.brand}
{/* Product Info */}
{/* Variable Realistic Social Proof & Reviews */}
{socialProof.rating} ({socialProof.reviewsCount})
+{socialProof.salesCount} pedidos
{/* Product Title */}

{product.modelName || product.name}

{/* Color Thumbnails Preview Swatches if multi-color */} {product.colors && product.colors.length > 1 && (
e.stopPropagation()}> Colores:
{product.colors.slice(0, 4).map((c) => ( ))} {product.colors.length > 4 && ( +{product.colors.length - 4} )}
)} {/* Available Sizes Pills */}
Tallas: {product.sizes.slice(0, 5).map((size) => ( {size} ))} {product.sizes.length > 5 && ( +{product.sizes.length - 5} )}
{/* Pricing & Separation terms */}
{priceRange.hasVariation ? `Desde ${formatCOP(priceRange.minPrice)}` : formatCOP(product.retailPrice)} {product.originalPrice && ( {formatCOP(product.originalPrice)} )}

⚡ Separa con {formatCOP(separation.depositAmount)} y cancelas al recibir.

{/* Quick Action Button */}
); };