fix date/time
This commit is contained in:
@@ -4,7 +4,7 @@ import { useMemo, useState, useCallback } from "react";
|
||||
import { GroupTable, Match, Team, ThirdPlaceRow } from "@/lib/types";
|
||||
import { ThirdAssignment, orderedRound } from "@/lib/bracket";
|
||||
import { resolveBracket, ResolvedSide, ResolvedTie } from "@/lib/resolve-bracket";
|
||||
import { STADIUMS, MATCH_STADIUMS } from "@/lib/stadiums";
|
||||
import { STADIUMS, MATCH_STADIUMS, MATCH_DATES } from "@/lib/stadiums";
|
||||
import Flag from "./Flag";
|
||||
|
||||
interface TipState { x: number; y: number; text: string }
|
||||
@@ -49,11 +49,11 @@ function Side({
|
||||
}
|
||||
|
||||
function fmtMatchInfo(utcDate?: string, stadiumId?: string): string {
|
||||
const city = stadiumId ? STADIUMS[stadiumId]?.city : "";
|
||||
if (!utcDate) return city; // Stadt auch ohne Datum anzeigen
|
||||
if (!utcDate) return "";
|
||||
const d = new Date(utcDate);
|
||||
const dateStr = d.toLocaleDateString("de-DE", { day: "numeric", month: "numeric" });
|
||||
const timeStr = d.toLocaleTimeString("de-DE", { hour: "2-digit", minute: "2-digit" });
|
||||
const city = stadiumId ? STADIUMS[stadiumId]?.city : "";
|
||||
const parts = [`${dateStr}`, `${timeStr}`];
|
||||
if (city) parts.push(city);
|
||||
return parts.join(" · ");
|
||||
@@ -91,32 +91,17 @@ export default function Bracket({
|
||||
|
||||
const r32ByNum = new Map(r32Array.map((t) => [t.matchNumber, t]));
|
||||
|
||||
// Baue slotNumber → formatted info (Stadt aus MATCH_STADIUMS, Datum/Uhrzeit aus Feed-Match)
|
||||
const feedByNum = useMemo(() => {
|
||||
const m = new Map<number, Match>();
|
||||
for (const fm of matches) {
|
||||
if (fm.group == null) m.set(fm.matchNumber, fm);
|
||||
}
|
||||
return m;
|
||||
}, [matches]);
|
||||
|
||||
// Slot-Nummer → formatierte Anzeige (Datum/Uhrzeit aus MATCH_DATES, Stadt aus MATCH_STADIUMS)
|
||||
const matchMeta = useMemo(() => {
|
||||
const meta = new Map<number, string>();
|
||||
for (let n = 73; n <= 104; n++) {
|
||||
const utcDate = MATCH_DATES[n];
|
||||
const stadiumId = MATCH_STADIUMS[n];
|
||||
const feedMatch = feedByNum.get(n);
|
||||
const info = fmtMatchInfo(feedMatch?.utcDate, stadiumId);
|
||||
const info = fmtMatchInfo(utcDate, stadiumId);
|
||||
if (info) meta.set(n, info);
|
||||
if (feedMatch?.matchNumber === 0 || !feedMatch) {
|
||||
console.log("[KO-SLOT-DATE]",
|
||||
"slot:", n,
|
||||
"| match.matchNumber:", feedMatch?.matchNumber ?? "—",
|
||||
"| match.utcDate:", feedMatch?.utcDate ?? "—",
|
||||
"| stadt:", STADIUMS[MATCH_STADIUMS[n]]?.city ?? "—");
|
||||
}
|
||||
}
|
||||
return meta;
|
||||
}, [feedByNum]);
|
||||
}, []);
|
||||
|
||||
const sfOrder = orderedRound([104]);
|
||||
const qfOrder = orderedRound(sfOrder);
|
||||
|
||||
Reference in New Issue
Block a user