diff --git a/apps/web/src/components/competition/CompetitionResults.tsx b/apps/web/src/components/competition/CompetitionResults.tsx index 3c87777d..c2d44c15 100644 --- a/apps/web/src/components/competition/CompetitionResults.tsx +++ b/apps/web/src/components/competition/CompetitionResults.tsx @@ -5,6 +5,9 @@ import type { TeamId, } from "@lolympus/contracts"; import { Link } from "react-router"; +import { DoubleEliminationBracket } from "./DoubleEliminationBracket"; +import { createCompetitionBracketLayout } from "./competition-display-layout"; +import { bracketRoundLabel } from "./double-elimination-bracket-layout"; import { RoundRobinTable } from "./RoundRobinTable"; import { SeriesScoreCard } from "./SeriesScoreCard"; @@ -20,6 +23,7 @@ export function CompetitionResults({ const seriesById = new Map( projection.series.map((series) => [series.seriesId, series]), ); + const doubleEliminationLayout = createCompetitionBracketLayout(competition); return (
@@ -54,18 +58,20 @@ export function CompetitionResults({ )} {projection.rounds.length > 0 ? ( -
-
- {projection.rounds.map((round) => ( - - ))} -
-
+ projection.formatType === "double-elimination" && + doubleEliminationLayout ? ( + + ) : ( + + ) ) : (

; + teamById: Map; +}) { + return ( +

+
+ {rounds.map((round) => ( + + ))} +
+
+ ); +} + function RoundColumn({ round, seriesById, @@ -116,7 +150,7 @@ function RoundColumn({ return (

- {stageLabel(round.stage, round.roundNumber)} + {bracketRoundLabel(round.stage, round.roundNumber)}

{round.seriesIds.map((seriesId) => { @@ -166,20 +200,3 @@ function OutcomeSummary({

); } - -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 "리셋 파이널"; - } -} diff --git a/apps/web/src/components/competition/DoubleEliminationBracket.tsx b/apps/web/src/components/competition/DoubleEliminationBracket.tsx new file mode 100644 index 00000000..4653f90e --- /dev/null +++ b/apps/web/src/components/competition/DoubleEliminationBracket.tsx @@ -0,0 +1,282 @@ +import type { + CompetitionTeamView, + DoubleEliminationCompetitionProjection, + TeamId, +} from "@lolympus/contracts"; +import type { + BracketConnectorKind, + DoubleEliminationBracketLayout, +} from "./double-elimination-bracket-layout"; +import { DOUBLE_ELIMINATION_BRACKET_GEOMETRY } from "./double-elimination-bracket-layout"; +import { DoubleEliminationMobileBracket } from "./DoubleEliminationMobileBracket"; +import { SeriesScoreCard } from "./SeriesScoreCard"; + +export function DoubleEliminationBracket({ + projection, + layout, + teamById, +}: { + projection: DoubleEliminationCompetitionProjection; + layout: DoubleEliminationBracketLayout; + teamById: ReadonlyMap; +}) { + return ( + <> + + + + ); +} + +function DesktopBracket({ + projection, + layout, + teamById, +}: { + projection: DoubleEliminationCompetitionProjection; + layout: DoubleEliminationBracketLayout; + teamById: ReadonlyMap; +}) { + const seriesById = new Map( + projection.series.map((series) => [series.seriesId, series]), + ); + const nodeById = new Map(layout.nodes.map((node) => [node.seriesId, node])); + const finalNodes = layout.nodes.filter(({ lane }) => lane === "final"); + const hasResetRoute = layout.connectors.some(({ kind }) => kind === "reset"); + const finalZoneLeft = Math.max( + 0, + Math.min(...finalNodes.map(({ x }) => x), layout.width) - 16, + ); + + return ( +
+
+

+ 승자조와 패자조는 같은 시간축을 공유하며 오른쪽 결승에서 합류합니다. + + 화면에 모두 보이지 않으면 가로로 스크롤하세요. + +

+ +
+
+
+ + + {finalNodes.length > 0 && ( + +
+
+ ); +} + +function LaneBand({ + label, + description, + top, + height, + width, +}: { + label: string; + description: string; + top: number; + height: number; + width: number; +}) { + return ( + <> +