Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 727x 458x 473x 423x 727x 393x 393x 393x 32x 32x 1x 1x 374x 374x | /**
* The Tournaments tab's URLs (SB-1767).
*
* There is no router. `/tournaments` is the season index and
* `/tournaments/<id>` is one tournament, so a tournament can be shared and
* survives a hard reload. App.vue decides which tab a path opens;
* TournamentMatchCenter decides index vs detail. Both read the path through
* `parseTournamentPath`, so they cannot disagree about what it means.
*
* Pure: no window, no history — callers pass the pathname in.
*/
const TOURNAMENTS_RE = /^\/tournaments(?:\/([^/]*))?\/?$/;
/**
* What a pathname asks the Tournaments tab for.
*
* '/tournaments' → { kind: 'index' }
* '/tournaments/12' → { kind: 'detail', id: 12 }
* '/tournaments/abc' → { kind: 'index' } (not an id; still the tab)
* anything else → null (not a tournaments path)
*/
export function parseTournamentPath(pathname) {
if (typeof pathname !== 'string') return null;
const match = TOURNAMENTS_RE.exec(pathname);
if (!match) return null;
const segment = match[1];
if (segment && /^\d+$/.test(segment)) {
const id = Number(segment);
if (Number.isSafeInteger(id) && id > 0) return { kind: 'detail', id };
}
return { kind: 'index' };
}
/** `/tournaments`, or `/tournaments/<id>` when an id is given. */
export function tournamentPath(id = null) {
return id == null ? '/tournaments' : `/tournaments/${id}`;
}
|