From 5f8179dce63a6fe68a78e05b306e0f84f0eb0953 Mon Sep 17 00:00:00 2001 From: Vula Builder Date: Wed, 29 Jul 2026 19:04:17 +0000 Subject: [PATCH] Deploy --- .../sections/JustDroppedSection.tsx | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 src/components/sections/JustDroppedSection.tsx diff --git a/src/components/sections/JustDroppedSection.tsx b/src/components/sections/JustDroppedSection.tsx new file mode 100644 index 0000000..9df1371 --- /dev/null +++ b/src/components/sections/JustDroppedSection.tsx @@ -0,0 +1,107 @@ +'use client' + +import { useProducts } from "@/hooks/useProducts" +import { useVulaCart } from "@/hooks/useVulaCart" +import Image from "next/image" +import Link from "next/link" +import Button from "@/components/ui/Button" +import { ShoppingBag, Star } from 'lucide-react' + +export default function JustDroppedSection() { + const { products, isLoading, error } = useProducts(8) + const { addToCart } = useVulaCart() + + const formatPrice = (amount: number) => `R${amount.toFixed(2)}` + + const handleAddToCart = (product: any) => { + if (!product.variants?.length) return + const variant = product.variants?.[0] + addToCart({ + variantId: variant.id, + productId: product.id, + title: product.title, + variant_title: variant.title, + unit_price: variant.price_amount, + quantity: 1, + thumbnail: product.thumbnail ?? null, + }) + window.dispatchEvent(new CustomEvent("cart-drawer-open")) + } + + if (isLoading) { + return ( +
+
+

+ Just Dropped +

+
+ +
+
+
+ ) + } + + if (error) { + return ( +
+
+

{error}

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

+ Just Dropped +

+
+ {products?.map((product: any) => ( +
+ + {product.thumbnail ? ( + {product.title} + ) : ( +
+ +
+ )} + +
+

+ + {product.title} + +

+

+ {product.price_amount != null ? formatPrice(product.price_amount) : "R0.00"} +

+ +
+
+ ))} +
+
+
+ ) +} \ No newline at end of file