import React, { useState } from "react"; import { Star, Sparkles, CheckCircle2 } from "lucide-react"; interface ReviewsSectionProps { darkMode: boolean; reviews: any[]; onAddReview: (review: { name: string; rating: number; text: string; date: string; initials: string }) => Promise; } export default function ReviewsSection({ darkMode, reviews, onAddReview }: ReviewsSectionProps) { const [newReview, setNewReview] = useState({ name: "", text: "", rating: 5 }); const [formSuccess, setFormSuccess] = useState(false); const [hoverRating, setHoverRating] = useState(null); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); if (!newReview.name.trim() || !newReview.text.trim()) return; // Grab initials const initials = newReview.name .split(" ") .map((n) => n[0]) .join("") .toUpperCase() .slice(0, 2) || "U"; const newlyCreated = { name: newReview.name, rating: newReview.rating, text: newReview.text, date: "Just now", initials: initials }; try { await onAddReview(newlyCreated); setNewReview({ name: "", text: "", rating: 5 }); setFormSuccess(true); setTimeout(() => setFormSuccess(false), 4500); } catch (e) { console.error(e); } }; return (
{/* Visual glowing orbs */}
4.8★ Ratings On Google Maps

Loved By Lahore's Car Community

Real testimonials from car, SUV, and commercial truck owners who buy their Michelin, Yokohama, and Autogrip tyres from us.

{/* Left Column: List of Reviews */}
{reviews.map((review, rIdx) => (
{review.initials}

{review.name}

Verified User • {review.date}
{Array.from({ length: 5 }).map((_, sIdx) => ( ))}

"{review.text}"

))}
{/* Right Column: Custom aggregate and submission form */}
{/* Aggregate Dashboard breakout */}

Google Maps Score

4.8
Based on {reviews.length} Genuine Feedback Records
{/* Leave a review interactive form */}

Leave Your Review

Submit your experience with Haider Brothers Traders. Your feedback will write directly to our Firestore node.

{formSuccess && (
Review recorded in Firestore database successfully!
)}
{/* Star rating selector */}
{Array.from({ length: 5 }).map((_, idx) => { const ratingVal = idx + 1; return ( ); })}
{/* Name field */}
setNewReview({ ...newReview, name: e.target.value })} className={`w-full p-3 rounded-xl text-sm border focus:ring-2 focus:ring-brand-orange focus:outline-none transition-all ${ darkMode ? "bg-black/40 border-white/10 text-white placeholder-slate-500" : "bg-white border-slate-200 text-slate-900 placeholder-slate-400" }`} id="review-name-input" />
{/* Feedback text */}