import Link from 'next/link' import { TeamFlag } from './team-flag' import { LiveBadge } from './live-badge' interface Team { name: string; iso2?: string | null } interface Match { id: number year: number round: string group?: string | null date?: string | null time?: string | null team1: Team team2: Team scoreFt?: number[] | null scoreEt?: number[] | null scoreP?: number[] | null isLive: boolean } function formatDate(d: string) { return new Date(d).toLocaleDateString('en-GB', { day: 'numeric', month: 'short', year: 'numeric' }) } export function MatchCard({ match, compact = false }: { match: Match; compact?: boolean }) { const ft = match.scoreFt const hasScore = ft != null const winner = ft ? (ft[0] > ft[1] ? 'home' : ft[0] < ft[1] ? 'away' : 'draw') : null if (compact) { return (
{match.round}{match.group ? ` · ${match.group}` : ''} · {match.date ? formatDate(match.date) : ''}
{match.team1.name}
{hasScore ? `${ft![0]} – ${ft![1]}` : match.isLive ? : '–'}
{match.team2.name}
{match.scoreEt &&
AET · {match.scoreP ? `PSO ${match.scoreP[0]}-${match.scoreP[1]}` : ''}
}
) } return (
{match.isLive &&
}
{match.team1.name}
{hasScore ? `${ft![0]} – ${ft![1]}` : '? – ?'}
{match.round}
{match.date ? formatDate(match.date) : ''}
{match.scoreEt &&
AET {match.scoreEt[0]}–{match.scoreEt[1]}
} {match.scoreP &&
PSO {match.scoreP[0]}–{match.scoreP[1]}
}
{match.team2.name}
) }