feat(web): align team match names with bracket

This commit is contained in:
dahyeon committed 2026-07-13 22:41:16 -07:00
1 parent bb32c26694
commit dc77b37494
5 files changed
+54 -60

No files matched your search

@@ -170,11 +170,12 @@ export function bracketRoundLabel(
stage: SeriesStageType, stage: SeriesStageType,
roundNumber?: number, roundNumber?: number,
): string { ): string {
const round = roundNumber ?? 1;
switch (stage) { switch (stage) {
case "upper": case "upper":
return `승자조 ${roundNumber ?? 1}라운드`; return round === 1 ? `브래킷 1R` : `브래킷 상위 ${round}R`;
case "lower": case "lower":
return `패자조 ${roundNumber ?? 1}라운드`; return `브래킷 하위 ${round}R`;
case "grand-final": case "grand-final":
return "그랜드 파이널"; return "그랜드 파이널";
case "reset-final": case "reset-final":
@@ -182,7 +183,7 @@ export function bracketRoundLabel(
case "pair": case "pair":
return "대진"; return "대진";
case "round-robin": case "round-robin":
return `${roundNumber ?? 1}라운드`; return `${round}라운드`;
} }
} }
+2 -41
View File
@@ -4,6 +4,7 @@ import type {
SeriesProjection, SeriesProjection,
TeamTournamentCodeView, TeamTournamentCodeView,
} from "@lolympus/contracts"; } from "@lolympus/contracts";
import { bracketRoundLabel } from "../components/competition/double-elimination-bracket-layout.ts";
export interface TeamSeriesGroup { export interface TeamSeriesGroup {
series: SeriesProjection; series: SeriesProjection;
@@ -78,11 +79,7 @@ export function getTeamSeriesDisplayLabel(
); );
const stage = round?.stage ?? series.stage.type; const stage = round?.stage ?? series.stage.type;
const roundNumber = round?.roundNumber ?? series.stage.roundNumber ?? 1; const roundNumber = round?.roundNumber ?? series.stage.roundNumber ?? 1;
const baseLabel = isFinalRound(round, rounds) const baseLabel = bracketRoundLabel(stage, roundNumber);
? stage === "upper"
? "승자조 결승"
: "패자조 결승"
: stageLabel(stage, roundNumber);
if (!round || round.seriesIds.length <= 1) return baseLabel; if (!round || round.seriesIds.length <= 1) return baseLabel;
const matchIndex = round.seriesIds.findIndex( 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 { function isExpired(expiresAt: string | null, now: number): boolean {
if (!expiresAt) return false; if (!expiresAt) return false;
const timestamp = Date.parse(expiresAt); const timestamp = Date.parse(expiresAt);
+23 -9
View File
@@ -51,24 +51,38 @@ test("groups only matching tournament codes under each active Series", () => {
); );
}); });
test("uses Korean round names while keeping global game numbers secondary", () => { test("uses bracket match names while keeping global game numbers secondary", () => {
const opening = readySeries("upper-opening-2", 1, "WB_R1_M2"); const opening = readySeries("upper-opening-2", 1, "WB_R1_M2");
const final = readySeries("upper-final", 3, "WB_FINAL"); const upperLater = readySeries("upper-final", 3, "WB_FINAL");
const lower: SeriesProjection = {
...readySeries("lower-opening", 4, "LB_R1_M1"),
stage: { type: "lower", roundNumber: 1, displayOrder: 4 },
};
const rounds: BracketRoundView[] = [ const rounds: BracketRoundView[] = [
round("upper", 1, 1, ["upper-opening-1", opening.seriesId]), round("upper", 1, 1, ["upper-opening-1", opening.seriesId]),
round("upper", 3, 3, [final.seriesId]), round("upper", 3, 3, [upperLater.seriesId]),
round("lower", 1, 4, [lower.seriesId]),
]; ];
assert.equal( assert.equal(
getTeamSeriesDisplayLabel(opening, rounds), getTeamSeriesDisplayLabel(opening, rounds),
"승자조 1라운드 · 2경기", "브래킷 1R · 2경기",
); );
assert.equal(getTeamSeriesDisplayLabel(final, rounds), "승자조 결승");
const assignment = tournamentCode("final-1", final.seriesId, 1, 19);
assert.equal( assert.equal(
getTournamentCodeCopyLabel(assignment, "승자조 결승"), getTeamSeriesDisplayLabel(upperLater, rounds),
"승자조 결승 1세트 토너먼트 코드 복사 (전체 19번 게임)", "브래킷 상위 3R",
);
assert.equal(getTeamSeriesDisplayLabel(lower, rounds), "브래킷 하위 1R");
const assignment = tournamentCode(
"final-1",
upperLater.seriesId,
1,
19,
);
assert.equal(
getTournamentCodeCopyLabel(assignment, "브래킷 상위 3R"),
"브래킷 상위 3R 1세트 토너먼트 코드 복사 (전체 19번 게임)",
); );
}); });
+15 -1
View File
@@ -15,6 +15,8 @@ metadata, outcome categories, and code expiry.
page-wide code grid. page-wide code grid.
- Keep the team page's Series presentation in a page-specific card so shared - Keep the team page's Series presentation in a page-specific card so shared
bracket/history layouts are unaffected; exhaustively test its outcome mapping. bracket/history layouts are unaffected; exhaustively test its outcome mapping.
- Reuse the bracket's canonical round-label helper so the bracket and team detail
cannot drift to different visible match names.
- Use one responsive layout and native disclosure/table semantics rather than - Use one responsive layout and native disclosure/table semantics rather than
separate desktop and mobile component trees. separate desktop and mobile component trees.
@@ -62,15 +64,27 @@ metadata, outcome categories, and code expiry.
under exactly one matching Series; empty states remain meaningful. under exactly one matching Series; empty states remain meaningful.
- Verify: desktop and mobile runtime screenshots. - Verify: desktop and mobile runtime screenshots.
- Files: `apps/web/src/pages/MatchTeamProgressPage.tsx` - Files: `apps/web/src/pages/MatchTeamProgressPage.tsx`
- [x] Compact and order the roster, and collapse results beyond the newest two. - [x] Compact and order the roster, and collapse results beyond the newest two.
- Acceptance: position labels are Korean and role-ordered, captain is adjacent, - Acceptance: position labels are Korean and role-ordered, captain is adjacent,
and older results remain keyboard-accessible. and older results remain keyboard-accessible.
- Verify: 320/768/1024/1440px reflow and keyboard traversal. - Verify: 320/768/1024/1440px reflow and keyboard traversal.
- Files: `apps/web/src/pages/MatchTeamProgressPage.tsx` - Files: `apps/web/src/pages/MatchTeamProgressPage.tsx`
### Phase 4: Bracket Naming Alignment
- [x] Reuse canonical bracket round labels in the team-detail view model.
- Acceptance: upper round 1 displays `브래킷 1R`, later upper rounds display
`브래킷 상위 nR`, lower rounds display `브래킷 하위 nR`, and multi-match
rounds keep the `· n경기` suffix.
- Verify: focused view-model test, full web suite, scoped lint, and build.
- Files: `apps/web/src/components/competition/double-elimination-bracket-layout.ts`,
`apps/web/src/pages/match-team-progress-view.ts`, and
`apps/web/test/match-team-progress-view.test.ts`
### Checkpoint: Complete ### Checkpoint: Complete
- [x] Focused (9) and full web tests (87) pass without skips. - [x] Focused (9) and full web tests (88) pass without skips.
- [x] Scoped lint and the production build pass. - [x] Scoped lint and the production build pass.
- [ ] Full repository lint passes. It is currently blocked by pre-existing errors - [ ] Full repository lint passes. It is currently blocked by pre-existing errors
outside the team-progress scope. outside the team-progress scope.
+10 -6
View File
@@ -18,8 +18,10 @@ accessible and explicit.
- Group tournament codes under their matching active Series using `seriesId`. - Group tournament codes under their matching active Series using `seriesId`.
- Label a Series-local game as `1세트`, `2세트`, and so on; retain global - Label a Series-local game as `1세트`, `2세트`, and so on; retain global
`Game 19`-style numbers only as secondary metadata. `Game 19`-style numbers only as secondary metadata.
- Derive Korean round labels from Competition round metadata and retain raw Series - Use the bracket's canonical visible round names from Competition round metadata:
codes such as `WB_FINAL` as secondary diagnostic text. upper round 1 is `브래킷 1R`, later upper rounds are `브래킷 상위 nR`, and
lower rounds are `브래킷 하위 nR`. Retain raw Series codes such as `WB_FINAL`
as secondary diagnostic text.
- Show pre-start and adjudicated Series without misleading `0–0` scores. - Show pre-start and adjudicated Series without misleading `0–0` scores.
- Distinguish `부전승`, `기권승`, `판정승`, and `무승부` using the existing - Distinguish `부전승`, `기권승`, `판정승`, and `무승부` using the existing
outcome discriminator. Do not invent a free-form reason that is not public data. outcome discriminator. Do not invent a free-form reason that is not public data.
@@ -51,6 +53,8 @@ accessible and explicit.
page ordering, and top-level team navigation. page ordering, and top-level team navigation.
- `apps/web/src/pages/match-team-progress-view.ts` owns pure grouping, ordering, - `apps/web/src/pages/match-team-progress-view.ts` owns pure grouping, ordering,
labels, code state, and copy-result behavior. labels, code state, and copy-result behavior.
- `apps/web/src/components/competition/double-elimination-bracket-layout.ts`
remains the canonical source for visible bracket round names.
- `apps/web/src/components/competition/TeamTournamentCodes.tsx` owns code rows and - `apps/web/src/components/competition/TeamTournamentCodes.tsx` owns code rows and
clipboard feedback. clipboard feedback.
- `apps/web/src/components/competition/TeamSeriesCard.tsx` owns the page-specific - `apps/web/src/components/competition/TeamSeriesCard.tsx` owns the page-specific
@@ -80,8 +84,8 @@ high-contrast base-content color.
- Test code-to-Series association by exact `seriesId` and deterministic ordinal - Test code-to-Series association by exact `seriesId` and deterministic ordinal
ordering before adding the UI. ordering before adding the UI.
- Test Korean round labels, code availability/expiry state, unique copy labels, - Test bracket-aligned round labels, code availability/expiry state, unique copy
and explicit clipboard success/failure results as pure functions. labels, and explicit clipboard success/failure results as pure functions.
- Test every page-specific Series lifecycle/outcome branch, including played and - Test every page-specific Series lifecycle/outcome branch, including played and
administrative draws, so the local summary cannot drift silently. administrative draws, so the local summary cannot drift silently.
- Run the complete web suite, lint, and build after the focused tests pass. - Run the complete web suite, lint, and build after the focused tests pass.
@@ -117,7 +121,7 @@ high-contrast base-content color.
- Each active Series appears as a full-width next-match panel containing only its - Each active Series appears as a full-width next-match panel containing only its
own ordered code rows. own ordered code rows.
- Human Korean labels lead raw Series codes, and Series-local set numbers lead - Bracket-aligned labels lead raw Series codes, and Series-local set numbers lead
global game numbers. global game numbers.
- Ready Series show a pending score, while adjudicated results show their result - Ready Series show a pending score, while adjudicated results show their result
category instead of a numeric score. category instead of a numeric score.
@@ -133,7 +137,7 @@ high-contrast base-content color.
## Verification Record ## Verification Record
- Focused view-model tests: 9 passed. - Focused view-model tests: 9 passed.
- Full web suite: 87 passed without skips. - Full web suite: 88 passed without skips.
- Scoped ESLint for all team-progress files: passed. - Scoped ESLint for all team-progress files: passed.
- Production TypeScript/Vite build: passed; only the existing large-chunk warning - Production TypeScript/Vite build: passed; only the existing large-chunk warning
remains. remains.