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 { Match } from "@/lib/types"; import TeamFlag from "./TeamFlag"; const STROKE = "#94FBE0"; // 일정 텍스트·선택 아웃라인 스트로크 컬러 const PHASE_META: Record = { open: { label: "투표 중", cls: "border-[#94FBE0] text-[#94FBE0]" }, scheduled: { label: "오픈 예정", cls: "border-[var(--line-d)] text-[var(--ink-muted)]" }, locked: { label: "투표 마감", cls: "border-[var(--line-d)] text-[var(--ink-muted)]" }, finished: { label: "종료", cls: "border-white/15 text-white/55" }, }; export default function ScheduleBoard() { const groups = matchesByDate(); return (

전체 일정

{groups.map((g) => (
{dateHeading(g.date)}
{g.matches.map((m) => ( ))}
))}
); } function MatchCard({ match }: { match: Match }) { const phase = matchPhase(match); const meta = PHASE_META[phase]; const preds = getPredictions(match); 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(`${match.teamA.shortName} ${tally.a}`); if (tally.d) split.push(`무 ${tally.d}`); if (tally.b) split.push(`${match.teamB.shortName} ${tally.b}`); return (
{timeOnly(match.kickoffKst)} KST · {match.roundLabel} {meta.label}
{match.teamA.shortName}
VS
{match.teamB.shortName}
AI 픽 {split.join(" · ")} {crowd.total.toLocaleString()}명 참여
); }