import { ArrowRight, CalendarDays, ChevronRight, Clock3, Info, Users, } from "lucide-react"; import type { SeriesProjection } from "@lolympus/contracts"; import type { ApiInternalMatchCard } from "../../api/types"; import pixelMedal from "../../assets/pixel-medal-first.svg"; import { formatOfficialMatchResult } from "../../lib/internal-stats-presentation"; import { getSeriesHistoryResultLabel, shouldDisplaySeriesHistoryScore, } from "../competition/competition-series-history"; import { StatsLink } from "./StatsShared"; import { statsDate, statsDuration } from "./stats-navigation"; import { statsGroups } from "./stats-model"; function statsFormat(match: ApiInternalMatchCard) { const result = match.resultPresentation; if (result?.type !== "official") return match.teams.length === 2 ? "두 팀 내전" : "내전 기록"; return { "paired-series": "두 팀 내전", "double-elimination": "더블 엘리미네이션", "round-robin": "리그전", }[result.formatType]; } function seriesLabel(series: SeriesProjection | undefined) { if (!series) return "공식 시리즈 정보 없음"; if (series.stage.type === "pair") return series.rule.type === "first-to" ? `${series.rule.winsRequired}선승 시리즈` : `${series.rule.gameCount}세트 시리즈`; return `${{ upper: "승자조", lower: "패자조", "grand-final": "최종 결승", "reset-final": "결승 재경기", "round-robin": "리그" }[series.stage.type]}${series.stage.roundNumber ? ` ${series.stage.roundNumber}라운드` : ""}`; } export function StatsEventOverview({ match }: { match: ApiInternalMatchCard }) { const analyzed = match.games.every( (g) => g.analysisAvailability !== undefined, ) ? match.games.filter((g) => g.analysisAvailability === "available").length : "—"; return (
{match.teams.length}팀 ·{" "} {match.teams.reduce((n, t) => n + t.members.length, 0)}명 {match.games.length}세트 결과 {analyzed}세트 분석 가능
{formatOfficialMatchResult(match.resultPresentation)}
); } export function StatsSeries({ match, gameHref, }: { match: ApiInternalMatchCard; gameHref: (number: number) => string; }) { const team = (index: number) => match.teams.find((t) => t.teamIndex === index)?.name ?? `${index}팀`; const officialTeam = (id: string | null) => match.teams.find((t) => t.teamId === id)?.name ?? (id ? "팀 미확인" : "상대 미정"); return (
{statsGroups(match).map(({ id, series, games }) => { const first = games[0], label = seriesLabel(series); const [a, b] = series?.entries ?? []; const score = series && shouldDisplaySeriesHistoryScore(series); const winner = series?.status === "completed" && series.outcome.type !== "draw" ? series.outcome.winnerTeamId : null; return (
{label} {games.length}세트 {series && score && games.length !== (a?.gameWins ?? 0) + (b?.gameWins ?? 0) ? " · 기간 내 기록" : ""}
{a ? officialTeam(a.teamId) : first ? team(first.blueTeamIndex) : "팀 미확인"} {score ? ( <> {a?.gameWins} : {b?.gameWins} ) : series ? ( (getSeriesHistoryResultLabel(series) ?? "VS") ) : ( "VS" )} {b ? officialTeam(b.teamId) : first ? team(first.redTeamIndex) : "팀 미확인"}
{games.length === 0 && (

{series && getSeriesHistoryResultLabel(series)} · 기록된 세트 없음

)}
); })}
); } export function StatsEvent({ match, eventHref, gameHref, }: { match: ApiInternalMatchCard; eventHref: string; gameHref: (number: number) => string; }) { return (
{statsFormat(match)} {Boolean(match.series?.length) && ( {match.series!.length}개 시리즈 )}

{match.title}

전체 기록
{match.games.length === 0 && (

기록된 세트가 없습니다. 전체 기록에서 공식 결과를 확인할 수 있습니다.

)}
); } export function StatsEventJump({ matches, }: { matches: ApiInternalMatchCard[]; }) { return ( ); }