import { useState, useEffect } from 'react'; interface DealItem { id: number; name: string; brand: string; slug: string; image_url: string; cutout_image_url: string | null; colorway: string; lowest_price: number | null; original_price: number | null; discount_pct: number; } export default function DealsForYouSection() { const [items, setItems] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { fetch('/api/user/deals-for-you') .then(r => r.json()) .then(data => { setItems(data.items || []); setLoading(false); }) .catch(() => setLoading(false)); }, []); if (loading) return null; if (items.length === 0) return null; return (

Deals van de dag — voor jou

Prijsdalingen op jouw favoriete merken en budgetrange

{items.map((item) => (
{item.name} { (e.target as HTMLImageElement).src = '/img/sneaker-placeholder.svg'; }} /> {item.discount_pct > 0 && (
-{item.discount_pct}%
)}

{item.brand}

{item.name}

{item.lowest_price ? ( <> €{item.lowest_price.toFixed(2).replace('.', ',')} {item.original_price && item.original_price > item.lowest_price && ( €{item.original_price.toFixed(2).replace('.', ',')} )} ) : ( N/A )}
))}
); }