feat: refresh the home page and separate match event types
Add an inhouse hero, Hall of Fame, rankings, and event-specific schedules. Carry the event type through the API and admin tools, and improve results and player history displays.
This commit is contained in:
1 parent
7e0cd7cb19
commit
664af15255
58 files changed
+2316
-593
No files matched your search
@@ -14,18 +14,22 @@ const BRAND_COLORS = {
|
||||
leaf: "#2f9e58",
|
||||
} as const;
|
||||
|
||||
test("defines each brand color once as a primitive token", () => {
|
||||
test("keeps literal colors in the primitive palette", () => {
|
||||
const palette = stylesheet.match(/@theme static\s*\{[^}]*\}/)?.[0];
|
||||
assert.ok(palette, "the primitive palette must be in @theme static");
|
||||
|
||||
for (const [name, value] of Object.entries(BRAND_COLORS)) {
|
||||
assert.match(
|
||||
stylesheet,
|
||||
palette,
|
||||
new RegExp(`--color-brand-${name}: ${escapeRegExp(value)};`),
|
||||
);
|
||||
assert.equal(
|
||||
stylesheet.split(value).length - 1,
|
||||
1,
|
||||
`${name} should have one literal source`,
|
||||
);
|
||||
assert.equal(palette.split(`${value};`).length - 1, 1);
|
||||
}
|
||||
|
||||
assert.doesNotMatch(
|
||||
stylesheet.replace(palette, ""),
|
||||
/#[\da-f]{3,8}\b|\b(?:rgba?|hsla?|oklch|oklab)\(/i,
|
||||
);
|
||||
});
|
||||
|
||||
test("keeps the layer order that lets LOLYMPUS tokens override Astryx", () => {
|
||||
@@ -43,7 +47,7 @@ test("derives Astryx action colors from the brand coral", () => {
|
||||
);
|
||||
assert.match(
|
||||
stylesheet,
|
||||
/--color-text-accent: light-dark\(\s*color-mix\(in oklab, var\(--color-brand-coral\) \d+%, black\),\s*color-mix\(in oklab, var\(--color-brand-coral\) \d+%, white\)\s*\);/,
|
||||
/--color-text-accent: light-dark\(\s*color-mix\(in oklab, var\(--color-brand-coral\) \d+%, var\(--color-palette-black\)\),\s*color-mix\(in oklab, var\(--color-brand-coral\) \d+%, var\(--color-palette-white\)\)\s*\);/,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import type { MatchParticipantView } from '@lolympus/contracts';
|
||||
import {
|
||||
getHistoryMatchTitle,
|
||||
getHomeMatchEnrollment,
|
||||
getHomeMatchSchedule,
|
||||
getNextMatchBanner,
|
||||
} from '../src/pages/home-match-presentation.ts';
|
||||
|
||||
test('uses the Korean schedule and only removes a matching generic title prefix', () => {
|
||||
@@ -48,3 +50,34 @@ test('promotes application only for an open match with available places', () =>
|
||||
'참가 완료',
|
||||
);
|
||||
});
|
||||
|
||||
test('uses neutral titles and distinguishes registration states on the next match banner', () => {
|
||||
const match = {
|
||||
title: '토요일 내전',
|
||||
status: 'recruiting' as const,
|
||||
joined: false,
|
||||
maxParticipants: 1,
|
||||
participants: [],
|
||||
};
|
||||
const participant: MatchParticipantView = {
|
||||
userId: 'player-1' as MatchParticipantView['userId'],
|
||||
joinedAt: '2026-11-10T09:00:00.000Z',
|
||||
preferredPositions: [],
|
||||
excluded: false,
|
||||
};
|
||||
|
||||
assert.deepEqual(getNextMatchBanner(match), {
|
||||
title: '정기 내전',
|
||||
status: '모집 중',
|
||||
capacity: '0/1명',
|
||||
canApply: true,
|
||||
});
|
||||
const fullMatch = { ...match, participants: [participant] };
|
||||
assert.equal(getNextMatchBanner(fullMatch).status, '정원 마감');
|
||||
assert.equal(getNextMatchBanner({ ...fullMatch, joined: true }).status, '신청 완료');
|
||||
assert.equal(getNextMatchBanner({ ...match, maxParticipants: 0 }).status, '모집 마감');
|
||||
assert.deepEqual(
|
||||
getNextMatchBanner({ ...fullMatch, title: '토요일 시즌 결승 내전', status: 'team-built' }),
|
||||
{ title: '토요일 시즌 결승 내전', status: '팀 편성', capacity: '1/1명', canApply: false },
|
||||
);
|
||||
});
|
||||
@@ -15,7 +15,7 @@ test("shares the four history columns between records and the loading state", ()
|
||||
assert.equal(columns.match(/<col(?:\s|\/|>)/g)?.length, 4);
|
||||
assert.deepEqual(
|
||||
Array.from(columns.matchAll(/<th\b[^>]*>\s*([^<]+?)\s*<\/th>/g), (match) => match[1]),
|
||||
["일정", "내전", "결과", "참가"],
|
||||
["일정", "대회", "상태·결과", "참가"],
|
||||
);
|
||||
assert.match(skeleton, /<HistoryTableColumns\s*\/>/);
|
||||
assert.match(records, /<HistoryTableColumns\s*\/>/);
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import {
|
||||
getInternalMatchOutcome,
|
||||
getMainLane,
|
||||
parseLeaderboardSort,
|
||||
rankLeaderboardByLane,
|
||||
sortLeaderboardRows,
|
||||
} from '../src/lib/internal-stats-presentation.ts';
|
||||
|
||||
const rows = [
|
||||
{ id: 'many', games: 90, winRate: 46, kda: 2.1 },
|
||||
{ id: 'steady', games: 40, winRate: 55, kda: 3.4 },
|
||||
{ id: 'lucky', games: 2, winRate: 100, kda: 9 },
|
||||
{ id: 'sharp', games: 12, winRate: 55, kda: 4.2 },
|
||||
];
|
||||
const ids = (list: typeof rows) => list.map(({ id }) => id);
|
||||
|
||||
test('keeps the server order for the default sort and ignores unknown values', () => {
|
||||
assert.equal(parseLeaderboardSort(null), 'games');
|
||||
assert.equal(parseLeaderboardSort('nope'), 'games');
|
||||
assert.equal(parseLeaderboardSort('kda'), 'kda');
|
||||
assert.deepEqual(ids(sortLeaderboardRows(rows, 'games')), ids(rows));
|
||||
});
|
||||
|
||||
test('ranks small samples after players with enough games', () => {
|
||||
assert.deepEqual(ids(sortLeaderboardRows(rows, 'winRate')), [
|
||||
'steady',
|
||||
'sharp',
|
||||
'many',
|
||||
'lucky',
|
||||
]);
|
||||
assert.deepEqual(ids(sortLeaderboardRows(rows, 'kda')), [
|
||||
'sharp',
|
||||
'steady',
|
||||
'many',
|
||||
'lucky',
|
||||
]);
|
||||
});
|
||||
|
||||
test('ranks one lane by its own win rate and sample size', () => {
|
||||
const player = (
|
||||
id: string,
|
||||
byLane: Parameters<typeof rankLeaderboardByLane>[0][number]['byLane'],
|
||||
) => ({ id, games: 50, wins: 25, losses: 25, winRate: 50, kda: 3, byLane });
|
||||
const ranked = rankLeaderboardByLane(
|
||||
[
|
||||
player('offlane', { MIDDLE: { games: 20, wins: 18, kda: 5 } }),
|
||||
player('lucky', { TOP: { games: 2, wins: 2, kda: 9 } }),
|
||||
player('steady', { TOP: { games: 10, wins: 6, kda: 3 } }),
|
||||
player('sharp', { TOP: { games: 6, wins: 4, kda: 4 } }),
|
||||
],
|
||||
'TOP',
|
||||
);
|
||||
|
||||
assert.deepEqual(
|
||||
ranked.map(({ id }) => id),
|
||||
['sharp', 'steady', 'lucky'],
|
||||
);
|
||||
assert.deepEqual(
|
||||
{ games: ranked[0].games, wins: ranked[0].wins, losses: ranked[0].losses, winRate: ranked[0].winRate },
|
||||
{ games: 6, wins: 4, losses: 2, winRate: 67 },
|
||||
);
|
||||
});
|
||||
|
||||
test('picks the most played lane', () => {
|
||||
assert.equal(
|
||||
getMainLane({
|
||||
TOP: { games: 3, wins: 1, kda: 2 },
|
||||
BOTTOM: { games: 8, wins: 4, kda: 3 },
|
||||
}),
|
||||
'BOTTOM',
|
||||
);
|
||||
assert.equal(getMainLane({}), undefined);
|
||||
});
|
||||
|
||||
test('shows a score for a single two-team series and a winner otherwise', () => {
|
||||
const team = (teamIndex: number) => ({
|
||||
teamIndex,
|
||||
name: `${teamIndex + 1}팀`,
|
||||
members: [],
|
||||
});
|
||||
const pair = getInternalMatchOutcome({
|
||||
winnerTeamIndex: 1,
|
||||
teams: [team(0), team(1)],
|
||||
seriesResults: [
|
||||
{ teamAIndex: 0, teamBIndex: 1, teamAWins: 1, teamBWins: 2 },
|
||||
],
|
||||
});
|
||||
assert.equal(pair?.type, 'score');
|
||||
assert.equal(pair?.type === 'score' && pair.rightWins, 2);
|
||||
assert.equal(pair?.winner?.name, '2팀');
|
||||
|
||||
const tournament = getInternalMatchOutcome({
|
||||
winnerTeamIndex: 2,
|
||||
teams: [team(0), team(1), team(2), team(3)],
|
||||
seriesResults: [],
|
||||
});
|
||||
assert.deepEqual(tournament, { type: 'winner', winner: team(2) });
|
||||
|
||||
assert.equal(
|
||||
getInternalMatchOutcome({ teams: [team(0), team(1)], seriesResults: [] }),
|
||||
undefined,
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,22 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { multiKillLabel, rankPositionRates } from '../src/lib/multi-kill.ts';
|
||||
|
||||
test('labels only real multi kills and caps at a penta kill', () => {
|
||||
assert.equal(multiKillLabel(undefined), undefined);
|
||||
assert.equal(multiKillLabel(1), undefined);
|
||||
assert.equal(multiKillLabel(2), '더블킬');
|
||||
assert.equal(multiKillLabel(4), '쿼드라킬');
|
||||
assert.equal(multiKillLabel(6), '펜타킬');
|
||||
});
|
||||
|
||||
test('orders played positions by rate and drops empty ones', () => {
|
||||
assert.deepEqual(
|
||||
rankPositionRates({ TOP: 32, MIDDLE: 58, JUNGLE: 0, BOTTOM: 10 }),
|
||||
[
|
||||
{ lane: 'MIDDLE', rate: 58 },
|
||||
{ lane: 'TOP', rate: 32 },
|
||||
],
|
||||
);
|
||||
assert.deepEqual(rankPositionRates({}), []);
|
||||
});
|
||||
Reference in new issue
Block a user