import { useEffect, useState } from 'react'; import { useParams, Link } from 'react-router-dom'; import { getVehicleById, Vehicle } from '@/data/vehicles'; import { ArrowLeft, Battery, Clock, Users, Zap, Check, Calendar, CreditCard } from 'lucide-react'; const VehicleDetailPage = () => { const { id } = useParams<{ id: string }>(); const [vehicle, setVehicle] = useState(null); const [activeTab, setActiveTab] = useState<'overview' | 'specs' | 'features'>('overview'); const [rentalDuration, setRentalDuration] = useState(1); // days const [isLoading, setIsLoading] = useState(true); useEffect(() => { if (id) { const foundVehicle = getVehicleById(id); setVehicle(foundVehicle || null); setIsLoading(false); } }, [id]); if (isLoading) { return (
); } if (!vehicle) { return (

Vehicle Not Found

Sorry, we couldn't find the vehicle you're looking for.

Back to Vehicles
); } const totalRentalPrice = vehicle.price * rentalDuration; return (
{/* Back navigation */} Back to Vehicles
{/* Left Column - Image */}
{`${vehicle.name}
{/* Right Column - Info */}

{vehicle.name} {vehicle.model}

{vehicle.category} Electric
${vehicle.price}
per day

{vehicle.description}

{/* Tabs */}
{/* Tab Content */}
{activeTab === 'overview' && (
Range
{vehicle.specs.range}
Acceleration
{vehicle.specs.acceleration}
Top Speed
{vehicle.specs.topSpeed}
Capacity
{vehicle.specs.capacity}

Rental Options

${vehicle.price} × {rentalDuration} day{rentalDuration > 1 ? 's' : ''} ${totalRentalPrice}
Insurance Included
Charging Included
Total ${totalRentalPrice}
)} {activeTab === 'specs' && (

Performance

Range {vehicle.specs.range}
Top Speed {vehicle.specs.topSpeed}
Acceleration {vehicle.specs.acceleration}

Interior

Seating {vehicle.specs.capacity}
Touchscreen 15" Center Display
Sound System Premium Audio

Technology

Autopilot Included
Over-the-air Updates Yes
Connectivity Premium Connectivity
)} {activeTab === 'features' && (
{vehicle.features.map((feature, index) => (
{feature}
))}
)}
); }; export default VehicleDetailPage;