import type { BracketRoundView, CompetitionDetailResponse, CompetitionOutcome, TeamId, } from "@lolympus/contracts"; import { Link } from "react-router"; import { RoundRobinTable } from "./RoundRobinTable"; import { SeriesScoreCard } from "./SeriesScoreCard"; export function CompetitionResults({ competition, }: { competition: CompetitionDetailResponse; }) { const { projection } = competition; const teamById = new Map( competition.teams.map((team) => [team.teamId, team]), ); const seriesById = new Map( projection.series.map((series) => [series.seriesId, series]), ); return (

Competition

공식 경기 결과

revision {competition.revision} 내 팀 진행
{projection.outcome && ( )} {projection.formatType === "round-robin" && ( )} {projection.rounds.length > 0 ? (
{projection.rounds.map((round) => ( ))}
) : (

편성된 공식 대진이 없습니다.

)} {projection.games.length > 0 && (

완료된 게임

    {projection.games.map((game) => (
  • Game {game.displayNumber} {teamById.get(game.winnerTeamId)?.name ?? "알 수 없는 팀"} 승
  • ))}
)}
); } function RoundColumn({ round, seriesById, teamById, }: { round: BracketRoundView; seriesById: Map< string, CompetitionDetailResponse["projection"]["series"][number] >; teamById: Map; }) { return (

{stageLabel(round.stage, round.roundNumber)}

{round.seriesIds.map((seriesId) => { const series = seriesById.get(seriesId); return series ? ( ) : null; })}
); } function OutcomeSummary({ outcome, teamById, }: { outcome: CompetitionOutcome; teamById: Map; }) { if (outcome.type === "paired-series") { return (

{outcome.completedSeriesIds.length + outcome.drawnSeriesIds.length}개 Series가 모두 종료되었습니다.

); } const leaders = outcome.type === "round-robin" ? outcome.leaderTeamIds : [outcome.championTeamId]; return (

{outcome.type === "round-robin" ? "1위" : "우승"} {leaders .map((teamId) => teamById.get(teamId)?.name ?? "알 수 없는 팀") .join(", ")}

); } function stageLabel(stage: BracketRoundView["stage"], round?: number) { switch (stage) { case "pair": return "대진"; case "round-robin": return `${round ?? 1}라운드`; case "upper": return `승자조 ${round ?? 1}라운드`; case "lower": return `패자조 ${round ?? 1}라운드`; case "grand-final": return "그랜드 파이널"; case "reset-final": return "리셋 파이널"; } }