changes
This commit is contained in:
@@ -9,13 +9,15 @@ function Side({
|
||||
s, prob, teams,
|
||||
}: { s: ResolvedSide; prob?: number | null; teams: Team[] }) {
|
||||
const team = s.teamId ? teams.find((t) => t.id === s.teamId) : undefined;
|
||||
// fix = ein echtes Team steht fest (nicht vorläufig). Eigene Klasse für klares Styling.
|
||||
const fix = s.teamId != null && !s.provisional;
|
||||
return (
|
||||
<div className={`side ${s.isWinner ? "win" : ""} ${s.provisional ? "prov" : ""}`}>
|
||||
<div className={`side ${s.isWinner ? "win" : ""} ${s.provisional ? "prov" : ""} ${fix ? "fix" : ""}`}>
|
||||
<span className="nm">
|
||||
{s.teamId ? (
|
||||
<>
|
||||
<Flag team={team} size={18} />
|
||||
<span>{s.label}</span>
|
||||
<span className="tn">{s.label}</span>
|
||||
{s.provisional && <span className="prov-mark" title="vorläufig – Gruppe/Zuordnung noch nicht fix">≈</span>}
|
||||
</>
|
||||
) : (
|
||||
@@ -33,7 +35,7 @@ function Side({
|
||||
function Tie({ tie, teams, isFinal }: { tie: ResolvedTie; teams: Team[]; isFinal?: boolean }) {
|
||||
return (
|
||||
<div className={`tie ${isFinal ? "final-tie" : ""}`}>
|
||||
<span className="tie-num">Spiel {tie.matchNumber}</span>
|
||||
<div className="tie-head">Spiel {tie.matchNumber}</div>
|
||||
<Side s={tie.home} prob={tie.prob?.home} teams={teams} />
|
||||
<Side s={tie.away} prob={tie.prob?.away} teams={teams} />
|
||||
</div>
|
||||
@@ -119,4 +121,4 @@ export default function Bracket({
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,31 @@
|
||||
"use client";
|
||||
|
||||
import { GROUP_IDS, GroupId, Match, Team } from "@/lib/types";
|
||||
import { computeGroupTables } from "@/lib/standings";
|
||||
import Flag from "./Flag";
|
||||
|
||||
function teamById(teams: Team[], id: string | null) {
|
||||
return id ? teams.find((t) => t.id === id) : undefined;
|
||||
}
|
||||
|
||||
// Kürzel der lokalen Browser-Zeitzone, z.B. "MEZ"/"GMT+1" – einmal ermittelt.
|
||||
const TZ_LABEL = (() => {
|
||||
try {
|
||||
const parts = new Intl.DateTimeFormat("de-DE", { timeZoneName: "short" })
|
||||
.formatToParts(new Date());
|
||||
return parts.find((p) => p.type === "timeZoneName")?.value ?? "";
|
||||
} catch {
|
||||
return "";
|
||||
}
|
||||
})();
|
||||
|
||||
function fmtDate(iso: string): string {
|
||||
const d = new Date(iso);
|
||||
return d.toLocaleString("de-DE", {
|
||||
const s = d.toLocaleString("de-DE", {
|
||||
weekday: "short", day: "2-digit", month: "2-digit",
|
||||
hour: "2-digit", minute: "2-digit",
|
||||
});
|
||||
return TZ_LABEL ? `${s} ${TZ_LABEL}` : s;
|
||||
}
|
||||
|
||||
function statusText(m: Match): { text: string; live: boolean } {
|
||||
@@ -29,7 +42,10 @@ function statusText(m: Match): { text: string; live: boolean } {
|
||||
}
|
||||
}
|
||||
|
||||
function ScoreOrTime({ m }: { m: Match }) {
|
||||
// Mitte: Ergebnis (wenn vorhanden) oder ein schlichtes "–" bei ungespielten
|
||||
// Spielen. Datum/Uhrzeit steht bereits links im Status und wird hier NICHT
|
||||
// wiederholt.
|
||||
function ScoreCell({ m }: { m: Match }) {
|
||||
const hasScore = m.homeScore != null && m.awayScore != null;
|
||||
const st = statusText(m);
|
||||
if (hasScore) {
|
||||
@@ -39,7 +55,69 @@ function ScoreOrTime({ m }: { m: Match }) {
|
||||
</span>
|
||||
);
|
||||
}
|
||||
return <span className="fx-time">{fmtDate(m.utcDate)}</span>;
|
||||
return <span className="fx-vs">–</span>;
|
||||
}
|
||||
|
||||
function GroupStandings({
|
||||
group, teams, matches,
|
||||
}: { group: GroupId; teams: Team[]; matches: Match[] }) {
|
||||
// Live-Tabelle: laufende Spiele werden mit Zwischenstand eingerechnet.
|
||||
const table = computeGroupTables(teams, matches, true).find((t) => t.group === group);
|
||||
if (!table) return null;
|
||||
|
||||
// Teams, die gerade ein laufendes Spiel haben -> Zeile markieren.
|
||||
const liveTeamIds = new Set<string>();
|
||||
let hasLive = false;
|
||||
for (const m of matches) {
|
||||
if (m.group !== group) continue;
|
||||
if (m.status === "LIVE" || m.status === "IN_PLAY" || m.status === "PAUSED") {
|
||||
hasLive = true;
|
||||
if (m.homeTeamId) liveTeamIds.add(m.homeTeamId);
|
||||
if (m.awayTeamId) liveTeamIds.add(m.awayTeamId);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="fx-standings">
|
||||
<div className="fx-standings-title">
|
||||
Tabelle – Gruppe {group}
|
||||
{hasLive && <span className="fx-standings-live">● LIVE</span>}
|
||||
</div>
|
||||
<table className="standings">
|
||||
<thead>
|
||||
<tr>
|
||||
<th className="team">Mannschaft</th>
|
||||
<th>Sp</th><th>S</th><th>U</th><th>N</th>
|
||||
<th>Tore</th><th>±</th><th>Pkt</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{table.rows.map((r) => {
|
||||
const team = teamById(teams, r.teamId);
|
||||
const cls = r.rank <= 2 ? `q${r.rank}` : r.rank === 3 ? "q3" : "";
|
||||
const isLive = liveTeamIds.has(r.teamId);
|
||||
return (
|
||||
<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>
|
||||
<td>{r.drawn}</td>
|
||||
<td>{r.lost}</td>
|
||||
<td>{r.goalsFor}:{r.goalsAgainst}</td>
|
||||
<td>{r.goalDiff > 0 ? `+${r.goalDiff}` : r.goalDiff}</td>
|
||||
<td className="pts">{r.points}</td>
|
||||
</tr>
|
||||
);
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default function Fixtures({
|
||||
@@ -83,14 +161,14 @@ export default function Fixtures({
|
||||
<span>{st.text}</span>
|
||||
</div>
|
||||
<div className="fx-teams">
|
||||
<div className={`fx-team ${homeWin ? "win" : ""}`}>
|
||||
<div className={`fx-team home ${homeWin ? "win" : ""}`}>
|
||||
<Flag team={home} size={22} />
|
||||
<span className="fx-name">{home?.name ?? "—"}</span>
|
||||
</div>
|
||||
<ScoreOrTime m={m} />
|
||||
<ScoreCell m={m} />
|
||||
<div className={`fx-team away ${awayWin ? "win" : ""}`}>
|
||||
<span className="fx-name">{away?.name ?? "—"}</span>
|
||||
<Flag team={away} size={22} />
|
||||
<span className="fx-name">{away?.name ?? "—"}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="fx-meta">
|
||||
@@ -104,6 +182,10 @@ export default function Fixtures({
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{list.length > 0 && (
|
||||
<GroupStandings group={group} teams={teams} matches={matches} />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -195,13 +195,12 @@ table.standings { width: 100%; border-collapse: collapse; }
|
||||
|
||||
.tie {
|
||||
background: var(--bg-card); border: 1px solid var(--line);
|
||||
border-radius: var(--radius-sm); overflow: hidden; position: relative;
|
||||
border-radius: var(--radius-sm); position: relative;
|
||||
}
|
||||
.tie.final-tie { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(255,210,74,0.2); }
|
||||
.tie-num {
|
||||
position: absolute; top: -7px; left: 8px;
|
||||
.tie-head {
|
||||
font-family: var(--font-mono); font-size: 9px; color: var(--ink-faint);
|
||||
background: var(--bg); padding: 0 5px;
|
||||
letter-spacing: 0.04em; padding: 5px 10px 0;
|
||||
}
|
||||
.side {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
@@ -212,7 +211,6 @@ table.standings { width: 100%; border-collapse: collapse; }
|
||||
.side .nm .c { font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint); }
|
||||
.side .lbl { color: var(--ink-dim); font-style: italic; }
|
||||
.side .sc { font-family: var(--font-mono); font-weight: 700; color: var(--floodlight); }
|
||||
.side.win .nm { color: var(--turf); font-weight: 700; }
|
||||
.side.win .sc { color: var(--turf); }
|
||||
.side .prob {
|
||||
font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint);
|
||||
@@ -285,7 +283,7 @@ table.standings { width: 100%; border-collapse: collapse; }
|
||||
.fx {
|
||||
background: var(--bg-card); border: 1px solid var(--line);
|
||||
border-radius: var(--radius); padding: 12px 16px;
|
||||
display: grid; grid-template-columns: 120px 1fr auto; gap: 14px; align-items: center;
|
||||
display: grid; grid-template-columns: 110px minmax(0, 560px) 1fr; gap: 14px; align-items: center;
|
||||
}
|
||||
.fx-live { border-color: rgba(255,61,127,0.4); }
|
||||
.fx-status {
|
||||
@@ -293,19 +291,52 @@ table.standings { width: 100%; border-collapse: collapse; }
|
||||
font-family: var(--font-mono); font-size: 12px; color: var(--ink-dim);
|
||||
}
|
||||
.fx-teams {
|
||||
display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
|
||||
align-items: center; column-gap: 34px;
|
||||
}
|
||||
.fx-team { display: flex; align-items: center; gap: 10px; min-width: 0; }
|
||||
.fx-team.away { justify-content: flex-end; }
|
||||
/* Beide Teams: Flagge links, Name daneben. Linkes Team rechtsbündig an den Score,
|
||||
rechtes Team linksbündig – so ist der Abstand zum Ergebnis beidseitig gleich. */
|
||||
.fx-team { display: flex; align-items: center; gap: 8px; min-width: 0; }
|
||||
.fx-team.home { justify-content: flex-end; }
|
||||
.fx-team.away { justify-content: flex-start; }
|
||||
.fx-team .fx-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.fx-team.win .fx-name { color: var(--turf); }
|
||||
.fx-score { font-family: var(--font-mono); font-weight: 700; font-size: 18px; color: var(--floodlight); white-space: nowrap; }
|
||||
.fx-score { font-family: var(--font-mono); font-weight: 700; font-size: 18px; color: var(--floodlight); white-space: nowrap; text-align: center; min-width: 54px; }
|
||||
.fx-score.score-live { color: var(--live); }
|
||||
.fx-time { font-family: var(--font-mono); font-size: 13px; color: var(--ink-faint); white-space: nowrap; }
|
||||
.fx-vs { font-family: var(--font-mono); font-size: 15px; color: var(--ink-faint); text-align: center; min-width: 54px; }
|
||||
.fx-meta {
|
||||
display: flex; flex-direction: column; gap: 3px; align-items: flex-end;
|
||||
font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); white-space: nowrap;
|
||||
}
|
||||
/* Austragungsort heller hervorheben. */
|
||||
.fx-venue { color: var(--ink-dim); }
|
||||
|
||||
/* Live-Tabelle der Gruppe unterhalb der Spiele. */
|
||||
.fx-standings { margin-top: 22px; }
|
||||
.fx-standings-title {
|
||||
font-family: var(--font-display, var(--font-mono)); font-size: 13px; letter-spacing: 0.06em;
|
||||
text-transform: uppercase; color: var(--ink-dim); margin: 0 2px 10px;
|
||||
display: flex; align-items: center; gap: 10px;
|
||||
}
|
||||
.fx-standings-live {
|
||||
font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em;
|
||||
color: var(--live); font-weight: 700;
|
||||
animation: livepulse 1.6s ease-in-out infinite;
|
||||
}
|
||||
.fx-standings .standings { width: 100%; }
|
||||
/* Zeile eines Teams mit laufendem Spiel hervorheben. */
|
||||
.fx-standings .row-live { background: rgba(255, 61, 127, 0.07); }
|
||||
.fx-standings .row-live .team-name { color: var(--floodlight); }
|
||||
.row-live-dot {
|
||||
display: inline-block; width: 7px; height: 7px; border-radius: 50%;
|
||||
background: var(--live); margin-left: 8px; vertical-align: middle;
|
||||
animation: livepulse 1.6s ease-in-out infinite;
|
||||
}
|
||||
@keyframes livepulse {
|
||||
0%, 100% { opacity: 1; }
|
||||
50% { opacity: 0.35; }
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.fx { grid-template-columns: 1fr; gap: 8px; }
|
||||
@@ -313,26 +344,31 @@ table.standings { width: 100%; border-collapse: collapse; }
|
||||
.fx-status { order: -1; }
|
||||
}
|
||||
|
||||
/* Bracket: Label-Fix oben (Match-Nummer ragt über den Rand) */
|
||||
.round-matches { padding-top: 8px; }
|
||||
.tie-num {
|
||||
top: -8px; left: 10px; white-space: nowrap;
|
||||
}
|
||||
/* Bracket: Label-Header braucht kein Extra-Padding mehr (sitzt im Kasten) */
|
||||
.round-matches { padding-top: 0; }
|
||||
|
||||
/* Bracket: fix vs. vorläufig */
|
||||
.side.prov .nm { color: var(--ink-dim); }
|
||||
.side.prov .nm span:not(.prov-mark) { font-style: italic; }
|
||||
/* Bracket: fix vs. vorläufig.
|
||||
.nm trägt die Standardfarbe; Team-Name liegt in .tn. */
|
||||
.side .nm .tn { color: var(--ink); }
|
||||
|
||||
/* vorläufig: gedimmt + kursiv + Marker */
|
||||
.side.prov .nm .tn { color: var(--ink-dim); font-style: italic; }
|
||||
.prov-mark {
|
||||
color: #f0a23a; font-family: var(--font-mono); font-weight: 700;
|
||||
font-size: 12px; margin-left: 2px;
|
||||
}
|
||||
/* fix qualifizierte (nicht vorläufige) Teams: voller Kontrast + linker Marker */
|
||||
.side:not(.prov) .nm > span:not(.c):not(.prob):not(.prov-mark) { color: var(--ink); font-weight: 600; }
|
||||
.side:not(.prov):not(.win) { box-shadow: inset 2px 0 0 var(--turf-deep); }
|
||||
|
||||
/* fix: echtes Team steht fest -> fett weiß + grüner Marker links */
|
||||
.side.fix .nm .tn { color: #ffffff; font-weight: 700; }
|
||||
.side.fix { box-shadow: inset 3px 0 0 var(--turf-deep); }
|
||||
|
||||
/* Sieger eines bereits gespielten Tie sticht zusätzlich grün hervor */
|
||||
.side.win .nm .tn { color: var(--turf); font-weight: 700; }
|
||||
.side.win { box-shadow: inset 3px 0 0 var(--turf); }
|
||||
|
||||
/* Legende-Marker */
|
||||
.legend i.leg-fix { background: var(--turf-deep); }
|
||||
.legend i.leg-prov {
|
||||
background: repeating-linear-gradient(45deg, #f0a23a, #f0a23a 3px, transparent 3px, transparent 6px);
|
||||
border: 1px solid #f0a23a;
|
||||
}
|
||||
}
|
||||
@@ -143,4 +143,4 @@ export default function Home() {
|
||||
</footer>
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user