diff --git a/components/match-card.tsx b/components/match-card.tsx index 78abf3b..8016c2f 100644 --- a/components/match-card.tsx +++ b/components/match-card.tsx @@ -25,7 +25,9 @@ function formatDate(d: string) { 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 + // Penalty score determines the winner when present + const decisive = match.scoreP ?? ft + const winner = decisive ? (decisive[0] > decisive[1] ? 'home' : decisive[0] < decisive[1] ? 'away' : 'draw') : null if (compact) { return ( @@ -41,8 +43,19 @@ export function MatchCard({ match, compact = false }: { match: Match; compact?: {match.team1.name} -
- {hasScore ? `${ft![0]} – ${ft![1]}` : match.isLive ? : '–'} +
+
+ {hasScore + ? match.scoreP + ? `${match.scoreP[0]} – ${match.scoreP[1]}` + : `${ft![0]} – ${ft![1]}` + : match.isLive ? : '–'} +
+ {match.scoreP && ( +
+ {ft![0]}–{ft![1]} a.e.t. +
+ )}
@@ -51,7 +64,9 @@ export function MatchCard({ match, compact = false }: { match: Match; compact?:
- {match.scoreEt &&
AET · {match.scoreP ? `PSO ${match.scoreP[0]}-${match.scoreP[1]}` : ''}
} + {match.scoreEt && !match.scoreP && ( +
a.e.t.
+ )} ) @@ -68,12 +83,20 @@ export function MatchCard({ match, compact = false }: { match: Match; compact?:
- {hasScore ? `${ft![0]} – ${ft![1]}` : '? – ?'} + {hasScore + ? match.scoreP + ? `${match.scoreP[0]} – ${match.scoreP[1]}` + : `${ft![0]} – ${ft![1]}` + : '? – ?'}
+ {match.scoreP && ( +
{ft![0]}–{ft![1]} a.e.t.
+ )}
{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.scoreEt && !match.scoreP && ( +
a.e.t. {match.scoreEt[0]}–{match.scoreEt[1]}
+ )}