import { formatDistanceToNow } from "date-fns"; import { TrendingUp } from "lucide-react"; import { GradientIcon } from "~/components/ui/GradientIcon"; import { BRACKT_GRADIENT } from "~/lib/brand"; export interface ScoreEventEntry { id: string; teamId: string; teamName: string; ownerName: string | null; scoringEventId: string | null; scoringEventName: string | null; sportName: string | null; pointsDelta: string; occurredAt: Date | string; participants: Array<{ id: string; name: string }>; } interface RecentScoresCardProps { events: ScoreEventEntry[]; } function TimelineDot({ isRecent }: { isRecent: boolean }) { return (
); } function ScoreRow({ event, isLast, }: { event: ScoreEventEntry; isLast: boolean; }) { const pts = parseFloat(event.pointsDelta); const displayPts = Number.isInteger(pts) ? pts.toString() : pts.toFixed(1); const managerName = event.ownerName ?? event.teamName; const isRecent = Date.now() - new Date(event.occurredAt).getTime() < 24 * 60 * 60 * 1000; return (
{/* Timeline spine */}
{!isLast &&
}
{/* Content row: points box + text */}
{/* Points box — square, no rounded corners */}
+{displayPts}
{/* Text content */}
{/* Date */}
{formatDistanceToNow(new Date(event.occurredAt), { addSuffix: true })}
{/* Manager name */}
{managerName}
{/* Sport · participant name(s) */}
{[ event.sportName, event.participants.length > 0 ? event.participants.map((p) => p.name).join(", ") : null, ] .filter(Boolean) .join(" · ")}
); } export function RecentScoresCard({ events }: RecentScoresCardProps) { return (
{/* Header */}
Recent Scores
{/* Timeline */} {events.length === 0 ? (

No recent scores yet — they'll appear here as events complete.

) : (
{events.map((event, index) => ( ))}
)}
); }