import { useState, useEffect } from "react"; import { motion, AnimatePresence } from "motion/react"; import { Sparkles, MapPin, Phone, Clock, Star, Layers, Compass, MessageSquare, Heart, CheckCircle2, ChevronRight, TrendingUp, Award, Search, ChevronDown, ChevronUp, Share2, Lock, Wrench, HelpCircle, FolderLock } from "lucide-react"; import { BUSINESS_INFO, BRANDS, REVIEWS, TireProduct } from "./data"; import { getTireProducts, getReviews, addReview, SEED_TYRE_PRODUCTS } from "./lib/tireService"; import { checkAuthState, logVisitorInfo, onProductsSnapshot } from "./lib/firebaseService"; import Navbar from "./components/Navbar"; import Logo from "./components/Logo"; import Hero from "./components/Hero"; import TireCard from "./components/TireCard"; import ProductDetailsModal from "./components/ProductDetailsModal"; import ReviewsSection from "./components/ReviewsSection"; import LocationContact from "./components/LocationContact"; import FloatingActions from "./components/FloatingActions"; import VehicleFitmentWidget from "./components/VehicleFitmentWidget"; import InventoryManager from "./components/InventoryManager"; import AdminLoginModal from "./components/AdminLoginModal"; import Promotions from "./components/Promotions"; import NewsletterSignup from "./components/NewsletterSignup"; import FAQSection from "./components/FAQSection"; export default function App() { const [darkMode, setDarkMode] = useState(true); const [currentPage, setCurrentPage] = useState("home"); const [currentUser, setCurrentUser] = useState(null); const [showAdminLoginModal, setShowAdminLoginModal] = useState(false); const isAuthorizedAdmin = currentUser?.email === "bahaduralimunnabhai@gmail.com"; // Redirect to home if unauthenticated user somehow sits on admin route useEffect(() => { if (currentPage === "admin" && !isAuthorizedAdmin) { setCurrentPage("home"); } }, [currentPage, isAuthorizedAdmin]); // Track page navigation analytics safely useEffect(() => { logVisitorInfo(currentPage); }, [currentPage]); // Auth listener useEffect(() => { const unsubscribe = checkAuthState((user) => { setCurrentUser(user); }); return () => unsubscribe(); }, []); // Master API database states loaded dynamically from Firestore const [products, setProducts] = useState([]); const [reviews, setReviews] = useState([]); const [loading, setLoading] = useState(true); // Dynamic state selectors const [activeSegment, setActiveSegment] = useState<'all' | 'hot' | 'new' | 'famous'>('all'); const [selectedBrand, setSelectedBrand] = useState('All'); const [searchQuery, setSearchQuery] = useState(''); const [priceSort, setPriceSort] = useState<'none' | 'low-high' | 'high-low'>('none'); const [selectedTire, setSelectedTire] = useState(null); // Load products dynamically in real-time and reviews on startup useEffect(() => { setLoading(true); // Subscribe to live products collection updates const unsubscribeProducts = onProductsSnapshot((snapshotList) => { const mapped = snapshotList.map(p => ({ id: p.id, name: p.name, brand: p.brand, size: p.size, feature: p.feature, price: p.price, badge: p.badge || (p.category === "hot-selling" ? "Hot Selling" : p.category === "new-brands" ? "New Arrival" : "Famous"), segment: p.segment || (p.category === "hot-selling" ? "hot" : p.category === "new-brands" ? "new" : "famous") as "hot" | "new" | "famous", image: p.image || p.imageUrl, stock: p.stock || 0, description: p.description || `Premium quality tire from ${p.brand}.` })); setProducts(mapped); setLoading(false); }); loadReviews(); return () => { unsubscribeProducts(); }; }, []); const loadReviews = async () => { try { const dbReviews = await getReviews(); if (dbReviews && dbReviews.length > 0) { setReviews(dbReviews); } else { setReviews(REVIEWS); } } catch (e) { console.error("Firestore reviews fallback.", e); setReviews(REVIEWS); } }; const handleAddNewReview = async (newReviewObj: any) => { try { await addReview(newReviewObj); // Reload from cloud immediately const dbReviews = await getReviews(); setReviews(dbReviews); } catch (e) { // Offline fallback append setReviews((prev) => [newReviewObj, ...prev]); } }; // Helper action: when selecting recommended size from widget, immediately filter catalogue const handleFilterSizeFromWidget = (sizeCode: string) => { setSearchQuery(sizeCode); setSelectedBrand("All"); setActiveSegment("all"); setPriceSort("none"); setCurrentPage("catalogue"); // Smooth scroll to top of database list setTimeout(() => { const el = document.getElementById("catalog-grid-top"); if (el) el.scrollIntoView({ behavior: "smooth", block: "start" }); }, 100); }; // Derivative Filter for landing sections const hotSellingProducts = products.filter(p => p.segment === 'hot'); const newArrivalProducts = products.filter(p => p.segment === 'new'); // Master Filter and Sorting engine for dynamic Catalogue list const filteredCatalogProducts = products.filter((tire) => { const matchesSegment = activeSegment === 'all' || tire.segment === activeSegment; const matchesBrand = selectedBrand === 'All' || tire.brand.toLowerCase() === selectedBrand.toLowerCase(); const searchString = `${tire.name} ${tire.brand} ${tire.size} ${tire.feature} ${tire.description}`.toLowerCase(); const matchesSearch = searchString.includes(searchQuery.toLowerCase()); return matchesSegment && matchesBrand && matchesSearch; }); // Apply Price Sorting configurations const sortedCatalogProducts = [...filteredCatalogProducts].sort((a, b) => { if (priceSort === "low-high") return a.price - b.price; if (priceSort === "high-low") return b.price - a.price; return 0; // retain database natural feed sorting }); return (
{/* 24/7 Top Alert Ribbon with High Visibility SEO keyword highlights */}
24/7 EMERGENCY TYRE PUNCTURE BREAKDOWN REPAIR ROAD ASSISTANCE IN LAHORE: 24/7 LAHORE EMERGENCY ASSISTANCE: 📞 {BUSINESS_INFO.phone}
{/* State-driven Navigation Bar */} {/* Main Container Wrapper with Animation Transitions */}
{/* VIEW 1: HOME PAGE PAGE-TAB */} {currentPage === "home" && ( {/* Elegant Display Hero Header */} {/* HIGH SEO TEXT SECTION & KEYWORDS */}
⚡ LAHORE INDUSTRIAL TRADING CORP • RETAIL & WHOLESALE RATES ON BRAND NEW TYRES IN FAISAL TOWN • CERTIFIED GERMAN TUNE-UP & ALIGNMENT STAGES
{/* SEASONAL BUNDLE PROMOTIONS CAROUSEL SLIDER */} {/* DYNAMIC CAR MODEL VEHICLE INTEGRATION WIDGET */}
Car Fitment Search

Vehicle Recommended Tyre Size Finder

Input or lookup your car name to pull custom rim specifications, load recommended profile compounds, and lookup live stock matching instantly.

{/* Mounted child fitment widget component */}
{/* FEATURED: HOT SELLING TYRES LISTING */}
🔥 Top Seller Index

Lahore's Demanded Tyres

{hotSellingProducts.slice(0, 4).map((tire) => ( setSelectedTire(t)} /> ))}
{/* BRAND DIFFERENTIATORS BENTO GRAPH DISPLAY SECTION */}
🛡️ Premium Security and Quality Safety

Why Faisal Town Chooses Haider Brothers Traders?

Our mission is to guarantee maximum safety rating, high speed response, comfortable suspensions, and durable tyre lifespan for everyday Pakistani passenger sedans and heavy commercial vehicles. We operate 24 hours a day to prevent vehicle emergencies and offer full high-grade premium warranty validation.

German 3D Wheel Alignment stages

We restore precise steering control & eliminate early tyre scrubbing.

100% Genuine Certified Imports

Say no to smuggling issues. Enjoy legal security with real DOT manufacturing years.

⚙️ Core Service Statistics

Original Custom Warranty Claim Ratio 100% Guaranteed
Response Speed under Emergency (Minutes) Within 25 Mins
Certified Import Tyre Compound Durability 50,000+ Kilometers
🔥 CERTIFIED REPUTATION FOR QUALITY FITTING
{/* SECTIONS: LAHORE STREET LOCATION CONTACT PREVIEW */}
)} {/* VIEW 2: TYRE CATALOGUE PAGE-TAB */} {currentPage === "catalogue" && ( {/* Header intro */}
Distributer Price Index

Full Tyre Inventory Catalogue

Live stock records connected to Faisal Town Lahore branch. Filter by sizes, manufacturers, segment highlights, or order by price index instantly.

{/* Advanced Filters Block */}
{/* Row 1: Search and Sorting controls */}
{/* Search Bar input */}
Filter by Keywords (e.g. Michelin, 185/65R14, grabber)
setSearchQuery(e.target.value)} className={`w-full p-3 pl-10 rounded-xl text-xs border focus:ring-1 focus:ring-brand-orange focus:outline-none ${ darkMode ? "bg-black/35 border-white/10 text-white placeholder-slate-500" : "bg-white border-slate-200 text-slate-800" }`} id="search-tyres-input" />
{/* Price sorting selection dropdown */}
Sort by Price Index
{/* Row 2: Segments */}
Filter by Segment Categories
{[ { id: 'all', label: 'All Products' }, { id: 'hot', label: '🔥 Hot Selling' }, { id: 'new', label: '🆕 New arrivals' }, { id: 'famous', label: '⭐ Famous Brand Favorites' } ].map((seg) => ( ))}
{/* Row 3: Manufacturer filters */}
Filter by Brand Manufacturer
{BRANDS.map((br) => ( ))}
{/* Results bar */}
Found {sortedCatalogProducts.length} matching products in Lahore branch {searchQuery && ( )}
{/* Dynamic Tyre Catalog Cards Grid */} {sortedCatalogProducts.length > 0 ? (
{sortedCatalogProducts.map((tire) => ( setSelectedTire(t)} /> ))}
) : (
🔍

No exact specification tyre found

We might still have warehouse stock of size custom model '{searchQuery}'! Please call or shoot a direct WhatsApp to our sales desk.

Call Sales Office
)}
)} {/* VIEW 3: LIVE REVIEWS BOARD PAGE-TAB */} {currentPage === "reviews" && ( {/* Direct mount child Reviews component */} )} {/* VIEW 4: SHOWROOM LOCATION DETAILS PAGE-TAB */} {currentPage === "showroom" && ( {/* Showroom location address layouts */} {/* FITTING & ALIGNMENT GUIDELINES EXTRA INFO PANEL */}

🧭 ROAD EMERGENCIES IN LAHORE

Broke down late at midnight in Faisal Town, Garden Town, Model Town, Gulberg, or Johar Town due to tyre flat punctures? Do not panic. Simply trigger our emergency phone number 24/7. Our mobile fitment van is equipped with high quality compound kits to rescue you immediately on-site!

🛠️ ALIGNMENT & COMPUTERIZED STEERING ADJUSTMENTS

We recommend doing computerized 3D wheel alignment checks and wheel balancing every 8,000 Kilometers to avoid uneven tread wire wear, suspension pull, and secure complete control of the car across highways at high speeds. Stop by during the day for discount fitment checking.

⏱️ 3D Alignment Stage is hosted 24/7 for premium passenger cars.

{/* DYNAMIC FAQ ACCORDION COMPONENT WITH HIGHEST SEO RATINGS */}
)} {/* VIEW 5: INVENTORY MANAGER DB SEEDING PAGE-TAB */} {currentPage === "admin" && (
Real Backend Integration Console

Firestore Inventory Manager

Admin board connected directly with our provisioned cloud Firestore. Any tyre product configured, edited, or removed in this environment reflects onto the landing page immediately.

Secure DB Mode
{/* Main inventory administration dashboards */}
)}
{/* COMPREHENSIVE HIGH SEO FOOTER ROW SUMMARY SECTION */}
{/* Column 1: About imports */}

Premium quality wholesaler and certified dealer of brand new tyres. We specialize in providing verified fresh manufacturing date imports, computer balancing, and 3D wheel alignments in Faisal Town Lahore.

⭐ 4.8 Ratings • Direct Google Mapping verified
{/* Column 2: Quick navigation */}

Navigation

{isAuthorizedAdmin && ( )}
{/* Column 3: Contact highlights & Location */}

Showroom Contact

📞 Emergency: {BUSINESS_INFO.phone} 💬 WhatsApp: Chat Live
📍 {BUSINESS_INFO.address}
Faisal Town Lahore
{/* Column 4: Newsletter signup */}

© {new Date().getFullYear()} Haider Brothers Traders Lahore. All Rights Reserved. Fully optimized in production under Pakistan wholesale regulations.

Drive Safely with certified tyre sizes & robust grip safety rules
{/* Interactive Detail Modal view */} {selectedTire && ( setSelectedTire(null)} darkMode={darkMode} /> )} {/* Staff Authentication Portal Modal */} setShowAdminLoginModal(false)} onSuccess={() => { setCurrentPage("admin"); window.scrollTo({ top: 0 }); }} darkMode={darkMode} /> {/* Floating Corner CTAs handles */}
); }