diff --git a/src/app/cars/[id]/page.tsx b/src/app/cars/[id]/page.tsx index 2843b0c..ab44cde 100644 --- a/src/app/cars/[id]/page.tsx +++ b/src/app/cars/[id]/page.tsx @@ -1,165 +1,385 @@ 'use client'; -import { ThemeProvider } from '@/components/theme/ThemeProvider'; -import NavbarStyleApple from '@/components/navbar/NavbarStyleApple/NavbarStyleApple'; -import ProductDetailCard from '@/components/ecommerce/productDetail/ProductDetailCard'; -import FooterSimple from '@/components/sections/footer/FooterSimple'; -import { useState } from 'react'; +import { useState, useEffect } from 'react'; +import Link from 'next/link'; import { useParams } from 'next/navigation'; -const navItems = [ - { name: 'Home', id: '/' }, - { name: 'Browse Cars', id: '/cars' }, - { name: 'Specifications', id: '/specifications' }, - { name: 'Compare', id: '/compare' }, - { name: 'Database', id: '/database' }, -]; +interface Car { + id: string; + make: string; + model: string; + year: number; + price: number; + image: string; + transmission: string; + fuel: string; + mileage: number; + bodyType?: string; + color?: string; + vin?: string; + engineSize?: number; + horsepower?: number; + torque?: number; + topSpeed?: number; + acceleration?: number; + mpg?: number; + seating?: number; + luggage?: number; + wheelbase?: number; + length?: number; + width?: number; + height?: number; + weight?: number; + fuelCapacity?: number; + safetyRating?: number; + features?: string[]; +} -const carDatabase: Record = { +const carsDatabase: Record = { '1': { - name: 'Tesla Model S', - price: '$73,990', - rating: 5, - description: 'The Tesla Model S is a high-performance sedan with exceptional acceleration, range, and technology. Features a sleek design and advanced autonomous capabilities.', - images: [ - { src: '/car-1-front.jpg', alt: 'Tesla Model S Front' }, - { src: '/car-1-side.jpg', alt: 'Tesla Model S Side' }, - { src: '/car-1-back.jpg', alt: 'Tesla Model S Back' }, + id: '1', + make: 'Toyota', + model: 'Camry', + year: 2024, + price: 32000, + image: '/car-camry.jpg', + transmission: 'Automatic', + fuel: 'Hybrid', + mileage: 0, + bodyType: 'Sedan', + color: 'Pearl White', + vin: 'T123456789ABC', + engineSize: 2.5, + horsepower: 208, + torque: 180, + topSpeed: 112, + acceleration: 8.2, + mpg: 52, + seating: 5, + luggage: 15.1, + wheelbase: 112.2, + length: 191.1, + width: 71.7, + height: 57.5, + weight: 3415, + fuelCapacity: 14.5, + safetyRating: 5, + features: [ + 'Hybrid Engine', + 'Toyota Safety Sense', + 'Adaptive Cruise Control', + 'Lane Departure Alert', + 'Bluetooth Connectivity', + 'Touchscreen Display', + 'Heated Seats', + 'Power Windows', ], - variants: [ - { label: 'Drive Type', options: ['Dual Motor AWD', 'Tri Motor'], selected: 'Dual Motor AWD', onChange: () => {} }, - { label: 'Range', options: ['405 miles', '405+ miles'], selected: '405 miles', onChange: () => {} }, - { label: 'Color', options: ['Pearl White', 'Solid Black', 'Midnight Silver', 'Deep Blue', 'Ultra Violet'], selected: 'Pearl White', onChange: () => {} }, - ], - quantity: { label: 'Quantity', options: ['1', '2', '3'], selected: '1', onChange: () => {} }, }, '2': { - name: 'BMW M440i xDrive', - price: '$61,550', - rating: 5, - description: 'The BMW M440i xDrive combines luxury and performance with a powerful turbocharged engine, premium interior, and cutting-edge technology.', - images: [ - { src: '/car-2-front.jpg', alt: 'BMW M440i Front' }, - { src: '/car-2-side.jpg', alt: 'BMW M440i Side' }, - { src: '/car-2-back.jpg', alt: 'BMW M440i Back' }, + id: '2', + make: 'Honda', + model: 'Civic', + year: 2024, + price: 28000, + image: '/car-civic.jpg', + transmission: 'Manual', + fuel: 'Gasoline', + mileage: 0, + bodyType: 'Sedan', + color: 'Sonic Gray', + vin: 'H987654321DEF', + engineSize: 2.0, + horsepower: 158, + torque: 138, + topSpeed: 125, + acceleration: 8.5, + mpg: 32, + seating: 5, + luggage: 12.3, + wheelbase: 106.3, + length: 182.2, + width: 70.8, + height: 56.0, + weight: 3040, + fuelCapacity: 12.3, + safetyRating: 5, + features: [ + 'Honda Sensing', + 'Collision Mitigation Braking', + 'Road Departure Mitigation', + 'Apple CarPlay', + 'Android Auto', + 'Rearview Camera', + 'Sunroof', + 'Alloy Wheels', ], - variants: [ - { label: 'Drive Type', options: ['xDrive'], selected: 'xDrive', onChange: () => {} }, - { label: 'Engine', options: ['3.0L Turbo', '4.4L Twin Turbo'], selected: '3.0L Turbo', onChange: () => {} }, - { label: 'Color', options: ['Alpine White', 'Jet Black', 'Oxide Grey', 'BMW Blue'], selected: 'Alpine White', onChange: () => {} }, - ], - quantity: { label: 'Quantity', options: ['1', '2', '3'], selected: '1', onChange: () => {} }, }, '3': { - name: 'Mercedes-Benz C-Class', - price: '$45,850', - rating: 4, - description: 'The Mercedes-Benz C-Class offers refined luxury, dynamic performance, and sophisticated technology in a compact sedan format.', - images: [ - { src: '/car-3-front.jpg', alt: 'Mercedes-Benz C-Class Front' }, - { src: '/car-3-side.jpg', alt: 'Mercedes-Benz C-Class Side' }, - { src: '/car-3-back.jpg', alt: 'Mercedes-Benz C-Class Back' }, + id: '3', + make: 'BMW', + model: '3 Series', + year: 2024, + price: 45000, + image: '/car-bmw.jpg', + transmission: 'Automatic', + fuel: 'Diesel', + mileage: 0, + bodyType: 'Sedan', + color: 'Jet Black', + vin: 'B456789012GHI', + engineSize: 2.0, + horsepower: 190, + torque: 295, + topSpeed: 130, + acceleration: 7.2, + mpg: 45, + seating: 5, + luggage: 13.6, + wheelbase: 112.8, + length: 184.4, + width: 71.7, + height: 56.3, + weight: 3550, + fuelCapacity: 13.2, + safetyRating: 5, + features: [ + 'BMW iDrive', + 'Adaptive Headlights', + 'Premium Sound System', + 'Panoramic Sunroof', + 'Power Seats', + 'Climate Control', + 'Gesture Control', + 'Head-Up Display', ], - variants: [ - { label: 'Engine', options: ['2.0L Turbo', '3.0L Turbo'], selected: '2.0L Turbo', onChange: () => {} }, - { label: 'Transmission', options: ['9-Speed Automatic'], selected: '9-Speed Automatic', onChange: () => {} }, - { label: 'Color', options: ['Diamond White', 'Obsidian Black', 'Graphite Grey', 'Cavansite Blue'], selected: 'Diamond White', onChange: () => {} }, - ], - quantity: { label: 'Quantity', options: ['1', '2', '3'], selected: '1', onChange: () => {} }, }, }; -const footerColumns = [ - { - title: 'Browse', - items: [ - { label: 'All Cars', href: '/cars' }, - { label: 'By Make', href: '/makes' }, - { label: 'By Year', href: '/years' }, - { label: 'New Releases', href: '/new' }, - ], - }, - { - title: 'Tools', - items: [ - { label: 'Compare Vehicles', href: '/compare' }, - { label: 'Search Database', href: '/database' }, - { label: 'Specifications', href: '/specifications' }, - { label: 'Reviews', href: '/reviews' }, - ], - }, - { - title: 'Company', - items: [ - { label: 'About Us', href: '/about' }, - { label: 'Contact', href: '/contact' }, - { label: 'Blog', href: '/blog' }, - { label: 'Careers', href: '/careers' }, - ], - }, - { - title: 'Legal', - items: [ - { label: 'Privacy Policy', href: '/privacy' }, - { label: 'Terms of Service', href: '/terms' }, - { label: 'Cookie Policy', href: '/cookies' }, - { label: 'Disclaimer', href: '/disclaimer' }, - ], - }, -]; - export default function CarDetailPage() { const params = useParams(); - const carId = params?.id as string; - const car = carDatabase[carId] || carDatabase['1']; - const [selectedVariants, setSelectedVariants] = useState>({}); - const [quantity, setQuantity] = useState('1'); + const [car, setCar] = useState(null); + const [loading, setLoading] = useState(true); + + useEffect(() => { + const id = params.id as string; + const carData = carsDatabase[id]; + if (carData) { + setCar(carData); + } + setLoading(false); + }, [params.id]); + + if (loading) { + return ( +
+
Loading...
+
+ ); + } + + if (!car) { + return ( +
+
+

Car Not Found

+

The car you're looking for doesn't exist.

+ + + +
+
+ ); + } return ( - - +
+
+ {/* Header */} +
+ + + +

+ {car.year} {car.make} {car.model} +

+
-
- ({ - ...v, - onChange: (value: string) => setSelectedVariants({ ...selectedVariants, [v.label]: value }), - }))} - quantity={{ - ...car.quantity, - onChange: (value: string) => setQuantity(value), - }} - buttons={[ - { text: 'Request Information', href: '/contact' }, - { text: 'Schedule Test Drive', onClick: () => alert('Test drive scheduled') }, - ]} - /> -
+ {/* Main Content */} +
+ {/* Image and Price Section */} +
+
+
+
+
Car Image
+
Main View
+
+
+
+
+

+ ${car.price.toLocaleString()} +

+

Starting Price

+ + +
+
+
+
- + + {/* Dimensions and Capacity */} +
+
+

Dimensions

+
+
+

Length

+

{car.length || 'N/A'} in

+
+
+

Width

+

{car.width || 'N/A'} in

+
+
+

Height

+

{car.height || 'N/A'} in

+
+
+

Wheelbase

+

{car.wheelbase || 'N/A'} in

+
+
+

Weight

+

{car.weight || 'N/A'} lbs

+
+
+
+ +
+

Capacity

+
+
+

Luggage Space

+

{car.luggage || 'N/A'} cu ft

+
+
+

Fuel Tank

+

{car.fuelCapacity || 'N/A'} gal

+
+
+

VIN

+

{car.vin || 'N/A'}

+
+
+
+
+ + {/* Features */} + {car.features && car.features.length > 0 && ( +
+

Features & Amenities

+
+ {car.features.map((feature, index) => ( +
+ +

{feature}

+
+ ))} +
+
+ )} + + {/* CTA Section */} +
+

Interested in this vehicle?

+

Contact our sales team to schedule a test drive or request more information.

+
+ + +
+
- +
); }