Update src/app/shop/[id]/page.tsx
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
import { Suspense, use, useCallback } from "react";
|
import { Suspense, use, useCallback } from "react";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import ReactLenis from "lenis/react";
|
|
||||||
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
|
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
|
||||||
import NavbarStyleCentered from '@/components/navbar/NavbarStyleCentered/NavbarStyleCentered';
|
import NavbarStyleCentered from '@/components/navbar/NavbarStyleCentered/NavbarStyleCentered';
|
||||||
import ProductDetailCard from "@/components/ecommerce/productDetail/ProductDetailCard";
|
import ProductDetailCard from "@/components/ecommerce/productDetail/ProductDetailCard";
|
||||||
@@ -101,14 +100,12 @@ function ProductPageContent({ params }: ProductPageProps) {
|
|||||||
secondaryButtonStyle="layered"
|
secondaryButtonStyle="layered"
|
||||||
headingFontWeight="light"
|
headingFontWeight="light"
|
||||||
>
|
>
|
||||||
<ReactLenis root>
|
<div id="nav" data-section="nav">
|
||||||
<div id="navbar" data-section="navbar">
|
{navbar}
|
||||||
{navbar}
|
</div>
|
||||||
</div>
|
<main className="min-h-screen flex items-center justify-center pt-20">
|
||||||
<main className="min-h-screen flex items-center justify-center pt-20">
|
<p className="text-foreground">Loading product...</p>
|
||||||
<p className="text-foreground">Loading product...</p>
|
</main>
|
||||||
</main>
|
|
||||||
</ReactLenis>
|
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -127,22 +124,20 @@ function ProductPageContent({ params }: ProductPageProps) {
|
|||||||
secondaryButtonStyle="layered"
|
secondaryButtonStyle="layered"
|
||||||
headingFontWeight="light"
|
headingFontWeight="light"
|
||||||
>
|
>
|
||||||
<ReactLenis root>
|
<div id="nav" data-section="nav">
|
||||||
<div id="navbar" data-section="navbar">
|
{navbar}
|
||||||
{navbar}
|
</div>
|
||||||
|
<main className="min-h-screen flex items-center justify-center pt-20">
|
||||||
|
<div className="text-center">
|
||||||
|
<p className="text-foreground mb-4">Product not found</p>
|
||||||
|
<button
|
||||||
|
onClick={() => router.push("/shop")}
|
||||||
|
className="primary-button px-6 py-2 rounded-theme text-primary-cta-text"
|
||||||
|
>
|
||||||
|
Back to Shop
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<main className="min-h-screen flex items-center justify-center pt-20">
|
</main>
|
||||||
<div className="text-center">
|
|
||||||
<p className="text-foreground mb-4">Product not found</p>
|
|
||||||
<button
|
|
||||||
onClick={() => router.push("/shop")}
|
|
||||||
className="primary-button px-6 py-2 rounded-theme text-primary-cta-text"
|
|
||||||
>
|
|
||||||
Back to Shop
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
</ReactLenis>
|
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -160,47 +155,45 @@ function ProductPageContent({ params }: ProductPageProps) {
|
|||||||
secondaryButtonStyle="layered"
|
secondaryButtonStyle="layered"
|
||||||
headingFontWeight="light"
|
headingFontWeight="light"
|
||||||
>
|
>
|
||||||
<ReactLenis root>
|
<div id="nav" data-section="nav">
|
||||||
<div id="navbar" data-section="navbar">
|
{navbar}
|
||||||
{navbar}
|
</div>
|
||||||
</div>
|
<div id="product-detail-card" data-section="product-detail-card">
|
||||||
<div id="product-detail-card" data-section="product-detail-card">
|
<ProductDetailCard
|
||||||
<ProductDetailCard
|
layout="page"
|
||||||
layout="page"
|
name={product.name}
|
||||||
name={product.name}
|
price={product.price}
|
||||||
price={product.price}
|
salePrice={meta.salePrice}
|
||||||
salePrice={meta.salePrice}
|
rating={product.rating || 0}
|
||||||
rating={product.rating || 0}
|
description={product.description}
|
||||||
description={product.description}
|
images={images}
|
||||||
images={images}
|
variants={variants.length > 0 ? variants : undefined}
|
||||||
variants={variants.length > 0 ? variants : undefined}
|
quantity={quantityVariant}
|
||||||
quantity={quantityVariant}
|
ribbon={meta.ribbon}
|
||||||
ribbon={meta.ribbon}
|
inventoryStatus={meta.inventoryStatus}
|
||||||
inventoryStatus={meta.inventoryStatus}
|
inventoryQuantity={meta.inventoryQuantity}
|
||||||
inventoryQuantity={meta.inventoryQuantity}
|
sku={meta.sku}
|
||||||
sku={meta.sku}
|
buttons={[
|
||||||
buttons={[
|
{ text: "Add To Cart", onClick: handleAddToCart },
|
||||||
{ text: "Add To Cart", onClick: handleAddToCart },
|
{ text: "Buy Now", onClick: handleBuyNow },
|
||||||
{ text: "Buy Now", onClick: handleBuyNow },
|
]}
|
||||||
]}
|
/>
|
||||||
/>
|
</div>
|
||||||
</div>
|
<div id="product-cart" data-section="product-cart">
|
||||||
<div id="product-cart" data-section="product-cart">
|
<ProductCart
|
||||||
<ProductCart
|
isOpen={cartOpen}
|
||||||
isOpen={cartOpen}
|
onClose={() => setCartOpen(false)}
|
||||||
onClose={() => setCartOpen(false)}
|
items={cartItems}
|
||||||
items={cartItems}
|
onQuantityChange={updateQuantity}
|
||||||
onQuantityChange={updateQuantity}
|
onRemove={removeItem}
|
||||||
onRemove={removeItem}
|
total={`$${cartTotal}`}
|
||||||
total={`$${cartTotal}`}
|
buttons={[
|
||||||
buttons={[
|
{
|
||||||
{
|
text: isCheckoutLoading ? "Processing..." : "Check Out", onClick: handleCheckout,
|
||||||
text: isCheckoutLoading ? "Processing..." : "Check Out", onClick: handleCheckout,
|
},
|
||||||
},
|
]}
|
||||||
]}
|
/>
|
||||||
/>
|
</div>
|
||||||
</div>
|
|
||||||
</ReactLenis>
|
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user