diff --git a/src/app/products/[id]/page.tsx b/src/app/products/[id]/page.tsx index 88e4bb4..37ea6d7 100644 --- a/src/app/products/[id]/page.tsx +++ b/src/app/products/[id]/page.tsx @@ -1,162 +1,199 @@ 'use client'; +import { ThemeProvider } from '@/providers/themeProvider/ThemeProvider'; -import { ThemeProvider } from 'next-themes'; -import NavbarLayoutFloatingInline from '@/components/navbar/NavbarLayoutFloatingInline'; -import TextAnimation from '@/components/text/TextAnimation'; +import NavbarStyleCentered from '@/components/navbar/NavbarStyleCentered/NavbarStyleCentered'; +import ProductCardTwo from '@/components/sections/product/ProductCardTwo'; import ButtonTextShift from '@/components/button/ButtonTextShift/ButtonTextShift'; -import TestimonialCardTwo from '@/components/sections/testimonial/TestimonialCardTwo'; -import ProductCardThree from '@/components/sections/product/ProductCardThree'; -import { Sparkles, Star } from 'lucide-react'; +import TextAnimation from '@/components/text/TextAnimation'; +import FooterBaseReveal from '@/components/sections/footer/FooterBaseReveal'; + +import { usePathname } from 'next/navigation'; +import { useState, useEffect } from 'react'; export default function ProductDetailPage() { - const book = { - id: 'the-alchemist', - title: 'The Alchemist', - author: 'Paulo Coelho', - description: 'A captivating novel about a young shepherd who journeys to the Egyptian desert in search of a treasure. His quest leads him to discover a different kind of treasure than he originally envisioned.', - price: '$12.99', - imageSrc: 'https://pub-8b4931a55099479ca4d5a9d685ac336c.r2.dev/book-cover-alchemist.png', - imageAlt: 'The Alchemist book cover', - rating: 4.8, - reviewCount: 1500, - }; + const pathname = usePathname(); + const productId = pathname.split('/').pop(); - const reviews = [ - { - id: '1', - name: 'Sophia M.', - role: 'Avid Reader', - testimonial: 'An inspiring and thought-provoking read that I couldn\'t put down. Highly recommended!', - imageSrc: 'https://pub-8b4931a55099479ca4d5a9d685ac336c.r2.dev/customer-avatar-1.jpg', - icon: Star, - }, - { - id: '2', - name: 'John D.', - role: 'Book Enthusiast', - testimonial: 'The story is beautifully written and full of wisdom. A true classic that everyone should read.', - imageSrc: 'https://pub-8b4931a55099479ca4d5a9d685ac336c.r2.dev/customer-avatar-2.jpg', - icon: Star, - }, - { - id: '3', - name: 'Emily R.', - role: 'Philosophy Student', - testimonial: 'Changed my perspective on life and destiny. Deeply moving and thought-provoking.', - imageSrc: 'https://pub-8b4931a55099479ca4d5a9d685ac336c.r2.dev/customer-avatar-3.jpg', - icon: Star, - }, + const [product, setProduct] = useState(null); + + useEffect(() => { + // Simulate fetching product details + const dummyProducts = [ + { + id: "prod1", brand: "BrandA", name: "Stylish Shirt", price: "$29.99", rating: 4.5, + reviewCount: "120", imageSrc: "https://via.placeholder.com/600x400?text=Product+1", imageAlt: "Stylish Shirt", description: "A very stylish shirt made from premium cotton. Perfect for any occasion.", details: ["100% Cotton", "Machine Washable", "Available in S, M, L, XL"], + reviews: [ + { author: "Alice", text: "Great shirt, very comfortable!", rating: 5 }, + { author: "Bob", text: "Good quality for the price.", rating: 4 }, + ] + }, + { + id: "prod2", brand: "BrandB", name: "Comfy Jeans", price: "$49.99", rating: 4.2, + reviewCount: "85", imageSrc: "https://via.placeholder.com/600x400?text=Product+2", imageAlt: "Comfy Jeans", description: "Comfortable and durable jeans, perfect for everyday wear.", details: ["98% Cotton, 2% Spandex", "Regular Fit", "Multiple sizes available"], + reviews: [ + { author: "Charlie", text: "My new favorite jeans!", rating: 5 }, + { author: "Diana", text: "A bit snug, but good overall.", rating: 3 }, + ] + }, + { + id: "prod3", brand: "BrandC", name: "Running Shoes", price: "$79.99", rating: 4.8, + reviewCount: "200", imageSrc: "https://via.placeholder.com/600x400?text=Product+3", imageAlt: "Running Shoes", description: "High-performance running shoes designed for ultimate comfort and speed.", details: ["Lightweight design", "Breathable mesh", "Shock-absorbing sole"], + reviews: [ + { author: "Eve", text: "Amazing shoes for long runs.", rating: 5 }, + { author: "Frank", text: "Worth every penny.", rating: 5 }, + ] + }, + ]; + + const foundProduct = dummyProducts.find(p => p.id === productId); + setProduct(foundProduct); + }, [productId]); + + const navItems = [ + { name: "Home", id: "/" }, + { name: "Cart", id: "/cart" }, + { name: "Checkout", id: "/checkout" }, + { name: "Order Conf", id: "/order-confirmation" }, + { name: "Products", id: "/products/1" }, + { name: "Collections", id: "/collections/all" } ]; - const relatedProducts = [ - { - id: 'little-prince', - name: 'The Little Prince', - price: '$9.99', - imageSrc: 'https://pub-8b4931a55099479ca4d5a9d685ac336c.r2.dev/book-cover-little-prince.png', - imageAlt: 'The Little Prince book cover', - }, - { - id: 'siddhartha', - name: 'Siddhartha', - price: '$11.50', - imageSrc: 'https://pub-8b4931a55099479ca4d5a9d685ac336c.r2.dev/book-cover-siddhartha.png', - imageAlt: 'Siddhartha book cover', - }, - { - id: 'jonathan-seagull', - name: 'Jonathan Livingston Seagull', - price: '$8.75', - imageSrc: 'https://pub-8b4931a55099479ca4d5a9d685ac336c.r2.dev/book-cover-jonathan-seagull.png', - imageAlt: 'Jonathan Livingston Seagull book cover', - }, - { - id: 'the-prophet', - name: 'The Prophet', - price: '$10.25', - imageSrc: 'https://pub-8b4931a55099479ca4d5a9d685ac336c.r2.dev/book-cover-prophet.png', - imageAlt: 'The Prophet book cover', - }, - ]; + if (!product) { + return ( + + +
+

Loading product details...

+
+ +
+ ); + } return ( - - -
- {/* Book Information Section */} -
-
- {book.imageAlt} -
-
+ + +
+
+
-

By {book.author}

-

{book.description}

-
- {Array.from({ length: Math.floor(book.rating) }).map((_, i) => ( - - ))} - ({book.rating} / {book.reviewCount} reviews) + className="text-4xl font-bold mb-4" + > + {`Details for ${product?.name || 'Product'}`} + +
+ +
+
+ {product.imageAlt}
-

{book.price}

-
- +

{product.name}

+

{product.price}

+
+ {'★'.repeat(Math.floor(product.rating))} + {'★'.repeat(5 - Math.floor(product.rating))} + ({product.reviewCount} Reviews) +
+

{product.description}

+

Product Details

+
    + {product.details.map((detail: string, index: number) => ( +
  • {detail}
  • + ))} +
+ alert(`Added ${product.name} to cart!`)} + className="w-full py-3 text-lg" + textClassName="font-bold" /> -
-
- {/* Reviews Section */} -
- -
- - {/* Related Products Section */} -
+
); -} \ No newline at end of file +}