From 6806e1b2e13f1e5617fa9fc15123a9a876634c7d Mon Sep 17 00:00:00 2001 From: bender Date: Wed, 25 Feb 2026 12:55:31 +0000 Subject: [PATCH 1/2] Add src/app/shop/[id]/page.tsx --- src/app/shop/[id]/page.tsx | 217 +++++++++++++++++++++++++++++++++++++ 1 file changed, 217 insertions(+) create mode 100644 src/app/shop/[id]/page.tsx diff --git a/src/app/shop/[id]/page.tsx b/src/app/shop/[id]/page.tsx new file mode 100644 index 0000000..e28ccfe --- /dev/null +++ b/src/app/shop/[id]/page.tsx @@ -0,0 +1,217 @@ +"use client"; + +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"; +import { useProductDetail } from "@/hooks/useProductDetail"; +import { useCart } from "@/hooks/useCart"; +import { useCheckout } from "@/hooks/useCheckout"; +import NavbarStyleFullscreen from '@/components/navbar/NavbarStyleFullscreen/NavbarStyleFullscreen'; +import FooterBaseReveal from '@/components/sections/footer/FooterBaseReveal'; + +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]); + + if (isLoading) { + return ( + + + +
+

Loading product...

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

Product not found

+ +
+
+
+
+ ); + } + + return ( + + + +
+ 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, + }, + ]} + /> +
+
+
+ ); +} -- 2.49.1 From cce4f46713424677d0c3a89eb55f60ee34e56b86 Mon Sep 17 00:00:00 2001 From: bender Date: Wed, 25 Feb 2026 12:55:32 +0000 Subject: [PATCH 2/2] Add src/app/shop/page.tsx --- src/app/shop/page.tsx | 99 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 src/app/shop/page.tsx diff --git a/src/app/shop/page.tsx b/src/app/shop/page.tsx new file mode 100644 index 0000000..bede681 --- /dev/null +++ b/src/app/shop/page.tsx @@ -0,0 +1,99 @@ +"use client"; + +import { Suspense } from "react"; +import ReactLenis from "lenis/react"; +import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider"; +import ProductCatalog from "@/components/ecommerce/productCatalog/ProductCatalog"; +import { useProductCatalog } from "@/hooks/useProductCatalog"; +import NavbarStyleFullscreen from '@/components/navbar/NavbarStyleFullscreen/NavbarStyleFullscreen'; +import FooterBaseReveal from '@/components/sections/footer/FooterBaseReveal'; + +function ShopPageContent() { + const { + products, + isLoading, + search, + setSearch, + filters, + } = useProductCatalog({ basePath: "/shop" }); + + if (isLoading) { + return ( + + + +
+

Loading products...

+
+
+
+ ); + } + + return ( + + + +
+ +
+
+
+ ); +} + +export default function ShopPage() { + return ( + + + + ); +} -- 2.49.1