"use client"; import { GROUP_IDS, GroupId, Match, Team } from "@/lib/types"; import Flag from "./Flag"; function teamById(teams: Team[], id: string | null) { return id ? teams.find((t) => t.id === id) : undefined; } function fmtDate(iso: string): string { const d = new Date(iso); return d.toLocaleString("de-DE", { weekday: "short", day: "2-digit", month: "2-digit", hour: "2-digit", minute: "2-digit", }); } function statusText(m: Match): { text: string; live: boolean } { switch (m.status) { case "LIVE": case "IN_PLAY": return { text: m.minute != null ? `${m.minute}'` : "läuft", live: true }; case "PAUSED": return { text: "Halbzeit", live: true }; case "FINISHED": return { text: "Beendet", live: false }; default: return { text: fmtDate(m.utcDate), live: false }; } } function ScoreOrTime({ m }: { m: Match }) { const hasScore = m.homeScore != null && m.awayScore != null; const st = statusText(m); if (hasScore) { return ( {m.homeScore} : {m.awayScore} ); } return {fmtDate(m.utcDate)}; } export default function Fixtures({ group, teams, matches, onSelectGroup, }: { group: GroupId; teams: Team[]; matches: Match[]; onSelectGroup: (g: GroupId) => void; }) { const list = matches .filter((m) => m.group === group) .sort((a, b) => +new Date(a.utcDate) - +new Date(b.utcDate)); return (