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 (
🚗 AutoParts | Free Shipping on Orders Above 200 AED
{deal.aedPrice} AED
)} {/* Part Number */}{deal.partNum}
{/* Add Button */} {!isInRequest ? ( ) : (No items yet
{item.name}
{item.aedPrice} AED × {item.quantity}
No items added
) : ( requestList.map(item => ({item.name}
{item.aedPrice} AED