From b417fc624a53c3970cfb914a1f6b205e2cf76cd7 Mon Sep 17 00:00:00 2001 From: Vula Builder Date: Tue, 28 Jul 2026 13:27:27 +0000 Subject: [PATCH] Deploy --- .../sections/LatestDropsSection.tsx | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 src/components/sections/LatestDropsSection.tsx diff --git a/src/components/sections/LatestDropsSection.tsx b/src/components/sections/LatestDropsSection.tsx new file mode 100644 index 0000000..d3fee5c --- /dev/null +++ b/src/components/sections/LatestDropsSection.tsx @@ -0,0 +1,92 @@ +'use client' + +import { useMedusaProducts } from '@/hooks/useMedusaProducts' +import { useMedusaCart } from '@/hooks/useMedusaCart' +import { Card, CardHeader, CardTitle, CardContent, CardFooter } from '@/components/ui/Card' +import Button from '@/components/ui/Button' +import Badge from '@/components/ui/Badge' +import Image from 'next/image' +import Link from 'next/link' + +const formatPrice = (amount: number, code?: string) => { + const syms: Record = { zar: 'R', usd: '$', eur: '€' } + const sym = syms[(code || '').toLowerCase()] || (code?.toUpperCase() || 'R') + return `${sym}${(amount / 100).toFixed(2)}` +} + +export default function LatestDropsSection() { + const { products, isLoading } = useMedusaProducts(4) + const { addToCart } = useMedusaCart() + + if (isLoading) { + return ( +
+
+
+ ) + } + + if (!products || products.length === 0) return null + + return ( +
+
+
+ +

+ Latest Drops +

+ +
+ +
+ {products.map((product) => { + const price = product.variants?.[0]?.prices?.[0] + const priceStr = price ? formatPrice(price.amount, price.currency_code) : 'Price on request' + + return ( + + +
+ {product.title} +
+ + + + {product.title} + + + +

{priceStr}

+
+ + + +
+ ) + })} +
+
+
+ ) +}