From bbde1090a9f9ac0ae80975c42ea9d4b0140e53ab Mon Sep 17 00:00:00 2001 From: Vula Builder Date: Mon, 27 Jul 2026 17:52:35 +0000 Subject: [PATCH] Deploy --- .../sections/FreshThreadsSection.tsx | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 src/components/sections/FreshThreadsSection.tsx diff --git a/src/components/sections/FreshThreadsSection.tsx b/src/components/sections/FreshThreadsSection.tsx new file mode 100644 index 0000000..5f0039f --- /dev/null +++ b/src/components/sections/FreshThreadsSection.tsx @@ -0,0 +1,82 @@ +'use client' + +import { useMedusaProducts } from '@/hooks/useMedusaProducts' +import { useMedusaCart } from '@/hooks/useMedusaCart' +import { Card, CardContent } from '@/components/ui/Card' +import Button from '@/components/ui/Button' +import Badge from '@/components/ui/Badge' +import { Eye, ShoppingBag } from 'lucide-react' +import Image from 'next/image' +import Link from 'next/link' + +const CURRENCY_SYMBOLS: Record = { zar: 'R', usd: '$', eur: '€', gbp: '£', kes: 'KSh', ngn: '₦', ghs: '₵' } +const formatPrice = (amount: number, code?: string) => { + const sym = CURRENCY_SYMBOLS[(code ?? '').toLowerCase()] ?? (code?.toUpperCase() ?? '') + return `${sym}${(amount / 100).toFixed(2)}` +} + +export default function FreshThreadsSection() { + const { products, isLoading } = useMedusaProducts(8) + const { addToCart } = useMedusaCart() + + if (isLoading) return
+ if (!products || products.length === 0) return null + + const handleQuickAdd = (variantId: string) => { + addToCart(variantId, 1) + window.dispatchEvent(new CustomEvent('cart-drawer-open')) + } + + return ( +
+
+

+ Fresh Threads +

+
+ {products.map((product) => { + const variant = product.variants?.[0] + const price = variant?.prices?.[0] + return ( + + + {product.thumbnail ? ( + {product.title} + ) : ( +
+ +
+ )} + + Just Dropped + + + +

{product.title}

+

+ {price ? formatPrice(price.amount, price.currency_code) : '—'} +

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