import React, { useState } from 'react'; import { ChevronRight, Plus, Minus, ShoppingCart, Send, Home, Grid3x3, Heart, User, Search, X } from 'lucide-react'; export default function AutoPartsCatalog() { const [expandedCategory, setExpandedCategory] = useState('Top Trending'); const [requestList, setRequestList] = useState([]); const [customerName, setCustomerName] = useState(''); const [customerEmail, setCustomerEmail] = useState(''); const [showCart, setShowCart] = useState(false); const [activeTab, setActiveTab] = useState('home'); const dealCategories = [ { title: 'Top Trending', icon: '📈', deals: [ { id: 1, name: '11.11 Sales', partNum: 'SALE001', aedPrice: 999, icon: '0%', badge: '%' }, { id: 2, name: 'Flash Sales', partNum: 'FLASH001', aedPrice: 599, icon: '⚡', badge: '⚡' }, { id: 3, name: 'Auto Parts Deal', partNum: 'AUTO001', aedPrice: 1299, icon: '%', badge: '%' }, ] }, { title: 'New in', icon: '✨', deals: [ { id: 4, name: 'Engine Parts', partNum: 'ENG001', aedPrice: 1499, icon: '⚙️', badge: '%' }, { id: 5, name: 'Brake Systems', partNum: 'BRK001', aedPrice: 899, icon: '🛑', badge: '%' }, { id: 6, name: 'Suspension Kit', partNum: 'SUSP001', aedPrice: 2499, icon: '🌪️', badge: '%' }, ] }, { title: 'Top Brands', icon: '⭐', deals: [ { id: 7, name: 'Bosch Parts', partNum: 'BOSCH001', aedPrice: 799, icon: '🏆', badge: '%' }, { id: 8, name: 'OEM Quality', partNum: 'OEM001', aedPrice: 699, icon: '✅', badge: '⬇️' }, { id: 9, name: 'Premium Fluids', partNum: 'FLUID001', aedPrice: 399, icon: '💧', badge: '%' }, ] }, { title: 'Clearence', icon: '💥', deals: [ { id: 10, name: 'Electrical Deals', partNum: 'ELEC001', aedPrice: 299, icon: '🔌', badge: '%' }, { id: 11, name: '30-day Lowest Price', partNum: 'LOW001', aedPrice: 199, icon: '📉', badge: '⬇️' }, { id: 12, name: 'Stock Clearance', partNum: 'CLEAR001', aedPrice: 149, icon: '%', badge: '%' }, ] }, { title: 'Bestsellers - Automotive', icon: '🏅', deals: [ { id: 13, name: 'Deals under 200 AED', partNum: 'DEAL200', aedPrice: 200, icon: '💰', badge: '₹200' }, { id: 14, name: 'Deals under 500 AED', partNum: 'DEAL500', aedPrice: 500, icon: '💰', badge: '₹500' }, { id: 15, name: 'Free Shipping', partNum: 'SHIP001', aedPrice: 0, icon: '📦', badge: '🚚' }, ] }, { title: 'Hot Deals', icon: '🔥', deals: [ { id: 16, name: 'Under 100 AED', partNum: 'HOT100', aedPrice: 99, icon: '🎯', badge: '100' }, { id: 17, name: 'Under 300 AED', partNum: 'HOT300', aedPrice: 299, icon: '🎯', badge: '300' }, { id: 18, name: '50% Off Special', partNum: 'SPECIAL50', aedPrice: 599, icon: '%', badge: '50%' }, ] }, ]; const addToRequest = (deal) => { const existing = requestList.find(item => item.id === deal.id); if (existing) { setRequestList(requestList.map(item => item.id === deal.id ? { ...item, quantity: item.quantity + 1 } : item )); } else { setRequestList([...requestList, { ...deal, quantity: 1 }]); } }; const removeFromRequest = (dealId) => { setRequestList(requestList.filter(item => item.id !== dealId)); }; const updateQuantity = (dealId, qty) => { if (qty <= 0) { removeFromRequest(dealId); } else { setRequestList(requestList.map(item => item.id === dealId ? { ...item, quantity: qty } : item )); } }; const totalAED = requestList.reduce((sum, item) => sum + (item.aedPrice * item.quantity), 0); const generateRequest = () => { if (!customerName.trim() || !customerEmail.trim() || requestList.length === 0) { alert('Please fill customer details and add items'); return; } let message = 'REQUEST FOR QUOTATION\n\n'; message += `Customer: ${customerName}\nEmail: ${customerEmail}\n`; message += `Date: ${new Date().toLocaleDateString()}\n\n`; message += 'REQUESTED PARTS:\n' + '─'.repeat(80) + '\n'; requestList.forEach((item, idx) => { message += `${idx + 1}. ${item.name}\nPart #: ${item.partNum} | Qty: ${item.quantity}\nPrice: ${item.aedPrice} AED | Subtotal: ${(item.aedPrice * item.quantity)} AED\n\n`; }); message += '─'.repeat(80) + `\nTOTAL: ${totalAED} AED\n`; const encoded = encodeURIComponent(message); window.open(`mailto:sales@autoparts.com?subject=RFQ from ${customerName}&body=${encoded}`); }; return (
{/* Header */}
{/* Top Bar */}

🚗 AutoParts | Free Shipping on Orders Above 200 AED

{/* Logo & Search */}

🚗 AutoParts

{/* Search Bar */}
{/* Main Content */}
{/* Left Sidebar - Desktop */}

🏷️ Dreamlike Deals

{dealCategories.map(cat => ( ))}
{/* Deal Sections */}
{dealCategories.map(category => (
{/* Category Header */} {/* Deals Grid */} {expandedCategory === category.title && (
{category.deals.map(deal => { const isInRequest = requestList.find(item => item.id === deal.id); const colors = ['from-purple-500 to-pink-500', 'from-pink-400 to-pink-500', 'from-cyan-400 to-teal-500', 'from-blue-500 to-purple-500', 'from-orange-400 to-orange-600', 'from-green-400 to-teal-500']; const bgColor = colors[deal.id % colors.length]; return (
addToRequest(deal)} className={`relative rounded-3xl p-6 cursor-pointer transition transform hover:scale-105 text-center bg-gradient-to-br ${bgColor} text-white shadow-lg ${ isInRequest ? 'ring-4 ring-green-400 scale-105' : '' }`} > {/* Badge */} {deal.badge && (
{deal.badge}
)} {/* Icon */}
{deal.icon}
{/* Deal Name */}

{deal.name}

{/* Price */} {deal.aedPrice > 0 && (

{deal.aedPrice} AED

)} {/* Part Number */}

{deal.partNum}

{/* Add Button */} {!isInRequest ? ( ) : (
✓ Added (Qty: {isInRequest.quantity})
)}
); })}
)}
))}
{/* Cart Drawer - Mobile */} {showCart && (
setShowCart(false)}>

Your Request

{requestList.length === 0 ? (

No items yet

) : (
{requestList.map(item => (

{item.name}

{item.aedPrice} AED × {item.quantity}

))}
Total: {totalAED} AED
)}
)} {/* Desktop Cart Sidebar */}

Your Request

setCustomerName(e.target.value)} className="w-full bg-white/20 border border-white/30 rounded-lg px-3 py-2 text-white placeholder-white/70 text-sm" /> setCustomerEmail(e.target.value)} className="w-full bg-white/20 border border-white/30 rounded-lg px-3 py-2 text-white placeholder-white/70 text-sm" />
{requestList.length === 0 ? (

No items added

) : ( requestList.map(item => (

{item.name}

{item.aedPrice} AED

{item.quantity}
)) )}
{requestList.length > 0 && ( <>
Total: {totalAED} AED
)}
{/* Bottom Navigation */}