type TopItemProps = { title: string; imageSrc: string; items: T[]; getLabel: (item: T) => string; includeTime?: boolean; }; export function RewindTopItem< T extends { id: string | number; listen_count: number; time_listened: number; } >({ title, imageSrc, items, getLabel, includeTime }: TopItemProps) { const [top, ...rest] = items; if (!top) return null; return (

{title}

{getLabel(top)}

{`${top.listen_count} plays`} {includeTime ? ` (${Math.floor(top.time_listened / 60)} minutes)` : ``}
{rest.map((e) => (
{getLabel(e)} {` - ${e.listen_count} plays`} {includeTime ? ` (${Math.floor(e.time_listened / 60)} minutes)` : ``}
))}
); }