diff --git a/src/app/shop/page.tsx b/src/app/shop/page.tsx index 6c65574..b7243c2 100644 --- a/src/app/shop/page.tsx +++ b/src/app/shop/page.tsx @@ -1,23 +1,29 @@ "use client"; import React, { useCallback } from "react"; -import ReactLenis from "lenis/react"; +import { useRouter } from 'next/navigation'; import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider"; import NavbarStyleApple from '@/components/navbar/NavbarStyleApple/NavbarStyleApple'; import FooterMedia from '@/components/sections/footer/FooterMedia'; -import ProductCatalog from "@/components/ecommerce/productCatalog/ProductCatalog"; +import ProductCardOne from "@/components/sections/product/ProductCardOne"; import ProductCart from "@/components/ecommerce/cart/ProductCart"; import { useProductCatalog } from "@/hooks/useProductCatalog"; import { useCart } from "@/hooks/useCart"; import { useCheckout } from "@/hooks/useCheckout"; +const navItems = [ + { name: "Home", id: "/" }, + { name: "Products", id: "/shop" }, + { name: "About", id: "/#about" }, + { name: "Testimonials", id: "/#testimonials" }, + { name: "Contact", id: "/#contact" }, +]; + export default function ShopPage() { + const router = useRouter(); const { products, isLoading, - search, - setSearch, - filters, } = useProductCatalog({ basePath: "/shop" }); const { @@ -41,22 +47,17 @@ export default function ShopPage() { await checkout(getCheckoutItems(), { successUrl: currentUrl.toString() }); }, [cartItems, checkout, getCheckoutItems]); + const cartCount = cartItems.length; const navbarProps = { - brandName: "Persik", navItems: [ - { name: "Home", id: "/" }, - { name: "Shop", id: "/shop" }, - { name: "About", id: "#about" }, - { name: "Testimonials", id: "#testimonials" }, - { name: "Contact", id: "#contact" } - ], - button: { text: "Cart", onClick: () => setCartOpen(true) }, + brandName: "Persik", navItems: navItems, + button: { text: `Cart (${cartCount})`, onClick: () => setCartOpen(true) }, mobileNavContent: (
) @@ -65,40 +66,11 @@ export default function ShopPage() { const footerProps = { imageSrc: "https://img.b2bpic.net/free-photo/woman-holds-festive-flower-arrangement-with-bright-chrysanthemum-flowers_169016-51483.jpg?_wi=3", imageAlt: "Soft focus background image of various flowers", logoText: "Persik Flowers", copyrightText: "© 2024 Persik | All rights reserved", columns: [ { title: "Shop", items: [{ label: "Bouquets", href: "/shop" }, { label: "Arrangements", href: "/shop" }, { label: "Gifts", href: "/shop" }] }, - { title: "About Us", items: [{ label: "Our Story", href: "#about" }, { label: "Testimonials", href: "#testimonials" }] }, - { title: "Support", items: [{ label: "Contact", href: "#contact" }, { label: "Delivery Info", href: "https://example.com/delivery" }, { label: "Privacy Policy", href: "https://example.com/privacy" }] } + { title: "About Us", items: [{ label: "Our Story", href: "/#about" }, { label: "Testimonials", href: "/#testimonials" }] }, + { title: "Support", items: [{ label: "Contact", href: "/#contact" }, { label: "Delivery Info", href: "https://example.com/delivery" }, { label: "Privacy Policy", href: "https://example.com/privacy" }] } ] }; - if (isLoading) { - return ( - - - -
-

Loading products...

-
- -
-
- ); - } - return ( - - + + {isLoading ? ( +
+

Loading products...

+
+ ) : (
- ({ + id: p.id, + name: p.name, + price: p.price, + imageSrc: p.images?.[0]?.src || '/placeholders/placeholder1.webp', + imageAlt: p.images?.[0]?.alt || p.name, + onProductClick: () => router.push(`/shop/${p.id}`), + }))} + gridVariant="four-items-2x2-equal-grid" + animationType="slide-up" + textboxLayout="default" + useInvertedBackground={false} />
-
- setCartOpen(false)} - items={cartItems} - onQuantityChange={updateQuantity} - onRemove={removeItem} - total={`$${cartTotal}`} - buttons={[ - { - text: isCheckoutLoading ? "Processing..." : "Check Out", onClick: handleCheckout, - }, - ]} - /> -
- -
+ )} + setCartOpen(false)} + items={cartItems} + onQuantityChange={updateQuantity} + onRemove={removeItem} + total={`$${cartTotal}`} + buttons={[ + { + text: isCheckoutLoading ? "Processing..." : "Check Out", onClick: handleCheckout, + }, + ]} + /> +
); } \ No newline at end of file