feat: polish double-elimination bracket navigation

Highlight connected routes, add readable round labels and accessible path descriptions, widen routing gaps, and centralize brand colors for winner progression.
This commit is contained in:
dahyeon committed 2026-07-13 23:17:19 -07:00
1 parent 03e88a03bc
commit b115072005
8 files changed
+761 -165

No files matched your search

@@ -16,7 +16,7 @@ export type BracketConnectorKind = "winner" | "loser" | "reset";
export const DOUBLE_ELIMINATION_BRACKET_GEOMETRY = {
boardPadding: 12,
columnWidth: 228,
columnGap: 32,
columnGap: 40,
cardBorderWidth: SERIES_SCORE_CARD_GEOMETRY.borderWidth,
cardHeight: SERIES_SCORE_CARD_GEOMETRY.height,
cardHeaderHeight: SERIES_SCORE_CARD_GEOMETRY.headerHeight,
@@ -29,6 +29,7 @@ export const DOUBLE_ELIMINATION_BRACKET_GEOMETRY = {
export interface BracketNodeLayout {
seriesId: SeriesId;
label: string;
accessibleLabel: string;
stage: BracketStage;
roundNumber: number;
lane: BracketLane;
@@ -52,6 +53,7 @@ export interface BracketConnectorLayout {
targetY: number;
path: string;
label: string;
accessibleLabel: string;
}
export interface DoubleEliminationBracketConfiguration {
@@ -63,6 +65,7 @@ export interface BracketRoundLayout {
stage: BracketStage;
roundNumber: number;
label: string;
accessibleLabel: string;
lane: BracketLane;
column: number;
x: number;
@@ -74,6 +77,7 @@ export interface MobileBracketGroup {
stage: BracketStage;
roundNumber: number;
label: string;
accessibleLabel: string;
seriesIds: SeriesId[];
}
@@ -101,6 +105,7 @@ interface NormalizedRound {
stage: BracketStage;
roundNumber: number;
label: string;
accessibleLabel: string;
seriesIds: SeriesId[];
}
@@ -169,13 +174,30 @@ export function createDoubleEliminationBracketLayout(
export function bracketRoundLabel(
stage: SeriesStageType,
roundNumber?: number,
): string {
return formatBracketRoundLabel(stage, roundNumber, "R");
}
export function bracketRoundAccessibleLabel(
stage: SeriesStageType,
roundNumber?: number,
): string {
return formatBracketRoundLabel(stage, roundNumber, "라운드");
}
function formatBracketRoundLabel(
stage: SeriesStageType,
roundNumber: number | undefined,
roundUnit: "R" | "라운드",
): string {
const round = roundNumber ?? 1;
switch (stage) {
case "upper":
return round === 1 ? `브래킷 1R` : `브래킷 상위 ${round}R`;
return round === 1
? `브래킷 1${roundUnit}`
: `브래킷 상위 ${round}${roundUnit}`;
case "lower":
return `브래킷 하위 ${round}R`;
return `브래킷 하위 ${round}${roundUnit}`;
case "grand-final":
return "그랜드 파이널";
case "reset-final":
@@ -311,6 +333,10 @@ function normalizeRounds(
stage: round.stage,
roundNumber: round.roundNumber,
label: bracketRoundLabel(round.stage, round.roundNumber),
accessibleLabel: bracketRoundAccessibleLabel(
round.stage,
round.roundNumber,
),
seriesIds: ids,
});
}
@@ -461,7 +487,12 @@ function buildNodes(
(laneGeometry.height * (index + 0.5)) / round.seriesIds.length;
result.push({
seriesId,
label: seriesName(graph.seriesById.get(seriesId), round),
label: seriesDisplayName(round, seriesId, round.label),
accessibleLabel: seriesDisplayName(
round,
seriesId,
round.accessibleLabel,
),
stage: round.stage,
roundNumber: round.roundNumber,
lane,
@@ -571,7 +602,8 @@ function buildConnectors(
targetX,
targetY,
path: `M ${number(sourceX)} ${number(sourceY)} H ${number(verticalX)} V ${number(targetY)} H ${number(targetX)}`,
label: connectorLabel(connector, graph),
label: connectorLabel(connector, graph, "label"),
accessibleLabel: connectorLabel(connector, graph, "accessibleLabel"),
});
}
return result.sort(
@@ -593,13 +625,20 @@ function buildConnectors(
function connectorLabel(
connector: SeriesConnectorView,
graph: ValidatedGraph,
labelKey: "label" | "accessibleLabel",
): string {
const source = graph.seriesById.get(connector.from.seriesId);
const target = graph.seriesById.get(connector.to.seriesId);
const sourceRound = graph.roundBySeriesId.get(connector.from.seriesId);
const targetRound = graph.roundBySeriesId.get(connector.to.seriesId);
const sourceName = seriesName(source, sourceRound);
const targetName = seriesName(target, targetRound);
const sourceName = seriesDisplayName(
sourceRound,
connector.from.seriesId,
sourceRound?.[labelKey],
);
const targetName = seriesDisplayName(
targetRound,
connector.to.seriesId,
targetRound?.[labelKey],
);
const selection =
connector.from.select === "winner"
? "승자"
@@ -611,16 +650,16 @@ function connectorLabel(
return `${sourceName} ${selection} → ${targetName} ${connector.to.slot} 슬롯`;
}
function seriesName(
series: DoubleEliminationCompetitionProjection["series"][number] | undefined,
function seriesDisplayName(
round: NormalizedRound | undefined,
seriesId: SeriesId,
roundLabel: string | undefined,
): string {
if (series?.code) return series.code;
if (!series || !round) return "알 수 없는 경기";
const index = round.seriesIds.indexOf(series.seriesId);
if (!round || !roundLabel) return "알 수 없는 경기";
const index = round.seriesIds.indexOf(seriesId);
return round.seriesIds.length > 1
? `${round.label} ${index + 1}경기`
: round.label;
? `${roundLabel} · ${index + 1}경기`
: roundLabel;
}
function connectorAnchorY(