fixes
This commit is contained in:
@@ -13,6 +13,18 @@ function liveMatchFor(group: string, matches: Match[]) {
|
||||
);
|
||||
}
|
||||
|
||||
function liveTeamIdsFor(group: GroupId, matches: Match[]): Set<string> {
|
||||
const ids = new Set<string>();
|
||||
for (const m of matches) {
|
||||
if (m.group !== group) continue;
|
||||
if (m.status === "LIVE" || m.status === "IN_PLAY" || m.status === "PAUSED") {
|
||||
if (m.homeTeamId) ids.add(m.homeTeamId);
|
||||
if (m.awayTeamId) ids.add(m.awayTeamId);
|
||||
}
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
export default function Groups({
|
||||
tables, teams, matches, onOpenGroup,
|
||||
}: {
|
||||
@@ -23,6 +35,7 @@ export default function Groups({
|
||||
<div className="group-grid">
|
||||
{tables.map((t) => {
|
||||
const live = liveMatchFor(t.group, matches);
|
||||
const liveIds = liveTeamIdsFor(t.group, matches);
|
||||
return (
|
||||
<div className="group-card" key={t.group}>
|
||||
<button
|
||||
@@ -47,12 +60,14 @@ export default function Groups({
|
||||
{t.rows.map((r) => {
|
||||
const team = teamById(teams, r.teamId);
|
||||
const cls = r.rank <= 2 ? `q${r.rank}` : r.rank === 3 ? "q3" : "";
|
||||
const isLive = liveIds.has(r.teamId);
|
||||
return (
|
||||
<tr key={r.teamId}>
|
||||
<tr key={r.teamId} className={isLive ? "row-live" : ""}>
|
||||
<td className="team">
|
||||
<span className={`rankdot ${cls}`}>{r.rank}</span>
|
||||
<Flag team={team} size={20} />
|
||||
<span className="team-name">{team?.name ?? r.teamId}</span>
|
||||
{isLive && <span className="row-live-dot" title="läuft gerade" />}
|
||||
</td>
|
||||
<td>{r.played}</td>
|
||||
<td>{r.won}</td>
|
||||
|
||||
Reference in New Issue
Block a user