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);
|
||||
|
||||
@@ -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 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[] = [
|
||||
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(
|
||||
getTeamSeriesDisplayLabel(opening, rounds),
|
||||
"승자조 1라운드 · 2경기",
|
||||
"브래킷 1R · 2경기",
|
||||
);
|
||||
assert.equal(getTeamSeriesDisplayLabel(final, rounds), "승자조 결승");
|
||||
|
||||
const assignment = tournamentCode("final-1", final.seriesId, 1, 19);
|
||||
assert.equal(
|
||||
getTournamentCodeCopyLabel(assignment, "승자조 결승"),
|
||||
"승자조 결승 1세트 토너먼트 코드 복사 (전체 19번 게임)",
|
||||
getTeamSeriesDisplayLabel(upperLater, rounds),
|
||||
"브래킷 상위 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,6 +15,8 @@ metadata, outcome categories, and code expiry.
|
||||
page-wide code grid.
|
||||
- Keep the team page's Series presentation in a page-specific card so shared
|
||||
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
|
||||
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.
|
||||
- Verify: desktop and mobile runtime screenshots.
|
||||
- Files: `apps/web/src/pages/MatchTeamProgressPage.tsx`
|
||||
|
||||
- [x] Compact and order the roster, and collapse results beyond the newest two.
|
||||
- Acceptance: position labels are Korean and role-ordered, captain is adjacent,
|
||||
and older results remain keyboard-accessible.
|
||||
- Verify: 320/768/1024/1440px reflow and keyboard traversal.
|
||||
- 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
|
||||
|
||||
- [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.
|
||||
- [ ] Full repository lint passes. It is currently blocked by pre-existing errors
|
||||
outside the team-progress scope.
|
||||
|
||||
@@ -18,8 +18,10 @@ accessible and explicit.
|
||||
- Group tournament codes under their matching active Series using `seriesId`.
|
||||
- Label a Series-local game as `1세트`, `2세트`, and so on; retain global
|
||||
`Game 19`-style numbers only as secondary metadata.
|
||||
- Derive Korean round labels from Competition round metadata and retain raw Series
|
||||
codes such as `WB_FINAL` as secondary diagnostic text.
|
||||
- Use the bracket's canonical visible round names from Competition round metadata:
|
||||
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.
|
||||
- Distinguish `부전승`, `기권승`, `판정승`, and `무승부` using the existing
|
||||
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.
|
||||
- `apps/web/src/pages/match-team-progress-view.ts` owns pure grouping, ordering,
|
||||
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
|
||||
clipboard feedback.
|
||||
- `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
|
||||
ordering before adding the UI.
|
||||
- Test Korean round labels, code availability/expiry state, unique copy labels,
|
||||
and explicit clipboard success/failure results as pure functions.
|
||||
- Test bracket-aligned round labels, code availability/expiry state, unique copy
|
||||
labels, and explicit clipboard success/failure results as pure functions.
|
||||
- Test every page-specific Series lifecycle/outcome branch, including played and
|
||||
administrative draws, so the local summary cannot drift silently.
|
||||
- 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
|
||||
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.
|
||||
- Ready Series show a pending score, while adjudicated results show their result
|
||||
category instead of a numeric score.
|
||||
@@ -133,7 +137,7 @@ high-contrast base-content color.
|
||||
## Verification Record
|
||||
|
||||
- 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.
|
||||
- Production TypeScript/Vite build: passed; only the existing large-chunk warning
|
||||
remains.
|
||||
|
||||
Reference in new issue
Block a user