import React, { useMemo } from 'react'; import type { FlyerItem } from '../types'; import { TrophyIcon } from './icons/TrophyIcon'; interface TopDealsProps { items: FlyerItem[]; } export const TopDeals: React.FC = ({ items }) => { const topDeals = useMemo(() => { return [...items] .filter(item => item.price_in_cents !== null) // Only include items with a parseable price .sort((a, b) => (a.price_in_cents ?? Infinity) - (b.price_in_cents ?? Infinity)) .slice(0, 10); }, [items]); if (topDeals.length === 0) { return null; } return (

Top 10 Deals Across All Flyers

); };