From 99c892e00c48091cca7a34ae941aa31dcf2cb901 Mon Sep 17 00:00:00 2001 From: bender Date: Sun, 22 Feb 2026 13:47:36 +0000 Subject: [PATCH] Update src/app/shop/[id]/page.tsx --- src/app/shop/[id]/page.tsx | 240 +++++++++++++------------------------ 1 file changed, 85 insertions(+), 155 deletions(-) diff --git a/src/app/shop/[id]/page.tsx b/src/app/shop/[id]/page.tsx index 2b990f6..6d233a4 100644 --- a/src/app/shop/[id]/page.tsx +++ b/src/app/shop/[id]/page.tsx @@ -2,7 +2,6 @@ import { Suspense, use, useCallback } from "react"; import { useRouter } from "next/navigation"; -import ReactLenis from "lenis/react"; import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider"; import ProductDetailCard from "@/components/ecommerce/productDetail/ProductDetailCard"; import ProductCart from "@/components/ecommerce/cart/ProductCart"; @@ -11,6 +10,7 @@ import { useCart } from "@/hooks/useCart"; import { useCheckout } from "@/hooks/useCheckout"; import NavbarLayoutFloatingOverlay from '@/components/navbar/NavbarLayoutFloatingOverlay/NavbarLayoutFloatingOverlay'; import FooterMedia from '@/components/sections/footer/FooterMedia'; +import Link from 'next/link'; interface ProductPageProps { params: Promise<{ id: string }>; @@ -19,12 +19,12 @@ interface ProductPageProps { export default function ProductPage({ params }: ProductPageProps) { return ( - + ); } -function ProductPageContent({ params }: ProductPageProps) { +function ProductPageContentWrapper({ params }: ProductPageProps) { const { id } = use(params); const router = useRouter(); @@ -74,100 +74,52 @@ function ProductPageContent({ params }: ProductPageProps) { await checkout(getCheckoutItems(), { successUrl: currentUrl.toString() }); }, [cartItems, checkout, getCheckoutItems]); - if (isLoading) { + const content = () => { + if (isLoading) { + return ( +
+

Loading product...

+
+ ) + } + if (!product) { + return ( +
+
+

Product not found

+ +
+
+ ) + } return ( - - - -
-

Loading product...

-
- -
-
- ); - } - - if (!product) { - return ( - - - -
-
-

Product not found

- -
-
- -
-
- ); +
+ 0 ? variants : undefined} + quantity={quantityVariant} + ribbon={meta.ribbon} + inventoryStatus={meta.inventoryStatus} + inventoryQuantity={meta.inventoryQuantity} + sku={meta.sku} + buttons={[ + { text: "Add To Cart", onClick: handleAddToCart }, + { text: "Buy Now", onClick: handleBuyNow }, + ]} + /> +
+ ) } return ( @@ -183,65 +135,43 @@ function ProductPageContent({ params }: ProductPageProps) { secondaryButtonStyle="glass" headingFontWeight="normal" > - - -
- 0 ? variants : undefined} - quantity={quantityVariant} - ribbon={meta.ribbon} - inventoryStatus={meta.inventoryStatus} - inventoryQuantity={meta.inventoryQuantity} - sku={meta.sku} - buttons={[ - { text: "Add To Cart", onClick: handleAddToCart }, - { text: "Buy Now", onClick: handleBuyNow }, - ]} - /> -
-
- setCartOpen(false)} - items={cartItems} - onQuantityChange={updateQuantity} - onRemove={removeItem} - total={`$${cartTotal}`} - buttons={[ - { - text: isCheckoutLoading ? "Processing..." : "Check Out", onClick: handleCheckout, - }, - ]} - /> -
- -
+ + {content()} +
+ setCartOpen(false)} + items={cartItems} + onQuantityChange={updateQuantity} + onRemove={removeItem} + total={`$${cartTotal}`} + buttons={[ + { + text: isCheckoutLoading ? "Processing..." : "Check Out", onClick: handleCheckout, + }, + ]} + /> +
+ ); }