import { GroupedProduct, ProductWithDistance } from '../types/product' import { formatCents } from '../utils/format' interface GroupedProductCardProps { group: GroupedProduct onClick: () => void } export const GroupedProductCard = ({ group, onClick }: GroupedProductCardProps) => { const nearestOffer = group.offers.reduce((a, b) => a.distance_km < b.distance_km ? a : b) const soonestExpiry = group.offers.reduce((a, b) => new Date(a.expires_at).getTime() < new Date(b.expires_at).getTime() ? a : b ) const isExpiringSoon = new Date(soonestExpiry.expires_at).getTime() - Date.now() < 30 * 24 * 60 * 60 * 1000 return (
{group.description}
A partir de