import Link from "next/link"; import { matchesByDate, matchPhase, type MatchPhase } from "@/lib/schedule"; import { getPredictions, getCrowd } from "@/lib/mockData"; import { dateHeading, timeOnly } from "@/lib/format"; import { type Lang, dict, teamShort, roundLabel as tRound } from "@/lib/i18n"; import type { Match } from "@/lib/types"; import TeamFlag from "./TeamFlag"; const STROKE = "#94FBE0"; // 일정 텍스트·선택 아웃라인 스트로크 컬러 const PHASE_CLS: Record = { open: "border-[#94FBE0] text-[#94FBE0]", scheduled: "border-[var(--line-d)] text-[var(--ink-muted)]", locked: "border-[var(--line-d)] text-[var(--ink-muted)]", finished: "border-white/15 text-white/55", }; export default function ScheduleBoard({ lang = "ko" }: { lang?: Lang }) { const t = dict(lang); const groups = matchesByDate(); return (

{t.schedTitle}

{t.schedGuide}
{groups.map((g) => (
{dateHeading(g.date, lang)}
{g.matches.map((m) => ( ))}
))}
); } function MatchCard({ match, lang }: { match: Match; lang: Lang }) { const t = dict(lang); const phase = matchPhase(match); const preds = getPredictions(match, lang); const crowd = getCrowd(match); // AI 픽 갈림 요약 const tally = { a: 0, d: 0, b: 0 }; for (const p of preds) { if (p.outcome === "TEAM_A_WIN") tally.a++; else if (p.outcome === "DRAW") tally.d++; else tally.b++; } const split: string[] = []; if (tally.a) split.push(`${teamShort(match.teamA, lang)} ${tally.a}`); if (tally.d) split.push(`${t.draw} ${tally.d}`); if (tally.b) split.push(`${teamShort(match.teamB, lang)} ${tally.b}`); // 종료 경기: 결과 스코어 + 승자 라벨 (예: "멕시코 승") const result = match.result; const winLabel = result ? result.outcome === "TEAM_A_WIN" ? `${teamShort(match.teamA, lang)} ${t.win}` : result.outcome === "TEAM_B_WIN" ? `${teamShort(match.teamB, lang)} ${t.win}` : t.drawLabel : null; const href = `/match/${match.matchId}${lang === "en" ? "?lang=en" : ""}`; return (
{timeOnly(match.kickoffKst)} KST ·{" "} {tRound(match.roundLabel, lang)} {winLabel && ( · {winLabel} )} {t.phase[phase]}
{teamShort(match.teamA, lang)}
{result ? ( {result.scoreA} VS {result.scoreB} ) : ( VS )}
{teamShort(match.teamB, lang)}
{t.aiPicks} {split.join(" · ")} {t.joined(crowd.total.toLocaleString())}
); }