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

@@ -4,8 +4,10 @@ import type {
SeriesId,
TeamId,
} from "@lolympus/contracts";
import { useId } from "react";
import type { DoubleEliminationBracketLayout } from "./double-elimination-bracket-layout";
import { SeriesScoreCard } from "./SeriesScoreCard";
import { getSeriesScoreCardAccessibleLabel } from "./series-score-card-model";
export function DoubleEliminationMobileBracket({
projection,
@@ -16,6 +18,7 @@ export function DoubleEliminationMobileBracket({
layout: DoubleEliminationBracketLayout;
teamById: ReadonlyMap<TeamId, CompetitionTeamView>;
}) {
const bracketId = useId();
const seriesById = new Map(
projection.series.map((series) => [series.seriesId, series]),
);
@@ -53,9 +56,15 @@ export function DoubleEliminationMobileBracket({
);
if (groups.length === 0) return null;
return (
<section key={section.key} aria-labelledby={`bracket-${section.key}`}>
<section
key={section.key}
aria-labelledby={`${bracketId}-${section.key}`}
>
<div className="mb-3 border-b border-base-content/10 pb-2">
<h3 id={`bracket-${section.key}`} className="text-sm font-bold">
<h3
id={`${bracketId}-${section.key}`}
className="text-sm font-bold"
>
{section.title}
</h3>
<p className="mt-0.5 text-xs text-content-muted">
@@ -66,24 +75,40 @@ export function DoubleEliminationMobileBracket({
{groups.map((group) => (
<section
key={`${group.stage}:${group.roundNumber}`}
aria-label={group.label}
aria-labelledby={`${bracketId}-${group.stage}-${group.roundNumber}`}
>
<h4 className="mb-2 text-xs font-bold text-content-muted">
<h4
id={`${bracketId}-${group.stage}-${group.roundNumber}`}
className="mb-2 text-xs font-bold text-content-muted"
aria-label={group.accessibleLabel}
>
{group.label}
</h4>
<div className="space-y-3">
{group.seriesIds.map((seriesId) => {
const series = seriesById.get(seriesId);
if (!series) return null;
const node = nodeById.get(seriesId);
const accessibilityLabel =
getSeriesScoreCardAccessibleLabel(
series,
node?.accessibleLabel,
teamById,
);
return (
<div key={seriesId}>
<SeriesScoreCard
series={series}
displayLabel={nodeById.get(seriesId)?.label}
displayLabel={node?.label}
teamById={teamById}
variant="bracket"
accessibilityLabel={accessibilityLabel}
/>
<MobileRoutes
layout={layout}
seriesId={seriesId}
seriesLabel={node?.accessibleLabel ?? "경기"}
/>
<MobileRoutes layout={layout} seriesId={seriesId} />
</div>
);
})}
@@ -101,19 +126,25 @@ export function DoubleEliminationMobileBracket({
function MobileRoutes({
layout,
seriesId,
seriesLabel,
}: {
layout: DoubleEliminationBracketLayout;
seriesId: SeriesId;
seriesLabel: string;
}) {
const routes = layout.connectors.filter(
(connector) => connector.fromSeriesId === seriesId,
);
if (routes.length === 0) return null;
return (
<ul className="mt-1.5 space-y-0.5 border-l border-base-content/10 pl-2 text-[11px] text-content-muted">
<ul
className="mt-1.5 space-y-0.5 border-l border-base-content/10 pl-2 text-[11px] text-content-muted"
aria-label={`${seriesLabel} 연결 경로`}
>
{routes.map((route) => (
<li key={`${route.select}:${route.toSeriesId}:${route.toSlot}`}>
{route.label}
<span aria-hidden="true">{route.label}</span>
<span className="sr-only">{route.accessibleLabel}</span>
</li>
))}
</ul>