From 5afa8f002304cb529474c95c9b906d869fc6816a Mon Sep 17 00:00:00 2001 From: bender Date: Tue, 24 Feb 2026 08:15:40 +0000 Subject: [PATCH] Update src/app/shop/[id]/page.tsx --- src/app/shop/[id]/page.tsx | 234 +++++++++++++------------------------ 1 file changed, 80 insertions(+), 154 deletions(-) diff --git a/src/app/shop/[id]/page.tsx b/src/app/shop/[id]/page.tsx index 1008e23..8f79449 100644 --- a/src/app/shop/[id]/page.tsx +++ b/src/app/shop/[id]/page.tsx @@ -1,88 +1,31 @@ "use client"; -import { Suspense, use, useCallback } from "react"; +import { Suspense, use } from "react"; import { useRouter } from "next/navigation"; -import ReactLenis from "lenis/react"; import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider"; import NavbarLayoutFloatingInline from '@/components/navbar/NavbarLayoutFloatingInline'; -import ProductDetailCard from "@/components/ecommerce/productDetail/ProductDetailCard"; -import ProductCart from "@/components/ecommerce/cart/ProductCart"; +import SplitAbout from '@/components/sections/about/SplitAbout'; import { useProductDetail } from "@/hooks/useProductDetail"; -import { useCart } from "@/hooks/useCart"; -import { useCheckout } from "@/hooks/useCheckout"; +import { DollarSign, Package, CheckCircle } from 'lucide-react'; -// Define common navigation items for sub-pages to maintain consistency -const ALL_NAV_ITEMS_SUB_PAGES = [ +const navItemsForSubPages = [ { name: "Home", id: "/" }, { name: "Products", id: "/products" }, - { name: "Shop", id: "/shop" }, - { name: "Blog", id: "/blog" }, { name: "About", id: "/#about" }, { name: "Testimonials", id: "/#testimonials" }, - { name: "FAQs", id: "/#faqs" } + { name: "FAQs", id: "/#faqs" }, + { name: "Contact", id: "/#contact" }, ]; interface ProductPageProps { params: Promise<{ id: string }>; } -export default function ProductPage({ params }: ProductPageProps) { - return ( - - - - ); -} - function ProductPageContent({ params }: ProductPageProps) { const { id } = use(params); const router = useRouter(); - const { - product, - isLoading, - images, - meta, - variants, - quantityVariant, - selectedQuantity, - createCartItem, - } = useProductDetail(id); - - const { - items: cartItems, - isOpen: cartOpen, - setIsOpen: setCartOpen, - addItem, - updateQuantity, - removeItem, - total: cartTotal, - getCheckoutItems, - } = useCart(); - - const { buyNow, checkout, isLoading: isCheckoutLoading } = useCheckout(); - - const handleAddToCart = useCallback(() => { - const item = createCartItem(); - if (item) { - addItem(item); - } - }, [createCartItem, addItem]); - - const handleBuyNow = useCallback(() => { - if (product) { - buyNow(product, selectedQuantity); - } - }, [product, selectedQuantity, buyNow]); - - const handleCheckout = useCallback(async () => { - if (cartItems.length === 0) return; - - const currentUrl = new URL(window.location.href); - currentUrl.searchParams.set("success", "true"); - - await checkout(getCheckoutItems(), { successUrl: currentUrl.toString() }); - }, [cartItems, checkout, getCheckoutItems]); + const { product, isLoading, images, meta } = useProductDetail(id); if (isLoading) { return ( @@ -98,23 +41,19 @@ function ProductPageContent({ params }: ProductPageProps) { secondaryButtonStyle="solid" headingFontWeight="light" > - - -
-
-

Loading product...

-
-
-
+ +
+

Loading product...

+
); } @@ -133,31 +72,27 @@ function ProductPageContent({ params }: ProductPageProps) { secondaryButtonStyle="solid" headingFontWeight="light" > - - + }> + + + ); +}