diff --git a/src/app/collections/[category]/page.tsx b/src/app/collections/[category]/page.tsx index b049e29..624036e 100644 --- a/src/app/collections/[category]/page.tsx +++ b/src/app/collections/[category]/page.tsx @@ -1,216 +1,115 @@ -"use client"; +'use client'; +import { ThemeProvider } from '@/providers/themeProvider/ThemeProvider'; +import NavbarStyleCentered from '@/components/navbar/NavbarStyleCentered/NavbarStyleCentered'; +import ProductCardTwo from '@/components/sections/product/ProductCardTwo'; +import ButtonTextShift from '@/components/button/ButtonTextShift/ButtonTextShift'; +import FooterBaseReveal from '@/components/sections/footer/FooterBaseReveal'; -import { useState, useMemo } from 'react'; -import NavbarStyleFullscreen from '@/components/navbar/NavbarStyleFullscreen/NavbarStyleFullscreen'; -import ProductCardThree from '@/components/sections/product/ProductCardThree'; -import Input from '@/components/form/Input'; -import ButtonExpandHover from '@/components/button/ButtonExpandHover'; -import { useRouter } from 'next/navigation'; -import { ChevronLeft, ChevronRight, Filter, Search, SlidersHorizontal } from 'lucide-react'; +import { usePathname } from 'next/navigation'; -// Dummy data for books -const allBooks = [ - { id: '1', name: 'The Art of Programming', price: '$29.99', imageSrc: '/book-programming.jpg', imageAlt: 'Book cover for The Art of Programming', category: 'technology' }, - { id: '2', name: 'Science Fiction Masterpiece', price: '$19.99', imageSrc: '/book-scifi.jpg', imageAlt: 'Book cover for Science Fiction Masterpiece', category: 'fiction' }, - { id: '3', name: 'A Culinary Journey', price: '$24.99', imageSrc: '/book-cooking.jpg', imageAlt: 'Book cover for A Culinary Journey', category: 'cooking' }, - { id: '4', name: 'History of the World', price: '$35.00', imageSrc: '/book-history.jpg', imageAlt: 'Book cover for History of the World', category: 'history' }, - { id: '5', name: 'Developing Modern Web Apps', price: '$39.99', imageSrc: '/book-webdev.jpg', imageAlt: 'Book cover for Developing Modern Web Apps', category: 'technology' }, - { id: '6', name: 'Fantasy Realms Saga', price: '$22.50', imageSrc: '/book-fantasy.jpg', imageAlt: 'Book cover for Fantasy Realms Saga', category: 'fiction' }, - { id: '7', name: 'Gourmet Baking Guide', price: '$28.00', imageSrc: '/book-baking.jpg', imageAlt: 'Book cover for Gourmet Baking Guide', category: 'cooking' }, - { id: '8', name: 'Ancient Civilizations', price: '$32.00', imageSrc: '/book-ancient.jpg', imageAlt: 'Book cover for Ancient Civilizations', category: 'history' }, - { id: '9', name: 'The Digital Frontier', price: '$31.99', imageSrc: '/book-digital.jpg', imageAlt: 'Book cover for The Digital Frontier', category: 'technology' }, - { id: '10', name: 'Mythical Beasts', price: '$18.75', imageSrc: '/book-myth.jpg', imageAlt: 'Book cover for Mythical Beasts', category: 'fiction' } -]; - -const ITEMS_PER_PAGE = 6; - -export default function BookCollectionPage({ params }: { params: { category: string } }) { - const router = useRouter(); - const { category } = params; - const [searchTerm, setSearchTerm] = useState(''); - const [sortOrder, setSortOrder] = useState<'asc' | 'desc' | 'none'>('none'); - const [currentPage, setCurrentPage] = useState(1); +export default function CollectionPage() { + const pathname = usePathname(); + const category = pathname.split('/').pop()?.replace(/-/g, ' ') || 'All Products'; const navItems = [ { name: "Home", id: "/" }, - { name: "About", id: "#about" }, - { name: "Features", id: "#features" }, - { name: "Pricing", id: "#pricing" }, - { name: "Books", id: "/collections/all" } + { 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 filteredAndSortedBooks = useMemo(() => { - let books = allBooks; - - // Category filtering - if (category !== 'all') { - books = books.filter(book => book.category === category); + // Dummy product data for the collection page + const products = [ + { + id: "prod1", brand: "BrandA", name: "Stylish Shirt", price: "$29.99", rating: 4.5, + reviewCount: "120", imageSrc: "https://via.placeholder.com/300x400?text=Product+1", imageAlt: "Stylish Shirt" + }, + { + id: "prod2", brand: "BrandB", name: "Comfy Jeans", price: "$49.99", rating: 4.2, + reviewCount: "85", imageSrc: "https://via.placeholder.com/300x400?text=Product+2", imageAlt: "Comfy Jeans" + }, + { + id: "prod3", brand: "BrandC", name: "Running Shoes", price: "$79.99", rating: 4.8, + reviewCount: "200", imageSrc: "https://via.placeholder.com/300x400?text=Product+3", imageAlt: "Running Shoes" + }, + { + id: "prod4", brand: "BrandD", name: "Elegant Dress", price: "$89.99", rating: 4.7, + reviewCount: "150", imageSrc: "https://via.placeholder.com/300x400?text=Product+4", imageAlt: "Elegant Dress" + }, + { + id: "prod5", brand: "BrandE", name: "Smart Watch", price: "$199.99", rating: 4.6, + reviewCount: "230", imageSrc: "https://via.placeholder.com/300x400?text=Product+5", imageAlt: "Smart Watch" } - - // Search term filtering - if (searchTerm) { - books = books.filter(book => - book.name.toLowerCase().includes(searchTerm.toLowerCase()) - ); - } - - // Sorting - if (sortOrder === 'asc') { - books = [...books].sort((a, b) => a.name.localeCompare(b.name)); - } else if (sortOrder === 'desc') { - books = [...books].sort((a, b) => b.name.localeCompare(a.name)); - } - - return books; - }, [category, searchTerm, sortOrder]); - - const totalPages = Math.ceil(filteredAndSortedBooks.length / ITEMS_PER_PAGE); - const paginatedBooks = useMemo(() => { - const startIndex = (currentPage - 1) * ITEMS_PER_PAGE; - const endIndex = startIndex + ITEMS_PER_PAGE; - return filteredAndSortedBooks.slice(startIndex, endIndex); - }, [filteredAndSortedBooks, currentPage]); - - const handleCategoryChange = (newCategory: string) => { - router.push(`/collections/${newCategory}`); - setCurrentPage(1); // Reset page on category change - }; - - const handlePageChange = (page: number) => { - if (page >= 1 && page <= totalPages) { - setCurrentPage(page); - } - }; - - const uniqueCategories = useMemo(() => { - const categories = new Set(allBooks.map(book => book.category)); - return ['all', ...Array.from(categories)]; - }, []); + ]; return ( -
- - -
-

- {category === 'all' ? 'All Books' : `${category} Books`} -

- -
- {/* Category Filter */} -
- - - -
- - {/* Search Input */} -
- - -
- - {/* Sort Order */} -
- - - -
-
- - {paginatedBooks.length > 0 ? ( - + +
+
+ ({ - id: book.id, - name: book.name, - price: book.price, - imageSrc: book.imageSrc, - imageAlt: book.imageAlt - // Add other necessary product props, e.g., onFavorite, onProductClick - }))} - className="mb-8" + title={`Collection: ${category}`} + description="Explore our curated selection of products." + products={products} + className="my-10" + textboxLayout="default" + useInvertedBackground={false} /> - ) : ( -
- No books found for this category or search term. +
+ alert("Loading more products...")} + disabled={false} + ariaLabel="View more products" + className="px-6 py-3" + textClassName="font-semibold" + /> + alert("Opening filter options...")} + disabled={false} + ariaLabel="Filter products" + className="px-6 py-3" + textClassName="font-semibold" + />
- )} - - {/* Pagination */} - {totalPages > 1 && ( -
- handlePageChange(currentPage - 1)} - disabled={currentPage === 1} - ariaLabel="Previous page" - className="w-10 h-10 p-0 flex items-center justify-center bg-secondary-cta hover:bg-secondary-cta/80 disabled:opacity-50 disabled:cursor-not-allowed" - textClassName="sr-only" - > - - - {Array.from({ length: totalPages }, (_, i) => i + 1).map(page => ( - - ))} - handlePageChange(currentPage + 1)} - disabled={currentPage === totalPages} - ariaLabel="Next page" - className="w-10 h-10 p-0 flex items-center justify-center bg-secondary-cta hover:bg-secondary-cta/80 disabled:opacity-50 disabled:cursor-not-allowed" - textClassName="sr-only" - > - - -
- )} -
-
+
+
+ + ); -} \ No newline at end of file +} diff --git a/src/app/order-confirmation/page.tsx b/src/app/order-confirmation/page.tsx index 8d9c771..3012078 100644 --- a/src/app/order-confirmation/page.tsx +++ b/src/app/order-confirmation/page.tsx @@ -1,7 +1,7 @@ 'use client'; -import { ThemeProvider } from 'next-themes'; +import { ThemeProvider } from '@/providers/themeProvider/ThemeProvider'; import NavbarStyleCentered from '@/components/navbar/NavbarStyleCentered/NavbarStyleCentered'; -import HeroCentered from '@/components/sections/hero/HeroCentered'; +import HeroSplitDoubleCarousel from '@/components/sections/hero/HeroSplitDoubleCarousel'; import FooterBaseReveal from '@/components/sections/footer/FooterBaseReveal'; export default function OrderConfirmationPage() { @@ -9,12 +9,13 @@ export default function OrderConfirmationPage() { { name: "Home", id: "/" }, { name: "Cart", id: "/cart" }, { name: "Checkout", id: "/checkout" }, - { name: "Order Conf", id: "/order-confirmation" } + { name: "Order Conf", id: "/order-confirmation" }, + { name: "Products", id: "/products/1" }, + { name: "Collections", id: "/collections/all" } ]; return ( - -
- + +
+
+ +