diff --git a/src/app/blog/page.tsx b/src/app/blog/page.tsx index a1d479b..d3ed726 100644 --- a/src/app/blog/page.tsx +++ b/src/app/blog/page.tsx @@ -33,7 +33,7 @@ export default function BlogPage() {
- { + const navigationItems = [ + { name: "Features", id: "/#features" }, + { name: "Products", id: "/#products" }, + { name: "Testimonials", id: "/#testimonials" }, + { name: "FAQ", id: "/#faq" }, + { name: "Contact", id: "/#contact" } + ]; -interface ProductPageProps { - params: Promise<{ id: string }>; -} - -export default function ProductPage({ 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, - }, - ]} - /> -
- -
-
- ); + 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, + }, + ]} + /> +
+ +
+
+ ); } diff --git a/src/app/shop/page.tsx b/src/app/shop/page.tsx index a6649d8..1307413 100644 --- a/src/app/shop/page.tsx +++ b/src/app/shop/page.tsx @@ -34,7 +34,7 @@ export default function ShopPage() {