feat(web): align team match names with bracket
This commit is contained in:
1 parent
bb32c26694
commit
dc77b37494
5 files changed
+54
-60
No files matched your search
@@ -170,11 +170,12 @@ export function bracketRoundLabel(
|
||||
stage: SeriesStageType,
|
||||
roundNumber?: number,
|
||||
): string {
|
||||
const round = roundNumber ?? 1;
|
||||
switch (stage) {
|
||||
case "upper":
|
||||
return `승자조 ${roundNumber ?? 1}라운드`;
|
||||
return round === 1 ? `브래킷 1R` : `브래킷 상위 ${round}R`;
|
||||
case "lower":
|
||||
return `패자조 ${roundNumber ?? 1}라운드`;
|
||||
return `브래킷 하위 ${round}R`;
|
||||
case "grand-final":
|
||||
return "그랜드 파이널";
|
||||
case "reset-final":
|
||||
@@ -182,7 +183,7 @@ export function bracketRoundLabel(
|
||||
case "pair":
|
||||
return "대진";
|
||||
case "round-robin":
|
||||
return `${roundNumber ?? 1}라운드`;
|
||||
return `${round}라운드`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import type {
|
||||
SeriesProjection,
|
||||
TeamTournamentCodeView,
|
||||
} from "@lolympus/contracts";
|
||||
import { bracketRoundLabel } from "../components/competition/double-elimination-bracket-layout.ts";
|
||||
|
||||
export interface TeamSeriesGroup {
|
||||
series: SeriesProjection;
|
||||
@@ -78,11 +79,7 @@ export function getTeamSeriesDisplayLabel(
|
||||
);
|
||||
const stage = round?.stage ?? series.stage.type;
|
||||
const roundNumber = round?.roundNumber ?? series.stage.roundNumber ?? 1;
|
||||
const baseLabel = isFinalRound(round, rounds)
|
||||
? stage === "upper"
|
||||
? "승자조 결승"
|
||||
: "패자조 결승"
|
||||
: stageLabel(stage, roundNumber);
|
||||
const baseLabel = bracketRoundLabel(stage, roundNumber);
|
||||
|
||||
if (!round || round.seriesIds.length <= 1) return baseLabel;
|
||||
const matchIndex = round.seriesIds.findIndex(
|
||||
@@ -265,42 +262,6 @@ function compareTournamentCodes(
|
||||
);
|
||||
}
|
||||
|
||||
function isFinalRound(
|
||||
round: BracketRoundView | undefined,
|
||||
rounds: readonly BracketRoundView[],
|
||||
): boolean {
|
||||
if (!round || (round.stage !== "upper" && round.stage !== "lower")) {
|
||||
return false;
|
||||
}
|
||||
const stageRoundNumbers = rounds
|
||||
.filter(({ stage }) => stage === round.stage)
|
||||
.map(({ roundNumber }) => roundNumber ?? 0);
|
||||
return (
|
||||
stageRoundNumbers.length > 0 &&
|
||||
(round.roundNumber ?? 0) === Math.max(...stageRoundNumbers)
|
||||
);
|
||||
}
|
||||
|
||||
function stageLabel(
|
||||
stage: SeriesProjection["stage"]["type"],
|
||||
roundNumber: number,
|
||||
): string {
|
||||
switch (stage) {
|
||||
case "upper":
|
||||
return `승자조 ${roundNumber}라운드`;
|
||||
case "lower":
|
||||
return `패자조 ${roundNumber}라운드`;
|
||||
case "grand-final":
|
||||
return "그랜드 파이널";
|
||||
case "reset-final":
|
||||
return "리셋 파이널";
|
||||
case "round-robin":
|
||||
return `${roundNumber}라운드`;
|
||||
case "pair":
|
||||
return "공식 대진";
|
||||
}
|
||||
}
|
||||
|
||||
function isExpired(expiresAt: string | null, now: number): boolean {
|
||||
if (!expiresAt) return false;
|
||||
const timestamp = Date.parse(expiresAt);
|
||||
|
||||
Reference in new issue
Block a user