feat: improve tournament workflows and prune outdated docs
This commit is contained in:
1 parent
da7b502936
commit
38a89b5374
53 files changed
+3308
-3276
No files matched your search
@@ -24,14 +24,9 @@ website/LICENSE
|
||||
*.md
|
||||
!README.md
|
||||
!design-qa.md
|
||||
!docs/specs/internal-match-game-analysis.md
|
||||
!docs/plans/internal-match-game-analysis-p0-p1.md
|
||||
!docs/specs/double-elimination-connector-routing.md
|
||||
!docs/specs/match-status-and-result-presentation.md
|
||||
!docs/ux-audit-2026-11-10/06-ui-improvement-review.md
|
||||
!docs/ux-audit-2026-11-10/07-visual-design-review.md
|
||||
!docs/plans/double-elimination-connector-routing.md
|
||||
!docs/plans/redis-8.10-optimization.md
|
||||
/tmp/
|
||||
/user-game-history/
|
||||
/*.txt
|
||||
|
||||
@@ -144,7 +144,9 @@ pnpm --filter api build
|
||||
|
||||
`test:redis`는 PATH의 `redis-server` 또는 `REDIS_TEST_SERVER`에 지정한 실행 파일로 Redis 8.10.x를 직접 실행합니다. 임의의 로컬 포트와 일회용 암호를 사용하고, 저장을 비활성화하며, 종료 후 프로세스와 임시 디렉터리를 정리합니다. 애플리케이션 Redis 연결 설정은 사용하지 않습니다. Windows에서는 PowerShell에서 `$env:REDIS_TEST_SERVER = 'C:\tools\redis\redis-server.exe'`처럼 지정할 수 있습니다.
|
||||
|
||||
커뮤니티 통계 캐시는 `riot:communitystats:v2:{communityId}:scope` Hash로 전환됩니다. 항목별 TTL은 일반 5분, 완성된 상세 24시간, 미완성 상세 60초를 유지합니다. 이전 String 캐시는 기존 TTL로 만료되며 새 캐시는 첫 조회에 생성됩니다. 구버전과 신버전은 무효화 대상이 다르므로 API 인스턴스를 같은 버전으로 함께 전환해야 합니다. 구현 범위와 검증 기록은 [Redis 변경 계획](docs/plans/redis-8.10-optimization.md)을 참고하세요.
|
||||
커뮤니티 통계 캐시는 `riot:communitystats:v2:{communityId}:scope` Hash를 사용합니다. 항목별 TTL은 일반 5분, 완성된 상세 24시간, 미완성 상세 60초입니다. 이전 String 캐시는 기존 TTL로 만료되며 새 캐시는 첫 조회에 생성됩니다. 구버전과 신버전은 무효화 대상이 다르므로 배포와 롤백 모두 API 인스턴스를 같은 버전으로 함께 전환해야 합니다.
|
||||
|
||||
스트림이 계속 커지면 소비자 그룹별 미처리 항목을 확인합니다. 사용이 중단된 그룹도 미처리 항목을 계속 보존할 수 있습니다.
|
||||
|
||||
### API New Relic APM
|
||||
|
||||
@@ -171,6 +173,8 @@ API 성능 계측은 기본 비활성화이며 필요할 때 `API_PERF_OBSERVABI
|
||||
|
||||
카카오톡 기반 명령어 기능은 Dakao(커스텀 카카오톡 게이트웨이) 연동이 필요합니다. Dakao가 실행 중이 아니거나 NATS를 통해 API 서버와 연결되어 있지 않으면 일정 조회, 내전 참가, 참가 취소, 계정 등록 같은 카카오톡 명령어는 사용할 수 없습니다.
|
||||
|
||||
카카오톡 방을 옮긴 뒤에는 새 방에서 `!내전 데이터이관 예전 닉네임`을 실행합니다. 같은 커뮤니티에서 Riot 계정이 등록된 기존 사용자의 카카오톡 ID만 바뀝니다. 기존 사용자 ID, 권한, 참가 기록은 유지됩니다. 닉네임이 중복되거나 새 ID가 이미 다른 사용자에 연결돼 있으면 운영자가 확인합니다. 계정 소유권 확인은 운영 절차에서 담당합니다.
|
||||
|
||||
## 커맨드
|
||||
|
||||
| Command | Description |
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
import mongoose from 'mongoose';
|
||||
import {
|
||||
summarizeMatchHistoryResult,
|
||||
type HistoryCompetition,
|
||||
} from './match-history-result';
|
||||
|
||||
const firstId = new mongoose.Types.ObjectId();
|
||||
const secondId = new mongoose.Types.ObjectId();
|
||||
const thirdId = new mongoose.Types.ObjectId();
|
||||
const teams = [
|
||||
{
|
||||
teamId: firstId,
|
||||
name: '첫 팀',
|
||||
displayOrder: 1,
|
||||
seedNumber: 1,
|
||||
members: [],
|
||||
},
|
||||
{
|
||||
teamId: secondId,
|
||||
name: '둘째 팀',
|
||||
displayOrder: 2,
|
||||
seedNumber: 2,
|
||||
members: [],
|
||||
},
|
||||
{
|
||||
teamId: thirdId,
|
||||
name: '셋째 팀',
|
||||
displayOrder: 3,
|
||||
seedNumber: 3,
|
||||
members: [],
|
||||
},
|
||||
];
|
||||
const finishedMatch = {
|
||||
status: 'finished' as const,
|
||||
competitionId: new mongoose.Types.ObjectId(),
|
||||
teams: [],
|
||||
};
|
||||
const singleSeries = {
|
||||
status: 'completed',
|
||||
entries: [{ gameWins: 2 }, { gameWins: 1 }],
|
||||
outcome: { type: 'played', winnerTeamId: firstId.toString() },
|
||||
};
|
||||
|
||||
describe('summarizeMatchHistoryResult', () => {
|
||||
it('shows played scores only for one completed series between two teams', () => {
|
||||
const competition: HistoryCompetition = {
|
||||
teams: teams.slice(0, 2),
|
||||
projection: {
|
||||
series: [singleSeries],
|
||||
outcome: { type: 'paired-series' },
|
||||
},
|
||||
};
|
||||
|
||||
expect(summarizeMatchHistoryResult(finishedMatch, competition)).toEqual({
|
||||
type: 'score',
|
||||
teamAWins: 2,
|
||||
teamBWins: 1,
|
||||
winnerTeamName: '첫 팀',
|
||||
});
|
||||
expect(
|
||||
summarizeMatchHistoryResult(
|
||||
{ ...finishedMatch, status: 'in-progress' },
|
||||
competition,
|
||||
),
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
summarizeMatchHistoryResult(finishedMatch, {
|
||||
...competition,
|
||||
projection: {
|
||||
...competition.projection,
|
||||
series: [singleSeries, singleSeries],
|
||||
},
|
||||
}),
|
||||
).toBeUndefined();
|
||||
});
|
||||
|
||||
it('shows adjudication without a score even if some games were played', () => {
|
||||
expect(
|
||||
summarizeMatchHistoryResult(finishedMatch, {
|
||||
teams: teams.slice(0, 2),
|
||||
projection: {
|
||||
series: [
|
||||
{
|
||||
...singleSeries,
|
||||
outcome: { ...singleSeries.outcome, type: 'forfeit' },
|
||||
},
|
||||
],
|
||||
outcome: { type: 'paired-series' },
|
||||
},
|
||||
}),
|
||||
).toEqual({
|
||||
type: 'decision',
|
||||
decision: 'forfeit',
|
||||
winnerTeamName: '첫 팀',
|
||||
});
|
||||
});
|
||||
|
||||
it('uses the tournament winner or joint leaders instead of a series score', () => {
|
||||
expect(
|
||||
summarizeMatchHistoryResult(finishedMatch, {
|
||||
teams,
|
||||
projection: {
|
||||
series: [singleSeries],
|
||||
outcome: {
|
||||
type: 'double-elimination',
|
||||
championTeamId: thirdId.toString(),
|
||||
},
|
||||
},
|
||||
}),
|
||||
).toEqual({ type: 'winners', teamNames: ['셋째 팀'] });
|
||||
expect(
|
||||
summarizeMatchHistoryResult(finishedMatch, {
|
||||
teams,
|
||||
projection: {
|
||||
series: [singleSeries],
|
||||
outcome: {
|
||||
type: 'round-robin',
|
||||
leaderTeamIds: [firstId.toString(), secondId.toString()],
|
||||
},
|
||||
},
|
||||
}),
|
||||
).toEqual({ type: 'winners', teamNames: ['첫 팀', '둘째 팀'] });
|
||||
});
|
||||
|
||||
it('uses collected games for legacy two-team records without a Competition', () => {
|
||||
const match = {
|
||||
status: 'finished' as const,
|
||||
teams: [
|
||||
{ teamIndex: 1, name: '첫 팀', members: [] },
|
||||
{ teamIndex: 2, name: '둘째 팀', members: [] },
|
||||
],
|
||||
result: {
|
||||
winnerTeamIndex: 2,
|
||||
riotMatchIds: ['KR_1'],
|
||||
games: [
|
||||
{
|
||||
gameNumber: 1,
|
||||
riotMatchId: 'KR_1',
|
||||
blueTeamIndex: 1,
|
||||
redTeamIndex: 2,
|
||||
winnerTeamIndex: 2,
|
||||
winnerSide: 'red' as const,
|
||||
gameCreation: 0,
|
||||
gameDuration: 1800,
|
||||
participants: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
expect(summarizeMatchHistoryResult(match)).toEqual({
|
||||
type: 'score',
|
||||
teamAWins: 0,
|
||||
teamBWins: 1,
|
||||
winnerTeamName: '둘째 팀',
|
||||
});
|
||||
expect(
|
||||
summarizeMatchHistoryResult({ ...match, competitionId: firstId }),
|
||||
).toBeUndefined();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,117 @@
|
||||
import type { MatchHistoryResult } from '@lolympus/contracts';
|
||||
import type { Competition } from '../competition/competition.schema';
|
||||
import type { CompetitionProjection } from '../competition/domain/competition-projector';
|
||||
import type { Match } from '../global/database/schema';
|
||||
|
||||
type HistoryMatch = Pick<
|
||||
Match,
|
||||
'status' | 'competitionId' | 'teams' | 'result' | 'doubleElimination'
|
||||
>;
|
||||
export type HistoryCompetition = Pick<Competition, 'projection' | 'teams'>;
|
||||
|
||||
export function summarizeMatchHistoryResult(
|
||||
match: HistoryMatch,
|
||||
competition?: HistoryCompetition,
|
||||
): MatchHistoryResult | undefined {
|
||||
if (match.status !== 'finished') return;
|
||||
if (!match.competitionId) return summarizeLegacyResult(match);
|
||||
if (!competition) return;
|
||||
|
||||
const { series, outcome } = competition.projection as Pick<
|
||||
CompetitionProjection,
|
||||
'series' | 'outcome'
|
||||
>;
|
||||
if (!outcome) return;
|
||||
|
||||
const teamName = (teamId: string) => {
|
||||
const team = competition.teams.find(
|
||||
(item) => String(item.teamId) === teamId,
|
||||
);
|
||||
return team && (team.name.trim() || `${team.displayOrder}팀`);
|
||||
};
|
||||
|
||||
const singleSeries = series?.length === 1 ? series[0] : undefined;
|
||||
if (competition.teams.length === 2 && singleSeries?.status === 'completed') {
|
||||
const decision = singleSeries.outcome;
|
||||
const winnerTeamName =
|
||||
decision.type === 'draw' ? undefined : teamName(decision.winnerTeamId);
|
||||
if (
|
||||
decision.type === 'played' ||
|
||||
(decision.type === 'draw' && decision.basis.type === 'played')
|
||||
) {
|
||||
const [teamA, teamB] = singleSeries.entries;
|
||||
return {
|
||||
type: 'score',
|
||||
teamAWins: teamA.gameWins,
|
||||
teamBWins: teamB.gameWins,
|
||||
winnerTeamName,
|
||||
};
|
||||
}
|
||||
return { type: 'decision', decision: decision.type, winnerTeamName };
|
||||
}
|
||||
|
||||
const winnerIds =
|
||||
outcome.type === 'double-elimination'
|
||||
? [outcome.championTeamId]
|
||||
: outcome.type === 'round-robin'
|
||||
? outcome.leaderTeamIds
|
||||
: [];
|
||||
const teamNames = winnerIds.map(teamName);
|
||||
if (teamNames.length > 0 && teamNames.every((name) => name !== undefined)) {
|
||||
return { type: 'winners', teamNames };
|
||||
}
|
||||
}
|
||||
|
||||
function summarizeLegacyResult(
|
||||
match: HistoryMatch,
|
||||
): MatchHistoryResult | undefined {
|
||||
const placement = match.doubleElimination?.placements.firstTeamIndex;
|
||||
if (placement !== undefined) {
|
||||
const champion = match.teams.find((team) => team.teamIndex === placement);
|
||||
if (champion) {
|
||||
return {
|
||||
type: 'winners',
|
||||
teamNames: [champion.name.trim() || `${placement}팀`],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (match.teams.length !== 2 || !match.result?.games.length) return;
|
||||
const [teamA, teamB] = [...match.teams].sort(
|
||||
(a, b) => a.teamIndex - b.teamIndex,
|
||||
);
|
||||
const { games } = match.result;
|
||||
const teamIndices = new Set([teamA.teamIndex, teamB.teamIndex]);
|
||||
if (
|
||||
games.some(
|
||||
({ blueTeamIndex, redTeamIndex }) =>
|
||||
blueTeamIndex === redTeamIndex ||
|
||||
!teamIndices.has(blueTeamIndex) ||
|
||||
!teamIndices.has(redTeamIndex),
|
||||
)
|
||||
)
|
||||
return;
|
||||
const teamAWins = games.filter(
|
||||
(game) => game.winnerTeamIndex === teamA.teamIndex,
|
||||
).length;
|
||||
const teamBWins = games.filter(
|
||||
(game) => game.winnerTeamIndex === teamB.teamIndex,
|
||||
).length;
|
||||
if (teamAWins + teamBWins !== games.length) return;
|
||||
const winner = match.teams.find(
|
||||
(team) => team.teamIndex === match.result?.winnerTeamIndex,
|
||||
);
|
||||
if (
|
||||
winner &&
|
||||
(teamAWins === teamBWins ||
|
||||
winner.teamIndex !==
|
||||
(teamAWins > teamBWins ? teamA.teamIndex : teamB.teamIndex))
|
||||
)
|
||||
return;
|
||||
return {
|
||||
type: 'score',
|
||||
teamAWins,
|
||||
teamBWins,
|
||||
winnerTeamName: winner && (winner.name.trim() || `${winner.teamIndex}팀`),
|
||||
};
|
||||
}
|
||||
@@ -7,6 +7,50 @@ import { RolesGuard } from '../auth/roles.guard';
|
||||
import type { UserDocument } from '../global/database/schema';
|
||||
import { MatchController } from './match.controller';
|
||||
|
||||
describe('MatchController history summaries', () => {
|
||||
it('only attaches the page results when requested', async () => {
|
||||
const communityId = new mongoose.Types.ObjectId();
|
||||
const match = { _id: new mongoose.Types.ObjectId() };
|
||||
const summary = { _id: match._id.toString() };
|
||||
const historyResult = { type: 'score', teamAWins: 2, teamBWins: 1 };
|
||||
const matchService = {
|
||||
listPage: jest
|
||||
.fn()
|
||||
.mockResolvedValue({ matches: [match], total: 1, page: 1, limit: 10 }),
|
||||
serialize: jest.fn().mockReturnValue(summary),
|
||||
getHistoryResults: jest
|
||||
.fn()
|
||||
.mockResolvedValue(new Map([[summary._id, historyResult]])),
|
||||
};
|
||||
const controller = new MatchController(matchService as never);
|
||||
|
||||
await expect(
|
||||
controller.listMatches(undefined, communityId),
|
||||
).resolves.toMatchObject({
|
||||
matches: [summary],
|
||||
});
|
||||
expect(matchService.getHistoryResults).not.toHaveBeenCalled();
|
||||
|
||||
await expect(
|
||||
controller.listMatches(
|
||||
undefined,
|
||||
communityId,
|
||||
undefined,
|
||||
'10',
|
||||
'1',
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
'desc',
|
||||
'true',
|
||||
),
|
||||
).resolves.toMatchObject({ matches: [{ ...summary, historyResult }] });
|
||||
expect(matchService.getHistoryResults).toHaveBeenCalledWith(communityId, [
|
||||
match,
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('MatchController participant access', () => {
|
||||
function createController() {
|
||||
const joinedMatch = { _id: new mongoose.Types.ObjectId() };
|
||||
|
||||
@@ -82,6 +82,7 @@ export class MatchController {
|
||||
@Query('scheduledFrom') scheduledFrom?: string,
|
||||
@Query('scheduledTo') scheduledTo?: string,
|
||||
@Query('sort') sort?: 'asc' | 'desc',
|
||||
@Query('includeResults') includeResults?: string,
|
||||
): Promise<MatchListResponse> {
|
||||
const result = await this.matchService.listPage({
|
||||
communityId,
|
||||
@@ -93,10 +94,14 @@ export class MatchController {
|
||||
scheduledTo: this.toOptionalDate(scheduledTo),
|
||||
sort,
|
||||
});
|
||||
const historyResults =
|
||||
includeResults === 'true'
|
||||
? await this.matchService.getHistoryResults(communityId, result.matches)
|
||||
: undefined;
|
||||
return {
|
||||
...result,
|
||||
matches: result.matches.map((match) =>
|
||||
this.matchService.serialize(match, {
|
||||
matches: result.matches.map((match) => {
|
||||
const summary = this.matchService.serialize(match, {
|
||||
...(currentUser
|
||||
? {
|
||||
joined: match.participants.some((participant) =>
|
||||
@@ -104,8 +109,10 @@ export class MatchController {
|
||||
),
|
||||
}
|
||||
: {}),
|
||||
}),
|
||||
),
|
||||
});
|
||||
const historyResult = historyResults?.get(summary._id);
|
||||
return historyResult ? { ...summary, historyResult } : summary;
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { MatchHistoryResult } from '@lolympus/contracts';
|
||||
import {
|
||||
BadRequestException,
|
||||
ConflictException,
|
||||
@@ -20,6 +21,10 @@ import {
|
||||
} from '../global/database/schema';
|
||||
import { DEFAULT_TOURNAMENT_GAME_COUNT } from '../tournament-code/tournament-code.constants';
|
||||
import { TournamentCodeService } from '../tournament-code/tournament-code.service';
|
||||
import {
|
||||
summarizeMatchHistoryResult,
|
||||
type HistoryCompetition,
|
||||
} from './match-history-result';
|
||||
import { presentPublicMatch } from './match-public.presenter';
|
||||
|
||||
const MATCH_SHORT_CODE_ALPHABET = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789';
|
||||
@@ -170,6 +175,47 @@ export class MatchService {
|
||||
};
|
||||
}
|
||||
|
||||
public async getHistoryResults(
|
||||
communityId: mongoose.Types.ObjectId,
|
||||
matches: readonly MatchDocument[],
|
||||
): Promise<Map<string, MatchHistoryResult>> {
|
||||
const finished = matches.filter((match) => match.status === 'finished');
|
||||
const competitionIds = finished.flatMap((match) =>
|
||||
match.competitionId ? [match.competitionId] : [],
|
||||
);
|
||||
const competitions = new Map<string, HistoryCompetition>();
|
||||
if (competitionIds.length > 0) {
|
||||
const CompetitionModel =
|
||||
await this.connectionService.getModel('competition');
|
||||
const completed = await CompetitionModel.find({
|
||||
_id: { $in: competitionIds },
|
||||
communityId,
|
||||
phase: 'completed',
|
||||
})
|
||||
.select({
|
||||
matchId: 1,
|
||||
'teams.teamId': 1,
|
||||
'teams.name': 1,
|
||||
'teams.displayOrder': 1,
|
||||
'projection.outcome': 1,
|
||||
'projection.series': 1,
|
||||
})
|
||||
.lean()
|
||||
.exec();
|
||||
for (const competition of completed) {
|
||||
competitions.set(competition.matchId.toString(), competition);
|
||||
}
|
||||
}
|
||||
|
||||
const results = new Map<string, MatchHistoryResult>();
|
||||
for (const match of finished) {
|
||||
const id = match._id.toString();
|
||||
const result = summarizeMatchHistoryResult(match, competitions.get(id));
|
||||
if (result) results.set(id, result);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
public async ensureShortCode(match: MatchDocument): Promise<MatchDocument> {
|
||||
if (match.shortCode) return match;
|
||||
|
||||
|
||||
+74
-53
@@ -1,5 +1,5 @@
|
||||
import { BrowserRouter, Link, NavLink, Route, Routes } from "react-router";
|
||||
import type { ReactNode } from "react";
|
||||
import { lazy, Suspense, type ReactNode } from "react";
|
||||
import { useMsal } from "@azure/msal-react";
|
||||
import { LogOut, Moon, Sun } from "lucide-react";
|
||||
import DevAuthSwitcher from "./components/DevAuthSwitcher";
|
||||
@@ -22,22 +22,15 @@ import MatchAdminPage from "./pages/admin/MatchAdminPage";
|
||||
import TournamentCodesPage from "./pages/admin/TournamentCodesPage";
|
||||
import { PlainPage, Tooltip, pageWidthClass } from "./ui";
|
||||
|
||||
const NAV_ICON_BUTTON_CLASS =
|
||||
"grid size-9 place-items-center rounded-field text-on-ink-muted transition-colors hover:bg-white/10 hover:text-on-ink";
|
||||
const InternalStatsPreview = import.meta.env.DEV
|
||||
? lazy(() => import("./preview/InternalStatsPreview"))
|
||||
: null;
|
||||
const MatchFlowsPreview = import.meta.env.DEV
|
||||
? lazy(() => import("./preview/MatchFlowsPreview"))
|
||||
: null;
|
||||
|
||||
function BrandMark() {
|
||||
return (
|
||||
<svg viewBox="0 0 28 28" className="size-7 shrink-0" aria-hidden="true">
|
||||
<rect width="28" height="28" rx="8" fill="var(--color-brand-coral)" />
|
||||
<path
|
||||
d="M5.5 20.5 11 10l3.4 5.6L16.6 12l5.9 8.5Z"
|
||||
fill="#2a1704"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
<circle cx="19.2" cy="8.4" r="1.9" fill="#2a1704" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
const NAV_ICON_BUTTON_CLASS =
|
||||
"grid size-9 shrink-0 place-items-center rounded-field text-content-muted transition-colors hover:bg-sunken-strong hover:text-content";
|
||||
|
||||
function MsalHeaderActions() {
|
||||
const { accounts, instance } = useMsal();
|
||||
@@ -46,7 +39,7 @@ function MsalHeaderActions() {
|
||||
if (!account) {
|
||||
return (
|
||||
<Link
|
||||
className="inline-flex h-9 items-center rounded-field bg-white/10 px-3.5 text-[13px] font-semibold text-on-ink transition-colors hover:bg-white/20"
|
||||
className="inline-flex h-9 items-center whitespace-nowrap rounded-full border border-line-strong px-2.5 text-[13px] font-semibold text-content transition-colors hover:bg-sunken sm:px-3.5"
|
||||
to="/login"
|
||||
>
|
||||
로그인
|
||||
@@ -58,7 +51,7 @@ function MsalHeaderActions() {
|
||||
|
||||
return (
|
||||
<div className="flex min-w-0 items-center gap-1">
|
||||
<span className="hidden max-w-40 truncate text-[13px] font-medium text-on-ink-muted sm:block">
|
||||
<span className="hidden max-w-40 truncate text-[13px] font-medium text-content-muted sm:block">
|
||||
{name}
|
||||
</span>
|
||||
<Tooltip content="로그아웃" placement="below">
|
||||
@@ -110,10 +103,10 @@ function PrimaryNavLink({
|
||||
to={to}
|
||||
end={end}
|
||||
className={({ isActive }) =>
|
||||
`relative inline-flex h-14 items-center px-3 text-sm font-semibold transition-colors ${
|
||||
`relative inline-flex h-full items-center whitespace-nowrap px-3 text-sm font-semibold transition-colors ${
|
||||
isActive
|
||||
? "text-on-ink after:absolute after:inset-x-3 after:bottom-0 after:h-[3px] after:rounded-t-full after:bg-brand-coral"
|
||||
: "text-on-ink-muted hover:text-on-ink"
|
||||
? "text-content after:absolute after:inset-x-3 after:bottom-0 after:h-0.5 after:rounded-t-full after:bg-content"
|
||||
: "text-content-muted hover:text-content"
|
||||
}`
|
||||
}
|
||||
>
|
||||
@@ -132,45 +125,51 @@ function AppHeader() {
|
||||
const canManage = role === "owner" || role === "admin";
|
||||
|
||||
return (
|
||||
<header className="sticky top-0 z-50 border-b border-ink-line bg-ink">
|
||||
<header className="sticky top-0 z-50 border-b border-line bg-card dark:bg-ink">
|
||||
<div
|
||||
className={`${pageWidthClass("xl")} flex h-14 items-center justify-between gap-3`}
|
||||
className={`${pageWidthClass("xl")} grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] grid-rows-[var(--app-header-row-height)_var(--app-header-nav-height)] items-center sm:gap-x-3`}
|
||||
>
|
||||
<div className="flex min-w-0 items-center gap-2 sm:gap-5">
|
||||
<Link
|
||||
className="flex shrink-0 items-center gap-2.5 text-on-ink"
|
||||
to="/"
|
||||
aria-label={`${communityLabel} 홈`}
|
||||
<Link
|
||||
className="col-start-2 row-start-1 flex h-full items-center text-content"
|
||||
to="/"
|
||||
aria-label={`${communityLabel} 홈`}
|
||||
>
|
||||
<span className="max-w-24 truncate text-[17px] font-extrabold tracking-[-0.02em] sm:max-w-40">
|
||||
{communityLabel}
|
||||
</span>
|
||||
</Link>
|
||||
{DEFAULT_COMMUNITY_ID && (
|
||||
<nav
|
||||
aria-label="주 메뉴"
|
||||
className="col-span-3 row-start-2 flex h-full items-center justify-center sm:col-span-1 sm:col-start-1 sm:row-start-1 sm:justify-start"
|
||||
>
|
||||
<BrandMark />
|
||||
<span className="hidden text-[17px] font-extrabold tracking-[-0.02em] sm:block">
|
||||
{communityLabel}
|
||||
</span>
|
||||
</Link>
|
||||
{DEFAULT_COMMUNITY_ID && (
|
||||
<nav aria-label="주 메뉴" className="flex items-center">
|
||||
<PrimaryNavLink to="/" end>
|
||||
내전
|
||||
</PrimaryNavLink>
|
||||
<PrimaryNavLink to="/" end>
|
||||
내전
|
||||
</PrimaryNavLink>
|
||||
<PrimaryNavLink
|
||||
to={`/communities/${DEFAULT_COMMUNITY_ID}/internal-stats`}
|
||||
>
|
||||
전적
|
||||
</PrimaryNavLink>
|
||||
{canManage && (
|
||||
<PrimaryNavLink
|
||||
to={`/communities/${DEFAULT_COMMUNITY_ID}/internal-stats`}
|
||||
to={`/admin/communities/${DEFAULT_COMMUNITY_ID}/matches`}
|
||||
>
|
||||
전적
|
||||
운영
|
||||
</PrimaryNavLink>
|
||||
{canManage && (
|
||||
<PrimaryNavLink
|
||||
to={`/admin/communities/${DEFAULT_COMMUNITY_ID}/matches`}
|
||||
>
|
||||
운영
|
||||
</PrimaryNavLink>
|
||||
)}
|
||||
</nav>
|
||||
)}
|
||||
</nav>
|
||||
)}
|
||||
<div className="contents sm:col-start-3 sm:row-start-1 sm:flex sm:min-w-0 sm:items-center sm:justify-self-end sm:gap-1">
|
||||
<div className="col-start-1 row-start-1 justify-self-start sm:shrink-0">
|
||||
<ThemeToggle />
|
||||
</div>
|
||||
{isMsalConfigured && (
|
||||
<div className="col-start-3 row-start-1 min-w-0 justify-self-end">
|
||||
<MsalHeaderActions />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex shrink-0 items-center gap-1">
|
||||
<ThemeToggle />
|
||||
{isMsalConfigured && <MsalHeaderActions />}
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
@@ -247,7 +246,9 @@ function NotFoundPage() {
|
||||
function App() {
|
||||
return (
|
||||
<BrowserRouter>
|
||||
<div className="flex min-h-screen flex-col bg-body">
|
||||
<div
|
||||
className={`lts-app-shell flex min-h-screen flex-col bg-body ${DEFAULT_COMMUNITY_ID ? "max-sm:[--app-header-nav-height:2.5rem]" : ""}`}
|
||||
>
|
||||
<AppHeader />
|
||||
|
||||
<div className="flex-1">
|
||||
@@ -270,6 +271,26 @@ function App() {
|
||||
path="/communities/:cid/internal-stats"
|
||||
element={<CommunityInternalStatsPage />}
|
||||
/>
|
||||
{InternalStatsPreview && (
|
||||
<Route
|
||||
path="/preview/internal-stats"
|
||||
element={
|
||||
<Suspense fallback={<PlainPage>전적 목업을 불러오는 중</PlainPage>}>
|
||||
<InternalStatsPreview />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{MatchFlowsPreview && (
|
||||
<Route
|
||||
path="/preview/match-flows"
|
||||
element={
|
||||
<Suspense fallback={<PlainPage>내전 목업을 불러오는 중</PlainPage>}>
|
||||
<MatchFlowsPreview />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
<Route
|
||||
path="/communities/:cid/internal-stats/match/:matchId"
|
||||
element={<InternalMatchDetailPage />}
|
||||
|
||||
@@ -72,6 +72,10 @@ interface MatchesQueryOptions {
|
||||
sort?: 'asc' | 'desc';
|
||||
}
|
||||
|
||||
interface MatchesPageQueryOptions extends MatchesQueryOptions {
|
||||
includeResults?: boolean;
|
||||
}
|
||||
|
||||
export interface UserHistoryFilters {
|
||||
queueGroup?: RiotQueueGroup;
|
||||
rank?: RiotRankFilter;
|
||||
@@ -89,7 +93,7 @@ export interface CommunityInternalStatsFilters {
|
||||
|
||||
function createMatchesPath(
|
||||
communityId: string,
|
||||
options: MatchesQueryOptions = {},
|
||||
options: MatchesPageQueryOptions = {},
|
||||
) {
|
||||
const searchParams = new URLSearchParams();
|
||||
if (options.status) searchParams.set('status', options.status);
|
||||
@@ -100,6 +104,7 @@ function createMatchesPath(
|
||||
searchParams.set('scheduledFrom', options.scheduledFrom);
|
||||
if (options.scheduledTo) searchParams.set('scheduledTo', options.scheduledTo);
|
||||
if (options.sort) searchParams.set('sort', options.sort);
|
||||
if (options.includeResults) searchParams.set('includeResults', 'true');
|
||||
|
||||
const queryString = searchParams.toString();
|
||||
return `/communities/${communityId}/matches${queryString ? `?${queryString}` : ''}`;
|
||||
@@ -183,7 +188,7 @@ export function useMatches(
|
||||
}
|
||||
|
||||
export function useMatchesPage(
|
||||
options: MatchesQueryOptions,
|
||||
options: MatchesPageQueryOptions,
|
||||
communityId = DEFAULT_COMMUNITY_ID,
|
||||
) {
|
||||
const authScope = useOptionalAuthQueryScope();
|
||||
@@ -200,6 +205,7 @@ export function useMatchesPage(
|
||||
options.scheduledFrom ?? null,
|
||||
options.scheduledTo ?? null,
|
||||
options.sort ?? null,
|
||||
options.includeResults ?? false,
|
||||
],
|
||||
queryFn: () =>
|
||||
authScope.fetch<MatchListResponse>(
|
||||
|
||||
@@ -37,14 +37,14 @@ export function AdminPage({
|
||||
<PageBody width="xl">
|
||||
<nav
|
||||
aria-label="운영 메뉴"
|
||||
className="lts-panel no-scrollbar mb-5 flex gap-1 overflow-x-auto p-1"
|
||||
className="lts-panel mb-5 grid grid-cols-2 gap-1 p-1 sm:flex sm:flex-wrap"
|
||||
>
|
||||
{ADMIN_SECTIONS.map((section) => (
|
||||
<NavLink
|
||||
key={section.path}
|
||||
to={`/admin/communities/${communityId}/${section.path}`}
|
||||
className={({ isActive }) =>
|
||||
`flex h-10 shrink-0 items-center rounded-[10px] px-4 text-sm font-bold transition-colors ${
|
||||
`flex min-h-10 items-center justify-center rounded-[10px] px-2 py-2 text-center text-xs font-bold transition-colors sm:px-4 sm:text-sm ${
|
||||
isActive
|
||||
? "bg-secondary text-secondary-content dark:bg-white dark:text-[#14161b]"
|
||||
: "text-content-muted hover:bg-sunken hover:text-content"
|
||||
|
||||
@@ -16,9 +16,11 @@ import { SeriesScoreCard } from "./SeriesScoreCard";
|
||||
export function CompetitionResults({
|
||||
competition,
|
||||
view = "all",
|
||||
showTeamLink = true,
|
||||
}: {
|
||||
competition: CompetitionDetailResponse;
|
||||
view?: "all" | "bracket" | "games";
|
||||
showTeamLink?: boolean;
|
||||
}) {
|
||||
const { projection } = competition;
|
||||
const teamById = new Map(
|
||||
@@ -59,24 +61,18 @@ export function CompetitionResults({
|
||||
<section className="mb-6 space-y-4" aria-labelledby="competition-heading">
|
||||
<header className="flex flex-wrap items-end justify-between gap-3 border-b border-base-content/10 pb-3">
|
||||
<div>
|
||||
<p className="text-[11px] font-bold uppercase tracking-wider text-base-content/35">
|
||||
Competition
|
||||
</p>
|
||||
<h2 id="competition-heading" className="mt-1 text-lg font-bold">
|
||||
공식 경기 일정·결과
|
||||
대진표·순위
|
||||
</h2>
|
||||
</div>
|
||||
<div className="flex items-center gap-3">
|
||||
<span className="text-xs text-base-content/40">
|
||||
revision {competition.revision}
|
||||
</span>
|
||||
{showTeamLink && (
|
||||
<Link
|
||||
to={`/match/${competition.matchId}/team`}
|
||||
className="border border-base-content/10 px-2.5 py-1.5 text-xs font-bold text-base-content/55 hover:border-primary/30 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary"
|
||||
>
|
||||
팀 진행
|
||||
팀 경기 현황
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
</header>
|
||||
|
||||
{projection.outcome && (
|
||||
@@ -136,8 +132,8 @@ function GenericRoundGrid({
|
||||
teamById: Map<TeamId, CompetitionDetailResponse["teams"][number]>;
|
||||
}) {
|
||||
return (
|
||||
<div className="overflow-x-auto pb-2">
|
||||
<div className="grid min-w-max auto-cols-[17rem] grid-flow-col gap-4">
|
||||
<div className="pb-2 md:overflow-x-auto">
|
||||
<div className="grid gap-4 md:min-w-max md:auto-cols-[17rem] md:grid-flow-col">
|
||||
{rounds.map((round) => (
|
||||
<RoundColumn
|
||||
key={`${round.stage}:${round.roundNumber ?? 0}`}
|
||||
|
||||
@@ -23,6 +23,10 @@ export function DoubleEliminationMobileBracket({
|
||||
projection.series.map((series) => [series.seriesId, series]),
|
||||
);
|
||||
const nodeById = new Map(layout.nodes.map((node) => [node.seriesId, node]));
|
||||
const isCurrentRound = (seriesIds: readonly SeriesId[]) => seriesIds.some((seriesId) => {
|
||||
const status = seriesById.get(seriesId)?.status;
|
||||
return status === "ready" || status === "in-progress";
|
||||
});
|
||||
const sections = [
|
||||
{
|
||||
key: "upper",
|
||||
@@ -71,20 +75,20 @@ export function DoubleEliminationMobileBracket({
|
||||
{section.description}
|
||||
</p>
|
||||
</div>
|
||||
<div className="space-y-5">
|
||||
<div className="space-y-2">
|
||||
{groups.map((group) => (
|
||||
<section
|
||||
<details
|
||||
key={`${group.stage}:${group.roundNumber}`}
|
||||
aria-labelledby={`${bracketId}-${group.stage}-${group.roundNumber}`}
|
||||
open={groups.length === 1 || isCurrentRound(group.seriesIds)}
|
||||
className="group lts-panel"
|
||||
>
|
||||
<h4
|
||||
id={`${bracketId}-${group.stage}-${group.roundNumber}`}
|
||||
className="mb-2 text-xs font-bold text-content-muted"
|
||||
aria-label={group.accessibleLabel}
|
||||
<summary
|
||||
className="cursor-pointer px-3 py-3 text-sm font-semibold hover:bg-sunken"
|
||||
>
|
||||
{group.label}
|
||||
</h4>
|
||||
<div className="space-y-3">
|
||||
{group.accessibleLabel}
|
||||
<span className="ml-2 text-xs font-medium text-content-muted">{group.seriesIds.length}경기</span>
|
||||
</summary>
|
||||
<div className="space-y-3 border-t border-line p-3">
|
||||
{group.seriesIds.map((seriesId) => {
|
||||
const series = seriesById.get(seriesId);
|
||||
if (!series) return null;
|
||||
@@ -113,7 +117,7 @@ export function DoubleEliminationMobileBracket({
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</section>
|
||||
</details>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -55,7 +55,7 @@ export function MatchDetailTabBar({
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="lts-panel sticky top-[60px] z-40 p-1">
|
||||
<div className="lts-panel sticky top-(--app-header-height) z-40 p-1">
|
||||
<div
|
||||
className="no-scrollbar flex gap-1 overflow-x-auto"
|
||||
role="tablist"
|
||||
|
||||
@@ -99,19 +99,10 @@ export function TeamTournamentCodes({
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<section
|
||||
className="border-t border-base-content/10"
|
||||
aria-label={`${seriesLabel} 토너먼트 코드`}
|
||||
>
|
||||
<div className="flex flex-wrap items-baseline justify-between gap-2 bg-base-200/25 px-4 py-2.5 sm:px-5">
|
||||
<h4 className="text-sm font-bold text-base-content">게임 코드</h4>
|
||||
<p className="text-xs text-content-muted">
|
||||
세트에 맞는 코드를 복사해 클라이언트에 입력하세요.
|
||||
</p>
|
||||
</div>
|
||||
<ol className="divide-y divide-base-content/10">
|
||||
{assignments.map((assignment) => {
|
||||
const nextAssignment = assignments.find((assignment) => assignment.state !== "used") ?? assignments[0];
|
||||
const otherAssignments = assignments.filter((assignment) => assignment !== nextAssignment);
|
||||
|
||||
function renderAssignment(assignment: TeamTournamentCodeView) {
|
||||
const slotId = String(assignment.gameSlotId);
|
||||
const presentation = getTournamentCodePresentation(assignment, now);
|
||||
const isCopying = copyingSlotId === slotId;
|
||||
@@ -127,7 +118,7 @@ export function TeamTournamentCodes({
|
||||
{assignment.ordinal}세트
|
||||
</p>
|
||||
<p className="mt-0.5 text-xs text-content-muted">
|
||||
전체 Game {assignment.displayNumber}
|
||||
전체 {assignment.displayNumber}경기
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -139,7 +130,7 @@ export function TeamTournamentCodes({
|
||||
/>
|
||||
) : (
|
||||
<p className="text-sm font-bold text-content-muted">
|
||||
발급 대기 중
|
||||
발급되면 이곳에서 복사할 수 있습니다.
|
||||
</p>
|
||||
)}
|
||||
{assignment.code &&
|
||||
@@ -199,8 +190,29 @@ export function TeamTournamentCodes({
|
||||
</div>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
}
|
||||
|
||||
return (
|
||||
<section
|
||||
className="border-t border-base-content/10 bg-sunken/50"
|
||||
aria-label={`${seriesLabel} 토너먼트 코드`}
|
||||
>
|
||||
<div className="px-4 pt-3 sm:px-5">
|
||||
<h4 className="text-sm font-bold text-base-content">토너먼트 코드</h4>
|
||||
</div>
|
||||
<ol>
|
||||
{renderAssignment(nextAssignment)}
|
||||
</ol>
|
||||
{otherAssignments.length > 0 && (
|
||||
<details className="border-t border-line">
|
||||
<summary className="cursor-pointer px-4 py-3 text-sm font-semibold hover:bg-sunken sm:px-5">
|
||||
다른 세트 코드 · {otherAssignments.length}개
|
||||
</summary>
|
||||
<ol className="divide-y divide-line border-t border-line">
|
||||
{otherAssignments.map(renderAssignment)}
|
||||
</ol>
|
||||
</details>
|
||||
)}
|
||||
|
||||
{feedback && (
|
||||
<p
|
||||
|
||||
+11
-1
@@ -76,7 +76,7 @@
|
||||
--color-icon-accent: var(--color-text-accent);
|
||||
|
||||
/* ── LOLYMPUS 전용 역할 ── */
|
||||
/* 상단 내비게이션과 페이지 머리 띠. 두 테마 모두 짙은 잉크색이다. */
|
||||
/* 짙은 페이지 머리 띠와 다크 모드 상단 내비게이션. */
|
||||
--lts-ink: light-dark(var(--color-brand-ink), #0e1014);
|
||||
--lts-ink-raised: light-dark(#2e323d, #1a1d24);
|
||||
--lts-ink-line: #ffffff1f;
|
||||
@@ -291,6 +291,16 @@
|
||||
}
|
||||
|
||||
@layer components {
|
||||
.lts-app-shell {
|
||||
--app-header-row-height: 3.5rem;
|
||||
--app-header-nav-height: 0px;
|
||||
--app-header-height: calc(var(--app-header-row-height) + var(--app-header-nav-height) + 1px);
|
||||
}
|
||||
|
||||
:root:not([data-theme="dark"]) .lts-app-shell:has(main.lts-overview) {
|
||||
--color-background-body: #f9f9f9;
|
||||
}
|
||||
|
||||
/* 흰 카드. 페이지의 기본 데이터 그릇이다. */
|
||||
.lts-panel {
|
||||
background: var(--color-background-card);
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
import type {
|
||||
CompetitionDetailResponse,
|
||||
CompetitionGameView,
|
||||
SeriesProjection,
|
||||
} from '@lolympus/contracts';
|
||||
import type { ApiInternalMatchDetailResponse } from '../api/types';
|
||||
import { bracketRoundAccessibleLabel } from '../components/competition/double-elimination-bracket-layout';
|
||||
import { teamIndexLabel } from './league';
|
||||
|
||||
type RecordedGame = ApiInternalMatchDetailResponse['games'][number];
|
||||
|
||||
export interface RecordedSet {
|
||||
game: RecordedGame;
|
||||
official?: CompetitionGameView;
|
||||
}
|
||||
|
||||
export interface RecordedSeries {
|
||||
id: string;
|
||||
label: string;
|
||||
series?: SeriesProjection;
|
||||
sets: RecordedSet[];
|
||||
}
|
||||
|
||||
export function groupRecordedSets(
|
||||
detail: ApiInternalMatchDetailResponse,
|
||||
competition?: CompetitionDetailResponse,
|
||||
) {
|
||||
const projection = competition?.projection;
|
||||
const officialByMatchId = new Map<string, CompetitionGameView>();
|
||||
for (const game of projection?.games ?? []) {
|
||||
if (game.evidence.type === 'riot')
|
||||
officialByMatchId.set(game.evidence.riotMatchId, game);
|
||||
}
|
||||
const seriesById = new Map(
|
||||
projection?.series.map((series) => [series.seriesId, series]),
|
||||
);
|
||||
const groups = new Map<string, RecordedSeries>();
|
||||
|
||||
for (const game of detail.games) {
|
||||
const official = officialByMatchId.get(game.riotMatchId);
|
||||
const series = official && seriesById.get(official.seriesId);
|
||||
const indexes = [
|
||||
...new Set(game.teams.map(({ teamIndex }) => teamIndex)),
|
||||
].sort((a, b) => a - b);
|
||||
const names = indexes.map((index) =>
|
||||
teamIndexLabel(
|
||||
index,
|
||||
detail.match.teams.find((team) => team.teamIndex === index)?.name,
|
||||
),
|
||||
);
|
||||
const id =
|
||||
series?.seriesId ??
|
||||
(indexes.length === 2
|
||||
? `teams:${indexes.join('-')}`
|
||||
: `game:${game.gameNumber}`);
|
||||
const matchup = names.join(' vs ') || `${game.gameNumber}세트`;
|
||||
const label =
|
||||
series && series.stage.type !== 'pair'
|
||||
? `${bracketRoundAccessibleLabel(series.stage.type, series.stage.roundNumber)} · ${matchup}`
|
||||
: matchup;
|
||||
const group = groups.get(id) ?? { id, label, series, sets: [] };
|
||||
group.sets.push({ game, official });
|
||||
groups.set(id, group);
|
||||
}
|
||||
|
||||
for (const group of groups.values()) {
|
||||
group.sets.sort(
|
||||
(left, right) =>
|
||||
(left.official?.ordinal ?? left.game.gameNumber) -
|
||||
(right.official?.ordinal ?? right.game.gameNumber),
|
||||
);
|
||||
}
|
||||
return [...groups.values()];
|
||||
}
|
||||
@@ -1263,9 +1263,7 @@ function PlayerSpotlight({
|
||||
);
|
||||
}
|
||||
|
||||
// serverTimeOffsetMs는 5초마다 갱신되지만 비교자에 넣지 않는다. deadline이 바뀌는
|
||||
// 순간(phase/currentBid 변화)에 항상 함께 리렌더되어 최신 offset이 반영되므로,
|
||||
// 굳이 5초마다 리렌더할 필요가 없다.
|
||||
// 서버 시간 차이만 바뀐 폴링에서는 카드를 다시 렌더하지 않는다.
|
||||
const MemoPlayerSpotlight = memo(
|
||||
PlayerSpotlight,
|
||||
(previous, next) =>
|
||||
@@ -1277,6 +1275,8 @@ const MemoPlayerSpotlight = memo(
|
||||
next.state.currentPlayer,
|
||||
) &&
|
||||
previous.state.phase === next.state.phase &&
|
||||
previous.state.deadline === next.state.deadline &&
|
||||
previous.state.maxTimer === next.state.maxTimer &&
|
||||
previous.state.currentBid === next.state.currentBid &&
|
||||
previous.state.currentBidder?.teamIndex ===
|
||||
next.state.currentBidder?.teamIndex &&
|
||||
@@ -1293,6 +1293,8 @@ function PlayerProfileDetails({
|
||||
bidStatus?: React.ReactNode;
|
||||
}) {
|
||||
const { data: ddragon } = useDdragonManifest();
|
||||
const [historyPlayerId, setHistoryPlayerId] = useState<string>();
|
||||
const isHistoryOpen = historyPlayerId === player.userId;
|
||||
const [tabState, setTabState] = useState<{
|
||||
playerId: string;
|
||||
tab: PlayerProfileTab;
|
||||
@@ -1311,7 +1313,7 @@ function PlayerProfileDetails({
|
||||
player.userId,
|
||||
{ queueGroup: "internal" },
|
||||
DEFAULT_COMMUNITY_ID,
|
||||
activeTab === "internal",
|
||||
isHistoryOpen && activeTab === "internal",
|
||||
);
|
||||
const internalFirstPage = internalHistoryQuery.data?.pages[0];
|
||||
const tierHistory =
|
||||
@@ -1384,7 +1386,15 @@ function PlayerProfileDetails({
|
||||
</div>
|
||||
|
||||
{bidStatus}
|
||||
{import.meta.env.DEV && bidStatus ? (
|
||||
<details
|
||||
key={player.userId}
|
||||
className="border-t border-line"
|
||||
onToggle={(event) => setHistoryPlayerId(event.currentTarget.open ? player.userId : undefined)}
|
||||
>
|
||||
<summary className="cursor-pointer px-4 py-3 text-sm font-semibold text-content hover:bg-sunken">
|
||||
선수 전적 보기
|
||||
</summary>
|
||||
{isHistoryOpen && (bidStatus ? (
|
||||
<AuctionAstryxTabs<PlayerProfileTab>
|
||||
label="선수 전적 종류"
|
||||
value={activeTab}
|
||||
@@ -1419,7 +1429,8 @@ function PlayerProfileDetails({
|
||||
</div>
|
||||
<div className={historyPanelClass}>{historyPanel}</div>
|
||||
</>
|
||||
)}
|
||||
))}
|
||||
</details>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1624,7 +1635,7 @@ function PlayerBidStatus({
|
||||
<div className="flex items-center justify-between px-4 py-3">
|
||||
<div className="flex flex-col gap-0.5">
|
||||
<span className="text-xs text-base-content/30 uppercase tracking-wider font-semibold">
|
||||
{isSold ? "낙찰가" : "현재 입찰가"}
|
||||
{isSold ? "낙찰가" : "현재 최고가"}
|
||||
</span>
|
||||
<span
|
||||
className={`text-xs font-bold ${statusTone}`}
|
||||
@@ -1724,18 +1735,10 @@ function BidControls({
|
||||
|
||||
if (state.phase !== "bidding") return null;
|
||||
|
||||
if (!activeTeam) {
|
||||
return (
|
||||
<div className="border border-base-content/10 bg-base-100 px-4 py-3 text-sm text-base-content/40">
|
||||
관전자 모드입니다. 우측 상단에서 조작자 역할을 선택하면 입찰할 수
|
||||
있습니다.
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if (!activeTeam) return null;
|
||||
|
||||
// 경매는 "현재가보다 얼마 더?"로 생각하므로 절대값이 아니라 증분 프리셋으로 제공한다.
|
||||
const bidIncrements = [10, 50, 100, 200];
|
||||
const teamTone = teamIndexColorClasses(activeTeam.teamIndex);
|
||||
const handlePlaceBid = () => onBid(activeTeam.teamIndex, effectiveBidAmount);
|
||||
const isBidDisabled =
|
||||
isBidPending ||
|
||||
@@ -1751,15 +1754,14 @@ function BidControls({
|
||||
? "입찰 마감 확인 중"
|
||||
: !canAffordNextBid
|
||||
? `입찰 불가 (다음 ${formatPoints(minBid)}P · 최대 ${formatPoints(maxBid)}P)`
|
||||
: `${teamIndexLabel(activeTeam.teamIndex, activeTeam.name)} 입찰 (${formatPoints(effectiveBidAmount)}P)`;
|
||||
const bidButtonToneClassName = `${teamTone.border} ${teamTone.bg} ${teamTone.text} hover:bg-base-content/5`;
|
||||
: `${formatPoints(effectiveBidAmount)}P 입찰`;
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="border border-base-content/10 bg-base-100 p-4">
|
||||
<div className="lts-panel p-4" aria-label={`${teamIndexLabel(activeTeam.teamIndex, activeTeam.name)} 입찰`}>
|
||||
<div className="mb-3 grid grid-cols-2 gap-2 text-xs sm:grid-cols-3">
|
||||
<div className="border border-base-content/10 px-2.5 py-2">
|
||||
<div className="text-base-content/30">보유</div>
|
||||
<div className="text-content-muted">잔여 포인트</div>
|
||||
<div className="mt-0.5 font-bold tabular-nums text-base-content">
|
||||
{formatPoints(activeTeam.points)}P
|
||||
</div>
|
||||
@@ -1816,6 +1818,7 @@ function BidControls({
|
||||
{/* 타이핑 중에는 클램프하지 않고(자릿수 입력 방해 방지) blur 시점에만 보정한다. */}
|
||||
<input
|
||||
type="number"
|
||||
aria-label="입찰 포인트"
|
||||
value={bidAmount}
|
||||
onChange={(event) => setBidAmount(Number(event.target.value))}
|
||||
onBlur={(event) =>
|
||||
@@ -1832,24 +1835,26 @@ function BidControls({
|
||||
className="lts-input w-24 tabular-nums text-right"
|
||||
/>
|
||||
</div>
|
||||
<button
|
||||
<Btn
|
||||
onClick={handlePlaceBid}
|
||||
disabled={isBidDisabled}
|
||||
className={`w-full py-2 text-xs font-bold uppercase tracking-wide border transition-colors disabled:opacity-30 disabled:cursor-not-allowed ${bidButtonToneClassName}`}
|
||||
variant="primary"
|
||||
className="w-full min-h-11"
|
||||
>
|
||||
{bidButtonLabel}
|
||||
</button>
|
||||
</Btn>
|
||||
</div>
|
||||
|
||||
{/* 모바일 sticky 입찰 바: 스크롤 위치와 무관하게 항상 입찰 가능하게 한다. */}
|
||||
<div className="fixed inset-x-0 bottom-0 z-40 border-t border-base-content/10 bg-base-100/95 px-4 pt-3 pb-[calc(env(safe-area-inset-bottom)+0.75rem)] backdrop-blur xl:hidden">
|
||||
<button
|
||||
<Btn
|
||||
onClick={handlePlaceBid}
|
||||
disabled={isBidDisabled}
|
||||
className={`w-full py-3 text-sm font-bold uppercase tracking-wide border transition-colors disabled:opacity-30 disabled:cursor-not-allowed ${bidButtonToneClassName}`}
|
||||
variant="primary"
|
||||
className="w-full min-h-11"
|
||||
>
|
||||
{bidButtonLabel}
|
||||
</button>
|
||||
</Btn>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
@@ -1867,12 +1872,13 @@ function BidLog({ bids }: { bids: AuctionStateView["bids"] }) {
|
||||
if (bids.length === 0) return null;
|
||||
|
||||
return (
|
||||
<div className="border border-base-content/10 bg-base-100 overflow-hidden">
|
||||
<div className="px-3 py-1.5 border-b border-base-content/8 bg-base-200/40">
|
||||
<span className="text-xs font-bold uppercase tracking-wider text-base-content/30">
|
||||
입찰 기록
|
||||
</span>
|
||||
</div>
|
||||
<details className="lts-panel overflow-hidden" onToggle={(event) => {
|
||||
const list = scrollRef.current;
|
||||
if (event.currentTarget.open && list) list.scrollTop = list.scrollHeight;
|
||||
}}>
|
||||
<summary className="cursor-pointer px-4 py-3 text-sm font-semibold hover:bg-sunken">
|
||||
입찰 기록 · {bids.length}건
|
||||
</summary>
|
||||
<div ref={scrollRef} className="max-h-28 overflow-y-auto p-2 space-y-0.5">
|
||||
{bids.map((bid, index) => (
|
||||
<div
|
||||
@@ -1891,7 +1897,7 @@ function BidLog({ bids }: { bids: AuctionStateView["bids"] }) {
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2401,15 +2407,6 @@ export default function AuctionPage() {
|
||||
visualPreview={visualPreview}
|
||||
/>
|
||||
|
||||
{auctionState.phase === "sold" && auctionState.currentBidder && (
|
||||
<div
|
||||
className={`text-center py-3 border text-sm font-bold ${`${teamIndexColorClasses(auctionState.currentBidder.teamIndex).border} ${teamIndexColorClasses(auctionState.currentBidder.teamIndex).bg} ${teamIndexColorClasses(auctionState.currentBidder.teamIndex).text}`}`}
|
||||
>
|
||||
{teamIndexLabel(auctionState.currentBidder.teamIndex)} 낙찰 —{" "}
|
||||
{formatPoints(auctionState.currentBid)}P
|
||||
</div>
|
||||
)}
|
||||
|
||||
<BidControls
|
||||
state={auctionState}
|
||||
captainRole={captainRole}
|
||||
@@ -2422,6 +2419,18 @@ export default function AuctionPage() {
|
||||
})
|
||||
}
|
||||
/>
|
||||
<section className="auction-team-summary lts-panel px-4 py-3" aria-label="팀 포인트 요약">
|
||||
<h2 className="text-sm font-bold">팀 포인트</h2>
|
||||
<ul className="mt-2 grid grid-cols-2 gap-x-4 gap-y-2 text-sm">
|
||||
{auctionState.teams.map((team) => (
|
||||
<li key={team.teamIndex} className="flex flex-wrap items-baseline justify-between gap-x-1 border-t border-line pt-2">
|
||||
<span className="min-w-0 break-words text-content-muted">{teamIndexLabel(team.teamIndex, team.name)}</span>
|
||||
<strong className="tabular">{formatPoints(team.points)}P</strong>
|
||||
<span className="basis-full text-xs text-content-muted">{getAuctionTeamSize(team)}/{AUCTION_MAX_TEAM_SIZE}명</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
<MemoBidLog bids={auctionState.bids} />
|
||||
|
||||
{canManageAuction && (
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
+413
-422
@@ -1,149 +1,252 @@
|
||||
import { useState } from 'react';
|
||||
import {
|
||||
CalendarDays,
|
||||
ChevronLeft,
|
||||
ChevronRight,
|
||||
Map as MapIcon,
|
||||
Users,
|
||||
} from 'lucide-react';
|
||||
import { Link } from 'react-router';
|
||||
import { mapApiMatchToMatchDetail } from '../api/mappers';
|
||||
import { useCommunity, useMatches, useMatchesPage } from '../api/hooks';
|
||||
import type {
|
||||
MatchDetailResponse,
|
||||
MatchSummaryResponse,
|
||||
} from '@lolympus/contracts';
|
||||
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
||||
import { Link, useSearchParams } from 'react-router';
|
||||
import { useMatches, useMatchesPage } from '../api/hooks';
|
||||
import { mapIdToLabel } from '../api/mappers';
|
||||
import { DEFAULT_COMMUNITY_ID } from '../config';
|
||||
import {
|
||||
Button,
|
||||
EmptyNote,
|
||||
ErrorNote,
|
||||
MetaDot,
|
||||
PageBody,
|
||||
PageHero,
|
||||
Panel,
|
||||
PanelHeader,
|
||||
Pill,
|
||||
PlainPage,
|
||||
Skeleton,
|
||||
type PillTone,
|
||||
} from '../ui';
|
||||
import {
|
||||
getHistoryMatchTitle,
|
||||
getHomeMatchEnrollment,
|
||||
getHomeMatchSchedule,
|
||||
HOME_MATCH_STATUS,
|
||||
} from './home-match-presentation';
|
||||
|
||||
const UPCOMING_GRID_MATCH_LIMIT = 3;
|
||||
const UPCOMING_MATCH_LIST_LIMIT = UPCOMING_GRID_MATCH_LIMIT + 1;
|
||||
const UPCOMING_MATCH_LIST_LIMIT = 4;
|
||||
const HISTORY_MATCH_PAGE_SIZE = 10;
|
||||
const HOME_HISTORY_LIMIT = 5;
|
||||
const DEFAULT_MAP_ID = 11;
|
||||
|
||||
const STATUS_PRESENTATION: Record<
|
||||
string,
|
||||
{ label: string; tone: PillTone; live?: boolean }
|
||||
> = {
|
||||
recruiting: { label: '모집중', tone: 'live', live: true },
|
||||
'team-built': { label: '팀빌딩', tone: 'gold' },
|
||||
'in-progress': { label: '진행중', tone: 'accent', live: true },
|
||||
finished: { label: '종료', tone: 'neutral' },
|
||||
};
|
||||
const DECISION_LABELS = {
|
||||
walkover: '부전승',
|
||||
forfeit: '기권승',
|
||||
administrative: '판정승',
|
||||
draw: '무승부',
|
||||
} as const;
|
||||
|
||||
function StatusPill({ status, onInk }: { status: string; onInk?: boolean }) {
|
||||
const presentation = STATUS_PRESENTATION[status] ?? {
|
||||
label: status,
|
||||
tone: 'neutral' as const,
|
||||
};
|
||||
const tone =
|
||||
onInk && presentation.tone === 'neutral' ? 'ink' : presentation.tone;
|
||||
function NextMatch({ match }: { match?: MatchDetailResponse }) {
|
||||
if (!match) {
|
||||
return (
|
||||
<h1 className="text-sm font-medium text-content-muted">
|
||||
예정된 내전이 없습니다
|
||||
</h1>
|
||||
);
|
||||
}
|
||||
|
||||
const schedule = getHomeMatchSchedule(match.scheduledAt);
|
||||
const enrollment = getHomeMatchEnrollment(match);
|
||||
const href = `/match/${match._id}`;
|
||||
|
||||
return (
|
||||
<Pill tone={tone} dot={presentation.live} pulse={presentation.live}>
|
||||
{presentation.label}
|
||||
</Pill>
|
||||
<header className="flex flex-col gap-3 rounded-xl border border-line bg-card p-4 sm:flex-row sm:items-center sm:justify-between sm:gap-6 sm:p-5">
|
||||
<div className="min-w-0">
|
||||
<p className="flex flex-wrap items-baseline gap-x-2 gap-y-0.5 text-sm text-content-muted">
|
||||
<span className="font-semibold">다음 내전</span>
|
||||
{schedule && (
|
||||
<time
|
||||
dateTime={match.scheduledAt}
|
||||
className="tabular font-semibold text-content"
|
||||
>
|
||||
{schedule.date} · {schedule.time}
|
||||
</time>
|
||||
)}
|
||||
</p>
|
||||
<h1 className="mt-1 break-words text-xl font-bold leading-snug sm:text-2xl">
|
||||
{match.title}
|
||||
</h1>
|
||||
<p className="tabular mt-1 flex flex-wrap items-baseline gap-x-2 gap-y-0.5 text-sm text-content-muted">
|
||||
{match.status !== 'recruiting' && (
|
||||
<span>{HOME_MATCH_STATUS[match.status]} ·</span>
|
||||
)}
|
||||
<span>{enrollment.capacity} ·</span>
|
||||
<strong className="font-semibold text-content">
|
||||
{enrollment.label}
|
||||
</strong>
|
||||
{match.mapId !== DEFAULT_MAP_ID && (
|
||||
<span>· {mapIdToLabel(match.mapId)}</span>
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
{enrollment.canApply ? (
|
||||
<div className="shrink-0">
|
||||
<Button label="참가 신청" variant="primary" size="md" href={href} />
|
||||
</div>
|
||||
) : (
|
||||
<Link
|
||||
to={href}
|
||||
className="inline-flex min-h-10 w-fit shrink-0 items-center gap-1 text-sm font-semibold text-content hover:underline"
|
||||
>
|
||||
내전 보기
|
||||
<ChevronRight className="size-4" aria-hidden="true" />
|
||||
</Link>
|
||||
)}
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
function formatCompactDateTime(dateLike: string) {
|
||||
const date = new Date(dateLike);
|
||||
if (Number.isNaN(date.getTime())) return '';
|
||||
|
||||
const weekday = new Intl.DateTimeFormat('ko-KR', {
|
||||
weekday: 'short',
|
||||
}).format(date);
|
||||
const hours = String(date.getHours()).padStart(2, '0');
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
|
||||
return `${date.getMonth() + 1}/${date.getDate()} (${weekday}) ${hours}:${minutes}`;
|
||||
function UpcomingMatches({ matches }: { matches: MatchDetailResponse[] }) {
|
||||
return (
|
||||
<Panel>
|
||||
<PanelHeader title="이어지는 내전" />
|
||||
<ul className="divide-y divide-line">
|
||||
{matches.map((match) => {
|
||||
const schedule = getHomeMatchSchedule(match.scheduledAt);
|
||||
const { capacity, label } = getHomeMatchEnrollment(match);
|
||||
return (
|
||||
<li key={match._id}>
|
||||
<Link
|
||||
to={`/match/${match._id}`}
|
||||
className="group grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 px-4 py-3 transition-colors hover:bg-sunken sm:grid-cols-[8rem_minmax(0,1fr)_auto_1rem] sm:px-5"
|
||||
>
|
||||
<time
|
||||
dateTime={match.scheduledAt}
|
||||
className="tabular col-start-1 text-xs text-content-muted"
|
||||
>
|
||||
{schedule?.compact ?? '일정 미정'}
|
||||
</time>
|
||||
<h3 className="col-start-1 mt-0.5 truncate text-[15px] font-semibold text-content group-hover:underline sm:col-start-2 sm:row-start-1 sm:mt-0">
|
||||
{match.title}
|
||||
</h3>
|
||||
<p className="tabular col-start-1 mt-1 text-[13px] text-content-muted sm:col-start-3 sm:row-start-1 sm:mt-0">
|
||||
{match.status === 'recruiting'
|
||||
? label
|
||||
: HOME_MATCH_STATUS[match.status]}{' '}
|
||||
· {capacity}
|
||||
</p>
|
||||
<ChevronRight
|
||||
className="col-start-2 row-span-3 row-start-1 size-4 text-content-muted sm:col-start-4 sm:row-span-1"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</Link>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</Panel>
|
||||
);
|
||||
}
|
||||
|
||||
/** 정원 대비 신청 인원. 숫자와 막대를 함께 보여 남은 자리를 바로 읽게 한다. */
|
||||
function CapacityMeter({
|
||||
current,
|
||||
max,
|
||||
onInk = false,
|
||||
}: {
|
||||
current: number;
|
||||
max: number;
|
||||
onInk?: boolean;
|
||||
}) {
|
||||
const ratio = max > 0 ? Math.min(1, current / max) : 0;
|
||||
const isFull = max > 0 && current >= max;
|
||||
|
||||
return (
|
||||
<span className="inline-flex items-center gap-2">
|
||||
<span className="tabular whitespace-nowrap">
|
||||
<strong className={onInk ? 'text-on-ink' : 'text-content'}>
|
||||
{current}
|
||||
</strong>
|
||||
/{max}명
|
||||
</span>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className={`h-1.5 w-16 overflow-hidden rounded-full ${onInk ? 'bg-white/15' : 'bg-sunken-strong'}`}
|
||||
function HistoryResult({ match }: { match: MatchSummaryResponse }) {
|
||||
const result = match.historyResult;
|
||||
if (match.status === 'finished' && result) {
|
||||
switch (result.type) {
|
||||
case 'score': {
|
||||
const label = result.winnerTeamName
|
||||
? `${result.winnerTeamName} 승`
|
||||
: undefined;
|
||||
return (
|
||||
<span className="flex min-w-0 items-baseline gap-1.5">
|
||||
<strong className="tabular shrink-0 font-bold text-content">
|
||||
{result.teamAWins}:{result.teamBWins}
|
||||
</strong>
|
||||
{label && (
|
||||
<span
|
||||
className="min-w-0 break-words text-content-muted md:truncate"
|
||||
title={label}
|
||||
>
|
||||
{label}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
case 'winners': {
|
||||
const label = result.teamNames.join(', ');
|
||||
return (
|
||||
<span className="flex min-w-0 items-baseline gap-1.5">
|
||||
<strong className="shrink-0 font-semibold text-content">
|
||||
{result.teamNames.length > 1 ? '공동 1위' : '우승'}
|
||||
</strong>
|
||||
<span
|
||||
className="min-w-0 break-words text-content-muted md:truncate"
|
||||
title={label}
|
||||
>
|
||||
{label}
|
||||
</span>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
case 'decision': {
|
||||
return (
|
||||
<span className="flex min-w-0 items-baseline gap-1.5">
|
||||
<strong className="shrink-0 font-semibold text-content">
|
||||
{DECISION_LABELS[result.decision]}
|
||||
</strong>
|
||||
{result.winnerTeamName && (
|
||||
<span
|
||||
className="min-w-0 break-words text-content-muted md:truncate"
|
||||
title={result.winnerTeamName}
|
||||
>
|
||||
{result.winnerTeamName}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (match.status === 'team-built' || match.status === 'in-progress') {
|
||||
return (
|
||||
<Pill
|
||||
tone={match.status === 'in-progress' ? 'live' : 'neutral'}
|
||||
dot={match.status === 'in-progress'}
|
||||
>
|
||||
<span
|
||||
className={`block h-full rounded-full ${isFull ? 'bg-brand-coral' : 'bg-brand-leaf'}`}
|
||||
style={{ width: `${ratio * 100}%` }}
|
||||
/>
|
||||
</span>
|
||||
{HOME_MATCH_STATUS[match.status]}
|
||||
</Pill>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<span className="text-content-muted">
|
||||
{HOME_MATCH_STATUS[match.status]}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
function HistoryTableColGroup() {
|
||||
return (
|
||||
<colgroup>
|
||||
<col className="w-[168px]" />
|
||||
<col />
|
||||
<col className="w-[96px]" />
|
||||
<col className="w-[132px]" />
|
||||
<col className="w-[72px]" />
|
||||
</colgroup>
|
||||
);
|
||||
}
|
||||
|
||||
function HistoryTableHeader() {
|
||||
return (
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">날짜</th>
|
||||
<th scope="col">내전</th>
|
||||
<th scope="col">상태</th>
|
||||
<th scope="col">맵</th>
|
||||
<th scope="col" className="!text-right">
|
||||
참가
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
);
|
||||
}
|
||||
|
||||
function HistoryRecordsSkeleton({
|
||||
rows = HISTORY_MATCH_PAGE_SIZE,
|
||||
}: {
|
||||
rows?: number;
|
||||
}) {
|
||||
const historySkeletons = Array.from({ length: rows });
|
||||
|
||||
function HistoryTableColumns() {
|
||||
return (
|
||||
<>
|
||||
<div className="hidden overflow-x-auto md:block">
|
||||
<table className="lts-table table-fixed">
|
||||
<HistoryTableColGroup />
|
||||
<HistoryTableHeader />
|
||||
<colgroup>
|
||||
<col className="w-36" />
|
||||
<col />
|
||||
<col className="w-44" />
|
||||
<col className="w-16" />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">일정</th>
|
||||
<th scope="col">내전</th>
|
||||
<th scope="col">결과</th>
|
||||
<th scope="col" className="!text-right">
|
||||
참가
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function HistoryRecordsSkeleton({ limit }: { limit: number }) {
|
||||
const rows = Array.from({ length: limit });
|
||||
return (
|
||||
<>
|
||||
<div className="hidden md:block">
|
||||
<table className="lts-table table-fixed" aria-hidden="true">
|
||||
<HistoryTableColumns />
|
||||
<tbody>
|
||||
{historySkeletons.map((_, index) => (
|
||||
{rows.map((_, index) => (
|
||||
<tr key={index}>
|
||||
<td>
|
||||
<Skeleton width={96} height={14} index={index} />
|
||||
@@ -152,10 +255,7 @@ function HistoryRecordsSkeleton({
|
||||
<Skeleton width="60%" height={14} index={index} />
|
||||
</td>
|
||||
<td>
|
||||
<Skeleton width={48} height={20} radius="rounded" />
|
||||
</td>
|
||||
<td>
|
||||
<Skeleton width={80} height={14} index={index} />
|
||||
<Skeleton width={56} height={14} index={index} />
|
||||
</td>
|
||||
<td>
|
||||
<Skeleton width={28} height={14} className="ml-auto" />
|
||||
@@ -165,8 +265,8 @@ function HistoryRecordsSkeleton({
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div className="divide-y divide-line md:hidden">
|
||||
{historySkeletons.map((_, index) => (
|
||||
<div className="divide-y divide-line md:hidden" aria-hidden="true">
|
||||
{rows.map((_, index) => (
|
||||
<div key={index} className="space-y-2 px-4 py-3">
|
||||
<Skeleton width={110} height={12} index={index} />
|
||||
<Skeleton width="70%" height={16} index={index} />
|
||||
@@ -177,22 +277,78 @@ function HistoryRecordsSkeleton({
|
||||
);
|
||||
}
|
||||
|
||||
function HomePageSkeleton() {
|
||||
function HistoryRecords({ matches }: { matches: MatchSummaryResponse[] }) {
|
||||
if (matches.length === 0) {
|
||||
return <EmptyNote size="sm" title="아직 내전 기록이 없습니다." />;
|
||||
}
|
||||
|
||||
const rows = matches.map((match) => {
|
||||
const schedule = getHomeMatchSchedule(match.scheduledAt);
|
||||
return {
|
||||
match,
|
||||
title: getHistoryMatchTitle(match.title, schedule),
|
||||
href: `/match/${match._id}`,
|
||||
schedule: schedule?.compact ?? '일정 미정',
|
||||
map:
|
||||
match.mapId === DEFAULT_MAP_ID ? undefined : mapIdToLabel(match.mapId),
|
||||
};
|
||||
});
|
||||
|
||||
return (
|
||||
<div aria-busy="true" aria-live="polite">
|
||||
<span className="sr-only">매치 목록을 불러오는 중...</span>
|
||||
<PageHero
|
||||
eyebrow="다음 내전"
|
||||
title={<span className="opacity-0">내전을 불러오는 중</span>}
|
||||
meta={<span className="opacity-0">일정</span>}
|
||||
/>
|
||||
<PageBody className="space-y-5">
|
||||
<Panel>
|
||||
<PanelHeader title="지난 내전" />
|
||||
<HistoryRecordsSkeleton />
|
||||
</Panel>
|
||||
</PageBody>
|
||||
</div>
|
||||
<>
|
||||
<div className="hidden md:block">
|
||||
<table className="lts-table table-fixed">
|
||||
<HistoryTableColumns />
|
||||
<tbody>
|
||||
{rows.map(({ match, title, href, schedule, map }) => (
|
||||
<tr key={match._id} className="transition-colors hover:bg-sunken">
|
||||
<td className="tabular whitespace-nowrap text-[13px] text-content-muted">
|
||||
<time dateTime={match.scheduledAt}>{schedule}</time>
|
||||
</td>
|
||||
<td>
|
||||
<Link
|
||||
to={href}
|
||||
className="block truncate font-semibold text-content hover:underline"
|
||||
title={match.title}
|
||||
>
|
||||
{title}
|
||||
</Link>
|
||||
{map && <p className="text-xs text-content-muted">{map}</p>}
|
||||
</td>
|
||||
<td className="text-[13px]">
|
||||
<HistoryResult match={match} />
|
||||
</td>
|
||||
<td className="tabular whitespace-nowrap text-right text-[13px] text-content-muted">
|
||||
{match.participants.length}명
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<ul className="divide-y divide-line md:hidden">
|
||||
{rows.map(({ match, title, href, schedule, map }) => (
|
||||
<li key={match._id}>
|
||||
<Link
|
||||
to={href}
|
||||
className="group block px-4 py-3 transition-colors hover:bg-sunken"
|
||||
>
|
||||
<div className="tabular flex flex-wrap justify-between gap-x-3 text-xs text-content-muted">
|
||||
<time dateTime={match.scheduledAt}>{schedule}</time>
|
||||
<span>{match.participants.length}명</span>
|
||||
</div>
|
||||
<p className="mt-0.5 break-words text-[15px] font-semibold leading-snug text-content group-hover:underline">
|
||||
{title}
|
||||
</p>
|
||||
<div className="mt-1 flex flex-wrap items-baseline gap-x-2 gap-y-1 text-[13px]">
|
||||
<HistoryResult match={match} />
|
||||
{map && <span className="text-content-muted">· {map}</span>}
|
||||
</div>
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -213,13 +369,10 @@ function HistoryPagination({
|
||||
onPrevious,
|
||||
onNext,
|
||||
}: HistoryPaginationProps) {
|
||||
const hasPrevious = page > 1;
|
||||
const hasNext = page < pageCount;
|
||||
|
||||
return (
|
||||
<div className="flex items-center justify-between gap-3 border-t border-line px-4 py-2.5 sm:px-5">
|
||||
<span className="tabular text-xs text-content-subtle">
|
||||
총 {total}개 · {page} / {pageCount}
|
||||
<div className="flex flex-wrap items-center justify-between gap-x-3 gap-y-1 border-t border-line px-4 py-2.5 sm:px-5">
|
||||
<span className="tabular text-xs text-content-muted">
|
||||
총 {total.toLocaleString('ko-KR')}개 · {page} / {pageCount}
|
||||
</span>
|
||||
<div className="flex items-center gap-1">
|
||||
<Button
|
||||
@@ -227,7 +380,7 @@ function HistoryPagination({
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
icon={<ChevronLeft className="size-4" aria-hidden="true" />}
|
||||
isDisabled={!hasPrevious || isFetching}
|
||||
isDisabled={page <= 1 || isFetching}
|
||||
onClick={onPrevious}
|
||||
/>
|
||||
<Button
|
||||
@@ -235,7 +388,7 @@ function HistoryPagination({
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
endContent={<ChevronRight className="size-4" aria-hidden="true" />}
|
||||
isDisabled={!hasNext || isFetching}
|
||||
isDisabled={page >= pageCount || isFetching}
|
||||
onClick={onNext}
|
||||
/>
|
||||
</div>
|
||||
@@ -245,29 +398,38 @@ function HistoryPagination({
|
||||
|
||||
export default function HomePage() {
|
||||
const [timelineNow] = useState(() => new Date().toISOString());
|
||||
const [historyPage, setHistoryPage] = useState(1);
|
||||
const communityQuery = useCommunity(DEFAULT_COMMUNITY_ID);
|
||||
const upcomingMatchesQuery = useMatches(
|
||||
{
|
||||
limit: UPCOMING_MATCH_LIST_LIMIT,
|
||||
scheduledFrom: timelineNow,
|
||||
sort: 'asc',
|
||||
},
|
||||
DEFAULT_COMMUNITY_ID,
|
||||
);
|
||||
const historyMatchesQuery = useMatchesPage(
|
||||
{
|
||||
limit: HISTORY_MATCH_PAGE_SIZE,
|
||||
page: historyPage,
|
||||
scheduledTo: timelineNow,
|
||||
sort: 'desc',
|
||||
},
|
||||
DEFAULT_COMMUNITY_ID,
|
||||
);
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
const showArchive = searchParams.get('history') === 'all';
|
||||
const requestedPage = Number(searchParams.get('page'));
|
||||
const historyPage =
|
||||
showArchive && Number.isSafeInteger(requestedPage) && requestedPage > 0
|
||||
? requestedPage
|
||||
: 1;
|
||||
const historyLimit = showArchive
|
||||
? HISTORY_MATCH_PAGE_SIZE
|
||||
: HOME_HISTORY_LIMIT;
|
||||
function setHistoryPage(page: number) {
|
||||
const params = new URLSearchParams(searchParams);
|
||||
if (page > 1) params.set('page', String(page));
|
||||
else params.delete('page');
|
||||
setSearchParams(params, { preventScrollReset: true });
|
||||
}
|
||||
const upcomingMatchesQuery = useMatches({
|
||||
limit: UPCOMING_MATCH_LIST_LIMIT,
|
||||
scheduledFrom: timelineNow,
|
||||
sort: 'asc',
|
||||
});
|
||||
const historyMatchesQuery = useMatchesPage({
|
||||
limit: historyLimit,
|
||||
page: historyPage,
|
||||
scheduledTo: timelineNow,
|
||||
sort: 'desc',
|
||||
includeResults: true,
|
||||
});
|
||||
|
||||
if (!DEFAULT_COMMUNITY_ID) {
|
||||
return (
|
||||
<PlainPage className="py-16">
|
||||
<PlainPage className="lts-overview py-16">
|
||||
<ErrorNote
|
||||
title="커뮤니티가 설정되지 않았습니다"
|
||||
description="apps/web/.env.development의 VITE_DEFAULT_COMMUNITY_ID를 먼저 설정해주세요."
|
||||
@@ -276,277 +438,106 @@ export default function HomePage() {
|
||||
);
|
||||
}
|
||||
|
||||
if (upcomingMatchesQuery.isLoading) {
|
||||
return <HomePageSkeleton />;
|
||||
}
|
||||
|
||||
if (upcomingMatchesQuery.error) {
|
||||
return (
|
||||
<PlainPage className="py-16">
|
||||
<ErrorNote
|
||||
title="매치 목록을 불러오지 못했습니다"
|
||||
action={
|
||||
<Button
|
||||
label="다시 시도"
|
||||
size="sm"
|
||||
variant="secondary"
|
||||
onClick={() => void upcomingMatchesQuery.refetch()}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</PlainPage>
|
||||
);
|
||||
}
|
||||
|
||||
const upcomingMatches =
|
||||
upcomingMatchesQuery.data?.map(mapApiMatchToMatchDetail) ?? [];
|
||||
const historyMatches =
|
||||
historyMatchesQuery.data?.matches.map((match) => ({
|
||||
...mapApiMatchToMatchDetail(match),
|
||||
rawStatus: match.status,
|
||||
compactDateTime: formatCompactDateTime(match.scheduledAt),
|
||||
})) ?? [];
|
||||
const [nextMatch, ...upcomingMatches] = upcomingMatchesQuery.data ?? [];
|
||||
const historyTotal = historyMatchesQuery.data?.total ?? 0;
|
||||
const historyLimit =
|
||||
historyMatchesQuery.data?.limit ?? HISTORY_MATCH_PAGE_SIZE;
|
||||
const historyPageCount = Math.max(1, Math.ceil(historyTotal / historyLimit));
|
||||
const historyPageCount = Math.max(
|
||||
1,
|
||||
Math.ceil(historyTotal / (historyMatchesQuery.data?.limit ?? historyLimit)),
|
||||
);
|
||||
const isHistoryPageLoading =
|
||||
historyMatchesQuery.isLoading ||
|
||||
(historyMatchesQuery.isFetching && historyMatchesQuery.isPlaceholderData);
|
||||
const hasHistoryError =
|
||||
Boolean(historyMatchesQuery.error) && !historyMatchesQuery.data;
|
||||
const goToPreviousHistoryPage = () =>
|
||||
setHistoryPage((page) => Math.max(1, page - 1));
|
||||
const goToNextHistoryPage = () => setHistoryPage((page) => page + 1);
|
||||
const nextMatch = upcomingMatches[0];
|
||||
const upcomingCards = upcomingMatches.slice(1, 1 + UPCOMING_GRID_MATCH_LIMIT);
|
||||
const statsPath = `/communities/${DEFAULT_COMMUNITY_ID}/internal-stats`;
|
||||
const communityName = communityQuery.data?.name ?? 'LOLYMPUS';
|
||||
|
||||
return (
|
||||
<>
|
||||
{nextMatch ? (
|
||||
<PageHero
|
||||
eyebrow="다음 내전"
|
||||
title={
|
||||
<Link to={`/match/${nextMatch.id}`} className="hover:underline">
|
||||
{nextMatch.title}
|
||||
</Link>
|
||||
}
|
||||
badges={<StatusPill status={nextMatch.status} onInk />}
|
||||
meta={
|
||||
<>
|
||||
<span className="inline-flex items-center gap-1.5">
|
||||
<CalendarDays className="size-4" aria-hidden="true" />
|
||||
{nextMatch.date} {nextMatch.time}
|
||||
</span>
|
||||
<MetaDot />
|
||||
<span className="inline-flex items-center gap-1.5">
|
||||
<MapIcon className="size-4" aria-hidden="true" />
|
||||
{nextMatch.map}
|
||||
</span>
|
||||
<MetaDot />
|
||||
<span className="inline-flex items-center gap-1.5">
|
||||
<Users className="size-4" aria-hidden="true" />
|
||||
<CapacityMeter
|
||||
current={nextMatch.participants.length}
|
||||
max={nextMatch.maxParticipants}
|
||||
onInk
|
||||
/>
|
||||
</span>
|
||||
</>
|
||||
}
|
||||
description={nextMatch.description || undefined}
|
||||
actions={
|
||||
<Button
|
||||
label={
|
||||
nextMatch.status === 'recruiting'
|
||||
? '참가 신청하러 가기'
|
||||
: '내전 보기'
|
||||
}
|
||||
variant="primary"
|
||||
size="lg"
|
||||
href={`/match/${nextMatch.id}`}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<PlainPage className="lts-overview space-y-5 pt-5 pb-16 sm:pt-6">
|
||||
{showArchive ? (
|
||||
<div className="flex flex-wrap items-center justify-between gap-3">
|
||||
<h1 className="text-2xl font-bold">전체 내전 일정</h1>
|
||||
<Link to="/" className="text-sm font-semibold hover:underline">
|
||||
내전 홈
|
||||
</Link>
|
||||
</div>
|
||||
) : upcomingMatchesQuery.isLoading ? (
|
||||
<h1 className="text-sm text-content-muted" aria-busy="true">
|
||||
내전 일정을 불러오는 중
|
||||
</h1>
|
||||
) : upcomingMatchesQuery.isError && !upcomingMatchesQuery.data ? (
|
||||
<div className="flex flex-wrap items-center gap-3">
|
||||
<h1 className="text-sm text-content-muted">
|
||||
내전 일정을 불러오지 못했습니다
|
||||
</h1>
|
||||
<button
|
||||
type="button"
|
||||
className="min-h-8 text-sm font-semibold underline"
|
||||
onClick={() => void upcomingMatchesQuery.refetch()}
|
||||
>
|
||||
다시 시도
|
||||
</button>
|
||||
</div>
|
||||
) : (
|
||||
<PageHero
|
||||
eyebrow={communityName}
|
||||
title="예정된 내전이 없습니다"
|
||||
meta="새 내전이 열리면 이곳에 가장 먼저 표시됩니다."
|
||||
actions={
|
||||
<Button
|
||||
label="내전 전적 보기"
|
||||
variant="primary"
|
||||
size="lg"
|
||||
href={statsPath}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<NextMatch match={nextMatch} />
|
||||
)}
|
||||
|
||||
<PageBody className="space-y-5">
|
||||
{upcomingCards.length > 0 && (
|
||||
<Panel>
|
||||
<PanelHeader title="이어지는 내전" count={upcomingCards.length} />
|
||||
<ul className="grid divide-y divide-line sm:grid-cols-3 sm:divide-x sm:divide-y-0">
|
||||
{upcomingCards.map((match) => (
|
||||
<li key={match.id} className="min-w-0">
|
||||
<Link
|
||||
to={`/match/${match.id}`}
|
||||
className="group block h-full px-4 py-4 transition-colors hover:bg-sunken sm:px-5"
|
||||
>
|
||||
<div className="flex items-start justify-between gap-2">
|
||||
<h3 className="min-w-0 truncate text-[15px] font-bold text-content group-hover:text-primary">
|
||||
{match.title}
|
||||
</h3>
|
||||
<StatusPill status={match.status} />
|
||||
</div>
|
||||
<p className="mt-2 text-[13px] text-content-muted">
|
||||
{match.date} {match.time}
|
||||
</p>
|
||||
<div className="mt-1 flex items-center gap-2 text-[13px] text-content-subtle">
|
||||
<span>{match.map}</span>
|
||||
<MetaDot />
|
||||
<CapacityMeter
|
||||
current={match.participants.length}
|
||||
max={match.maxParticipants}
|
||||
/>
|
||||
</div>
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</Panel>
|
||||
)}
|
||||
{!showArchive && upcomingMatches.length > 0 && (
|
||||
<UpcomingMatches matches={upcomingMatches} />
|
||||
)}
|
||||
|
||||
<Panel aria-busy={isHistoryPageLoading} aria-live="polite">
|
||||
<PanelHeader
|
||||
title="지난 내전"
|
||||
count={historyTotal > 0 ? historyTotal : undefined}
|
||||
actions={
|
||||
<Link
|
||||
to={statsPath}
|
||||
className="inline-flex items-center gap-0.5 text-[13px] font-semibold text-primary hover:underline"
|
||||
>
|
||||
전적·순위 보기
|
||||
<ChevronRight className="size-4" aria-hidden="true" />
|
||||
</Link>
|
||||
}
|
||||
/>
|
||||
{isHistoryPageLoading ? (
|
||||
<HistoryRecordsSkeleton rows={HISTORY_MATCH_PAGE_SIZE} />
|
||||
) : hasHistoryError ? (
|
||||
<div className="p-4">
|
||||
<ErrorNote
|
||||
title="지난 내전 기록을 불러오지 못했습니다"
|
||||
action={
|
||||
<Button
|
||||
label="다시 시도"
|
||||
size="sm"
|
||||
variant="secondary"
|
||||
onClick={() => void historyMatchesQuery.refetch()}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
{/* 데스크톱: 표 */}
|
||||
<div className="hidden overflow-x-auto md:block">
|
||||
<table className="lts-table table-fixed">
|
||||
<HistoryTableColGroup />
|
||||
<HistoryTableHeader />
|
||||
<tbody>
|
||||
{historyMatches.length > 0 ? (
|
||||
historyMatches.map((match) => (
|
||||
<tr
|
||||
key={match.id}
|
||||
className="transition-colors hover:bg-sunken"
|
||||
>
|
||||
<td className="tabular whitespace-nowrap text-[13px] text-content-muted">
|
||||
{match.compactDateTime || match.date}
|
||||
</td>
|
||||
<td>
|
||||
<Link
|
||||
to={`/match/${match.id}`}
|
||||
className="block truncate font-semibold text-content hover:text-primary"
|
||||
>
|
||||
{match.title}
|
||||
</Link>
|
||||
</td>
|
||||
<td>
|
||||
<StatusPill status={match.rawStatus} />
|
||||
</td>
|
||||
<td className="truncate text-[13px] text-content-muted">
|
||||
{match.map}
|
||||
</td>
|
||||
<td className="tabular whitespace-nowrap text-right text-[13px] text-content-muted">
|
||||
{match.participants.length}명
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
) : (
|
||||
<tr>
|
||||
<td colSpan={5}>
|
||||
<EmptyNote
|
||||
size="sm"
|
||||
title="아직 내전 기록이 없습니다."
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{/* 모바일: 목록 */}
|
||||
<div className="divide-y divide-line md:hidden">
|
||||
{historyMatches.length > 0 ? (
|
||||
historyMatches.map((match) => (
|
||||
<Link
|
||||
key={match.id}
|
||||
to={`/match/${match.id}`}
|
||||
className="block px-4 py-3 transition-colors hover:bg-sunken"
|
||||
>
|
||||
<div className="flex items-start justify-between gap-3">
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="tabular text-xs text-content-subtle">
|
||||
{match.compactDateTime ||
|
||||
`${match.date} ${match.time}`}
|
||||
</div>
|
||||
<div className="mt-0.5 break-words text-[15px] font-semibold leading-snug text-content">
|
||||
{match.title}
|
||||
</div>
|
||||
</div>
|
||||
<StatusPill status={match.rawStatus} />
|
||||
</div>
|
||||
<div className="mt-1.5 flex items-center gap-2 text-xs text-content-subtle">
|
||||
<span>{match.map}</span>
|
||||
<MetaDot />
|
||||
<span>{match.participants.length}명</span>
|
||||
</div>
|
||||
</Link>
|
||||
))
|
||||
) : (
|
||||
<EmptyNote size="sm" title="아직 내전 기록이 없습니다." />
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
{!hasHistoryError && historyTotal > 0 && (
|
||||
<HistoryPagination
|
||||
page={historyPage}
|
||||
pageCount={historyPageCount}
|
||||
total={historyTotal}
|
||||
isFetching={historyMatchesQuery.isFetching}
|
||||
onPrevious={goToPreviousHistoryPage}
|
||||
onNext={goToNextHistoryPage}
|
||||
<Panel aria-busy={isHistoryPageLoading} aria-live="polite">
|
||||
<PanelHeader
|
||||
title={showArchive ? '지난 일정 전체' : '최근 내전 일정'}
|
||||
actions={
|
||||
<Link
|
||||
to={statsPath}
|
||||
className="inline-flex items-center gap-0.5 text-[13px] font-semibold text-content-muted hover:text-content hover:underline"
|
||||
>
|
||||
전적 검색
|
||||
<ChevronRight className="size-4" aria-hidden="true" />
|
||||
</Link>
|
||||
}
|
||||
/>
|
||||
{isHistoryPageLoading ? (
|
||||
<HistoryRecordsSkeleton limit={historyLimit} />
|
||||
) : hasHistoryError ? (
|
||||
<div className="p-4">
|
||||
<ErrorNote
|
||||
title="지난 내전 기록을 불러오지 못했습니다"
|
||||
action={
|
||||
<Button
|
||||
label="다시 시도"
|
||||
size="sm"
|
||||
variant="secondary"
|
||||
onClick={() => void historyMatchesQuery.refetch()}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</Panel>
|
||||
</PageBody>
|
||||
</>
|
||||
</div>
|
||||
) : (
|
||||
<HistoryRecords matches={historyMatchesQuery.data?.matches ?? []} />
|
||||
)}
|
||||
{showArchive && !hasHistoryError && historyTotal > 0 && (
|
||||
<HistoryPagination
|
||||
page={historyPage}
|
||||
pageCount={historyPageCount}
|
||||
total={historyTotal}
|
||||
isFetching={historyMatchesQuery.isFetching}
|
||||
onPrevious={() => setHistoryPage(Math.max(1, historyPage - 1))}
|
||||
onNext={() => setHistoryPage(historyPage + 1)}
|
||||
/>
|
||||
)}
|
||||
{!showArchive && historyTotal > HOME_HISTORY_LIMIT && (
|
||||
<div className="border-t border-line px-4 py-2.5 text-right sm:px-5">
|
||||
<Link
|
||||
to="/?history=all"
|
||||
className="text-sm text-content-muted hover:underline"
|
||||
>
|
||||
전체 일정 기록
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
</Panel>
|
||||
</PlainPage>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Link, useLocation, useParams } from "react-router";
|
||||
import { useDdragonManifest, useInternalMatchDetail } from "../api/hooks";
|
||||
import { useCompetition, useDdragonManifest, useInternalMatchDetail } from "../api/hooks";
|
||||
import type { ApiInternalMatchDetailResponse, TeamSide } from "../api/types";
|
||||
import { DEFAULT_COMMUNITY_ID } from "../config";
|
||||
import {
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
teamIndexLabel,
|
||||
} from "../lib/league";
|
||||
import { internalMatchGamePath } from "../lib/internal-match-routes";
|
||||
import { groupRecordedSets } from "../lib/internal-match-series";
|
||||
import { LANE_LABELS } from "../lib/riot-history";
|
||||
import { ItemIcon } from "../components/ItemTooltip";
|
||||
|
||||
@@ -100,11 +101,13 @@ function GamePanel({
|
||||
communityId,
|
||||
matchId,
|
||||
game,
|
||||
ordinal,
|
||||
manifest,
|
||||
}: {
|
||||
communityId: string;
|
||||
matchId: string;
|
||||
game: ApiInternalMatchDetailResponse["games"][number];
|
||||
ordinal?: number;
|
||||
manifest: ReturnType<typeof useDdragonManifest>["data"];
|
||||
}) {
|
||||
const location = useLocation();
|
||||
@@ -114,9 +117,12 @@ function GamePanel({
|
||||
<section className="lts-panel overflow-hidden">
|
||||
<div className="flex flex-wrap items-center justify-between gap-3 border-b border-line px-4 py-3 sm:px-5">
|
||||
<div>
|
||||
<h2 className="text-sm font-black text-base-content">
|
||||
{game.gameNumber}경기
|
||||
</h2>
|
||||
<h3 className="text-sm font-black text-base-content">
|
||||
{ordinal === undefined ? `전체 ${game.gameNumber}세트` : `${ordinal}세트`}
|
||||
{ordinal !== undefined && ordinal !== game.gameNumber && (
|
||||
<span className="ml-2 text-xs font-medium text-content-muted">전체 {game.gameNumber}</span>
|
||||
)}
|
||||
</h3>
|
||||
<p className="mt-1 text-xs text-base-content/35">
|
||||
{formatDateTime(game.gameCreation)} ·{" "}
|
||||
{formatDuration(game.gameDuration)} ·{" "}
|
||||
@@ -247,8 +253,14 @@ function GamePanel({
|
||||
|
||||
export default function InternalMatchDetailPage() {
|
||||
const { cid, matchId } = useParams();
|
||||
const location = useLocation();
|
||||
const communityId = cid ?? DEFAULT_COMMUNITY_ID;
|
||||
const requestedBack = location.state?.backTo;
|
||||
const backTo = typeof requestedBack === "string" && requestedBack.startsWith("/") && !requestedBack.startsWith("//")
|
||||
? requestedBack
|
||||
: `/communities/${communityId}/internal-stats`;
|
||||
const detailQuery = useInternalMatchDetail(matchId, communityId);
|
||||
const competition = useCompetition(matchId, communityId);
|
||||
const { data: ddragon } = useDdragonManifest();
|
||||
const detail = detailQuery.data;
|
||||
|
||||
@@ -266,7 +278,7 @@ export default function InternalMatchDetailPage() {
|
||||
<EmptyNote
|
||||
title="내전 기록을 찾을 수 없습니다"
|
||||
action={
|
||||
<Btn to={`/communities/${communityId}/internal-stats`}>
|
||||
<Btn to={backTo}>
|
||||
내전 전적으로
|
||||
</Btn>
|
||||
}
|
||||
@@ -275,20 +287,14 @@ export default function InternalMatchDetailPage() {
|
||||
);
|
||||
}
|
||||
|
||||
const isHeadToHead = detail.match.teams.length === 2;
|
||||
const primarySeries = isHeadToHead ? detail.match.seriesResults[0] : undefined;
|
||||
const teamName = (teamIndex: number) =>
|
||||
teamIndexLabel(
|
||||
teamIndex,
|
||||
detail.match.teams.find((team) => team.teamIndex === teamIndex)?.name,
|
||||
);
|
||||
const groups = groupRecordedSets(detail, competition.data);
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageHero
|
||||
width="xl"
|
||||
crumbs={[
|
||||
{ label: "전적", to: `/communities/${communityId}/internal-stats` },
|
||||
{ label: "전적", to: backTo },
|
||||
{ label: detail.match.title },
|
||||
]}
|
||||
title={detail.match.title}
|
||||
@@ -298,52 +304,13 @@ export default function InternalMatchDetailPage() {
|
||||
<MetaDot />
|
||||
<span>{detail.match.teams.length}팀</span>
|
||||
<MetaDot />
|
||||
<span>{detail.match.gameCount}경기</span>
|
||||
<span>{detail.games.length}세트 수집</span>
|
||||
</>
|
||||
}
|
||||
actions={
|
||||
primarySeries ? (
|
||||
<div
|
||||
className="flex items-center gap-4"
|
||||
aria-label={`시리즈 결과 ${teamName(primarySeries.teamAIndex)} ${primarySeries.teamAWins} 대 ${primarySeries.teamBWins} ${teamName(primarySeries.teamBIndex)}`}
|
||||
>
|
||||
<span
|
||||
className={`max-w-32 truncate text-sm font-bold ${primarySeries.winnerTeamIndex === primarySeries.teamAIndex ? "text-on-ink" : "text-on-ink-muted"}`}
|
||||
>
|
||||
{teamName(primarySeries.teamAIndex)}
|
||||
</span>
|
||||
<span className="tabular flex items-baseline gap-2 text-4xl font-extrabold">
|
||||
<span
|
||||
className={
|
||||
primarySeries.winnerTeamIndex === primarySeries.teamAIndex
|
||||
? "text-brand-coral"
|
||||
: "text-on-ink-muted"
|
||||
}
|
||||
>
|
||||
{primarySeries.teamAWins}
|
||||
</span>
|
||||
<span className="text-xl text-on-ink-muted">:</span>
|
||||
<span
|
||||
className={
|
||||
primarySeries.winnerTeamIndex === primarySeries.teamBIndex
|
||||
? "text-brand-coral"
|
||||
: "text-on-ink-muted"
|
||||
}
|
||||
>
|
||||
{primarySeries.teamBWins}
|
||||
</span>
|
||||
</span>
|
||||
<span
|
||||
className={`max-w-32 truncate text-sm font-bold ${primarySeries.winnerTeamIndex === primarySeries.teamBIndex ? "text-on-ink" : "text-on-ink-muted"}`}
|
||||
>
|
||||
{teamName(primarySeries.teamBIndex)}
|
||||
</span>
|
||||
</div>
|
||||
) : (
|
||||
<Btn to={`/match/${detail.match.matchId}`} variant="primary">
|
||||
대진표 보기
|
||||
{detail.match.teams.length === 2 ? "내전 보기" : "대진표 보기"}
|
||||
</Btn>
|
||||
)
|
||||
}
|
||||
/>
|
||||
<PageBody width="xl" className="space-y-4">
|
||||
@@ -352,14 +319,18 @@ export default function InternalMatchDetailPage() {
|
||||
<EmptyNote title="수집된 경기 기록이 없습니다" />
|
||||
</Panel>
|
||||
)}
|
||||
{detail.games.map((game) => (
|
||||
<GamePanel
|
||||
key={game.riotMatchId}
|
||||
communityId={communityId}
|
||||
matchId={detail.match.matchId}
|
||||
game={game}
|
||||
manifest={ddragon}
|
||||
/>
|
||||
{groups.map((group) => (
|
||||
<section key={group.id} className="space-y-3">
|
||||
<h2 className="flex flex-wrap items-baseline gap-x-2 px-1 text-base font-bold">
|
||||
{group.label}
|
||||
<span className="text-xs font-medium text-content-muted">
|
||||
{group.series ? "시리즈" : "대진"} · {group.sets.length}세트 수집
|
||||
</span>
|
||||
</h2>
|
||||
{group.sets.map(({ game, official }) => (
|
||||
<GamePanel key={game.riotMatchId} communityId={communityId} matchId={detail.match.matchId} game={game} ordinal={official?.ordinal} manifest={ddragon} />
|
||||
))}
|
||||
</section>
|
||||
))}
|
||||
</PageBody>
|
||||
</>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useMsal } from "@azure/msal-react";
|
||||
import { KeyRound } from "lucide-react";
|
||||
import { Link, useSearchParams } from "react-router";
|
||||
import {
|
||||
isMsalConfigured,
|
||||
MSAL_API_SCOPE,
|
||||
@@ -7,7 +8,7 @@ import {
|
||||
} from "../lib/auth/msal.config";
|
||||
import { Button, ErrorNote, PlainPage } from "../ui";
|
||||
|
||||
function LoginButton() {
|
||||
function LoginButton({ returnPath }: { returnPath?: string }) {
|
||||
const { instance } = useMsal();
|
||||
|
||||
return (
|
||||
@@ -20,6 +21,9 @@ function LoginButton() {
|
||||
void instance.loginRedirect({
|
||||
scopes: [MSAL_API_SCOPE],
|
||||
prompt: "select_account",
|
||||
redirectStartPage: returnPath
|
||||
? new URL(returnPath, window.location.origin).href
|
||||
: undefined,
|
||||
})
|
||||
}
|
||||
/>
|
||||
@@ -27,6 +31,10 @@ function LoginButton() {
|
||||
}
|
||||
|
||||
export default function LoginPage() {
|
||||
const [params] = useSearchParams();
|
||||
const next = params.get("next");
|
||||
const returnPath = next && /^\/match\/[a-f\d]{24}$/i.test(next) ? next : undefined;
|
||||
|
||||
return (
|
||||
<PlainPage width="md" className="py-16 sm:py-24">
|
||||
<div className="lts-panel mx-auto max-w-sm p-6 sm:p-8">
|
||||
@@ -40,7 +48,7 @@ export default function LoginPage() {
|
||||
</p>
|
||||
<div className="mt-6">
|
||||
{isMsalConfigured && msalInstance ? (
|
||||
<LoginButton />
|
||||
<LoginButton returnPath={returnPath} />
|
||||
) : (
|
||||
<ErrorNote
|
||||
title="로그인을 사용할 수 없습니다"
|
||||
@@ -48,6 +56,11 @@ export default function LoginPage() {
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
{returnPath && (
|
||||
<Link to={returnPath} className="mt-4 inline-block text-sm font-semibold text-primary hover:underline">
|
||||
내전 상세로 돌아가기
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
</PlainPage>
|
||||
);
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
MetaDot,
|
||||
PageBody,
|
||||
PageHero,
|
||||
Panel,
|
||||
Pill,
|
||||
PlainPage,
|
||||
type PillTone,
|
||||
@@ -991,13 +992,80 @@ function AdminAddParticipantModal({
|
||||
);
|
||||
}
|
||||
|
||||
function MatchRegistration({
|
||||
match,
|
||||
canJoin,
|
||||
checkingAccount,
|
||||
initialPosition,
|
||||
joining,
|
||||
error,
|
||||
onJoin,
|
||||
}: {
|
||||
match: MatchDetailView;
|
||||
canJoin: boolean;
|
||||
checkingAccount: boolean;
|
||||
initialPosition: Position;
|
||||
joining: boolean;
|
||||
error: Error | null;
|
||||
onJoin: (position: Position) => void;
|
||||
}) {
|
||||
const [selectedPosition, setSelectedPosition] = useState<Position>();
|
||||
const position = selectedPosition ?? initialPosition;
|
||||
const count = match.participants.length;
|
||||
const remaining = Math.max(0, match.maxParticipants - count);
|
||||
const progress = match.maxParticipants > 0 ? Math.min(100, count / match.maxParticipants * 100) : 0;
|
||||
|
||||
return (
|
||||
<Panel className="mb-5 px-4 py-4 sm:px-5" aria-labelledby="match-registration-title">
|
||||
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||
<h2 id="match-registration-title" className="text-base font-bold">참가 신청</h2>
|
||||
<Pill tone={match.joined ? "live" : remaining > 0 ? "neutral" : "gold"}>
|
||||
{count}/{match.maxParticipants}명
|
||||
</Pill>
|
||||
</div>
|
||||
<p className="mt-2 font-semibold" role="status">
|
||||
{match.joined ? "참가 신청 완료" : remaining > 0 ? `${remaining}자리 남음` : "정원이 찼습니다"}
|
||||
</p>
|
||||
<div className="mt-2 h-2 overflow-hidden rounded-full bg-sunken-strong" aria-hidden="true">
|
||||
<div className="h-full rounded-full bg-brand-coral" style={{ width: `${progress}%` }} />
|
||||
</div>
|
||||
{!match.joined && remaining > 0 && (
|
||||
checkingAccount ? (
|
||||
<p className="mt-4 text-sm text-content-muted">참가 권한을 확인하고 있습니다.</p>
|
||||
) : canJoin ? (
|
||||
<form className="mt-4 flex flex-wrap items-end justify-between gap-4" onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
if (!joining) onJoin(position);
|
||||
}}>
|
||||
<fieldset disabled={joining}>
|
||||
<legend className="mb-2 text-sm font-semibold">1순위 희망 포지션</legend>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{POSITION_ORDER.map((role) => (
|
||||
<label key={role} className="cursor-pointer">
|
||||
<input type="radio" name="preferred-position" value={role} checked={role === position} onChange={() => setSelectedPosition(role)} className="peer sr-only" />
|
||||
<span className="inline-flex min-h-9 items-center rounded-full border border-line-strong px-3 text-sm peer-checked:border-transparent peer-checked:bg-secondary peer-checked:text-secondary-content peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2">
|
||||
{positionLabel[role]}
|
||||
</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
</fieldset>
|
||||
<Btn type="submit" variant="primary" size="lg" disabled={joining}>
|
||||
{joining ? "신청 중…" : "참가 신청"}
|
||||
</Btn>
|
||||
</form>
|
||||
) : (
|
||||
<div className="mt-4"><Btn to={`/login?next=${encodeURIComponent(`/match/${match.id}`)}`} variant="primary">로그인하고 참가하기</Btn></div>
|
||||
)
|
||||
)}
|
||||
{error && <ErrorNote className="mt-4" title="참가 신청을 완료하지 못했습니다" description={error.message} />}
|
||||
</Panel>
|
||||
);
|
||||
}
|
||||
|
||||
function ParticipantTable({
|
||||
participants,
|
||||
maxParticipants,
|
||||
joined,
|
||||
canJoin,
|
||||
onJoin,
|
||||
isJoining,
|
||||
canManage,
|
||||
onOpenAddParticipant,
|
||||
onRemoveParticipant,
|
||||
@@ -1007,10 +1075,6 @@ function ParticipantTable({
|
||||
}: {
|
||||
participants: ParticipantView[];
|
||||
maxParticipants: number;
|
||||
joined: boolean;
|
||||
canJoin: boolean;
|
||||
onJoin: () => void;
|
||||
isJoining: boolean;
|
||||
canManage: boolean;
|
||||
onOpenAddParticipant: () => void;
|
||||
onRemoveParticipant: (userId: string) => void;
|
||||
@@ -1078,13 +1142,6 @@ function ParticipantTable({
|
||||
참가자 ({participants.length}/{maxParticipants})
|
||||
</h3>
|
||||
<div className="flex flex-wrap items-center justify-end gap-2">
|
||||
<Btn
|
||||
onClick={onJoin}
|
||||
disabled={!canJoin || joined || isJoining}
|
||||
variant="primary" size="sm"
|
||||
>
|
||||
{joined ? "참가 완료" : isJoining ? "신청 중..." : "참가 신청"}
|
||||
</Btn>
|
||||
{canManage && (
|
||||
<Btn
|
||||
onClick={onOpenAddParticipant}
|
||||
@@ -1271,13 +1328,6 @@ function ParticipantTable({
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{participants.length < maxParticipants && (
|
||||
<div className="px-4 py-2.5 border-t border-base-content/5 text-center bg-base-200/20">
|
||||
<span className="text-xs text-base-content/25">
|
||||
{maxParticipants - participants.length}자리 남음
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1451,19 +1501,27 @@ export default function MatchDetailPage() {
|
||||
const collectResultByRiotMatchMutation =
|
||||
useCollectTournamentResultByRiotMatch(DEFAULT_COMMUNITY_ID);
|
||||
|
||||
const preferredPositions = currentUser?.preferredPositions.length
|
||||
? [...currentUser.preferredPositions].sort((left, right) => left.priority - right.priority)
|
||||
: buildDefaultPreferredPositions();
|
||||
const matchQueryKey = matchQuery.queryKey;
|
||||
|
||||
const joinMatchMutation = useMutation({
|
||||
mutationFn: () =>
|
||||
apiFetch(
|
||||
mutationFn: (position: Position) => {
|
||||
const positions = [position, ...preferredPositions.map((entry) => entry.position)];
|
||||
return apiFetch<MatchDetailResponse>(
|
||||
`/communities/${DEFAULT_COMMUNITY_ID}/matches/${id}/participants`,
|
||||
{
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
preferredPositions: currentUser?.preferredPositions.length
|
||||
? currentUser.preferredPositions.slice(0, 5)
|
||||
: buildDefaultPreferredPositions(),
|
||||
preferredPositions: [...new Set(positions)].slice(0, 5).map((entry, index) => ({
|
||||
position: entry,
|
||||
priority: index + 1,
|
||||
})),
|
||||
}),
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
onSuccess: async () => {
|
||||
await Promise.all([
|
||||
queryClient.invalidateQueries({
|
||||
@@ -1474,10 +1532,11 @@ export default function MatchDetailPage() {
|
||||
}),
|
||||
]);
|
||||
},
|
||||
onError: () => {
|
||||
void queryClient.invalidateQueries({ queryKey: ["match", DEFAULT_COMMUNITY_ID, id ?? null] });
|
||||
},
|
||||
});
|
||||
|
||||
const matchQueryKey = matchQuery.queryKey;
|
||||
|
||||
const addParticipantMutation = useMutation({
|
||||
mutationFn: ({
|
||||
userId,
|
||||
@@ -1791,6 +1850,8 @@ export default function MatchDetailPage() {
|
||||
auctionQuery.error instanceof ApiError && auctionQuery.error.status === 404;
|
||||
const activeAuction = auctionNotStarted ? null : auctionQuery.data;
|
||||
const showAuctionLink = Boolean(activeAuction);
|
||||
const hasTeamProgress = Boolean(competitionQuery.data?.teams.length) &&
|
||||
(match.status === "in-progress" || match.status === "finished");
|
||||
const auctionParticipantPool = buildAuctionParticipantPool(
|
||||
matchQuery.data.participants,
|
||||
);
|
||||
@@ -1929,16 +1990,27 @@ export default function MatchDetailPage() {
|
||||
}
|
||||
description={match.description || undefined}
|
||||
actions={
|
||||
showAuctionLink ? (
|
||||
<Btn to={`/match/${match.id}/auction`} variant="primary" size="lg">
|
||||
경매 보기
|
||||
hasTeamProgress ? (
|
||||
<Btn to={`/match/${match.id}/team`} variant="primary" size="lg">
|
||||
팀 경기 현황
|
||||
</Btn>
|
||||
) : showAuctionLink && match.status !== "recruiting" ? (
|
||||
<Btn to={`/match/${match.id}/auction`} variant="primary" size="lg">경매 보기</Btn>
|
||||
) : undefined
|
||||
}
|
||||
/>
|
||||
<PageBody>
|
||||
{joinMatchMutation.error instanceof Error && (
|
||||
<ErrorNote className="mb-4" title="요청을 처리하지 못했습니다" description={joinMatchMutation.error.message} />
|
||||
<PageBody className={!usesTabbedLayout && match.status !== "recruiting" ? "pt-12" : undefined}>
|
||||
{match.status === "recruiting" && (
|
||||
<MatchRegistration
|
||||
key={match.id}
|
||||
match={match}
|
||||
canJoin={canUseMemberActions}
|
||||
checkingAccount={isCheckingPermissions && !canUseMemberActions}
|
||||
initialPosition={preferredPositions[0]?.position ?? "TOP"}
|
||||
joining={joinMatchMutation.isPending}
|
||||
error={joinMatchMutation.error}
|
||||
onJoin={joinMatchMutation.mutate}
|
||||
/>
|
||||
)}
|
||||
|
||||
{startAuctionMutation.error instanceof Error && (
|
||||
@@ -2044,6 +2116,7 @@ export default function MatchDetailPage() {
|
||||
{showCompetitionResults && (
|
||||
<CompetitionResults
|
||||
competition={competitionQuery.data}
|
||||
showTeamLink={!hasTeamProgress}
|
||||
view={
|
||||
usesTabbedLayout
|
||||
? activeMatchTab === "games"
|
||||
@@ -2097,10 +2170,6 @@ export default function MatchDetailPage() {
|
||||
<ParticipantTable
|
||||
participants={match.participants}
|
||||
maxParticipants={match.maxParticipants}
|
||||
joined={match.joined}
|
||||
canJoin={canUseMemberActions}
|
||||
onJoin={() => joinMatchMutation.mutate()}
|
||||
isJoining={joinMatchMutation.isPending}
|
||||
canManage={canManageAuction}
|
||||
onOpenAddParticipant={() => setAddParticipantOpen(true)}
|
||||
onRemoveParticipant={(userId) =>
|
||||
@@ -2480,13 +2549,13 @@ export default function MatchDetailPage() {
|
||||
{match.teams.map((team) => (
|
||||
<TeamCard key={team.teamIndex} team={team} />
|
||||
))}
|
||||
{showAuctionLink && (
|
||||
{showAuctionLink && hasTeamProgress && (
|
||||
<div className="flex justify-end">
|
||||
<Btn
|
||||
to={`/match/${match.id}/auction`}
|
||||
variant="primary"
|
||||
variant="secondary"
|
||||
>
|
||||
경매 페이지 열기
|
||||
경매 기록 보기
|
||||
</Btn>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { ChevronLeft, ChevronRight } from "lucide-react";
|
||||
import { Link, useLocation, useParams } from "react-router";
|
||||
import { Link, useLocation, useNavigate, useParams } from "react-router";
|
||||
import {
|
||||
Area,
|
||||
AreaChart,
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
XAxis,
|
||||
YAxis,
|
||||
} from "recharts";
|
||||
import { useDdragonManifest, useInternalMatchDetail } from "../api/hooks";
|
||||
import { useCompetition, useDdragonManifest, useInternalMatchDetail } from "../api/hooks";
|
||||
import type { ApiInternalMatchDetailResponse, TeamSide } from "../api/types";
|
||||
import { DEFAULT_COMMUNITY_ID } from "../config";
|
||||
import {
|
||||
@@ -30,6 +30,8 @@ import {
|
||||
internalMatchGamePath,
|
||||
} from "../lib/internal-match-routes";
|
||||
import { selectInternalMatchGame } from "../lib/internal-match-game-selection";
|
||||
import { groupRecordedSets, type RecordedSeries } from "../lib/internal-match-series";
|
||||
import { getSeriesHistoryResultLabel, shouldDisplaySeriesHistoryScore } from "../components/competition/competition-series-history";
|
||||
import { LANE_LABELS } from "../lib/riot-history";
|
||||
import {
|
||||
filterTimelineEvents,
|
||||
@@ -241,18 +243,6 @@ function getTeamName(
|
||||
);
|
||||
}
|
||||
|
||||
function resolveSelectedSeries(
|
||||
detail: ApiInternalMatchDetailResponse,
|
||||
selectedGame: MatchGameDetail,
|
||||
) {
|
||||
const teamIndexes = selectedGame.teams.map((team) => team.teamIndex);
|
||||
return detail.match.seriesResults.find(
|
||||
(series) =>
|
||||
teamIndexes.includes(series.teamAIndex) &&
|
||||
teamIndexes.includes(series.teamBIndex),
|
||||
);
|
||||
}
|
||||
|
||||
function WinBadge({ win }: { win: boolean }) {
|
||||
return win ? (
|
||||
<span className="inline-flex items-center border border-accent/60 bg-accent px-2 py-0.5 text-xs font-black text-accent-content">
|
||||
@@ -1514,21 +1504,27 @@ function ScoreboardTables({
|
||||
|
||||
function GameTabs({
|
||||
detail,
|
||||
groups,
|
||||
group,
|
||||
communityId,
|
||||
currentGameNumber,
|
||||
navigationState,
|
||||
}: {
|
||||
detail: ApiInternalMatchDetailResponse;
|
||||
groups: RecordedSeries[];
|
||||
group: RecordedSeries;
|
||||
communityId: string;
|
||||
currentGameNumber: number;
|
||||
navigationState: MatchGameNavigationState | undefined;
|
||||
}) {
|
||||
const navigate = useNavigate();
|
||||
const currentRef = useRef<HTMLAnchorElement | null>(null);
|
||||
const currentIndex = detail.games.findIndex(
|
||||
const games = group.sets.map(({ game }) => game);
|
||||
const currentIndex = games.findIndex(
|
||||
(game) => game.gameNumber === currentGameNumber,
|
||||
);
|
||||
const previousGame = detail.games[currentIndex - 1];
|
||||
const nextGame = detail.games[currentIndex + 1];
|
||||
const previousGame = games[currentIndex - 1];
|
||||
const nextGame = games[currentIndex + 1];
|
||||
const pathFor = (gameNumber: number) =>
|
||||
internalMatchGamePath(communityId, detail.match.matchId, gameNumber);
|
||||
|
||||
@@ -1541,9 +1537,25 @@ function GameTabs({
|
||||
|
||||
return (
|
||||
<nav
|
||||
className="lts-panel sticky top-[60px] z-30 flex items-center gap-1 p-1"
|
||||
className="lts-panel sticky top-(--app-header-height) z-30 p-1"
|
||||
aria-label="세트 선택"
|
||||
>
|
||||
<label className="flex min-w-0 items-center gap-2 border-b border-line px-2 py-1.5 text-xs font-semibold text-content-muted">
|
||||
<span className="shrink-0">대진</span>
|
||||
<select
|
||||
className="lts-select min-w-0"
|
||||
value={group.id}
|
||||
onChange={(event) => {
|
||||
const next = groups.find((candidate) => candidate.id === event.target.value);
|
||||
if (next) void navigate(pathFor(next.sets[0].game.gameNumber), { state: navigationState });
|
||||
}}
|
||||
>
|
||||
{groups.map((candidate) => (
|
||||
<option key={candidate.id} value={candidate.id}>{candidate.label}</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<div className="flex items-center gap-1">
|
||||
<Link
|
||||
to={previousGame ? pathFor(previousGame.gameNumber) : "#"}
|
||||
state={navigationState}
|
||||
@@ -1555,7 +1567,7 @@ function GameTabs({
|
||||
<ChevronLeft className="size-4" aria-hidden="true" />
|
||||
</Link>
|
||||
<div className="no-scrollbar flex min-w-0 flex-1 gap-1 overflow-x-auto">
|
||||
{detail.games.map((game) => {
|
||||
{group.sets.map(({ game, official }) => {
|
||||
const winnerTeam = game.teams.find((team) => team.win);
|
||||
const active = game.gameNumber === currentGameNumber;
|
||||
return (
|
||||
@@ -1571,7 +1583,12 @@ function GameTabs({
|
||||
: "text-content-muted hover:bg-sunken hover:text-content"
|
||||
}`}
|
||||
>
|
||||
<span className="font-bold">{game.gameNumber}세트</span>
|
||||
<span className="font-bold">
|
||||
{official ? `${official.ordinal}세트` : `전체 ${game.gameNumber}세트`}
|
||||
</span>
|
||||
{official && official.ordinal !== game.gameNumber && (
|
||||
<span className="text-xs opacity-80">전체 {game.gameNumber}</span>
|
||||
)}
|
||||
<span
|
||||
className={`max-w-28 truncate text-xs ${active ? "opacity-80" : "text-content-subtle"}`}
|
||||
>
|
||||
@@ -1593,6 +1610,7 @@ function GameTabs({
|
||||
>
|
||||
<ChevronRight className="size-4" aria-hidden="true" />
|
||||
</Link>
|
||||
</div>
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
@@ -1600,22 +1618,25 @@ function GameTabs({
|
||||
function MatchScoreHero({
|
||||
detail,
|
||||
selectedGame,
|
||||
group,
|
||||
backTarget,
|
||||
}: {
|
||||
detail: ApiInternalMatchDetailResponse;
|
||||
selectedGame: MatchGameDetail;
|
||||
group: RecordedSeries;
|
||||
backTarget: MatchGameBackTarget;
|
||||
}) {
|
||||
const selectedSeries = resolveSelectedSeries(detail, selectedGame);
|
||||
const selectedSeries = group.series;
|
||||
const officialGame = group.sets.find(({ game }) => game === selectedGame)?.official;
|
||||
const setLabel = officialGame ? `${officialGame.ordinal}세트` : `전체 ${selectedGame.gameNumber}세트`;
|
||||
const [leftTeam, rightTeam] = selectedGame.teams;
|
||||
const leftScore =
|
||||
selectedSeries?.teamAIndex === leftTeam?.teamIndex
|
||||
? selectedSeries?.teamAWins
|
||||
: selectedSeries?.teamBWins;
|
||||
const rightScore =
|
||||
selectedSeries?.teamBIndex === rightTeam?.teamIndex
|
||||
? selectedSeries?.teamBWins
|
||||
: selectedSeries?.teamAWins;
|
||||
const getScore = (side: TeamSide) => selectedSeries?.entries.find(
|
||||
(entry) => entry.teamId === officialGame?.teams[side].teamId,
|
||||
)?.gameWins;
|
||||
const leftScore = leftTeam && getScore(leftTeam.side);
|
||||
const rightScore = rightTeam && getScore(rightTeam.side);
|
||||
const showSeriesScore = selectedSeries && shouldDisplaySeriesHistoryScore(selectedSeries) && leftScore !== undefined && rightScore !== undefined;
|
||||
const decision = selectedSeries?.status === "completed" ? getSeriesHistoryResultLabel(selectedSeries) : null;
|
||||
const sideTone = (side: TeamSide) =>
|
||||
side === "blue" ? "text-[#8fb6ff]" : "text-[#ff99a5]";
|
||||
|
||||
@@ -1624,19 +1645,25 @@ function MatchScoreHero({
|
||||
width="xl"
|
||||
crumbs={[
|
||||
{ label: backTarget.label, to: backTarget.to },
|
||||
{ label: `${selectedGame.gameNumber}세트` },
|
||||
{ label: setLabel },
|
||||
]}
|
||||
title={
|
||||
<>
|
||||
{detail.match.title}
|
||||
<span className="ml-2 text-on-ink-muted">
|
||||
{selectedGame.gameNumber}세트
|
||||
{setLabel}
|
||||
</span>
|
||||
</>
|
||||
}
|
||||
meta={
|
||||
<>
|
||||
<span>{formatDateTime(selectedGame.gameCreation)}</span>
|
||||
{officialGame && officialGame.ordinal !== selectedGame.gameNumber && (
|
||||
<>
|
||||
<MetaDot />
|
||||
<span>전체 {selectedGame.gameNumber}세트</span>
|
||||
</>
|
||||
)}
|
||||
<MetaDot />
|
||||
<span className="tabular">
|
||||
{formatDuration(selectedGame.gameDuration)}
|
||||
@@ -1662,14 +1689,16 @@ function MatchScoreHero({
|
||||
</div>
|
||||
</div>
|
||||
<div className="text-center">
|
||||
<div className="tabular flex items-baseline gap-2.5 text-4xl font-extrabold">
|
||||
<span>{leftScore ?? (leftTeam.win ? 1 : 0)}</span>
|
||||
<span className="text-xl text-on-ink-muted">:</span>
|
||||
<span>{rightScore ?? (rightTeam.win ? 1 : 0)}</span>
|
||||
</div>
|
||||
<div className="mt-0.5 text-[11px] font-semibold text-on-ink-muted">
|
||||
시리즈 스코어
|
||||
</div>
|
||||
{showSeriesScore ? (
|
||||
<>
|
||||
<div className="tabular text-4xl font-extrabold">{leftScore} : {rightScore}</div>
|
||||
<div className="mt-0.5 text-xs font-semibold text-on-ink-muted">
|
||||
{selectedSeries.status === "in-progress" ? "시리즈 진행 스코어" : "시리즈 스코어"}
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<div className="text-sm font-semibold text-on-ink-muted">{decision ?? "세트 결과"}</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="min-w-0">
|
||||
<div
|
||||
@@ -1700,6 +1729,7 @@ export default function MatchGameDetailPage() {
|
||||
const resolvedMatchId = matchId ?? id;
|
||||
const requestedGameNumber = Number(gameNumber);
|
||||
const detailQuery = useInternalMatchDetail(resolvedMatchId, communityId);
|
||||
const competition = useCompetition(resolvedMatchId, communityId);
|
||||
const { data: ddragon } = useDdragonManifest();
|
||||
const detail = detailQuery.data;
|
||||
const fallbackBackTo = resolvedMatchId
|
||||
@@ -1732,7 +1762,9 @@ export default function MatchGameDetailPage() {
|
||||
requestedGameNumber,
|
||||
);
|
||||
|
||||
if (!selectedGame) {
|
||||
const groups = groupRecordedSets(detail, competition.data);
|
||||
const group = groups.find(({ sets }) => sets.some(({ game }) => game === selectedGame));
|
||||
if (!selectedGame || !group) {
|
||||
const hasRecordedGames = detail.games.length > 0;
|
||||
const requestedGameLabel =
|
||||
Number.isSafeInteger(requestedGameNumber) && requestedGameNumber > 0
|
||||
@@ -1762,11 +1794,14 @@ export default function MatchGameDetailPage() {
|
||||
<MatchScoreHero
|
||||
detail={detail}
|
||||
selectedGame={selectedGame}
|
||||
group={group}
|
||||
backTarget={backTarget}
|
||||
/>
|
||||
<PageBody width="xl">
|
||||
<GameTabs
|
||||
detail={detail}
|
||||
groups={groups}
|
||||
group={group}
|
||||
communityId={communityId}
|
||||
currentGameNumber={selectedGame.gameNumber}
|
||||
navigationState={navigationState}
|
||||
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
sortTeamMembersForRoster,
|
||||
} from "./match-team-progress-view";
|
||||
|
||||
import { PageBody, PageHero } from "../ui";
|
||||
import { PageBody, PageHero, PlainPage } from "../ui";
|
||||
export default function MatchTeamProgressPage() {
|
||||
const { id } = useParams();
|
||||
const [searchParams] = useSearchParams();
|
||||
@@ -187,6 +187,7 @@ export default function MatchTeamProgressPage() {
|
||||
</span>
|
||||
}
|
||||
meta="다음 상대와 세트별 토너먼트 코드를 한곳에서 확인할 수 있습니다."
|
||||
flush
|
||||
actions={
|
||||
<Link
|
||||
to={`/match/${id}/team?select=1`}
|
||||
@@ -197,9 +198,9 @@ export default function MatchTeamProgressPage() {
|
||||
</Link>
|
||||
}
|
||||
/>
|
||||
<PageBody>
|
||||
|
||||
<section className="mb-8" aria-labelledby="active-series-heading">
|
||||
<PlainPage>
|
||||
<div className={team ? "mb-8 grid items-start gap-6 lg:grid-cols-[minmax(0,1.6fr)_minmax(0,1fr)]" : "mb-8"}>
|
||||
<section aria-labelledby="active-series-heading">
|
||||
<SectionHeading
|
||||
id="active-series-heading"
|
||||
title="다음 경기"
|
||||
@@ -229,16 +230,22 @@ export default function MatchTeamProgressPage() {
|
||||
) : (
|
||||
<EmptyState message="현재 준비하거나 진행할 대진이 없습니다." />
|
||||
)}
|
||||
<Link
|
||||
to={`/match/${id}?tab=bracket`}
|
||||
className="mt-3 inline-flex min-h-10 items-center text-sm font-semibold text-primary hover:underline"
|
||||
>
|
||||
전체 대진표 보기
|
||||
</Link>
|
||||
</section>
|
||||
|
||||
{team && (
|
||||
<section className="mb-8" aria-labelledby="roster-heading">
|
||||
<section aria-labelledby="roster-heading">
|
||||
<SectionHeading
|
||||
id="roster-heading"
|
||||
title="팀 구성"
|
||||
description={`${team.members.length}명의 라인업을 포지션 순서로 보여줍니다.`}
|
||||
/>
|
||||
<ul className="divide-y divide-base-content/10 border border-base-content/10 bg-base-100">
|
||||
<ul className="lts-panel divide-y divide-line">
|
||||
{sortTeamMembersForRoster(team.members).map((member) => (
|
||||
<li
|
||||
key={member.userId}
|
||||
@@ -264,6 +271,7 @@ export default function MatchTeamProgressPage() {
|
||||
</ul>
|
||||
</section>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<section className="mb-6" aria-labelledby="completed-heading">
|
||||
<SectionHeading
|
||||
@@ -311,7 +319,7 @@ export default function MatchTeamProgressPage() {
|
||||
<EmptyState message="아직 종료된 대진이 없습니다." />
|
||||
)}
|
||||
</section>
|
||||
</PageBody>
|
||||
</PlainPage>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -411,55 +411,6 @@ function ItemGrid({
|
||||
);
|
||||
}
|
||||
|
||||
function TeamMini({
|
||||
match,
|
||||
manifest,
|
||||
ownerParticipantId,
|
||||
}: {
|
||||
match: ApiRecentMatchView;
|
||||
manifest: DdragonManifest | null | undefined;
|
||||
ownerParticipantId: string;
|
||||
}) {
|
||||
return (
|
||||
<div className="grid flex-1 grid-cols-2 gap-x-3 text-[10px] leading-tight min-w-0">
|
||||
{match.teams.map((team) => (
|
||||
<div key={`${match.matchId}-${team.side}`} className="min-w-0">
|
||||
{team.participants.map((participant) => {
|
||||
const championName =
|
||||
championDisplayName(manifest, participant.championId) ??
|
||||
String(participant.championId);
|
||||
const isOwner = participant.puuid === ownerParticipantId;
|
||||
return (
|
||||
<div
|
||||
key={`${participant.puuid}-${participant.championId}`}
|
||||
className="flex items-center gap-1 min-w-0"
|
||||
>
|
||||
<ChampionIcon
|
||||
championId={participant.championId}
|
||||
manifest={manifest}
|
||||
size="xs"
|
||||
className={
|
||||
isOwner ? "ring-1 ring-primary ring-inset" : undefined
|
||||
}
|
||||
/>
|
||||
<span
|
||||
className={`truncate ${
|
||||
isOwner
|
||||
? "font-bold text-base-content/80"
|
||||
: "text-base-content/40"
|
||||
}`}
|
||||
>
|
||||
{participant.gameName || championName}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
type MatchDetailScales = {
|
||||
maxDamage: number;
|
||||
};
|
||||
@@ -884,146 +835,56 @@ function RecentMatchCard({
|
||||
loss: "border-loss-line bg-loss-tint",
|
||||
remake: "border-line bg-card",
|
||||
}[outcome];
|
||||
const bar = { win: "bg-win", loss: "bg-loss", remake: "bg-content-disabled" }[
|
||||
outcome
|
||||
];
|
||||
const bar = { win: "bg-win", loss: "bg-loss", remake: "bg-content-disabled" }[outcome];
|
||||
const resultClass = {
|
||||
win: "text-win",
|
||||
loss: "text-loss",
|
||||
remake: "text-content-muted",
|
||||
}[outcome];
|
||||
const toggleSurface = {
|
||||
win: "lg:bg-win/15 lg:text-win",
|
||||
loss: "lg:bg-loss/15 lg:text-loss",
|
||||
remake: "lg:bg-sunken-strong",
|
||||
}[outcome];
|
||||
|
||||
return (
|
||||
<article
|
||||
className={`relative overflow-hidden rounded-box border ${surface}`}
|
||||
>
|
||||
<span aria-hidden="true" className={`absolute inset-y-0 left-0 w-1.5 ${bar}`} />
|
||||
<div className="grid items-center gap-3 py-3 pl-5 pr-3 lg:grid-cols-[112px_1fr_120px_1.5fr_36px] lg:pr-0">
|
||||
<div className="text-center lg:text-left">
|
||||
<div className={`text-sm font-extrabold ${resultClass}`}>
|
||||
{match.remake ? "다시하기" : match.win ? "승리" : "패배"}
|
||||
</div>
|
||||
<div className="text-xs font-bold text-base-content/45 mt-1">
|
||||
{match.queueLabel}
|
||||
</div>
|
||||
<div className="mt-1 text-xs text-base-content/25">
|
||||
{formatDate(match.gameCreation)}
|
||||
</div>
|
||||
<div className="text-xs text-base-content/25">
|
||||
{formatDuration(match.gameDuration)}
|
||||
</div>
|
||||
<article className={`relative overflow-hidden rounded-box border ${surface}`}>
|
||||
<span aria-hidden="true" className={`absolute inset-y-0 left-0 w-1 ${bar}`} />
|
||||
<div className="grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-2 py-3 pl-4 pr-2 sm:grid-cols-[minmax(0,1fr)_auto_auto] sm:gap-x-5 sm:px-5">
|
||||
<div className="col-span-2 flex flex-wrap items-baseline gap-x-2 text-xs text-content-muted sm:col-span-3">
|
||||
<strong className={`text-sm ${resultClass}`}>{match.remake ? "다시하기" : match.win ? "승리" : "패배"}</strong>
|
||||
<span>{formatDate(match.gameCreation)} · {match.queueLabel}</span>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2 min-w-0">
|
||||
<ChampionIcon
|
||||
championId={match.championId}
|
||||
manifest={manifest}
|
||||
size="lg"
|
||||
/>
|
||||
<LoadoutIcons
|
||||
summonerSpells={match.summonerSpells}
|
||||
perks={match.perks}
|
||||
manifest={manifest}
|
||||
/>
|
||||
<div className="flex min-w-0 items-center gap-2">
|
||||
<ChampionIcon championId={match.championId} manifest={manifest} />
|
||||
<div className="min-w-0">
|
||||
<div className="font-bold text-base-content truncate">
|
||||
{championName}
|
||||
</div>
|
||||
<div className="text-xs text-base-content/35">
|
||||
Lv.{match.championLevel} ·{" "}
|
||||
{(LANE_LABELS[match.teamPosition] ?? match.teamPosition) ||
|
||||
"포지션 없음"}
|
||||
<div className="truncate font-bold text-content" title={championName}>{championName}</div>
|
||||
<div className="text-xs text-content-muted">
|
||||
{LANE_LABELS[match.teamPosition] ?? (match.teamPosition || "포지션 미확인")}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="text-center">
|
||||
<div className="text-lg font-bold tabular-nums">
|
||||
<span>{match.kills}</span>
|
||||
<span className="text-base-content/25"> / </span>
|
||||
<span className="text-loss">{match.deaths}</span>
|
||||
<span className="text-base-content/25"> / </span>
|
||||
<span>{match.assists}</span>
|
||||
</div>
|
||||
<div
|
||||
className={`text-xs font-bold tabular-nums ${kdaClass(match.kda)}`}
|
||||
>
|
||||
{match.deaths === 0 ? "Perfect" : `${match.kda} KDA`}
|
||||
</div>
|
||||
<div className="mt-1 text-xs text-base-content/35">
|
||||
킬 관여 {match.killParticipation}%
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid sm:grid-cols-[100px_1fr] gap-3 items-center min-w-0">
|
||||
<div className="space-y-1 text-xs text-base-content/45">
|
||||
<div>
|
||||
CS{" "}
|
||||
<span className="font-bold text-base-content/70">
|
||||
{match.totalCs}
|
||||
</span>{" "}
|
||||
({match.csPerMin}/m)
|
||||
</div>
|
||||
<div>
|
||||
시야{" "}
|
||||
<span className="font-bold text-base-content/70">
|
||||
{match.visionScore}
|
||||
</span>{" "}
|
||||
제어와드 {match.controlWardsBought}
|
||||
</div>
|
||||
<div>
|
||||
피해량{" "}
|
||||
<span className="font-bold text-base-content/70">
|
||||
{match.damageDealtToChampions.toLocaleString()}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-start gap-3 min-w-0">
|
||||
<ItemGrid
|
||||
items={match.items}
|
||||
trinket={match.trinket}
|
||||
manifest={manifest}
|
||||
itemKey={match.matchId}
|
||||
/>
|
||||
<TeamMini
|
||||
match={match}
|
||||
manifest={manifest}
|
||||
ownerParticipantId={ownerParticipantId}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-end lg:-my-3 lg:self-stretch">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setExpanded((current) => !current)}
|
||||
className={`flex h-10 w-full items-center justify-center gap-1 rounded-field border border-line-strong bg-card text-content-muted transition-colors hover:text-content sm:w-auto sm:px-3 lg:h-full lg:w-9 lg:rounded-none lg:border-0 lg:px-0 ${toggleSurface}`}
|
||||
aria-expanded={expanded}
|
||||
aria-label={expanded ? "상세 전적 접기" : "상세 전적 펼치기"}
|
||||
>
|
||||
<span className="text-xs font-bold lg:hidden">
|
||||
{expanded ? "상세 접기" : "상세 보기"}
|
||||
</span>
|
||||
{expanded ? (
|
||||
<ChevronUp className="h-4 w-4" aria-hidden="true" />
|
||||
) : (
|
||||
<ChevronDown className="h-4 w-4" aria-hidden="true" />
|
||||
)}
|
||||
</button>
|
||||
<div className="tabular whitespace-nowrap text-right">
|
||||
<strong className="text-sm sm:text-base">{match.kills} / {match.deaths} / {match.assists}</strong>
|
||||
<div className="text-xs text-content-muted">{match.deaths === 0 ? "Perfect" : `${match.kda} KDA`}</div>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setExpanded((current) => !current)}
|
||||
className="col-span-2 flex min-h-9 items-center justify-end gap-1 rounded-field px-2 text-xs font-semibold text-content-muted hover:text-content focus-visible:-outline-offset-2 sm:col-span-1"
|
||||
aria-expanded={expanded}
|
||||
aria-label={expanded ? "상세 전적 접기" : "상세 전적 펼치기"}
|
||||
>
|
||||
{expanded ? "상세 접기" : "상세 보기"}
|
||||
{expanded ? <ChevronUp className="size-4" aria-hidden="true" /> : <ChevronDown className="size-4" aria-hidden="true" />}
|
||||
</button>
|
||||
</div>
|
||||
{expanded && (
|
||||
<div className="border-t border-line bg-card">
|
||||
<MatchDetailTabs
|
||||
match={match}
|
||||
manifest={manifest}
|
||||
ownerParticipantId={ownerParticipantId}
|
||||
/>
|
||||
<div className="flex flex-wrap items-center gap-x-4 gap-y-2 border-b border-line px-4 py-3 text-xs text-content-muted">
|
||||
<LoadoutIcons summonerSpells={match.summonerSpells} perks={match.perks} manifest={manifest} />
|
||||
<span>Lv.{match.championLevel} · {formatDuration(match.gameDuration)}</span>
|
||||
<span>킬 관여 {match.killParticipation}%</span>
|
||||
<span>CS {match.totalCs} ({match.csPerMin}/분)</span>
|
||||
<span>시야 {match.visionScore} · 제어와드 {match.controlWardsBought}</span>
|
||||
<span>챔피언 피해량 {match.damageDealtToChampions.toLocaleString()}</span>
|
||||
</div>
|
||||
<MatchDetailTabs match={match} manifest={manifest} ownerParticipantId={ownerParticipantId} />
|
||||
</div>
|
||||
)}
|
||||
</article>
|
||||
@@ -1036,45 +897,14 @@ function SkeletonBlock({ className = "" }: { className?: string }) {
|
||||
|
||||
function MatchCardSkeleton() {
|
||||
return (
|
||||
<article className="border border-l-4 border-l-base-content/10 border-base-content/10 bg-base-100">
|
||||
<div className="grid items-center gap-3 p-3 lg:grid-cols-[120px_1fr_120px_1.5fr_40px]">
|
||||
<div className="space-y-1.5">
|
||||
<SkeletonBlock className="h-3.5 w-12" />
|
||||
<SkeletonBlock className="h-2.5 w-16" />
|
||||
<SkeletonBlock className="h-2.5 w-20" />
|
||||
</div>
|
||||
<article className="space-y-2 rounded-box border border-line bg-card p-4">
|
||||
<SkeletonBlock className="h-3 w-32" />
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<div className="flex items-center gap-2">
|
||||
<SkeletonBlock className="h-12 w-12" />
|
||||
<div className="grid grid-cols-2 gap-0.5">
|
||||
{Array.from({ length: 4 }).map((_, index) => (
|
||||
<SkeletonBlock key={index} className="h-5 w-5" />
|
||||
))}
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<SkeletonBlock className="h-3.5 w-24" />
|
||||
<SkeletonBlock className="h-2.5 w-16" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex flex-col items-center gap-1.5">
|
||||
<SkeletonBlock className="size-9 rounded-field" />
|
||||
<SkeletonBlock className="h-4 w-20" />
|
||||
<SkeletonBlock className="h-2.5 w-12" />
|
||||
</div>
|
||||
<div className="flex items-start gap-3">
|
||||
<div className="grid grid-cols-3 gap-1">
|
||||
{Array.from({ length: 6 }).map((_, index) => (
|
||||
<SkeletonBlock key={index} className="h-6 w-6" />
|
||||
))}
|
||||
</div>
|
||||
<SkeletonBlock className="h-6 w-6" />
|
||||
<div className="grid flex-1 grid-cols-2 gap-x-3 gap-y-1">
|
||||
{Array.from({ length: 10 }).map((_, index) => (
|
||||
<SkeletonBlock key={index} className="h-2.5 w-full" />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div className="hidden justify-end lg:flex">
|
||||
<SkeletonBlock className="h-8 w-8" />
|
||||
</div>
|
||||
<SkeletonBlock className="h-4 w-16" />
|
||||
</div>
|
||||
</article>
|
||||
);
|
||||
@@ -1422,7 +1252,7 @@ export default function UserHistoryPage() {
|
||||
</div>
|
||||
))}
|
||||
|
||||
<div className="lts-panel sticky top-[60px] z-30 p-1">
|
||||
<div className="lts-panel sticky top-(--app-header-height) z-30 p-1">
|
||||
<div
|
||||
className="no-scrollbar flex gap-1 overflow-x-auto"
|
||||
role="tablist"
|
||||
@@ -1442,70 +1272,64 @@ export default function UserHistoryPage() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-wrap items-center justify-between gap-3">
|
||||
{!isInternalQueue ? (
|
||||
<div
|
||||
className="flex flex-wrap gap-1.5"
|
||||
role="group"
|
||||
aria-label="큐 종류"
|
||||
>
|
||||
{RANK_FILTER_TABS.map((tab) => (
|
||||
<Chip
|
||||
key={tab.value}
|
||||
selected={rank === tab.value}
|
||||
onClick={() =>
|
||||
updateSearch({ rank: tab.value, championId: null })
|
||||
}
|
||||
>
|
||||
{tab.label}
|
||||
</Chip>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<p className="text-[13px] text-content-muted">
|
||||
토너먼트 코드로 수집한 내전 결과만 집계합니다.
|
||||
</p>
|
||||
)}
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
{selectedChampionName && (
|
||||
<Chip
|
||||
selected
|
||||
onClick={() => updateSearch({ championId: null })}
|
||||
aria-label={`${selectedChampionName} 필터 해제`}
|
||||
>
|
||||
{selectedChampionName}
|
||||
<X className="size-3.5" aria-hidden="true" />
|
||||
</Chip>
|
||||
)}
|
||||
{profile.seasons.length > 0 && (
|
||||
<select
|
||||
aria-label="시즌"
|
||||
value={filters.seasonId ?? profile.season.id}
|
||||
onChange={(event) =>
|
||||
updateSearch({
|
||||
seasonId: event.target.value,
|
||||
championId: null,
|
||||
})
|
||||
}
|
||||
className="lts-select !w-auto"
|
||||
>
|
||||
{profile.seasons.map((season) => (
|
||||
<option key={season.id} value={season.id}>
|
||||
{season.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{profile.tierHistory.length > 0 && !isInternalQueue && (
|
||||
<Suspense fallback={<div className="lts-panel h-[180px]" />}>
|
||||
<TierHistoryChart entries={profile.tierHistory} />
|
||||
</Suspense>
|
||||
)}
|
||||
|
||||
<Panel>
|
||||
<div className="flex flex-wrap items-center justify-between gap-3 border-b border-line px-4 py-3 sm:px-5">
|
||||
{!isInternalQueue ? (
|
||||
<div
|
||||
className="flex flex-wrap gap-1.5"
|
||||
role="group"
|
||||
aria-label="큐 종류"
|
||||
>
|
||||
{RANK_FILTER_TABS.map((tab) => (
|
||||
<Chip
|
||||
key={tab.value}
|
||||
selected={rank === tab.value}
|
||||
onClick={() =>
|
||||
updateSearch({ rank: tab.value, championId: null })
|
||||
}
|
||||
>
|
||||
{tab.label}
|
||||
</Chip>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<p className="text-[13px] text-content-muted">
|
||||
토너먼트 코드로 수집한 내전 결과만 집계합니다.
|
||||
</p>
|
||||
)}
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
{selectedChampionName && (
|
||||
<Chip
|
||||
selected
|
||||
onClick={() => updateSearch({ championId: null })}
|
||||
aria-label={`${selectedChampionName} 필터 해제`}
|
||||
>
|
||||
{selectedChampionName}
|
||||
<X className="size-3.5" aria-hidden="true" />
|
||||
</Chip>
|
||||
)}
|
||||
{profile.seasons.length > 0 && (
|
||||
<select
|
||||
aria-label="시즌"
|
||||
value={filters.seasonId ?? profile.season.id}
|
||||
onChange={(event) =>
|
||||
updateSearch({
|
||||
seasonId: event.target.value,
|
||||
championId: null,
|
||||
})
|
||||
}
|
||||
className="lts-select !w-auto"
|
||||
>
|
||||
{profile.seasons.map((season) => (
|
||||
<option key={season.id} value={season.id}>
|
||||
{season.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<PanelHeader
|
||||
title={`최근 ${summary?.windowSize ?? 20}게임 요약`}
|
||||
description={
|
||||
@@ -1587,6 +1411,15 @@ export default function UserHistoryPage() {
|
||||
</div>
|
||||
</Panel>
|
||||
|
||||
{profile.tierHistory.length > 0 && !isInternalQueue && (
|
||||
<details className="lts-panel">
|
||||
<summary className="cursor-pointer px-4 py-3 text-sm font-semibold">티어 그래프</summary>
|
||||
<Suspense fallback={<div className="h-[180px]" />}>
|
||||
<TierHistoryChart entries={profile.tierHistory} />
|
||||
</Suspense>
|
||||
</details>
|
||||
)}
|
||||
|
||||
<div
|
||||
className="flex items-center gap-1.5"
|
||||
role="tablist"
|
||||
|
||||
@@ -126,6 +126,7 @@ export default function LegacyImportPage() {
|
||||
const [windowStart, setWindowStart] = useState(toInputValue(DEFAULT_START));
|
||||
const [windowEnd, setWindowEnd] = useState('');
|
||||
const [message, setMessage] = useState<string | null>(null);
|
||||
const [memberSearch, setMemberSearch] = useState('');
|
||||
const [overrides, setOverrides] = useState<
|
||||
Record<string, MemberWindowOverride>
|
||||
>({});
|
||||
@@ -146,6 +147,10 @@ export default function LegacyImportPage() {
|
||||
const startMutation = useStartLegacyImport(communityId);
|
||||
const cancelMutation = useCancelLegacyImport(communityId);
|
||||
const members = membersQuery.data?.members ?? [];
|
||||
const memberSearchTerm = memberSearch.trim().toLowerCase();
|
||||
const filteredMembers = members.filter((member) =>
|
||||
`${member.displayName} ${member.gameName}#${member.tagLine}`.toLowerCase().includes(memberSearchTerm),
|
||||
);
|
||||
|
||||
const manageableMemberships =
|
||||
meQuery.data?.memberships.filter((membership) => {
|
||||
@@ -296,13 +301,23 @@ export default function LegacyImportPage() {
|
||||
)}
|
||||
</section>
|
||||
|
||||
<section className="border border-base-content/10 bg-base-100 overflow-hidden mb-6">
|
||||
<div className="px-4 py-3 border-b border-base-content/10">
|
||||
<h2 className="text-sm font-bold">멤버별 윈도우</h2>
|
||||
<p className="mt-1 text-xs text-base-content/35">
|
||||
<details className="lts-panel overflow-hidden mb-6">
|
||||
<summary className="cursor-pointer px-4 py-3 text-sm font-bold">
|
||||
멤버별 수집 기간 설정 · {members.length}명
|
||||
</summary>
|
||||
<div className="border-y border-line px-4 py-3">
|
||||
<p className="text-sm text-content-muted">
|
||||
기본 시작일은 2024-05-01이며, 필요하면 멤버별 시작/종료 시간을 조정할 수 있습니다.
|
||||
비활성 멤버는 종료일이 마지막 업데이트 시각으로 잡힙니다.
|
||||
</p>
|
||||
<input
|
||||
type="search"
|
||||
value={memberSearch}
|
||||
onChange={(event) => setMemberSearch(event.target.value)}
|
||||
aria-label="멤버 이름 또는 Riot ID 검색"
|
||||
placeholder="멤버 이름 또는 Riot ID 검색"
|
||||
className="lts-input mt-3 w-full sm:max-w-xs"
|
||||
/>
|
||||
</div>
|
||||
<div className="overflow-x-auto">
|
||||
<table className="lts-table min-w-[900px]">
|
||||
@@ -316,7 +331,7 @@ export default function LegacyImportPage() {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{members.map((member) => {
|
||||
{filteredMembers.map((member) => {
|
||||
const override =
|
||||
overrides[member.userId] ?? defaultMemberOverride(member);
|
||||
return (
|
||||
@@ -336,6 +351,7 @@ export default function LegacyImportPage() {
|
||||
<td className="px-3 py-2">
|
||||
<input
|
||||
type="datetime-local"
|
||||
aria-label={`${member.displayName} 수집 시작 시간`}
|
||||
value={override.startTime}
|
||||
onChange={(event) =>
|
||||
setOverrides((current) => {
|
||||
@@ -357,6 +373,7 @@ export default function LegacyImportPage() {
|
||||
<td className="px-3 py-2">
|
||||
<input
|
||||
type="datetime-local"
|
||||
aria-label={`${member.displayName} 수집 종료 시간`}
|
||||
value={override.endTime}
|
||||
onChange={(event) =>
|
||||
setOverrides((current) => {
|
||||
@@ -378,17 +395,17 @@ export default function LegacyImportPage() {
|
||||
</tr>
|
||||
);
|
||||
})}
|
||||
{members.length === 0 && (
|
||||
{filteredMembers.length === 0 && (
|
||||
<tr>
|
||||
<td colSpan={5} className="px-4 py-8 text-center text-sm text-base-content/35">
|
||||
Riot 계정이 있는 멤버가 없습니다.
|
||||
{memberSearchTerm ? '검색 조건에 맞는 멤버가 없습니다.' : 'Riot 계정이 있는 멤버가 없습니다.'}
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</details>
|
||||
|
||||
<section className="space-y-3">
|
||||
<h2 className="text-sm font-bold">작업 이력</h2>
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { useMemo, useState } from 'react';
|
||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import type {
|
||||
MatchDetailResponse,
|
||||
MatchGameMode,
|
||||
MatchLifecycleStatus,
|
||||
MatchScheduleItemView,
|
||||
} from '@lolympus/contracts';
|
||||
import { Link, useParams } from 'react-router';
|
||||
@@ -16,7 +17,7 @@ import {
|
||||
import type { MatchMutationRequest } from '../../api/types';
|
||||
import { DEFAULT_COMMUNITY_ID } from '../../config';
|
||||
|
||||
import { Btn } from "../../ui/Btn";
|
||||
import { Btn, Chip, ErrorNote, LoadingNote, Pill, type PillTone } from '../../ui';
|
||||
import { AdminNotice, AdminPage } from '../../components/AdminPage';
|
||||
const DEFAULT_FORM: MatchMutationRequest = {
|
||||
title: '',
|
||||
@@ -38,6 +39,24 @@ const GAME_MODE_LABEL: Record<MatchGameMode, string> = {
|
||||
'double-elimination': '더블 엘리미네이션',
|
||||
};
|
||||
|
||||
const MATCH_STATES = {
|
||||
recruiting: { label: '모집 중', tone: 'live' },
|
||||
'team-built': { label: '팀빌딩 완료', tone: 'gold' },
|
||||
'in-progress': { label: '진행 중', tone: 'accent' },
|
||||
finished: { label: '종료', tone: 'neutral' },
|
||||
} satisfies Record<MatchLifecycleStatus, { label: string; tone: PillTone }>;
|
||||
|
||||
const matchStatusFilters = Object.keys(MATCH_STATES) as MatchLifecycleStatus[];
|
||||
|
||||
function matchModeDetail(match: MatchDetailResponse) {
|
||||
if (match.gameMode === 'round-robin' && match.roundRobinMaxRounds) {
|
||||
return `최대 ${match.roundRobinMaxRounds}라운드`;
|
||||
}
|
||||
if (match.gameMode === 'double-elimination') {
|
||||
return match.doubleEliminationResetFinalEnabled ? '결승 리셋 허용' : '결승 리셋 없음';
|
||||
}
|
||||
}
|
||||
|
||||
function resolveRoundRobinFullRoundCount(maxParticipants?: number) {
|
||||
const teamCount = Math.floor(Number(maxParticipants ?? 10) / 5);
|
||||
if (teamCount < 2) return 0;
|
||||
@@ -147,7 +166,8 @@ export default function MatchAdminPage() {
|
||||
const communityId = cid ?? DEFAULT_COMMUNITY_ID;
|
||||
const queryClient = useQueryClient();
|
||||
const meQuery = useMe();
|
||||
const matchesQuery = useMatches({ limit: 200 }, communityId);
|
||||
const [statusFilter, setStatusFilter] = useState<MatchLifecycleStatus>();
|
||||
const matchesQuery = useMatches({ limit: 200, status: statusFilter }, communityId);
|
||||
const createMutation = useCreateMatch(communityId);
|
||||
const updateMutation = useUpdateMatch(communityId);
|
||||
const deleteMutation = useDeleteMatch(communityId);
|
||||
@@ -155,6 +175,11 @@ export default function MatchAdminPage() {
|
||||
const [showForm, setShowForm] = useState(false);
|
||||
const [form, setForm] = useState(makeForm());
|
||||
const [message, setMessage] = useState<string | null>(null);
|
||||
const formHeading = useRef<HTMLHeadingElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (showForm) formHeading.current?.focus();
|
||||
}, [showForm, editing]);
|
||||
|
||||
const currentUser =
|
||||
meQuery.data?.memberships.find(
|
||||
@@ -246,7 +271,34 @@ export default function MatchAdminPage() {
|
||||
createMutation.mutate(payload, callbacks);
|
||||
}
|
||||
|
||||
if (!canManage && !meQuery.isPending) {
|
||||
function matchActions(match: MatchDetailResponse) {
|
||||
return (
|
||||
<div className="flex flex-wrap gap-2">
|
||||
<Btn onClick={() => openEdit(match)} variant="secondary">수정</Btn>
|
||||
{match.status === 'recruiting' && (
|
||||
<Btn
|
||||
variant="destructive"
|
||||
disabled={deleteMutation.isPending}
|
||||
onClick={() => {
|
||||
if (!window.confirm('이 내전을 삭제할까요?')) return;
|
||||
deleteMutation.mutate(match._id, {
|
||||
onSuccess: invalidate,
|
||||
onError: (error) => setMessage(error instanceof Error ? error.message : '삭제 실패'),
|
||||
});
|
||||
}}
|
||||
>
|
||||
삭제
|
||||
</Btn>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (meQuery.isLoading) {
|
||||
return <AdminNotice title="권한 확인 중" />;
|
||||
}
|
||||
|
||||
if (!canManage) {
|
||||
return (
|
||||
<AdminNotice title="권한이 필요합니다">
|
||||
<p className="mt-2 text-sm text-base-content/40">
|
||||
@@ -262,8 +314,16 @@ export default function MatchAdminPage() {
|
||||
title="내전 관리"
|
||||
description="내전 생성, 모집 정원, 게임 모드와 공지 내용을 관리합니다."
|
||||
>
|
||||
<div className="mb-4 flex flex-wrap items-center justify-end gap-2">
|
||||
<Btn variant="primary" onClick={openCreate}>
|
||||
<div className="mb-4 flex flex-wrap items-center justify-between gap-3">
|
||||
<div className="flex flex-wrap gap-2" role="group" aria-label="내전 상태 필터">
|
||||
<Chip selected={!statusFilter} onClick={() => setStatusFilter(undefined)}>전체</Chip>
|
||||
{matchStatusFilters.map((status) => (
|
||||
<Chip key={status} selected={statusFilter === status} onClick={() => setStatusFilter(status)}>
|
||||
{MATCH_STATES[status].label}
|
||||
</Chip>
|
||||
))}
|
||||
</div>
|
||||
<Btn variant="primary" onClick={openCreate}>
|
||||
새 내전 만들기
|
||||
</Btn>
|
||||
</div>
|
||||
@@ -277,7 +337,7 @@ export default function MatchAdminPage() {
|
||||
{showForm && (
|
||||
<section className="mb-6 border border-base-content/10 bg-base-100 p-4">
|
||||
<div className="mb-4 flex items-center justify-between gap-3">
|
||||
<h2 className="text-sm font-bold">
|
||||
<h2 ref={formHeading} tabIndex={-1} className="scroll-mt-28 text-sm font-bold">
|
||||
{editing ? '내전 수정' : '새 내전'}
|
||||
</h2>
|
||||
<button
|
||||
@@ -484,9 +544,42 @@ export default function MatchAdminPage() {
|
||||
</section>
|
||||
)}
|
||||
|
||||
<section className="lts-panel overflow-hidden">
|
||||
<div className="overflow-x-auto">
|
||||
<table className="lts-table min-w-[900px]">
|
||||
{matchesQuery.isLoading ? (
|
||||
<LoadingNote label="내전 목록을 불러오는 중" />
|
||||
) : matchesQuery.isError ? (
|
||||
<ErrorNote title="내전 목록을 불러오지 못했습니다" action={<Btn onClick={() => void matchesQuery.refetch()}>다시 시도</Btn>} />
|
||||
) : matches.length === 0 ? (
|
||||
<p role="status" className="lts-panel p-6 text-center text-sm text-content-muted">
|
||||
{statusFilter ? '이 상태의 내전이 없습니다.' : '등록된 내전이 없습니다.'}
|
||||
</p>
|
||||
) : (
|
||||
<section className="lts-panel overflow-hidden" aria-label="내전 목록">
|
||||
<ul className="divide-y divide-line lg:hidden">
|
||||
{matches.map((match) => (
|
||||
<li key={match._id} className="space-y-2 px-4 py-3">
|
||||
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||
<Link to={`/match/${match._id}`} className="min-w-0 break-words text-sm font-bold hover:text-primary">
|
||||
{match.title}
|
||||
</Link>
|
||||
<Pill tone={MATCH_STATES[match.status].tone}>{MATCH_STATES[match.status].label}</Pill>
|
||||
</div>
|
||||
<p className="text-xs text-content-muted">
|
||||
{formatDate(match.scheduledAt)} · {match.participants.length}/{match.maxParticipants}명
|
||||
</p>
|
||||
<details className="text-sm">
|
||||
<summary className="cursor-pointer py-2 font-semibold">상세·관리</summary>
|
||||
<p className="mb-2 text-xs text-content-muted">
|
||||
{GAME_MODE_LABEL[match.gameMode ?? 'pair']}
|
||||
{matchModeDetail(match) && ` · ${matchModeDetail(match)}`}
|
||||
</p>
|
||||
{match.description && <p className="mb-3 break-words text-sm text-content-muted">{match.description}</p>}
|
||||
{matchActions(match)}
|
||||
</details>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<div className="hidden overflow-x-auto lg:block">
|
||||
<table className="lts-table">
|
||||
<thead>
|
||||
<tr className="bg-base-200/40 border-b border-base-content/10 text-xs uppercase tracking-wider text-base-content/35">
|
||||
<th className="px-3 py-2">시간</th>
|
||||
@@ -511,74 +604,24 @@ export default function MatchAdminPage() {
|
||||
{match.description || '-'}
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-3 py-2 text-xs">{match.status}</td>
|
||||
<td className="px-3 py-2 text-xs"><Pill tone={MATCH_STATES[match.status].tone}>{MATCH_STATES[match.status].label}</Pill></td>
|
||||
<td className="px-3 py-2 text-xs tabular-nums">
|
||||
{match.participants.length}/{match.maxParticipants}
|
||||
</td>
|
||||
<td className="px-3 py-2 text-xs">
|
||||
{GAME_MODE_LABEL[match.gameMode ?? 'pair']}
|
||||
{match.gameMode === 'round-robin' &&
|
||||
match.roundRobinMaxRounds && (
|
||||
<span className="block text-xs text-base-content/30">
|
||||
최대 {match.roundRobinMaxRounds}R
|
||||
</span>
|
||||
)}
|
||||
{match.gameMode === 'double-elimination' && (
|
||||
<span className="block text-xs text-base-content/30">
|
||||
GF 리셋{' '}
|
||||
{match.doubleEliminationResetFinalEnabled
|
||||
? '허용'
|
||||
: '없음'}
|
||||
</span>
|
||||
)}
|
||||
<span className="block text-xs text-content-muted">{matchModeDetail(match)}</span>
|
||||
</td>
|
||||
<td className="px-3 py-2 text-right">
|
||||
<div className="inline-flex gap-2">
|
||||
<button
|
||||
type="button"
|
||||
className="text-xs px-2 py-1 border border-base-content/10 text-base-content/50 hover:text-primary"
|
||||
onClick={() => openEdit(match)}
|
||||
>
|
||||
수정
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="text-xs px-2 py-1 border border-loss-line text-loss hover:bg-loss-tint"
|
||||
disabled={
|
||||
deleteMutation.isPending ||
|
||||
match.status !== 'recruiting'
|
||||
}
|
||||
title={
|
||||
match.status === 'recruiting'
|
||||
? '내전 삭제'
|
||||
: '팀 구성이 확정된 내전 기록은 삭제할 수 없습니다.'
|
||||
}
|
||||
onClick={() => {
|
||||
if (!window.confirm('이 내전을 삭제할까요?')) return;
|
||||
deleteMutation.mutate(match._id, {
|
||||
onSuccess: invalidate,
|
||||
onError: (error) =>
|
||||
setMessage(error instanceof Error ? error.message : '삭제 실패'),
|
||||
});
|
||||
}}
|
||||
>
|
||||
삭제
|
||||
</button>
|
||||
</div>
|
||||
<div className="inline-block">{matchActions(match)}</div>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
{matches.length === 0 && (
|
||||
<tr>
|
||||
<td colSpan={6} className="px-4 py-10 text-center text-sm text-base-content/35">
|
||||
등록된 내전이 없습니다.
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
</AdminPage>
|
||||
);
|
||||
}
|
||||
@@ -15,7 +15,7 @@ import type {
|
||||
} from '../../api/types';
|
||||
import { DEFAULT_COMMUNITY_ID } from '../../config';
|
||||
|
||||
import { Btn } from "../../ui/Btn";
|
||||
import { Btn, Chip, ErrorNote, LoadingNote } from '../../ui';
|
||||
import { AdminNotice, AdminPage } from '../../components/AdminPage';
|
||||
const STATES: TournamentCodeState[] = [
|
||||
'available',
|
||||
@@ -23,7 +23,16 @@ const STATES: TournamentCodeState[] = [
|
||||
'released',
|
||||
'used',
|
||||
'expired',
|
||||
'voided',
|
||||
];
|
||||
const STATE_LABELS: Record<TournamentCodeState, string> = {
|
||||
available: '사용 가능',
|
||||
reserved: '경기 배정',
|
||||
released: '배정 해제',
|
||||
used: '사용 완료',
|
||||
expired: '만료',
|
||||
voided: '폐기',
|
||||
};
|
||||
|
||||
function formatDate(value: string | undefined) {
|
||||
if (!value) return '-';
|
||||
@@ -186,22 +195,21 @@ export default function TournamentCodesPage() {
|
||||
description="외부에서 생성한 코드를 업로드하고, 매치에 자동 할당되는 풀을 관리합니다."
|
||||
>
|
||||
|
||||
<section className="grid sm:grid-cols-5 gap-3 mb-6">
|
||||
<div className="mb-4 flex flex-wrap gap-2" role="group" aria-label="토너먼트 코드 상태 필터">
|
||||
<Chip selected={stateFilter === ''} onClick={() => setStateFilter('')}>전체</Chip>
|
||||
{STATES.map((state) => (
|
||||
<div key={state} className="border border-base-content/10 bg-base-100 p-4">
|
||||
<div className="text-xs uppercase tracking-wider text-base-content/30">
|
||||
{state}
|
||||
</div>
|
||||
<div className="mt-2 text-2xl font-black tabular-nums">
|
||||
{counts?.[state] ?? 0}
|
||||
</div>
|
||||
</div>
|
||||
<Chip key={state} selected={stateFilter === state} onClick={() => setStateFilter(state)}>
|
||||
{STATE_LABELS[state]}
|
||||
{counts && <span className="tabular">{counts[state] ?? 0}</span>}
|
||||
</Chip>
|
||||
))}
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<section className="border border-base-content/10 bg-base-100 p-4 mb-6">
|
||||
<details className="lts-panel mb-4">
|
||||
<summary className="cursor-pointer px-4 py-3 text-sm font-bold">토너먼트 코드 일괄 등록</summary>
|
||||
<div className="border-t border-line p-4">
|
||||
<div className="flex items-center justify-between gap-3 mb-3">
|
||||
<h2 className="text-sm font-bold">Bulk 업로드</h2>
|
||||
<span className="text-sm font-semibold">입력 형식</span>
|
||||
<div className="flex gap-1">
|
||||
<button
|
||||
type="button"
|
||||
@@ -220,6 +228,7 @@ export default function TournamentCodesPage() {
|
||||
</div>
|
||||
</div>
|
||||
<textarea
|
||||
aria-label="등록할 토너먼트 코드"
|
||||
value={text}
|
||||
onChange={(event) => setText(event.target.value)}
|
||||
rows={7}
|
||||
@@ -238,26 +247,20 @@ export default function TournamentCodesPage() {
|
||||
>
|
||||
{uploadMutation.isPending ? '업로드 중...' : '업로드'}
|
||||
</Btn>
|
||||
{message && <span className="text-xs text-base-content/45">{message}</span>}
|
||||
{message && <span role="status" className="text-sm text-content-muted">{message}</span>}
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<section className="lts-panel overflow-hidden">
|
||||
<div className="px-4 py-3 border-b border-base-content/10 flex items-center justify-between gap-3">
|
||||
<h2 className="text-sm font-bold">코드 목록</h2>
|
||||
<select
|
||||
value={stateFilter}
|
||||
onChange={(event) => setStateFilter(event.target.value as TournamentCodeState | '')}
|
||||
className="lts-select"
|
||||
>
|
||||
<option value="">전체</option>
|
||||
{STATES.map((state) => (
|
||||
<option key={state} value={state}>
|
||||
{state}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
{listQuery.isLoading ? (
|
||||
<LoadingNote label="코드 목록을 불러오는 중" />
|
||||
) : listQuery.isError ? (
|
||||
<ErrorNote title="코드 목록을 불러오지 못했습니다" action={<Btn onClick={() => void listQuery.refetch()}>다시 시도</Btn>} />
|
||||
) : (
|
||||
<div className="overflow-x-auto">
|
||||
<table className="lts-table min-w-[900px]">
|
||||
<thead>
|
||||
@@ -276,7 +279,7 @@ export default function TournamentCodesPage() {
|
||||
<td className="px-3 py-2 font-mono text-xs font-bold">
|
||||
{code.code}
|
||||
</td>
|
||||
<td className="px-3 py-2 text-xs">{code.state}</td>
|
||||
<td className="px-3 py-2 text-xs">{STATE_LABELS[code.state]}</td>
|
||||
<td className="px-3 py-2 text-xs text-base-content/50">
|
||||
{formatDate(code.expiresAt)}
|
||||
</td>
|
||||
@@ -304,7 +307,7 @@ export default function TournamentCodesPage() {
|
||||
})
|
||||
}
|
||||
>
|
||||
available 환원
|
||||
사용 가능으로 복원
|
||||
</button>
|
||||
)}
|
||||
{code.state === 'available' && (
|
||||
@@ -337,6 +340,7 @@ export default function TournamentCodesPage() {
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
</AdminPage>
|
||||
);
|
||||
|
||||
@@ -369,6 +369,10 @@
|
||||
}
|
||||
|
||||
@media (min-width: 920px) {
|
||||
.auction-visual-preview .auction-team-summary {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.auction-visual-preview .auction-preview-grid {
|
||||
gap: var(--spacing-5);
|
||||
grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
import type { MatchDetailResponse } from '@lolympus/contracts';
|
||||
|
||||
const scheduleFormatter = new Intl.DateTimeFormat('ko-KR', {
|
||||
timeZone: 'Asia/Seoul',
|
||||
month: 'numeric',
|
||||
day: 'numeric',
|
||||
weekday: 'short',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
hourCycle: 'h23',
|
||||
});
|
||||
|
||||
export const HOME_MATCH_STATUS = {
|
||||
recruiting: '모집 중',
|
||||
'team-built': '팀빌딩',
|
||||
'in-progress': '진행 중',
|
||||
finished: '종료',
|
||||
} as const;
|
||||
|
||||
export function getHomeMatchSchedule(scheduledAt: string) {
|
||||
const value = new Date(scheduledAt);
|
||||
if (Number.isNaN(value.getTime())) return;
|
||||
|
||||
const { month, day, weekday, hour, minute } = Object.fromEntries(
|
||||
scheduleFormatter
|
||||
.formatToParts(value)
|
||||
.map(({ type, value }) => [type, value]),
|
||||
);
|
||||
const time = `${hour}:${minute}`;
|
||||
return {
|
||||
date: `${month}월 ${day}일 (${weekday})`,
|
||||
compact: `${month}/${day} (${weekday}) ${time}`,
|
||||
month,
|
||||
day,
|
||||
weekday,
|
||||
hour,
|
||||
minute,
|
||||
time,
|
||||
};
|
||||
}
|
||||
|
||||
export function getHistoryMatchTitle(
|
||||
title: string,
|
||||
schedule: ReturnType<typeof getHomeMatchSchedule>,
|
||||
) {
|
||||
if (!schedule) return title;
|
||||
|
||||
// Only shorten a generic date-based title when its entire date and time match the row.
|
||||
const generic =
|
||||
/^(\d{1,2})\/(\d{1,2})\s*\(([월화수목금토일])\)\s*(\d{1,2})(?:시(?:\s*(\d{1,2})분)?|:(\d{2}))\s*(정기\s*내전|내전)$/u.exec(
|
||||
title.trim(),
|
||||
);
|
||||
if (!generic) return title;
|
||||
const [, month, day, weekday, hour, minutes, colonMinutes, name] = generic;
|
||||
return Number(month) === Number(schedule.month) &&
|
||||
Number(day) === Number(schedule.day) &&
|
||||
weekday === schedule.weekday &&
|
||||
Number(hour) === Number(schedule.hour) &&
|
||||
Number(minutes ?? colonMinutes ?? 0) === Number(schedule.minute)
|
||||
? name
|
||||
: title;
|
||||
}
|
||||
|
||||
export function getHomeMatchEnrollment(
|
||||
match: Pick<
|
||||
MatchDetailResponse,
|
||||
'status' | 'joined' | 'participants' | 'maxParticipants'
|
||||
>,
|
||||
) {
|
||||
const current = match.participants.length;
|
||||
const remaining = match.maxParticipants - current;
|
||||
const isRecruiting = match.status === 'recruiting';
|
||||
const canApply = isRecruiting && remaining > 0 && !match.joined;
|
||||
const capacity =
|
||||
match.maxParticipants > 0
|
||||
? `${current}/${match.maxParticipants}명`
|
||||
: `${current}명`;
|
||||
const label =
|
||||
isRecruiting && match.joined
|
||||
? '참가 완료'
|
||||
: canApply
|
||||
? `${remaining}자리 남음`
|
||||
: '모집 마감';
|
||||
|
||||
return { canApply, capacity, label };
|
||||
}
|
||||
@@ -0,0 +1,416 @@
|
||||
import { ChevronDown, Search, X } from 'lucide-react';
|
||||
import { Link, useSearchParams } from 'react-router';
|
||||
import { DEFAULT_COMMUNITY_ID } from '../config';
|
||||
import { getHomeMatchSchedule } from '../pages/home-match-presentation';
|
||||
import { Chip, EmptyNote, pageWidthClass } from '../ui';
|
||||
import {
|
||||
previewSeasons,
|
||||
type PreviewMatch,
|
||||
type PreviewPlayer,
|
||||
} from './internal-stats-fixtures';
|
||||
|
||||
const formats = [
|
||||
{ value: '', label: '전체' },
|
||||
{ value: 'pair', label: '두 팀 내전' },
|
||||
{ value: 'tournament', label: '대회' },
|
||||
] as const;
|
||||
|
||||
function MatchResult({ result }: { result: PreviewMatch['result'] }) {
|
||||
switch (result.kind) {
|
||||
case 'series':
|
||||
return (
|
||||
<span className="flex flex-wrap items-center gap-x-2 text-sm">
|
||||
{result.series.teams[0]}
|
||||
<strong className="tabular rounded-field bg-sunken px-2 py-0.5 text-base">
|
||||
{result.series.score.join(' : ')}
|
||||
</strong>
|
||||
{result.series.teams[1]}
|
||||
</span>
|
||||
);
|
||||
case 'tournament':
|
||||
return (
|
||||
<span className="text-sm font-semibold">
|
||||
<span className="mr-2 text-xs font-medium text-content-muted">
|
||||
우승
|
||||
</span>
|
||||
{result.champion}
|
||||
</span>
|
||||
);
|
||||
case 'collecting':
|
||||
return (
|
||||
<span className="text-sm font-semibold text-content">
|
||||
결과 수집 중{' '}
|
||||
<span className="ml-1 font-normal text-content-muted">
|
||||
{result.recordedGames}세트
|
||||
</span>
|
||||
</span>
|
||||
);
|
||||
case 'unavailable':
|
||||
return <span className="text-sm text-content-muted">공식 결과 없음</span>;
|
||||
}
|
||||
}
|
||||
|
||||
function MatchDetails({ result }: { result: PreviewMatch['result'] }) {
|
||||
if (result.kind === 'collecting') {
|
||||
return (
|
||||
<p>
|
||||
수집된 {result.recordedGames}세트를 확인 중입니다. 순위와 우승팀은 대회
|
||||
결과가 확정되면 표시됩니다.
|
||||
</p>
|
||||
);
|
||||
}
|
||||
if (result.kind === 'unavailable') {
|
||||
return <p>내전 일정은 종료됐고 공식 결과가 등록되지 않았습니다.</p>;
|
||||
}
|
||||
|
||||
const series = result.kind === 'tournament' ? result.final : result.series;
|
||||
return (
|
||||
<>
|
||||
<p className="font-semibold text-content">
|
||||
{result.kind === 'tournament' ? '결승 시리즈' : '시리즈 결과'}
|
||||
<span className="tabular ml-2">
|
||||
{series.teams[0]} {series.score.join(' : ')} {series.teams[1]}
|
||||
</span>
|
||||
</p>
|
||||
<ol className="mt-2 divide-y divide-line">
|
||||
{series.games.map((game, index) => (
|
||||
<li
|
||||
key={index}
|
||||
className="tabular flex flex-wrap justify-between gap-x-4 py-2"
|
||||
>
|
||||
<span>
|
||||
{index + 1}세트 ·{' '}
|
||||
<strong className="font-semibold text-content">
|
||||
{game.winner} 승리
|
||||
</strong>
|
||||
</span>
|
||||
<span>{game.duration}</span>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function MatchRow({ match }: { match: PreviewMatch }) {
|
||||
const schedule = getHomeMatchSchedule(match.scheduledAt);
|
||||
return (
|
||||
<li>
|
||||
<details className="group">
|
||||
<summary className="grid cursor-pointer list-none grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-2 px-4 py-3.5 hover:bg-sunken focus-visible:-outline-offset-2 sm:grid-cols-[minmax(0,1fr)_minmax(0,auto)_auto] sm:px-5 [&::-webkit-details-marker]:hidden">
|
||||
<span className="min-w-0">
|
||||
<span className="tabular block text-xs text-content-muted">
|
||||
<time dateTime={match.scheduledAt}>{schedule?.compact}</time> ·{' '}
|
||||
{match.teamCount}팀
|
||||
</span>
|
||||
<strong className="mt-1 block break-words text-base font-semibold leading-snug">
|
||||
{match.title}
|
||||
</strong>
|
||||
</span>
|
||||
<span className="col-start-1 row-start-2 min-w-0 sm:col-start-2 sm:row-start-1">
|
||||
<MatchResult result={match.result} />
|
||||
</span>
|
||||
<ChevronDown
|
||||
className="col-start-2 row-span-2 row-start-1 size-4 text-content-muted transition-transform group-open:rotate-180 sm:col-start-3 sm:row-span-1"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</summary>
|
||||
<div className="border-t border-line bg-sunken px-4 py-3 text-sm text-content-muted sm:px-5">
|
||||
<MatchDetails result={match.result} />
|
||||
</div>
|
||||
</details>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
function Ranking({
|
||||
players,
|
||||
season,
|
||||
}: {
|
||||
players: (PreviewPlayer & { rank: number })[];
|
||||
season: string;
|
||||
}) {
|
||||
return (
|
||||
<table className="w-full table-fixed text-left text-sm">
|
||||
<colgroup>
|
||||
<col className="w-12" />
|
||||
<col />
|
||||
<col className="w-14" />
|
||||
<col className="w-18" />
|
||||
</colgroup>
|
||||
<thead className="bg-sunken text-xs text-content-muted">
|
||||
<tr>
|
||||
<th scope="col" className="py-2 pl-4 font-semibold">
|
||||
순위
|
||||
</th>
|
||||
<th scope="col" className="px-2 py-2 font-semibold">
|
||||
선수
|
||||
</th>
|
||||
<th scope="col" className="py-2 text-right font-semibold">
|
||||
세트
|
||||
</th>
|
||||
<th scope="col" className="py-2 pr-4 text-right font-semibold">
|
||||
승률
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-y divide-line">
|
||||
{players.map((player) => {
|
||||
const total = player.wins + player.losses;
|
||||
const search = new URLSearchParams({ season, player: player.id });
|
||||
return (
|
||||
<tr key={player.id} className="hover:bg-sunken">
|
||||
<td className="tabular py-3 pl-4 text-content-muted">
|
||||
{player.rank}
|
||||
</td>
|
||||
<td className="px-2 py-3">
|
||||
<Link
|
||||
to={`?${search}`}
|
||||
className="break-words font-semibold hover:underline"
|
||||
aria-label={`${player.name}#${player.tag} 참가 내전 보기`}
|
||||
>
|
||||
{player.name}
|
||||
<span className="font-normal text-content-muted">
|
||||
#{player.tag}
|
||||
</span>
|
||||
</Link>
|
||||
<p className="text-xs text-content-muted">{player.position}</p>
|
||||
</td>
|
||||
<td className="tabular py-3 text-right">{total}</td>
|
||||
<td className="tabular py-3 pr-4 text-right font-semibold">
|
||||
{Math.round((player.wins / total) * 100)}%
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
);
|
||||
}
|
||||
|
||||
function SeasonSummary({
|
||||
season,
|
||||
playerCount,
|
||||
sideWins,
|
||||
}: {
|
||||
season: string;
|
||||
playerCount: number;
|
||||
sideWins: [number, number];
|
||||
}) {
|
||||
const [blue, red] = sideWins;
|
||||
const total = blue + red;
|
||||
const blueShare = Math.round((blue / total) * 100);
|
||||
return (
|
||||
<aside
|
||||
className="self-start rounded-xl border border-line bg-card p-5"
|
||||
aria-labelledby="preview-season-heading"
|
||||
>
|
||||
<h2 id="preview-season-heading" className="text-base font-bold">
|
||||
시즌 요약
|
||||
</h2>
|
||||
<p className="mt-1 text-xs text-content-muted">{season} 시즌 전체</p>
|
||||
<dl className="tabular my-4 flex gap-6 border-b border-line pb-4 text-sm">
|
||||
<div>
|
||||
<dt className="text-xs text-content-muted">기록된 세트</dt>
|
||||
<dd className="text-xl font-bold">{total}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt className="text-xs text-content-muted">집계 선수</dt>
|
||||
<dd className="text-xl font-bold">{playerCount}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<p className="text-sm font-semibold">진영 승률</p>
|
||||
<div className="tabular mt-2 flex justify-between gap-2 text-xs font-semibold">
|
||||
<span>블루 {blueShare}%</span>
|
||||
<span>레드 {100 - blueShare}%</span>
|
||||
</div>
|
||||
<div
|
||||
aria-hidden="true"
|
||||
className="mt-2 flex h-1.5 gap-0.5 overflow-hidden rounded-full"
|
||||
>
|
||||
<div className="bg-win" style={{ width: `${blueShare}%` }} />
|
||||
<div className="flex-1 bg-loss" />
|
||||
</div>
|
||||
<p className="tabular mt-2 text-xs text-content-muted">
|
||||
승패가 기록된 {total}세트 기준
|
||||
</p>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
|
||||
export default function InternalStatsPreview() {
|
||||
const [params, setParams] = useSearchParams();
|
||||
const season = params.get('season') === '2025' ? '2025' : '2026';
|
||||
const view = params.get('view') === 'ranking' ? 'ranking' : 'matches';
|
||||
const data = previewSeasons[season];
|
||||
const query = params.get('q') ?? '';
|
||||
const keyword = query.trim().toLocaleLowerCase('ko-KR');
|
||||
const format =
|
||||
formats.find(({ value }) => value === params.get('format'))?.value ?? '';
|
||||
const player = data.players.find(({ id }) => id === params.get('player'));
|
||||
const matches = data.matches.filter((match) => {
|
||||
const matchFormat = match.teamCount === 2 ? 'pair' : 'tournament';
|
||||
return (
|
||||
(!format || matchFormat === format) &&
|
||||
(!player || match.playerIds.includes(player.id)) &&
|
||||
match.title.toLocaleLowerCase('ko-KR').includes(keyword)
|
||||
);
|
||||
});
|
||||
const players = data.players
|
||||
.map((entry, index) => ({ ...entry, rank: index + 1 }))
|
||||
.filter(({ name, tag }) =>
|
||||
`${name}#${tag}`.toLocaleLowerCase('ko-KR').includes(keyword),
|
||||
);
|
||||
const isRanking = view === 'ranking';
|
||||
const sectionTitle = isRanking ? '선수 순위' : '최근 내전';
|
||||
const count = isRanking ? players.length : matches.length;
|
||||
|
||||
function updateParam(key: string, value: string) {
|
||||
const next = new URLSearchParams(params);
|
||||
if (value) next.set(key, value);
|
||||
else next.delete(key);
|
||||
if (key === 'view' || key === 'season') {
|
||||
next.delete('q');
|
||||
next.delete('format');
|
||||
next.delete('player');
|
||||
}
|
||||
setParams(next, { replace: key === 'q', preventScrollReset: true });
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-[calc(100vh-var(--app-header-height))] bg-[#f9f9f9] dark:bg-body">
|
||||
<main className={`${pageWidthClass()} pb-12 pt-6 sm:pt-8`}>
|
||||
<header className="flex flex-wrap items-end justify-between gap-4">
|
||||
<div>
|
||||
<div className="flex flex-wrap items-center gap-2 text-xs font-semibold text-content-muted">
|
||||
<span className="rounded-full border border-line-strong bg-card px-2 py-0.5">
|
||||
목업 데이터
|
||||
</span>
|
||||
<Link
|
||||
to={`/communities/${DEFAULT_COMMUNITY_ID}/internal-stats`}
|
||||
className="hover:underline"
|
||||
>
|
||||
현재 전적 화면 보기
|
||||
</Link>
|
||||
</div>
|
||||
<h1 className="mt-2 text-2xl font-bold tracking-tight sm:text-[30px]">
|
||||
내전 전적
|
||||
</h1>
|
||||
<p className="mt-1 text-sm text-content-muted">
|
||||
최근 내전 결과와 시즌별 선수 순위
|
||||
</p>
|
||||
</div>
|
||||
<label className="flex items-center gap-2 text-sm font-semibold">
|
||||
시즌
|
||||
<select
|
||||
className="lts-select !w-auto"
|
||||
value={season}
|
||||
onChange={(event) => updateParam('season', event.target.value)}
|
||||
>
|
||||
<option value="2026">2026 시즌</option>
|
||||
<option value="2025">2025 시즌</option>
|
||||
</select>
|
||||
</label>
|
||||
</header>
|
||||
|
||||
<div className="mt-6 grid gap-5 lg:grid-cols-[minmax(0,1fr)_16rem]">
|
||||
<section
|
||||
aria-labelledby="preview-results-heading"
|
||||
className="min-w-0"
|
||||
>
|
||||
<div className="flex flex-wrap items-center justify-between gap-3">
|
||||
<div className="flex gap-1.5" role="group" aria-label="전적 보기">
|
||||
<Chip
|
||||
selected={!isRanking}
|
||||
onClick={() => updateParam('view', '')}
|
||||
>
|
||||
최근 내전
|
||||
</Chip>
|
||||
<Chip
|
||||
selected={isRanking}
|
||||
onClick={() => updateParam('view', 'ranking')}
|
||||
>
|
||||
선수 순위
|
||||
</Chip>
|
||||
</div>
|
||||
<label className="flex h-10 w-full items-center gap-2 rounded-full border border-line-strong bg-card px-3 text-content-muted focus-within:border-content-muted sm:w-60">
|
||||
<Search className="size-4 shrink-0" aria-hidden="true" />
|
||||
<input
|
||||
type="search"
|
||||
aria-label={isRanking ? '선수 검색' : '내전명 검색'}
|
||||
placeholder={
|
||||
isRanking ? '선수 이름 또는 이름#태그' : '내전명 검색'
|
||||
}
|
||||
value={query}
|
||||
onChange={(event) => updateParam('q', event.target.value)}
|
||||
className="min-w-0 flex-1 text-sm text-content focus-visible:outline-none"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div className="mt-4 overflow-hidden rounded-xl border border-line bg-card">
|
||||
<div className="flex flex-wrap items-center justify-between gap-2 border-b border-line px-4 py-3 sm:px-5">
|
||||
<h2
|
||||
id="preview-results-heading"
|
||||
className="text-base font-bold"
|
||||
>
|
||||
{sectionTitle}{' '}
|
||||
<span className="tabular ml-1 text-sm font-medium text-content-muted">
|
||||
{count}
|
||||
</span>
|
||||
</h2>
|
||||
{isRanking ? (
|
||||
<span className="text-xs text-content-muted">승률 순</span>
|
||||
) : (
|
||||
<div
|
||||
className="flex flex-wrap gap-1.5"
|
||||
role="group"
|
||||
aria-label="내전 유형"
|
||||
>
|
||||
{formats.map(({ value, label }) => (
|
||||
<Chip
|
||||
key={value}
|
||||
selected={format === value}
|
||||
onClick={() => updateParam('format', value)}
|
||||
>
|
||||
{label}
|
||||
</Chip>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{!isRanking && player && (
|
||||
<div className="border-b border-line px-4 py-2 sm:px-5">
|
||||
<Chip
|
||||
selected
|
||||
onClick={() => updateParam('player', '')}
|
||||
aria-label={`${player.name} 참가 내전 필터 해제`}
|
||||
>
|
||||
{player.name} 참가 내전{' '}
|
||||
<X className="size-3.5" aria-hidden="true" />
|
||||
</Chip>
|
||||
</div>
|
||||
)}
|
||||
{count === 0 ? (
|
||||
<EmptyNote size="sm" title="조건에 맞는 기록이 없습니다" />
|
||||
) : isRanking ? (
|
||||
<Ranking players={players} season={season} />
|
||||
) : (
|
||||
<ul className="divide-y divide-line">
|
||||
{matches.map((match) => (
|
||||
<MatchRow key={match.id} match={match} />
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
<SeasonSummary
|
||||
season={season}
|
||||
playerCount={data.players.length}
|
||||
sideWins={data.sideWins}
|
||||
/>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,292 @@
|
||||
import { useState, type ReactNode } from "react";
|
||||
import { Link, useSearchParams } from "react-router";
|
||||
import { Btn, Chip, Pill, pageWidthClass } from "../ui";
|
||||
import "./match-flows-preview.css";
|
||||
|
||||
const flows = [
|
||||
{ id: "signup", name: "참가 신청" },
|
||||
{ id: "auction", name: "경매" },
|
||||
{ id: "team", name: "팀 진행·대진" },
|
||||
{ id: "ops", name: "운영" },
|
||||
] as const;
|
||||
|
||||
const teams = [
|
||||
{ name: "별무리", points: 430, players: 3, open: "정글 · 서포터" },
|
||||
{ name: "여울", points: 520, players: 2, open: "탑 · 미드 · 원딜" },
|
||||
{ name: "밤편지", points: 370, players: 4, open: "원딜" },
|
||||
{ name: "서릿길", points: 480, players: 3, open: "탑 · 미드" },
|
||||
] as const;
|
||||
|
||||
const opsItems = [
|
||||
{ id: "code", type: "코드", title: "1세트 코드 발급 대기", context: "토요 내전 · 준결승 2경기", action: "예시 코드 발급", done: "발급됨", detail: "별무리와 여울의 1세트입니다. 발급되면 두 팀의 팀 진행 화면에 표시됩니다." },
|
||||
{ id: "result", type: "결과", title: "수집된 결과 확인", context: "수요 내전 · 결승 2세트", action: "예시 결과 확인 완료", done: "확인 완료", detail: "수집된 결과는 여울 승리입니다. 내전과 세트를 확인한 뒤 검토를 마칠 수 있습니다." },
|
||||
{ id: "import", type: "과거 기록", title: "중복 후보 2건 검토", context: "11월 1일~7일 · 수집 완료 18건", action: "예시 검토 완료", done: "검토 완료", detail: "같은 Riot 경기 ID가 이미 등록된 기록입니다. 두 기록을 비교한 뒤 정리하는 단계입니다." },
|
||||
] as const;
|
||||
|
||||
const headings = {
|
||||
signup: { label: "참가 신청", title: "토요 내전", detail: "11월 14일 (토) 21:00 · 소환사의 협곡 · 4팀" },
|
||||
auction: { label: "팀빌딩", title: "토요 내전 경매", detail: "현재 선수와 팀 포인트를 한 화면에서 확인하세요." },
|
||||
team: { label: "팀 진행", title: "별무리의 다음 경기", detail: "토요 내전 · 더블 엘리미네이션" },
|
||||
ops: { label: "운영", title: "확인할 작업", detail: "코드 발급, 결과 확인, 과거 기록 검토를 모았습니다." },
|
||||
} as const;
|
||||
|
||||
function Panel({ title, children }: { title: string; children: ReactNode }) {
|
||||
return (
|
||||
<section className="match-flows-panel min-w-0 border border-line bg-card">
|
||||
<h2 className="border-b border-line px-4 py-3.5 text-base font-bold sm:px-5">{title}</h2>
|
||||
<div className="px-4 py-4 sm:px-5">{children}</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
function PreviewControl({ label, children }: { label: string; children: ReactNode }) {
|
||||
return (
|
||||
<label className="flex flex-wrap items-center gap-2 text-sm font-medium text-content-muted">
|
||||
{label}
|
||||
{children}
|
||||
</label>
|
||||
);
|
||||
}
|
||||
|
||||
const selectClass = "min-h-10 max-w-full rounded-field border border-line-strong bg-card px-2.5 text-sm text-content";
|
||||
|
||||
function Signup() {
|
||||
const [full, setFull] = useState(false);
|
||||
const [position, setPosition] = useState("");
|
||||
const [entry, setEntry] = useState<"joined" | "waiting" | null>(null);
|
||||
const enrolled = full ? 20 : entry === "joined" ? 19 : 18;
|
||||
const positions = ["탑", "정글", "미드", "원딜", "서포터"];
|
||||
|
||||
return (
|
||||
<>
|
||||
<PreviewControl label="예시 모집 상태">
|
||||
<select className={selectClass} value={full ? "full" : "open"} onChange={(event) => {
|
||||
setFull(event.target.value === "full");
|
||||
setEntry(null);
|
||||
setPosition("");
|
||||
}}>
|
||||
<option value="open">자리 있음</option>
|
||||
<option value="full">정원 마감</option>
|
||||
</select>
|
||||
</PreviewControl>
|
||||
<div className="match-flows-grid grid gap-4">
|
||||
<Panel title="내 참가 상태">
|
||||
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||
<p role="status" className="text-lg font-bold">
|
||||
{entry === "joined" ? "참가 확정" : entry === "waiting" ? "대기 신청 완료" : full ? "현재 정원이 찼습니다" : "2자리 남았어요"}
|
||||
</p>
|
||||
<Pill tone={full ? "gold" : "live"}>{enrolled}/20명</Pill>
|
||||
</div>
|
||||
<progress className="match-flows-capacity mt-3 h-2 w-full" value={enrolled} max={20} aria-label="참가 정원" />
|
||||
{entry ? (
|
||||
<div className="mt-4 grid gap-3">
|
||||
<p className="text-sm text-content-muted">
|
||||
{entry === "joined" ? `희망 포지션은 ${position}입니다. 20:50까지 디스코드 대기실에 입장해 주세요.` : `희망 포지션은 ${position}입니다. 현재 대기 1번이며 빈자리가 생기면 순서대로 안내합니다.`}
|
||||
</p>
|
||||
<div><Btn variant="ghost" onClick={() => setEntry(null)}>신청 취소</Btn></div>
|
||||
</div>
|
||||
) : (
|
||||
<form className="mt-4 grid gap-4" onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
setEntry(full ? "waiting" : "joined");
|
||||
}}>
|
||||
<fieldset>
|
||||
<legend className="mb-2 text-sm font-semibold">희망 포지션</legend>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{positions.map((role) => (
|
||||
<label key={role} className="cursor-pointer">
|
||||
<input className="peer sr-only" type="radio" name="position" value={role} checked={position === role} onChange={() => setPosition(role)} />
|
||||
<span className="inline-flex min-h-9 items-center rounded-full border border-line-strong px-3 text-sm peer-checked:border-transparent peer-checked:bg-secondary peer-checked:text-secondary-content peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2">{role}</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
</fieldset>
|
||||
<div><Btn type="submit" variant="primary" disabled={!position} className="min-h-11">{full ? "대기 신청" : "참가 신청"}</Btn></div>
|
||||
</form>
|
||||
)}
|
||||
</Panel>
|
||||
<Panel title="일정 안내">
|
||||
<dl className="space-y-3 text-sm">
|
||||
<div className="flex justify-between gap-4"><dt className="text-content-muted">신청 마감</dt><dd className="font-semibold">20:30</dd></div>
|
||||
<div className="flex justify-between gap-4"><dt className="text-content-muted">디스코드 집결</dt><dd className="font-semibold">20:50</dd></div>
|
||||
<div className="flex justify-between gap-4"><dt className="text-content-muted">내전 시작</dt><dd className="font-semibold">21:00</dd></div>
|
||||
</dl>
|
||||
<details className="mt-4 border-t border-line pt-3 text-sm">
|
||||
<summary className="cursor-pointer font-semibold">참가 규칙</summary>
|
||||
<p className="mt-2 text-content-muted">희망 포지션과 실제 배정은 다를 수 있습니다. 불참 시 모집 마감 전 신청을 취소해 주세요.</p>
|
||||
</details>
|
||||
</Panel>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function Auction() {
|
||||
const [spectator, setSpectator] = useState(false);
|
||||
const [closed, setClosed] = useState(false);
|
||||
const [bids, setBids] = useState([{ team: "밤편지", points: 120 }, { team: "여울", points: 110 }]);
|
||||
const current = bids[0];
|
||||
const nextBid = current.points + 10;
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="flex flex-wrap items-center gap-x-4 gap-y-2">
|
||||
<PreviewControl label="예시 역할">
|
||||
<select className={selectClass} value={spectator ? "spectator" : "captain"} onChange={(event) => setSpectator(event.target.value === "spectator")}>
|
||||
<option value="captain">별무리 팀장</option>
|
||||
<option value="spectator">관전자</option>
|
||||
</select>
|
||||
</PreviewControl>
|
||||
<Chip selected={closed} onClick={() => setClosed(!closed)}>입찰 마감 상태</Chip>
|
||||
</div>
|
||||
<div className="match-flows-grid grid gap-4">
|
||||
<Panel title="현재 선수 · 7/16">
|
||||
<div className="flex flex-wrap items-start justify-between gap-3">
|
||||
<div><p className="text-xl font-bold">초승달 <span className="text-sm font-medium text-content-muted">#MOON</span></p><p className="mt-1 text-sm text-content-muted">다이아몬드 2 · 정글 / 서포터</p></div>
|
||||
<Pill tone={closed ? "neutral" : "live"}>{closed ? "입찰 마감" : "입찰 중"}</Pill>
|
||||
</div>
|
||||
<div className="mt-5 grid grid-cols-2 gap-3 rounded-lg bg-sunken px-3 py-3.5 sm:px-4" role="status">
|
||||
<div><p className="text-sm text-content-muted">{closed ? "최종 낙찰가" : "현재 최고가"}</p><p className="tabular text-xl font-bold">{current.points}P</p><p className="text-sm text-content-muted">{current.team}</p></div>
|
||||
{!spectator && <div><p className="text-sm text-content-muted">별무리 잔여</p><p className="tabular text-xl font-bold">{closed && current.team === "별무리" ? teams[0].points - current.points : teams[0].points}P</p></div>}
|
||||
</div>
|
||||
{!spectator && !closed && (
|
||||
<div className="mt-4 flex flex-wrap items-center gap-2">
|
||||
<Btn variant="primary" className="min-h-11" disabled={current.team === "별무리"} onClick={() => setBids([{ team: "별무리", points: nextBid }, ...bids])}>{current.team === "별무리" ? "현재 최고 입찰" : `${nextBid}P 입찰`}</Btn>
|
||||
<p className="text-sm text-content-muted">낙찰될 때 포인트가 차감됩니다.</p>
|
||||
</div>
|
||||
)}
|
||||
<div className="mt-5 space-y-3 border-t border-line pt-3 text-sm">
|
||||
<details><summary className="cursor-pointer font-semibold">최근 내전 전적</summary><p className="mt-2 text-content-muted">최근 8세트 · 5승 3패 · KDA 3.6</p></details>
|
||||
<details><summary className="cursor-pointer font-semibold">현재 선수 입찰 기록 · {bids.length}건</summary><ol className="mt-2 divide-y divide-line">{bids.map((bid) => <li key={bid.points} className="flex justify-between py-2"><span>{bid.team}</span><strong>{bid.points}P</strong></li>)}</ol></details>
|
||||
</div>
|
||||
</Panel>
|
||||
<Panel title="팀 현황">
|
||||
<ul className="divide-y divide-line">
|
||||
{teams.map((team) => {
|
||||
const won = closed && current.team === team.name;
|
||||
return (
|
||||
<li key={team.name} className="flex justify-between gap-3 py-3 first:pt-0 last:pb-0">
|
||||
<div><p className="font-semibold">{team.name}</p><p className="mt-1 text-xs text-content-muted">{won ? "선수 1명 낙찰" : `빈 포지션 · ${team.open}`}</p></div>
|
||||
<div className="tabular text-right"><p className="font-bold">{team.points - (won ? current.points : 0)}P</p><p className="mt-1 text-xs text-content-muted">{team.players + Number(won)}/5명</p></div>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</Panel>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function TeamProgress() {
|
||||
const [issued, setIssued] = useState(false);
|
||||
const [codeStatus, setCodeStatus] = useState("");
|
||||
const code = "DEMO-ONLY-01";
|
||||
|
||||
async function copyCode() {
|
||||
try {
|
||||
await navigator.clipboard.writeText(code);
|
||||
setCodeStatus("예시 코드를 복사했습니다.");
|
||||
} catch {
|
||||
setCodeStatus("복사할 수 없습니다. 코드를 직접 선택해 주세요.");
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div><Chip selected={issued} onClick={() => { setIssued(!issued); setCodeStatus(""); }}>코드 발급 상태</Chip></div>
|
||||
<div className="match-flows-grid grid gap-4">
|
||||
<Panel title="다음 경기">
|
||||
<p className="text-sm text-content-muted">준결승 · 3전 2선승 · 21:30</p>
|
||||
<p className="mt-2 text-xl font-bold">별무리 <span className="mx-1 text-sm font-medium text-content-muted">vs</span> 여울</p>
|
||||
<div className="mt-5 grid gap-3 rounded-lg bg-sunken p-3.5 sm:p-4">
|
||||
<div className="flex flex-wrap items-center justify-between gap-2"><p className="text-sm font-semibold">1세트 토너먼트 코드</p><Pill tone={issued ? "live" : "gold"}>{issued ? "발급됨" : "발급 대기"}</Pill></div>
|
||||
{issued ? (
|
||||
<div className="flex flex-wrap items-center justify-between gap-2"><code className="text-sm font-semibold">{code}</code><Btn onClick={() => void copyCode()}>코드 복사</Btn></div>
|
||||
) : <p className="text-sm text-content-muted">운영자가 코드를 발급하면 이곳에서 복사할 수 있습니다.</p>}
|
||||
<p role="status" className={codeStatus ? "text-sm text-content-muted" : "sr-only"}>{codeStatus}</p>
|
||||
</div>
|
||||
<details className="mt-4 border-t border-line pt-3 text-sm">
|
||||
<summary className="cursor-pointer font-semibold">다른 세트 상태</summary>
|
||||
<p className="mt-2 text-content-muted">2세트 · 발급 대기</p><p className="mt-1 text-content-muted">3세트 · 필요 시 진행</p>
|
||||
</details>
|
||||
</Panel>
|
||||
<Panel title="라운드별 일정·결과">
|
||||
<ul className="space-y-3 text-sm">
|
||||
<li><details><summary className="cursor-pointer font-semibold">1라운드 · 종료</summary><p className="mt-2 text-content-muted">별무리 2 : 0 밤편지</p></details></li>
|
||||
<li className="border-t border-line pt-3"><details><summary className="cursor-pointer font-semibold">준결승 · 2대진</summary><p className="mt-2 text-content-muted">별무리 vs 여울 · 21:30</p><p className="mt-1 text-content-muted">서릿길 vs 파도 · 21:30</p></details></li>
|
||||
<li className="border-t border-line pt-3 text-content-muted">결승 · 대진 미정</li>
|
||||
</ul>
|
||||
</Panel>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function Operations() {
|
||||
const [filter, setFilter] = useState("전체");
|
||||
const [done, setDone] = useState<string[]>([]);
|
||||
const [message, setMessage] = useState("");
|
||||
const shown = opsItems.filter((item) => filter === "전체" || filter === item.type);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="flex flex-wrap gap-2" role="group" aria-label="작업 유형">
|
||||
{["전체", ...opsItems.map((item) => item.type)].map((type) => (
|
||||
<Chip key={type} selected={type === filter} onClick={() => setFilter(type)}>{type}</Chip>
|
||||
))}
|
||||
</div>
|
||||
<Panel title={`남은 작업 ${opsItems.length - done.length}건`}>
|
||||
<ul className="divide-y divide-line">
|
||||
{shown.map((item) => {
|
||||
const completed = done.includes(item.id);
|
||||
return (
|
||||
<li key={item.id} className="py-3 first:pt-0 last:pb-0">
|
||||
<details>
|
||||
<summary className="cursor-pointer rounded-field py-1 focus-visible:outline-2 focus-visible:outline-offset-2">
|
||||
<span className="match-flows-task inline-flex flex-wrap items-center gap-x-3 gap-y-1 align-middle"><strong className="text-sm">{item.title}</strong><Pill tone={completed ? "live" : "gold"}>{completed ? item.done : "확인 필요"}</Pill><span className="match-flows-task-context text-sm text-content-muted">{item.context}</span></span>
|
||||
</summary>
|
||||
<div className="mt-2 space-y-3 rounded-lg bg-sunken p-3 text-sm text-content-muted">
|
||||
<p>{item.detail}</p>
|
||||
{!completed && <Btn onClick={() => { setDone([...done, item.id]); setMessage(`${item.title} · ${item.done}`); }}>{item.action}</Btn>}
|
||||
</div>
|
||||
</details>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
<p role="status" className="sr-only">{message}</p>
|
||||
</Panel>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default function MatchFlowsPreview() {
|
||||
const [params] = useSearchParams();
|
||||
const active = flows.find((flow) => flow.id === params.get("flow"))?.id ?? "signup";
|
||||
const heading = headings[active];
|
||||
|
||||
return (
|
||||
<main className={`${pageWidthClass("lg")} pb-12 pt-6 text-content sm:pt-9`}>
|
||||
<div className="flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-content-muted">
|
||||
<Pill>UX 목업</Pill><span>샘플 데이터로 보는 내전 흐름</span>
|
||||
</div>
|
||||
<nav aria-label="목업 흐름" className="mt-4 flex flex-wrap gap-2 border-b border-line pb-4">
|
||||
{flows.map((flow) => (
|
||||
<Link key={flow.id} to={`?flow=${flow.id}`} aria-current={active === flow.id ? "page" : undefined} className="match-flows-link inline-flex min-h-9 items-center rounded-full border border-line-strong bg-card px-3.5 text-sm font-semibold text-content-muted hover:text-content">{flow.name}</Link>
|
||||
))}
|
||||
</nav>
|
||||
<div className="pb-5 pt-5 sm:pt-7">
|
||||
<p className="text-sm font-semibold text-content-muted">{heading.label}</p>
|
||||
<h1 className="match-flows-title mt-1 font-bold leading-tight">{heading.title}</h1>
|
||||
<p className="mt-1.5 text-sm text-content-muted">{heading.detail}</p>
|
||||
</div>
|
||||
<div className="space-y-3">
|
||||
{active === "signup" && <Signup />}
|
||||
{active === "auction" && <Auction />}
|
||||
{active === "team" && <TeamProgress />}
|
||||
{active === "ops" && <Operations />}
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
type Series = {
|
||||
teams: [string, string];
|
||||
score: [number, number];
|
||||
games: { winner: string; duration: string }[];
|
||||
};
|
||||
|
||||
type MatchResult =
|
||||
| { kind: 'series'; series: Series }
|
||||
| { kind: 'tournament'; champion: string; final: Series }
|
||||
| { kind: 'collecting'; recordedGames: number }
|
||||
| { kind: 'unavailable' };
|
||||
|
||||
export type PreviewMatch = {
|
||||
id: string;
|
||||
title: string;
|
||||
scheduledAt: string;
|
||||
teamCount: number;
|
||||
playerIds: string[];
|
||||
result: MatchResult;
|
||||
};
|
||||
|
||||
export type PreviewPlayer = {
|
||||
id: string;
|
||||
name: string;
|
||||
tag: string;
|
||||
position: string;
|
||||
wins: number;
|
||||
losses: number;
|
||||
};
|
||||
|
||||
type PreviewSeason = {
|
||||
matches: PreviewMatch[];
|
||||
players: PreviewPlayer[];
|
||||
sideWins: [blue: number, red: number];
|
||||
};
|
||||
|
||||
const final: Series = {
|
||||
teams: ['별빛', '바람'],
|
||||
score: [2, 1],
|
||||
games: [
|
||||
{ winner: '별빛', duration: '30:42' },
|
||||
{ winner: '바람', duration: '28:17' },
|
||||
{ winner: '별빛', duration: '34:11' },
|
||||
],
|
||||
};
|
||||
|
||||
export const previewSeasons: Record<'2026' | '2025', PreviewSeason> = {
|
||||
'2026': {
|
||||
sideWins: [24, 21],
|
||||
matches: [
|
||||
{
|
||||
id: 'autumn-league',
|
||||
title: '가을 내전 리그',
|
||||
scheduledAt: '2026-11-08T12:00:00+09:00',
|
||||
teamCount: 8,
|
||||
playerIds: ['star', 'wind', 'forest'],
|
||||
result: { kind: 'collecting', recordedGames: 16 },
|
||||
},
|
||||
{
|
||||
id: 'loly-cup',
|
||||
title: '롤림푸스 컵',
|
||||
scheduledAt: '2026-11-07T21:00:00+09:00',
|
||||
teamCount: 4,
|
||||
playerIds: ['star', 'wind', 'forest', 'dawn'],
|
||||
result: { kind: 'tournament', champion: '별빛', final },
|
||||
},
|
||||
{
|
||||
id: 'saturday',
|
||||
title: '토요일 정기 내전',
|
||||
scheduledAt: '2026-10-31T21:00:00+09:00',
|
||||
teamCount: 2,
|
||||
playerIds: ['star', 'wind', 'dawn'],
|
||||
result: { kind: 'series', series: final },
|
||||
},
|
||||
{
|
||||
id: 'friday',
|
||||
title: '금요일 심야 내전',
|
||||
scheduledAt: '2026-10-30T22:00:00+09:00',
|
||||
teamCount: 2,
|
||||
playerIds: ['forest', 'dawn'],
|
||||
result: { kind: 'unavailable' },
|
||||
},
|
||||
],
|
||||
players: [
|
||||
{
|
||||
id: 'star',
|
||||
name: '별빛',
|
||||
tag: 'LTS',
|
||||
position: '미드',
|
||||
wins: 12,
|
||||
losses: 5,
|
||||
},
|
||||
{
|
||||
id: 'wind',
|
||||
name: '바람',
|
||||
tag: 'LTS',
|
||||
position: '정글',
|
||||
wins: 10,
|
||||
losses: 6,
|
||||
},
|
||||
{
|
||||
id: 'forest',
|
||||
name: '숲길',
|
||||
tag: 'KR1',
|
||||
position: '서포터',
|
||||
wins: 8,
|
||||
losses: 6,
|
||||
},
|
||||
{
|
||||
id: 'dawn',
|
||||
name: '새벽',
|
||||
tag: 'KR1',
|
||||
position: '원딜',
|
||||
wins: 7,
|
||||
losses: 8,
|
||||
},
|
||||
],
|
||||
},
|
||||
'2025': {
|
||||
sideWins: [2, 1],
|
||||
matches: [
|
||||
{
|
||||
id: 'winter',
|
||||
title: '겨울 시즌 마감전',
|
||||
scheduledAt: '2025-12-20T21:00:00+09:00',
|
||||
teamCount: 2,
|
||||
playerIds: ['star', 'wind'],
|
||||
result: { kind: 'series', series: final },
|
||||
},
|
||||
],
|
||||
players: [
|
||||
{
|
||||
id: 'star',
|
||||
name: '별빛',
|
||||
tag: 'LTS',
|
||||
position: '미드',
|
||||
wins: 2,
|
||||
losses: 1,
|
||||
},
|
||||
{
|
||||
id: 'wind',
|
||||
name: '바람',
|
||||
tag: 'LTS',
|
||||
position: '정글',
|
||||
wins: 1,
|
||||
losses: 2,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
.match-flows-title {
|
||||
font-size: clamp(1.5rem, 5vw, 2rem);
|
||||
}
|
||||
|
||||
.match-flows-panel {
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 3px 10px rgb(0 0 0 / 3%);
|
||||
}
|
||||
|
||||
.match-flows-link[aria-current="page"] {
|
||||
border-color: transparent;
|
||||
background: var(--lts-ink);
|
||||
color: var(--lts-on-ink);
|
||||
}
|
||||
|
||||
.match-flows-capacity {
|
||||
appearance: none;
|
||||
overflow: hidden;
|
||||
border-radius: 999px;
|
||||
background-color: var(--lts-sunken-strong);
|
||||
}
|
||||
|
||||
.match-flows-capacity::-webkit-progress-bar {
|
||||
background-color: var(--lts-sunken-strong);
|
||||
}
|
||||
|
||||
.match-flows-capacity::-webkit-progress-value {
|
||||
background-color: var(--color-brand-coral);
|
||||
}
|
||||
|
||||
.match-flows-capacity::-moz-progress-bar {
|
||||
background-color: var(--color-brand-coral);
|
||||
}
|
||||
|
||||
.match-flows-task {
|
||||
max-width: calc(100% - 1.25rem);
|
||||
}
|
||||
|
||||
.match-flows-task-context {
|
||||
flex-basis: 100%;
|
||||
}
|
||||
|
||||
@media (min-width: 48rem) {
|
||||
.match-flows-grid {
|
||||
grid-template-columns: minmax(0, 1fr) minmax(16rem, 0.6fr);
|
||||
align-items: start;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import {
|
||||
getHistoryMatchTitle,
|
||||
getHomeMatchEnrollment,
|
||||
getHomeMatchSchedule,
|
||||
} from '../src/pages/home-match-presentation.ts';
|
||||
|
||||
test('uses the Korean schedule and only removes a matching generic title prefix', () => {
|
||||
const schedule = getHomeMatchSchedule('2026-06-25T12:00:00.000Z');
|
||||
assert.equal(schedule?.compact, '6/25 (목) 21:00');
|
||||
assert.equal(
|
||||
getHistoryMatchTitle('6/25 (목) 21시 정기 내전', schedule),
|
||||
'정기 내전',
|
||||
);
|
||||
for (const title of [
|
||||
'6/25 (목) 21시 멸망전',
|
||||
'6/25 (목) 20시 내전',
|
||||
'6/24 (수) 21시 내전',
|
||||
]) {
|
||||
assert.equal(getHistoryMatchTitle(title, schedule), title);
|
||||
}
|
||||
});
|
||||
|
||||
test('promotes application only for an open match with available places', () => {
|
||||
const match = {
|
||||
status: 'recruiting' as const,
|
||||
joined: false,
|
||||
maxParticipants: 4,
|
||||
participants: [],
|
||||
};
|
||||
assert.deepEqual(getHomeMatchEnrollment(match), {
|
||||
canApply: true,
|
||||
capacity: '0/4명',
|
||||
label: '4자리 남음',
|
||||
});
|
||||
assert.deepEqual(getHomeMatchEnrollment({ ...match, maxParticipants: 0 }), {
|
||||
canApply: false,
|
||||
capacity: '0명',
|
||||
label: '모집 마감',
|
||||
});
|
||||
assert.equal(
|
||||
getHomeMatchEnrollment({ ...match, status: 'team-built' }).canApply,
|
||||
false,
|
||||
);
|
||||
assert.equal(
|
||||
getHomeMatchEnrollment({ ...match, joined: true }).label,
|
||||
'참가 완료',
|
||||
);
|
||||
});
|
||||
@@ -7,16 +7,19 @@ const homePageSource = await readFile(
|
||||
"utf8",
|
||||
);
|
||||
|
||||
test("keeps past match history focused on the five summary columns", () => {
|
||||
const colGroup = sourceForFunction("HistoryTableColGroup");
|
||||
const header = sourceForFunction("HistoryTableHeader");
|
||||
test("shares the four history columns between records and the loading state", () => {
|
||||
const columns = sourceForFunction("HistoryTableColumns");
|
||||
const skeleton = sourceForFunction("HistoryRecordsSkeleton");
|
||||
const records = sourceForFunction("HistoryRecords");
|
||||
|
||||
assert.equal(colGroup.match(/<col(?:\s|\/|>)/g)?.length, 5);
|
||||
assert.doesNotMatch(header, />결과<\/th>/);
|
||||
assert.doesNotMatch(homePageSource, /공식 결과/);
|
||||
assert.doesNotMatch(skeleton, /1팀 승리/);
|
||||
assert.match(homePageSource, /colSpan=\{5\}/);
|
||||
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*\/>/);
|
||||
assert.doesNotMatch(skeleton, /<HistoryResult\b/);
|
||||
});
|
||||
|
||||
function sourceForFunction(name: string): string {
|
||||
|
||||
@@ -256,4 +256,3 @@ SINCE 1 day ago
|
||||
- `apps/api/src/modules/global/observability/performance-observer.ts`
|
||||
- `apps/api/src/modules/global/observability/mongoose-performance.plugin.ts`
|
||||
- `apps/api/src/scripts/api-performance-report.ts`
|
||||
- `docs/specs/api-performance-observability.md`
|
||||
@@ -1,203 +0,0 @@
|
||||
# Implementation Plan: Series Result History UI
|
||||
|
||||
## Overview
|
||||
|
||||
Replace the existing completed-Game mini-card grid with a tested chronological
|
||||
Series result history. Keep data derivation pure, render responsive semantic rows,
|
||||
and preserve all current Competition/API contracts.
|
||||
|
||||
## Architecture Decisions
|
||||
|
||||
- Derive a local view model from `projection.series` and `projection.games`; no API
|
||||
or persistence change is required.
|
||||
- Anchor a played Series to its earliest accepted Game start. Anchor a game-less
|
||||
completed decision to its decision time only for grouping and sorting.
|
||||
- Keep the original narrowed Series and Game objects in each row so the UI does not
|
||||
duplicate domain state or collapse outcome semantics.
|
||||
- Use a native `details/summary` disclosure for Game history and omit it when a
|
||||
Series has no Games.
|
||||
- Extract the new UI from `CompetitionResults.tsx` so the format selector remains
|
||||
focused.
|
||||
|
||||
## Task List
|
||||
|
||||
### Phase 1: Result-History Contract
|
||||
|
||||
#### Task 1: Specify aggregation and chronology test-first
|
||||
|
||||
**Acceptance criteria:**
|
||||
|
||||
- [x] Tests cover Series aggregation, ordinal Game order, KST date boundaries,
|
||||
chronological order, outcome variants, and deterministic fallbacks.
|
||||
- [x] The focused test fails because the model module does not yet exist.
|
||||
|
||||
**Verification:**
|
||||
|
||||
- [x] Run the focused Node test and record the expected RED failure.
|
||||
|
||||
**Files likely touched:**
|
||||
|
||||
- `apps/web/test/competition-series-history.test.ts`
|
||||
|
||||
#### Task 2: Implement the pure history model
|
||||
|
||||
**Acceptance criteria:**
|
||||
|
||||
- [x] Only recorded in-progress and completed Series are returned.
|
||||
- [x] Date grouping and format helpers are explicitly KST-aware.
|
||||
- [x] Decision outcomes and missing legacy durations remain distinguishable.
|
||||
|
||||
**Verification:**
|
||||
|
||||
- [x] Focused history tests pass.
|
||||
- [x] Existing web tests still pass.
|
||||
|
||||
**Files likely touched:**
|
||||
|
||||
- `apps/web/src/components/competition/competition-series-history.ts`
|
||||
- `apps/web/test/competition-series-history.test.ts`
|
||||
|
||||
### Checkpoint: Model
|
||||
|
||||
- [x] Pure tests pass without a React or browser dependency.
|
||||
|
||||
### Phase 2: Responsive Result UI
|
||||
|
||||
#### Task 3: Render date sections and Series rows
|
||||
|
||||
**Acceptance criteria:**
|
||||
|
||||
- [x] Desktop uses a flat schedule-like row; mobile stacks metadata and matchup
|
||||
without horizontal scrolling.
|
||||
- [x] Status and official winner are communicated with visible text and typography,
|
||||
not color alone.
|
||||
- [x] Game-less decisions do not show fake start times or `0 : 0`.
|
||||
|
||||
**Verification:**
|
||||
|
||||
- [x] Changed component files pass ESLint.
|
||||
- [x] Web build succeeds.
|
||||
|
||||
**Files likely touched:**
|
||||
|
||||
- `apps/web/src/components/competition/CompetitionSeriesHistory.tsx`
|
||||
|
||||
#### Task 4: Integrate accessible Game disclosures
|
||||
|
||||
**Acceptance criteria:**
|
||||
|
||||
- [x] Each Series with Games exposes a native keyboard-operable disclosure.
|
||||
- [x] Games use Series-local ordinal, team-ID winner lookup, and omit unknown
|
||||
zero-duration values.
|
||||
- [x] The old completed-Game mini-card block is removed.
|
||||
|
||||
**Verification:**
|
||||
|
||||
- [x] Full web tests, changed-file lint, and build pass. Repository-wide lint remains
|
||||
blocked by pre-existing errors outside this change.
|
||||
- [x] Source review checks heading order, disclosure semantics, and 320px layout.
|
||||
|
||||
**Files likely touched:**
|
||||
|
||||
- `apps/web/src/components/competition/CompetitionSeriesHistory.tsx`
|
||||
- `apps/web/src/components/competition/CompetitionResults.tsx`
|
||||
|
||||
### Checkpoint: Complete
|
||||
|
||||
- [x] All specification success criteria are met.
|
||||
- [x] Git diff contains only the feature spec, plan, tests, model, and UI integration.
|
||||
- [x] Unrelated working-tree files are unchanged.
|
||||
|
||||
### Phase 3: Game Detail Navigation
|
||||
|
||||
#### Task 5: Specify the canonical Game route test-first
|
||||
|
||||
**Acceptance criteria:**
|
||||
|
||||
- [x] A Game whose `ordinal` and `displayNumber` differ links with
|
||||
`displayNumber`.
|
||||
- [x] Non-positive or non-integer legacy display numbers do not produce a broken
|
||||
detail link.
|
||||
- [x] The focused test is observed failing before the route adapter exists.
|
||||
|
||||
**Verification:**
|
||||
|
||||
- [x] Run the focused Node test for RED and GREEN states.
|
||||
|
||||
**Files likely touched:**
|
||||
|
||||
- `apps/web/test/competition-series-history.test.ts`
|
||||
- `apps/web/src/components/competition/competition-series-history.ts`
|
||||
|
||||
#### Task 6: Make disclosed Game rows navigable
|
||||
|
||||
**Acceptance criteria:**
|
||||
|
||||
- [x] The full Game row is one React Router link with an always-visible detail cue.
|
||||
- [x] The link carries the current Competition location as `backTo` and a Korean
|
||||
return label.
|
||||
- [x] Mobile targets are at least 44px high; keyboard focus is visible; hover and
|
||||
active states use restrained semantic-primary coral accents.
|
||||
- [x] The scoped primary token keeps that coral accent in both themes without a
|
||||
global dark-theme color migration.
|
||||
- [x] Winner, score, and status colors retain their existing domain meaning.
|
||||
|
||||
**Verification:**
|
||||
|
||||
- [x] Focused and full web tests pass.
|
||||
- [x] Changed-file ESLint and the production web build pass.
|
||||
- [x] Independent review checks route identity, interaction semantics, accessibility,
|
||||
and unrelated working-tree preservation.
|
||||
|
||||
**Files likely touched:**
|
||||
|
||||
- `apps/web/src/components/competition/CompetitionGameHistory.tsx`
|
||||
- `apps/web/src/components/competition/CompetitionSeriesHistory.tsx`
|
||||
- `apps/web/src/components/competition/CompetitionResults.tsx`
|
||||
|
||||
#### Task 7: Refuse incorrect Game-detail fallbacks
|
||||
|
||||
**Acceptance criteria:**
|
||||
|
||||
- [x] Exact requested Game numbers resolve to that Game.
|
||||
- [x] Missing or invalid requested Game numbers return no selection instead of the
|
||||
first Game.
|
||||
- [x] The detail page renders an explicit missing-Game state with the preserved return
|
||||
target.
|
||||
- [x] The policy is covered by an observed RED→GREEN pure regression test.
|
||||
|
||||
**Verification:**
|
||||
|
||||
- [x] Focused selection tests, full web tests, changed-file ESLint, and build pass.
|
||||
|
||||
**Files likely touched:**
|
||||
|
||||
- `apps/web/src/lib/internal-match-game-selection.ts`
|
||||
- `apps/web/src/pages/MatchGameDetailPage.tsx`
|
||||
- `apps/web/test/internal-match-game-selection.test.ts`
|
||||
|
||||
### Checkpoint: Navigable Game History
|
||||
|
||||
- [x] Every valid recorded Game opens its own internal-stat detail view.
|
||||
- [x] Browser back and the detail page return link restore the Competition result
|
||||
page.
|
||||
- [x] Invalid legacy route data degrades to a non-clickable row instead of a wrong
|
||||
destination.
|
||||
- [x] A stale detail payload cannot substitute a different Game for the requested
|
||||
route.
|
||||
|
||||
## Risks and Mitigations
|
||||
|
||||
| Risk | Impact | Mitigation |
|
||||
|---|---|---|
|
||||
| Game sides are mistaken for Series slots | High | Use Series A/B entries and outcome team IDs; test side swaps. |
|
||||
| Completion time is shown as start time | Medium | Track timestamp source and render a blank time for decisions. |
|
||||
| KST day changes by deploy environment | Medium | Use explicit `Intl.DateTimeFormat` timezone and boundary tests. |
|
||||
| Long team names break mobile rows | Medium | Use balanced minmax columns and allow wrapping. |
|
||||
| Existing dirty work is overwritten | High | Restrict patches and verification to named feature files. |
|
||||
| Series-local ordinal opens another Series' Game | High | Generate routes only from tested global `displayNumber`. |
|
||||
| Coral is mistaken for the winning side | Medium | Restrict primary color to interaction edges, focus, and arrows. |
|
||||
|
||||
## Open Questions
|
||||
|
||||
None.
|
||||
@@ -1,84 +0,0 @@
|
||||
# Implementation Plan: Double-Elimination Connector Routing
|
||||
|
||||
## Overview
|
||||
|
||||
Replace per-edge winner rail staggering with deterministic, collision-aware winner
|
||||
bundles while retaining the existing target-corridor `H-V-H` path model and the
|
||||
current loser/reset routing behavior.
|
||||
|
||||
## Architecture Decisions
|
||||
|
||||
- Keep routing as a pure layout calculation; the React renderer consumes unchanged
|
||||
`BracketConnectorLayout` paths.
|
||||
- Allocate baseline rails first, then choose one rail for each same-target winner
|
||||
bundle while leaving loser/reset coordinates unchanged.
|
||||
- Score complete candidate paths by parallel-stroke clearance, strict crossings,
|
||||
and distance from the corridor midpoint.
|
||||
- Permit shared `verticalX` only when the participating vertical intervals do not
|
||||
overlap; otherwise search the same corridor for the nearest deterministic pair
|
||||
of separate rails with focused-stroke clearance.
|
||||
|
||||
## Task List
|
||||
|
||||
### Phase 1: Regression Contract
|
||||
|
||||
- [x] Add tests proving quiet winner bundles use the corridor midpoint and all
|
||||
shareable same-target winner paths remain aligned.
|
||||
- [x] Replace target-column rail uniqueness with interval-aware segment assertions.
|
||||
- [x] Cover reversed A/B input where overlapping vertical spans require the
|
||||
deterministic separate-rail fallback.
|
||||
- [x] Confirm the focused test fails with the current allocator.
|
||||
|
||||
### Checkpoint: RED
|
||||
|
||||
- [x] The new behavioral assertion fails for the expected unequal `verticalX`.
|
||||
- [x] Existing tests remain unchanged except where their invariant is obsolete.
|
||||
|
||||
### Phase 2: Bundle-Aware Allocator
|
||||
|
||||
- [x] Represent connector routing inputs with precomputed source/target anchors.
|
||||
- [x] Retain stable independent rails for loser/reset routes.
|
||||
- [x] Group the two winners entering each target and select the nearest safe shared
|
||||
rail without card penetration, forbidden overlap, or avoidable added crossings.
|
||||
- [x] Fall back to the nearest deterministic, stroke-clear separate rails only
|
||||
when the pair's own vertical intervals overlap and cannot safely share a rail.
|
||||
|
||||
### Checkpoint: GREEN
|
||||
|
||||
- [x] Focused layout tests pass for four-team, eight-team, reset-final, and shuffled
|
||||
input fixtures.
|
||||
- [x] Strict crossing, collinear-overlap, and 5px parallel-clearance safeguards pass.
|
||||
|
||||
### Phase 3: Verification and Review
|
||||
|
||||
- [x] Run the full web suite, lint, and production build; document the unrelated
|
||||
pre-existing full-lint failures while verifying changed files separately.
|
||||
- [x] Inspect the diff for correctness, simplicity, security, performance, and
|
||||
adherence to the approved spec.
|
||||
- [x] Perform an independent review and address all required findings.
|
||||
|
||||
### Checkpoint: Complete
|
||||
|
||||
- [x] All success criteria in the spec are verified.
|
||||
- [x] No unrelated files are modified.
|
||||
|
||||
## Risks and Mitigations
|
||||
|
||||
| Risk | Impact | Mitigation |
|
||||
|---|---|---|
|
||||
| Blind midpoint alignment adds crossings in busy upper rounds | High | Score complete candidate paths and move the winner bundle together to the nearest safe rail. |
|
||||
| Shared rails create overlapping vertical segments | High | Check interval overlap before allowing a shared `verticalX`; search deterministic fallback rails with 5px clearance otherwise. |
|
||||
| Visually parallel rails pass exact-coordinate tests but overlap at stroke width | High | Require 5px clearance across overlapping vertical runs and cover it for 4/8-team fixtures. |
|
||||
| Routing changes depend on input array order | Medium | Sort routes and bundles by graph display order and retain shuffled-fixture equality tests. |
|
||||
| A long connector bends through an intermediate card | High | Restrict every candidate to the target corridor and retain card-penetration assertions. |
|
||||
| Reset-final slot carry-over is accidentally treated as a winner pair | Medium | Bundle only connectors whose computed kind is `winner`; keep reset paths independent. |
|
||||
|
||||
## Dependencies
|
||||
|
||||
```text
|
||||
Regression contract -> bundle-aware rail allocator -> full verification -> review
|
||||
```
|
||||
|
||||
## Open Questions
|
||||
|
||||
None.
|
||||
@@ -1,78 +0,0 @@
|
||||
# Implementation Plan: Internal Match Game Analysis P0/P1
|
||||
|
||||
## Overview
|
||||
|
||||
Deliver three independently verifiable slices: P0 existing-data UI, P1-A timeline
|
||||
checkpoints and lane comparison, and P1-B unified notable events. Preserve the
|
||||
existing detail endpoint and use builder/cache versioning to refresh old projections.
|
||||
|
||||
## Task List
|
||||
|
||||
### Phase 1: P0 Existing Data
|
||||
|
||||
- [x] Add tested objective normalization, chart markers, an accessible event list,
|
||||
and move game flow above the detail tabs.
|
||||
- [x] Add a complete objective comparison strip with conservative dragon-type
|
||||
fallback behavior.
|
||||
- [x] Label KP and add participant gold/GPM to the combined CS/economy presentation.
|
||||
|
||||
### Checkpoint: P0
|
||||
|
||||
- [x] Web tests, lint, and production build pass.
|
||||
- [x] Desktop and mobile layouts retain all existing scoreboard/build behavior.
|
||||
|
||||
### Phase 2: P1-A Lane Checkpoints
|
||||
|
||||
- [x] Parse the remaining participant event identifier fields and project tested
|
||||
participant checkpoints at 10 and 15 minutes.
|
||||
- [x] Persist and expose optional checkpoint fields, reject stale caches, and bump
|
||||
the match-stats builder/detail-response versions.
|
||||
- [x] Replace final-state lane comparisons with tested role-based 10/15-minute
|
||||
GD/CSD/XPD and K/D/A comparisons.
|
||||
|
||||
### Checkpoint: P1-A
|
||||
|
||||
- [x] Focused API tests and builds pass.
|
||||
- [x] Web tests and production build pass.
|
||||
- [x] Short and missing-timeline games show unavailable states rather than zeros.
|
||||
|
||||
### Phase 3: P1-B Unified Events
|
||||
|
||||
- [x] Project objectives, champion kills, towers, and inhibitors into a deterministic
|
||||
tested event stream.
|
||||
- [x] Expose `timelineEvents` while retaining `objectiveEvents` compatibility and
|
||||
bump persisted/cache versions as required.
|
||||
- [x] Add accessible event filtering and chart selection with objective-only fallback.
|
||||
- [x] Coalesce concurrent hydration and short-cache incomplete results so transient
|
||||
failures retry without rebuilding on every sequential page request.
|
||||
|
||||
### Checkpoint: Complete
|
||||
|
||||
- [x] API and web focused suites pass without skipped tests.
|
||||
- [x] API and web production builds pass.
|
||||
- [x] Responsive runtime review passes at 320px, 390px, 768px, 1024px, and 1440px.
|
||||
- [x] P0/P1 edits exclude unrelated Competition/bracket modifications already in
|
||||
the shared worktree.
|
||||
|
||||
## Risks and Mitigations
|
||||
|
||||
| Risk | Impact | Mitigation |
|
||||
|---|---|---|
|
||||
| Missing or delayed Riot frames misrepresent @10/@15 | High | Use only a frame at/before the target within one frame interval and expose its actual timestamp. |
|
||||
| Building events attribute the destroyed team's side as the scorer | High | Prefer killer participant side; otherwise invert the destroyed `teamId`; cover both paths in tests. |
|
||||
| Old cached shapes hide new fields | High | Increment builder and response cache versions and strengthen completeness validation. |
|
||||
| A kill-heavy game makes the page excessively long | Medium | Add event-category filters and a bounded scroll region. |
|
||||
| Mobile chart remains hard to reach | Medium | Move flow directly below the summary before any participant cards. |
|
||||
| Existing dirty work is accidentally included | High | Restrict edits and verification to the named game-analysis files and inspect the final diff by path. |
|
||||
|
||||
## Dependencies
|
||||
|
||||
```text
|
||||
P0 event normalization -> P0 objective strip
|
||||
P1 checkpoint projector -> response contract -> lane UI
|
||||
P1 checkpoint identifiers -> event projector -> response contract -> event UI
|
||||
```
|
||||
|
||||
## Open Questions
|
||||
|
||||
None.
|
||||
@@ -1,62 +0,0 @@
|
||||
# Redis 8.10 correctness and optimization
|
||||
|
||||
## Scope and invariants
|
||||
|
||||
- Fix blocking reads sharing a client, Hash payload cleanup, duplicate action-order entries, and non-atomic scheduled-job promotion.
|
||||
- Preserve high-before-low consumption, the 30-minute pending recovery threshold, business processing locks, replay fingerprints, 500-request limits, and auction lifecycle fencing.
|
||||
- Use XACKDEL ACKED, XREADGROUP CLAIM, conditional string deletion/renewal, and INCREX. Never trim unacknowledged work.
|
||||
- Move community response caches to hashes with independent field TTLs: 300 seconds normally, 86400 for complete details, 60 for incomplete details. Preserve response shapes and in-flight coalescing. Fence cache fills across invalidation.
|
||||
- Do not implement conditional Compact Hash, JSON, Array, or request-retention redesign proposals in this change.
|
||||
|
||||
## Implementation sequence
|
||||
|
||||
1. Add regression coverage and fix the four correctness defects.
|
||||
2. Upgrade stream consumption/acknowledgement and protect pending entries during trimming.
|
||||
3. Replace lock scripts and token-unsafe dedup deletion with Redis conditional commands.
|
||||
4. Replace failure-counter increment/expiry with INCREX.
|
||||
5. Introduce versioned community hash caches and generation-aware fills/invalidation.
|
||||
|
||||
## Validation
|
||||
|
||||
- Run existing API tests before changes and record baseline failures.
|
||||
- Exercise actual Lua and Redis 8.10 commands in an isolated local Redis process, including concurrent promotion, pending recovery, foreign-group retention, stale lock ownership, lifecycle-specific cleanup, and cache invalidation races/field expiry.
|
||||
- Add unit regressions for worker connection lifecycle, command response handling, caller cache scopes, and interrupted operations.
|
||||
- Run the full API suite, API build, changed-file lint, and dependency checks. Distinguish mock-based tests from real Redis integration results.
|
||||
|
||||
## Environment
|
||||
|
||||
The repository's named workflow skills are absent. Work follows the above explicit specification, incremental implementation, regression tests, and final review. Windows has no Docker/WSL; a temporary loopback-only Redis 8.10.3 Windows community build is used for integration validation, without accessing application Redis credentials.
|
||||
|
||||
## Results (2026-11-09)
|
||||
|
||||
| Check | Result |
|
||||
| --- | --- |
|
||||
| API unit/regression suite | 105 suites, 704 tests passed |
|
||||
| Web regression suite | 129 tests passed |
|
||||
| Isolated Redis 8.10.3 integration suite | 2 suites, 31 tests passed |
|
||||
| API, web, and contracts builds | Passed (`pnpm -r --workspace-concurrency=1 build`) |
|
||||
| ESLint on the 20 repaired test files | Passed with zero warnings |
|
||||
| Dependency regression checks | 3 tests passed |
|
||||
| Integration runner syntax and missing-executable failure cleanup | Passed; no leaked temporary directory |
|
||||
| Git whitespace check | Passed |
|
||||
| Full API TypeScript check including test files | Passed; all 90 pre-existing diagnostics repaired |
|
||||
| Contracts and web application TypeScript checks | Passed (web check runs as part of its build) |
|
||||
|
||||
The initial API baseline was 685 passing tests and one failure caused by Windows path separators in the performance report. The report now emits platform-independent paths and its existing test passes. The original Redis change exposed 90 pre-existing test-type diagnostics, confirmed against HEAD sources through an in-memory compiler host. The requested follow-up repairs all 90 across 20 test files. Workspace dependencies were installed from the frozen lockfile without changing package versions.
|
||||
|
||||
The type repairs preserve test assertions and scenarios: public service types are separated from private-method test accessors, partial database mocks are typed at the harness boundary, generic helpers retain their full element types, and Riot/Match fixtures provide required fields. Position fixtures use the domain's `SUP`/`JGL` values, optional lookup assertions still fail when the expected object is missing, and scheduler teardown is awaited. No tests were removed or skipped, no TypeScript settings were relaxed, and no suppression directives were added. The final suite also includes the concurrent tournament polling/retry changes present in the shared workspace.
|
||||
|
||||
Run `pnpm --filter api typecheck` to check API source and tests without emitting files or relying on incremental state. Run `pnpm -r --if-present typecheck`, `pnpm --filter api test -- --runInBand`, `pnpm --filter web test`, `pnpm --filter api test:redis`, `pnpm test:dependency-security`, and `pnpm -r --workspace-concurrency=1 build` to reproduce the workspace checks above. The web build reports a non-failing bundle-size warning.
|
||||
|
||||
Actual Redis coverage includes dedicated blocking reads alongside normal commands, stale pending recovery, acknowledgement retention across consumer groups, safe stream trimming, foreign-owner lock protection, compare-and-delete dedup tokens, concurrent failure-counter increments, scheduled-job failure/retry and concurrent promotion, rescheduling fences, malformed scheduled entries and batch limits, Hash/legacy payload cleanup, action reservation/apply/replay, the 500-request cap and five-minute retention, independent cache field expiry, scope isolation, and stale cache fills across invalidation. The detail-response invalidation race also exercises the real CommunityStatsService and Redis cache with only the underlying dataset loader stubbed.
|
||||
|
||||
MongoDB/NATS/Riot end-to-end execution, Linux production-runtime validation, and production-scale latency/memory benchmarks were not run. No measured production speedup is claimed.
|
||||
|
||||
## Rollout and operating behavior
|
||||
|
||||
- Requires Redis 8.10.x and the existing node-redis 5.12.x client. The integration runner verifies the server version before executing tests.
|
||||
- Switch API instances together: old String-cache invalidation and new Hash-cache invalidation target different namespaces. Rolling with both versions serving traffic can leave the other version's cache stale. Rollback has the same constraint.
|
||||
- Old cache values expire on their existing TTL, at most 24 hours. New hashes populate on cache misses; this can temporarily increase database reads after deployment. A persistent generation token per community fences slow responses across invalidation.
|
||||
- Pending/unread stream entries are retained even past the approximate 10,000-entry target. Monitor stream length and pending entries; an abandoned consumer group can retain entries until that group is deliberately retired.
|
||||
- Existing action-order duplicates are not rewritten during deployment. The fix prevents new duplicates; existing entries age out through the existing five-minute replay retention and count-based cleanup.
|
||||
- `pnpm --filter api test:redis` starts only its own loopback server, uses a random port/password, disables persistence, and cleans up afterward. Set `REDIS_TEST_SERVER` to an installed executable if it is not on PATH.
|
||||
@@ -1,121 +0,0 @@
|
||||
# Implementation Plan: Refresh Riot ID by PUUID
|
||||
|
||||
## Overview
|
||||
|
||||
Deliver the behavior in three backend slices. First add and prove the safe
|
||||
Account-V1-to-user persistence operation. Then invoke it from the existing
|
||||
personal-history refresh worker before completion is broadcast. Finally reuse it
|
||||
from stale-account background refresh with community-aware region resolution and
|
||||
failure isolation. No database or frontend contract change is required.
|
||||
|
||||
## Task List
|
||||
|
||||
### Phase 1: Identity Refresh Boundary
|
||||
|
||||
- [x] Add failing tests for changed, unchanged, incomplete, mismatched, and failed
|
||||
PUUID identity lookups.
|
||||
- Acceptance: tests describe state outcomes and fail because the focused method
|
||||
is not implemented.
|
||||
- Verify:
|
||||
`pnpm --filter api exec jest --runInBand riot-account-enrichment.service.spec.ts`
|
||||
- Files:
|
||||
`apps/api/src/modules/riot/riot-account-enrichment.service.spec.ts`
|
||||
- [x] Implement `refreshRiotIdentity` using `RiotAccountService.getByPuuid`.
|
||||
- Acceptance: valid changed values persist together; invalid results preserve
|
||||
existing values; unchanged values avoid a write.
|
||||
- Verify: the Phase 1 focused test passes.
|
||||
- Files:
|
||||
`apps/api/src/modules/riot/riot-account-enrichment.service.ts`
|
||||
|
||||
### Checkpoint: Phase 1
|
||||
|
||||
- [x] The enrichment service has a typed three-state result and all focused tests
|
||||
pass.
|
||||
- [x] No schema, endpoint, queue payload, or frontend changes exist.
|
||||
|
||||
### Phase 2: Refresh Worker Integration
|
||||
|
||||
- [x] Add a failing worker test proving that a user-history job requests identity
|
||||
refresh with its user ID, PUUID, and region.
|
||||
- Acceptance: the test fails before worker orchestration is updated.
|
||||
- Verify:
|
||||
`pnpm --filter api exec jest --runInBand riot-job-worker.service.spec.ts`
|
||||
- Files: `apps/api/src/modules/riot-job-queue/riot-job-worker.service.spec.ts`
|
||||
- [x] Invoke best-effort identity refresh before job completion.
|
||||
- Acceptance: the worker logs identity failure without aborting successful match
|
||||
refresh work, and broadcasts completion only after identity refresh returns.
|
||||
- Verify: the Phase 2 focused test passes.
|
||||
- Files: `apps/api/src/modules/riot-job-queue/riot-job-worker.service.ts`
|
||||
|
||||
### Checkpoint: Complete
|
||||
|
||||
- [x] Focused API suites pass without skipped tests.
|
||||
- [x] API lint and build pass.
|
||||
- [x] Web lint and production build pass, confirming the existing profile
|
||||
invalidation integration remains compatible.
|
||||
- [x] Final diff contains only the specification, plan, enrichment service, worker,
|
||||
and their tests.
|
||||
|
||||
### Phase 3: Background Refresh Integration
|
||||
|
||||
- [x] Add a failing enrichment-service test proving that an omitted region is
|
||||
resolved from the user's community.
|
||||
- Acceptance: a non-Asia community route reaches Account-V1 without changing the
|
||||
public method signature.
|
||||
- Verify:
|
||||
`pnpm --filter api exec jest --runInBand riot-account-enrichment.service.spec.ts`
|
||||
- Files:
|
||||
`apps/api/src/modules/riot/riot-account-enrichment.service.spec.ts`
|
||||
- [x] Resolve the community Riot region for region-less identity refresh calls.
|
||||
- Acceptance: explicit caller regions remain unchanged; missing community routes
|
||||
use the existing `asia` fallback.
|
||||
- Verify: the focused enrichment-service test passes.
|
||||
- Files:
|
||||
`apps/api/src/modules/riot/riot-account-enrichment.service.ts`
|
||||
- [x] Add failing background scheduler tests for identity refresh ordering and
|
||||
failure isolation.
|
||||
- Acceptance: stale accounts request identity refresh before statistics
|
||||
enrichment, while identity rejection does not increment failure counters.
|
||||
- Verify:
|
||||
`pnpm --filter api exec jest --runInBand background-refresh.scheduler.spec.ts`
|
||||
- Files:
|
||||
`apps/api/src/modules/riot-background-refresh/background-refresh.scheduler.spec.ts`
|
||||
- [x] Invoke best-effort identity refresh from the stale-account loop.
|
||||
- Acceptance: each processed candidate gets one PUUID identity lookup, statistics
|
||||
enrichment still determines processed/failed/backoff state, and no new Redis or
|
||||
database contract is added.
|
||||
- Verify: the focused background scheduler tests pass.
|
||||
- Files:
|
||||
`apps/api/src/modules/riot-background-refresh/background-refresh.scheduler.ts`
|
||||
|
||||
### Checkpoint: Background Refresh Complete
|
||||
|
||||
- [x] Focused identity, manual worker, and background scheduler suites pass.
|
||||
- [x] API lint, full tests, and build pass.
|
||||
- [x] Final diff remains limited to the existing feature documents, identity
|
||||
service/tests, and background scheduler/tests.
|
||||
|
||||
## Risks and Mitigations
|
||||
|
||||
| Risk | Impact | Mitigation |
|
||||
|---|---|---|
|
||||
| Account-V1 returns an incomplete identity | High | Require matching PUUID and two non-empty Riot ID fields before mutation. |
|
||||
| Riot Account-V1 is temporarily unavailable | Medium | Preserve stored identity, log the failure, and retain existing best-effort job semantics. |
|
||||
| Multiple queue groups repeat identity lookup | Low | The personal page requests one queue group; avoid a new dedup mechanism until a measured need exists. |
|
||||
| Background community uses a non-Asia Riot route | High | Resolve omitted regions from the user's community before falling back to `asia`. |
|
||||
| Identity lookup failure triggers background backoff | Medium | Isolate identity exceptions and let existing statistics enrichment alone control failure counters. |
|
||||
| UI keeps the stale profile cached | High | Identity update completes before the existing completion event invalidates the profile query. |
|
||||
| Historical names are unexpectedly rewritten | Medium | Restrict persistence to the embedded Riot account and leave match snapshots untouched. |
|
||||
|
||||
## Dependencies
|
||||
|
||||
```text
|
||||
validated Account-V1 lookup
|
||||
-> focused identity persistence method
|
||||
-> manual refresh worker -> existing completion event -> profile invalidation
|
||||
-> background scheduler -> existing statistics enrichment and backoff policy
|
||||
```
|
||||
|
||||
## Open Questions
|
||||
|
||||
None. The user approved the specification and requested implementation.
|
||||
@@ -1,116 +0,0 @@
|
||||
# Implementation Plan: Team Progress Page UX Refresh
|
||||
|
||||
## Overview
|
||||
|
||||
Deliver the redesign in three verifiable slices: tested presentation rules, shared
|
||||
Series semantics, and the integrated page/copy experience. No API or dependency
|
||||
change is required because the team view already exposes `seriesId`, ordinal, round
|
||||
metadata, outcome categories, and code expiry.
|
||||
|
||||
## Architecture Decisions
|
||||
|
||||
- Keep API/query ownership in the page and move deterministic presentation logic
|
||||
into a pure module that the existing Node test runner can exercise.
|
||||
- Compose the active-Series card with code rows instead of maintaining a separate
|
||||
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.
|
||||
|
||||
## Task List
|
||||
|
||||
### Phase 1: Tested View Model
|
||||
|
||||
- [x] Add failing tests for Series/code grouping, stable ordering, Korean round
|
||||
labels, code availability/expiry, unique copy labels, and explicit clipboard
|
||||
results.
|
||||
- Acceptance: the new focused test fails because the behavior is not implemented.
|
||||
- Verify: `pnpm --filter web exec node --test --experimental-strip-types test/match-team-progress-view.test.ts`
|
||||
- Files: `apps/web/test/match-team-progress-view.test.ts`
|
||||
- [x] Implement the minimal pure view helpers.
|
||||
- Acceptance: all focused assertions pass without React or DOM mocks.
|
||||
- Verify: rerun the focused command once after implementation.
|
||||
- Files: `apps/web/src/pages/match-team-progress-view.ts`
|
||||
|
||||
### Checkpoint: View Model
|
||||
|
||||
- [x] Focused tests pass and no API/contract file changed.
|
||||
|
||||
### Phase 2: Series Semantics and Code Interaction
|
||||
|
||||
- [x] Add a page-specific Series card that prefers supplied human labels, shows
|
||||
technical codes secondarily, and hides misleading pre-start/adjudicated scores.
|
||||
- Acceptance: ready and adjudicated cards show `—`; result categories remain
|
||||
text-visible; bracket geometry stays unchanged.
|
||||
- Verify: `pnpm --filter web test`
|
||||
- Files: `apps/web/src/components/competition/TeamSeriesCard.tsx`
|
||||
- [x] Add the responsive tournament-code list with accessible clipboard feedback.
|
||||
- Acceptance: code rows show local set number first, full selectable codes,
|
||||
unique 44px copy controls, expiry/state text, and success/failure announcements.
|
||||
- Verify: TypeScript build plus runtime keyboard/copy check.
|
||||
- Files: `apps/web/src/components/competition/TeamTournamentCodes.tsx`
|
||||
|
||||
### Checkpoint: Interaction
|
||||
|
||||
- [x] Full web tests pass and the web build succeeds.
|
||||
|
||||
### Phase 3: Page Hierarchy and Polish
|
||||
|
||||
- [x] Reorder the page and integrate code rows with matching active Series.
|
||||
- Acceptance: order is next match, roster, recent results; every code appears
|
||||
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 (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.
|
||||
- [ ] Runtime review confirms no console errors or horizontal overflow. The
|
||||
required in-app browser was unavailable in this session.
|
||||
- [x] The scoped implementation contains only the spec, plan, focused tests, and
|
||||
team-progress UI; unrelated concurrent worktree changes are excluded.
|
||||
|
||||
## Risks and Mitigations
|
||||
|
||||
| Risk | Impact | Mitigation |
|
||||
|---|---|---|
|
||||
| A code appears under the wrong Series | High | Join only on exact `seriesId` and cover opponent/other-Series codes in tests. |
|
||||
| Global and local game numbers are confused | High | Lead with `ordinal` as set number and demote `displayNumber`. |
|
||||
| Adjudication looks like a played 0–0 | High | Reuse tested outcome/score helpers from Competition history. |
|
||||
| Clipboard permissions fail silently | Medium | Return a typed result and render an alert with manual-selection guidance. |
|
||||
| Long codes overflow at mobile widths | Medium | Use `minmax(0,1fr)`, `break-all`, selectable text, and a stacked mobile row. |
|
||||
| Page-specific result semantics drift | Medium | Cover every lifecycle/outcome branch in the pure presentation tests. |
|
||||
|
||||
## Dependencies
|
||||
|
||||
```text
|
||||
View-model tests -> view helpers -> code component -> page composition
|
||||
Exhaustive Series outcome tests -> page-specific score semantics -> recent results
|
||||
```
|
||||
|
||||
## Open Questions
|
||||
|
||||
None.
|
||||
@@ -1,80 +0,0 @@
|
||||
# Spec: API Performance Observability And Full Route Report
|
||||
|
||||
## Objective
|
||||
|
||||
Add Phase 1 and Phase 2 support for API performance work:
|
||||
|
||||
- Phase 1 records request latency and Mongoose document-return metrics.
|
||||
- Phase 2 generates a report for every API route, not only the slowest routes.
|
||||
- New Relic Transaction or custom event data is the preferred production source.
|
||||
- Local NDJSON files provide a staging/local fallback with query-level detail.
|
||||
|
||||
Success means an engineer can run representative traffic against the API and produce
|
||||
a route-complete report that includes routes with no samples.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
- NestJS API in `apps/api`
|
||||
- Mongoose models created through `ConnectionService`
|
||||
- New Relic Node agent, already configured by `apps/api/newrelic.cjs`
|
||||
- Jest for unit tests
|
||||
- `ts-node` for API maintenance scripts
|
||||
|
||||
## Commands
|
||||
|
||||
- Build: `pnpm --filter api build`
|
||||
- Test: `pnpm --filter api test`
|
||||
- Generate local/New Relic report: `pnpm --filter api perf:report`
|
||||
- Generate route manifest only: `pnpm --filter api perf:routes`
|
||||
|
||||
## Project Structure
|
||||
|
||||
- `apps/api/src/modules/global/observability/` contains request/query instrumentation.
|
||||
- `apps/api/src/scripts/api-performance-report.ts` generates full API reports.
|
||||
- `docs/specs/api-performance-observability.md` defines this behavior.
|
||||
|
||||
## Code Style
|
||||
|
||||
Instrumentation must be opt-in and defensive:
|
||||
|
||||
```ts
|
||||
if (!isPerformanceObservabilityEnabled()) return;
|
||||
recordApiPerformanceEvent({
|
||||
type: 'api-request',
|
||||
method,
|
||||
route,
|
||||
durationMs,
|
||||
});
|
||||
```
|
||||
|
||||
Do not record raw request bodies, authorization headers, cookies, raw Mongo filters,
|
||||
or raw query results.
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
- Unit test pure metric aggregation and route discovery logic.
|
||||
- Unit test request context aggregation without a database.
|
||||
- Build the API to catch Nest and TypeScript integration issues.
|
||||
- Production/staging validation uses New Relic Transaction data and optional local
|
||||
NDJSON from representative traffic.
|
||||
|
||||
## Boundaries
|
||||
|
||||
- Always: keep instrumentation disabled unless explicitly enabled.
|
||||
- Always: include all discovered controller routes in the report.
|
||||
- Always: report `no-samples` for routes that did not receive traffic.
|
||||
- Ask first: adding external load-test dependencies or CI performance gates.
|
||||
- Never: log secrets, request bodies, auth headers, cookies, or raw Mongo filters.
|
||||
|
||||
## Success Criteria
|
||||
|
||||
- API request events include duration, status, route, query count, Mongoose duration,
|
||||
returned document count, and hydrated document count.
|
||||
- Mongoose query events include model, collection, operation, duration, returned
|
||||
documents, hydrated documents, and lean status.
|
||||
- New Relic receives route-level custom events when instrumentation is enabled.
|
||||
- New Relic Transaction traces can be grouped by route through custom transaction names
|
||||
and attributes.
|
||||
- The report generator can use local NDJSON, New Relic custom events, or New Relic
|
||||
Transaction duration data.
|
||||
- The report lists every API route from controller source files.
|
||||
@@ -1,67 +0,0 @@
|
||||
# Spec: Dakao Upcoming Internal Match List
|
||||
|
||||
## Objective
|
||||
|
||||
When a user sends `!내전 일정`, return only recruiting matches whose scheduled
|
||||
start is not earlier than the command processing time. Matches that have already
|
||||
started must not consume the ten-result query limit or appear in the response.
|
||||
|
||||
## Approved Product Decisions
|
||||
|
||||
- Capture the command processing time once before querying matches.
|
||||
- Exclude `scheduledAt < now`.
|
||||
- Include `scheduledAt === now` and future matches.
|
||||
- Apply the boundary only to the Dakao `!내전 일정` command.
|
||||
- Preserve the existing recruiting status, result limit, ordering, formatting,
|
||||
short-code generation, and short-link behavior.
|
||||
|
||||
## Commands
|
||||
|
||||
- Focused test:
|
||||
`pnpm --filter api exec jest src/modules/dakao/handlers/match-list.handler.spec.ts --runInBand`
|
||||
- API lint:
|
||||
`pnpm --filter api exec eslint "{src,apps,libs,test}/**/*.ts" --max-warnings=0`
|
||||
- API build: `pnpm --filter api build`
|
||||
|
||||
## Project Structure
|
||||
|
||||
- `apps/api/src/modules/dakao/handlers/match-list.handler.ts` owns the command
|
||||
query and response formatting.
|
||||
- `apps/api/src/modules/dakao/handlers/match-list.handler.spec.ts` verifies the
|
||||
command boundary and presentation.
|
||||
- `apps/api/src/modules/match/match.service.ts` translates `scheduledFrom` into a
|
||||
MongoDB `$gte` filter.
|
||||
|
||||
## Code Style
|
||||
|
||||
Pass the captured boundary through the existing list contract:
|
||||
|
||||
```ts
|
||||
const scheduledFrom = new Date();
|
||||
await matchService.list({ communityId, scheduledFrom });
|
||||
```
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
- Freeze the system clock in the handler unit test.
|
||||
- Assert that the exact frozen time is passed as `scheduledFrom`.
|
||||
- Rely on the existing `MatchService` test that verifies `scheduledFrom` becomes
|
||||
`{ scheduledAt: { $gte: scheduledFrom } }`.
|
||||
- Run the focused handler test, full API lint, and API build.
|
||||
|
||||
## Boundaries
|
||||
|
||||
- Always: filter before applying the result limit and use one captured time.
|
||||
- Ask first: change ordering, statuses, limit, or response wording.
|
||||
- Never: hide the requirement with an ESLint exception or filter only after the
|
||||
limited database query.
|
||||
|
||||
## Success Criteria
|
||||
|
||||
- A match scheduled before command processing time is not queried.
|
||||
- A match scheduled exactly at command processing time remains eligible.
|
||||
- Existing command formatting and link tests continue to pass.
|
||||
|
||||
## Open Questions
|
||||
|
||||
None.
|
||||
@@ -1,134 +0,0 @@
|
||||
# Spec: Double-Elimination Connector Routing
|
||||
|
||||
## Objective
|
||||
|
||||
Make winner advancement lines in the desktop double-elimination bracket bend at a
|
||||
consistent horizontal position. Two winner lines entering the same match should
|
||||
read as one visual pair when their vertical spans can share a rail: use the center
|
||||
of the 40px inter-column corridor when it is safe, and move the pair together only
|
||||
when another connector would interfere. If an accepted A/B mapping reverses the
|
||||
source order and makes those spans overlap, preserve separate deterministic,
|
||||
stroke-clear rails instead of creating a collinear overlap.
|
||||
|
||||
The primary user is a participant or organizer tracing advancement through a busy
|
||||
eight-team bracket. Success means the solid coral winner paths are visually
|
||||
aligned without degrading the existing dashed loser paths, card placement, or
|
||||
keyboard-driven connector highlighting.
|
||||
|
||||
## Approved Product Decisions
|
||||
|
||||
- Treat the two `winner` connectors entering one Series as a semantic bundle.
|
||||
- Prefer `target.x - columnGap / 2` for a winner bundle.
|
||||
- If the preferred rail causes crossings, collinear overlap, or less than 5px of
|
||||
clearance from an overlapping parallel route, move a shareable bundle to the
|
||||
nearest safe rail. Retain separate rails only when the pair's own vertical spans
|
||||
overlap and therefore cannot safely share any rail; move those rails to the
|
||||
nearest deterministic positions needed to preserve the same 5px clearance.
|
||||
- Preserve the current loser/reset rail ordering unless moving one is required to
|
||||
maintain valid geometry.
|
||||
- Keep every connector as a separate `H-V-H` SVG path so focus highlighting and
|
||||
accessible labels remain independent.
|
||||
- Keep long-distance bends inside the corridor immediately before the target
|
||||
column; do not use the midpoint between source and target cards.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
- React 19, TypeScript 6, Vite 8, Tailwind CSS 4, and daisyUI under `apps/web`
|
||||
- Node's built-in test runner for the pure bracket layout calculation
|
||||
|
||||
## Commands
|
||||
|
||||
- Focused layout tests: `pnpm --filter web exec node --test --experimental-strip-types test/double-elimination-bracket-layout.test.ts`
|
||||
- Full web tests: `pnpm --filter web test`
|
||||
- Web lint: `pnpm --filter web lint`
|
||||
- Web production build: `pnpm --filter web build:prod`
|
||||
- Development server: `pnpm --filter web start:dev`
|
||||
|
||||
## Project Structure
|
||||
|
||||
- `apps/web/src/components/competition/double-elimination-bracket-layout.ts`
|
||||
validates the bracket graph, positions cards, assigns connector rails, and emits
|
||||
SVG path geometry.
|
||||
- `apps/web/src/components/competition/DoubleEliminationBracket.tsx` renders the
|
||||
computed paths and must not need routing-specific changes.
|
||||
- `apps/web/test/double-elimination-bracket-layout.test.ts` contains canonical
|
||||
four-team, eight-team, and reset-final fixtures plus geometry assertions.
|
||||
|
||||
## Code Style
|
||||
|
||||
Keep routing deterministic and express geometry through small named helpers:
|
||||
|
||||
```ts
|
||||
const preferredX = target.x - geometry.columnGap / 2;
|
||||
const verticalX = nearestSafeRail(preferredX, bundle, occupiedRoutes);
|
||||
```
|
||||
|
||||
Use existing layout types and semantic connector kinds. Do not add a dependency,
|
||||
DOM measurement, mutable global state, or renderer-specific routing behavior.
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
- Add regression tests before implementation and confirm they fail against the
|
||||
current per-edge rail allocator.
|
||||
- Assert observable geometry: safe winner pairs share a rail, quiet corridors use
|
||||
their exact midpoint, busy corridors keep a pair aligned, and mixed
|
||||
winner/loser entries remain distinguishable.
|
||||
- Cover reversed A/B winner input explicitly: it remains deterministic and uses
|
||||
separate rails without collinear overlap or focused-stroke clearance conflicts
|
||||
because no shared H-V-H rail is safe.
|
||||
- Replace the obsolete "all rails in a target column are unique" assertion with
|
||||
interval-aware overlap and 5px focused-stroke clearance protection.
|
||||
- Preserve deterministic output for shuffled input, finite path coordinates,
|
||||
target-corridor bounds, card avoidance, endpoint alignment, and canonical graph
|
||||
validation.
|
||||
- Verify four-team, eight-team, and reset-final layouts; run the complete web test,
|
||||
lint, and production build commands.
|
||||
|
||||
## Boundaries
|
||||
|
||||
### Always
|
||||
|
||||
- Keep winner, loser, and reset connectors visually distinguishable by the existing
|
||||
solid/dashed patterns and brand tokens.
|
||||
- Keep connector rails strictly inside the target corridor.
|
||||
- Avoid strict segment crossings and collinear overlaps whenever a safe candidate
|
||||
exists.
|
||||
- Keep overlapping parallel winner and loser rails at least 5px apart, matching
|
||||
the widest focused connector underlay.
|
||||
- Produce the same layout regardless of projection input ordering.
|
||||
|
||||
### Ask First
|
||||
|
||||
- Add dependencies or change the public projection contract.
|
||||
- Change bracket card dimensions, round columns, or the 40px column gap.
|
||||
- Redesign mobile bracket presentation or connector interaction behavior.
|
||||
|
||||
### Never
|
||||
|
||||
- Route a connector through a match card.
|
||||
- Infer routing from Series codes; use canonical graph identity and topology.
|
||||
- Merge two logical connectors into one SVG path.
|
||||
- Modify unrelated competition or score-card behavior.
|
||||
|
||||
## Success Criteria
|
||||
|
||||
- The two winner paths into `LB_R3_M1` bend at the corridor midpoint and share the
|
||||
same `verticalX`.
|
||||
- The winner paths into the grand final share the corridor midpoint when safe.
|
||||
- Every same-target winner pair whose vertical spans do not overlap shares one
|
||||
`verticalX`, using the nearest collision-safe rail when the midpoint is busy.
|
||||
- A reversed A/B pair with overlapping vertical spans retains deterministic
|
||||
separate rails, produces no collinear segment overlap, and remains at least 5px
|
||||
from every overlapping vertical route.
|
||||
- Loser/reset paths retain their baseline rails, and winner bundles remain at least
|
||||
5px away where their vertical runs overlap.
|
||||
- All rails remain inside their target corridors without card penetration or
|
||||
collinear overlap.
|
||||
- Canonical four-team, eight-team, reset-final, and shuffled-input tests pass.
|
||||
- Full web tests and production build pass; changed-file lint passes, and any
|
||||
unrelated full-lint baseline failures are documented.
|
||||
|
||||
## Open Questions
|
||||
|
||||
None. The user reviewed the proposed bundle-aware routing behavior and requested
|
||||
implementation.
|
||||
@@ -1,170 +0,0 @@
|
||||
# Spec: Internal Match Game Analysis P0/P1
|
||||
|
||||
## Objective
|
||||
|
||||
Make an internal-match game result explain both the final numbers and how the game
|
||||
reached them. P0 exposes data already present in the detail response: objective
|
||||
events, complete team objectives, participant gold/GPM, and explicitly labelled
|
||||
kill participation. P1 projects Riot Match-V5 timeline frames into real 10- and
|
||||
15-minute lane checkpoints and a unified event stream for kills and structures.
|
||||
|
||||
The primary user is a tournament participant or organizer reviewing a completed
|
||||
game on desktop or mobile. Success means the user can identify the major objective
|
||||
sequence before reading ten player cards, compare lane state at 10/15 minutes, and
|
||||
trace kills and building events without mistaking unavailable data for zero.
|
||||
|
||||
## Approved Product Decisions
|
||||
|
||||
- Place game flow immediately after the game summary and before detail tabs.
|
||||
- Render chart events as both visual markers and a keyboard-readable text list.
|
||||
- Keep the existing gold/XP toggle and runes/build experience.
|
||||
- Show tower, dragon, inhibitor, Baron, Rift Herald, Void Grub, and Elder Dragon
|
||||
totals; derive dragon type labels only when objective events are available.
|
||||
- Combine participant CS and economy instead of adding another wide table column.
|
||||
- Label kill participation explicitly as `KP`.
|
||||
- Replace final-state values in the lane tab with 10/15-minute checkpoints; default
|
||||
to 15 minutes and pair players by `teamPosition`, never array position.
|
||||
- Keep `objectiveEvents` for compatibility and add `timelineEvents` for the unified
|
||||
P1 stream.
|
||||
- Treat missing checkpoints and events as unavailable, not zero.
|
||||
- Do not add an opaque MVP/rating or new external data feed in this scope.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
- React 19, TypeScript 6, Recharts 3, Tailwind CSS 4, and daisyUI under `apps/web`
|
||||
- NestJS 11, TypeScript 5, Mongoose 9, and Jest under `apps/api`
|
||||
- Riot Match-V5 match and timeline payloads already cached in `RiotMatchModel`
|
||||
- Node's built-in test runner for pure web transformations
|
||||
|
||||
## Commands
|
||||
|
||||
- Focused web tests: `pnpm --filter web test`
|
||||
- Web lint: `pnpm --filter web lint`
|
||||
- Web production build: `pnpm --filter web build:prod`
|
||||
- Focused API tests: `pnpm --filter api test -- --runInBand riot-match.service.spec.ts match-stats-fragment.builder.spec.ts community-stats.service.spec.ts`
|
||||
- API build: `pnpm --filter api build`
|
||||
- Development web server: `pnpm --filter web start:dev`
|
||||
|
||||
## Project Structure
|
||||
|
||||
- `apps/web/src/pages/MatchGameDetailPage.tsx` owns the result summary,
|
||||
participant scoreboard, flow chart, and accessible event list.
|
||||
- `apps/web/src/components/InternalGameAnalysisTabs.tsx` owns the lane and build
|
||||
tabs.
|
||||
- `apps/web/src/lib/internal-match-timeline.ts` owns pure event normalization,
|
||||
labels, filtering, and chart projection.
|
||||
- `apps/web/src/lib/internal-game-matchups.ts` owns pure role pairing and checkpoint
|
||||
comparisons.
|
||||
- `apps/web/test/` contains Node unit tests for the pure web transformations.
|
||||
- `apps/api/src/modules/riot/` parses trusted fields from Riot match timelines.
|
||||
- `apps/api/src/modules/community-stats/match-stats-fragment.builder.ts` projects
|
||||
stored Riot payloads into cached internal-match records.
|
||||
- `apps/api/src/modules/community-stats/community-stats.service.ts` maps persisted
|
||||
records into the public detail response and versions response caches.
|
||||
- `apps/api/src/modules/global/database/schema.ts` defines persisted TypeScript
|
||||
shapes; nested `gameDetails` remains a Mongoose Mixed array.
|
||||
|
||||
## Data Contract
|
||||
|
||||
Participant checkpoint data is additive and optional for legacy/fallback games:
|
||||
|
||||
```ts
|
||||
interface MatchStatsCheckpoint {
|
||||
timestamp: number;
|
||||
gold: number;
|
||||
cs: number;
|
||||
xp: number;
|
||||
kills: number;
|
||||
deaths: number;
|
||||
assists: number;
|
||||
}
|
||||
|
||||
interface MatchStatsParticipantCheckpoints {
|
||||
at10?: MatchStatsCheckpoint;
|
||||
at15?: MatchStatsCheckpoint;
|
||||
}
|
||||
```
|
||||
|
||||
Each detailed participant gains optional `participantId` and `checkpoints`. Each
|
||||
game gains optional `timelineEvents`, whose `type` is an existing objective type or
|
||||
`championKill`, `tower`, or `inhibitor`. Actor IDs, assists, monster subtype, and
|
||||
tower subtype are optional fields appropriate to the event type.
|
||||
|
||||
For a 10/15-minute target, use the latest frame at or before the target only when it
|
||||
is less than one `frameInterval` old. Persist the actual selected timestamp. CS is
|
||||
`minionsKilled + jungleMinionsKilled`; checkpoint K/D/A includes champion-kill
|
||||
events through the selected timestamp. A game ending before a target has no value
|
||||
for that checkpoint.
|
||||
|
||||
## Code Style
|
||||
|
||||
Keep timeline calculations independent from React and use discriminated event
|
||||
types with conservative fallbacks:
|
||||
|
||||
```ts
|
||||
const events = game.timelineEvents?.length
|
||||
? game.timelineEvents
|
||||
: game.objectiveEvents;
|
||||
|
||||
const checkpoint = participant.checkpoints?.at15;
|
||||
if (!checkpoint) return { kind: "unavailable" };
|
||||
```
|
||||
|
||||
Use existing semantic color tokens and square bordered panels. Dynamic chart
|
||||
coordinates may use numeric props; spacing, colors, and typography remain in the
|
||||
existing Tailwind/daisyUI system.
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
- Develop pure event normalization, checkpoint selection, role pairing, and metric
|
||||
comparison test-first.
|
||||
- Builder tests cover exact and missing checkpoints, jungle CS, cumulative K/D/A,
|
||||
executes, objective fallback, building ownership, and deterministic event order.
|
||||
- Service tests reject stale cached response shapes and verify additive mapping.
|
||||
- Browser verification covers 320px, 390px, 768px, 1024px, and 1440px; the event
|
||||
text list is the accessible equivalent of decorative chart markers.
|
||||
- Verify the supplied production-like game as well as a short game and a game with
|
||||
no timeline.
|
||||
|
||||
## Boundaries
|
||||
|
||||
### Always
|
||||
|
||||
- Preserve existing `objectiveEvents`, runes/builds, and match-detail routes.
|
||||
- Derive participant checkpoint values from stored Riot timeline frames.
|
||||
- Pair lanes by normalized `teamPosition` and show unavailable states explicitly.
|
||||
- Communicate team/event meaning with text as well as color.
|
||||
- Increment the match-stats builder and detail-response cache versions whenever a
|
||||
persisted or cached response shape changes.
|
||||
|
||||
### Ask First
|
||||
|
||||
- Add a frontend or backend dependency.
|
||||
- Change the public route or remove compatibility fields.
|
||||
- Add a database migration or make a bulk external Riot API fetch.
|
||||
- Deploy, push, or alter CI configuration.
|
||||
|
||||
### Never
|
||||
|
||||
- Infer absent checkpoint data as zero.
|
||||
- Pair opponents by array order.
|
||||
- Claim that a nearby objective caused a gold swing.
|
||||
- Expose unparsed arbitrary Riot event fields.
|
||||
- Modify unrelated Competition/bracket work already present in the worktree.
|
||||
|
||||
## Success Criteria
|
||||
|
||||
- Game flow appears before player details and includes objective markers plus an
|
||||
equivalent textual sequence on desktop and mobile.
|
||||
- Summary shows all currently projected objective totals and available dragon types.
|
||||
- Every participant shows labelled KP, gold, GPM, CS, and CS/min without breaking
|
||||
the responsive scoreboard.
|
||||
- The lane tab defaults to 15 minutes, can switch to 10 minutes, and presents
|
||||
GD/CSD/XPD and checkpoint K/D/A for correctly paired roles.
|
||||
- The unified timeline can filter and display objectives, champion kills, towers,
|
||||
and inhibitors, while falling back to objective-only data during rolling updates.
|
||||
- Focused API/web tests, lint, and production builds pass.
|
||||
|
||||
## Open Questions
|
||||
|
||||
None. The user reviewed the P0/P1 task plan and requested implementation.
|
||||
@@ -1,93 +0,0 @@
|
||||
# Spec: 카카오톡 방 이동 후 사용자 데이터 이관
|
||||
|
||||
## Objective
|
||||
|
||||
`!내전 데이터이관 <예전 kakaoTalkNickname>` 명령으로 기존 user의
|
||||
`kakaoTalkId`를 명령 발신자의 현재 ID로 변경한다. 기존 user의 `_id`,
|
||||
`riotAccounts`, 참가 기록, 권한과 기타 데이터는 유지한다.
|
||||
|
||||
## Proposed Success Criteria
|
||||
|
||||
- 현재 명령이 연결된 community 안에서만 조회한다.
|
||||
- 인자 전체를 예전 닉네임으로 취급하여 공백이 포함된 닉네임을 지원한다.
|
||||
- 닉네임은 앞뒤 인자 공백을 제거한 후 정확히 일치하는 값으로 조회한다.
|
||||
- `riotAccounts`가 있는 기존 user를 이관 대상으로 삼는다.
|
||||
- 대상 없음, 중복 닉네임, 다른 user의 현재 카카오 ID 점유는 변경 없이 안내한다.
|
||||
- 성공 시 기존 user의 `kakaoTalkId`만 변경하고 발신자에게 완료를 안내한다.
|
||||
- 동일 ID로 재시도하면 이미 연결된 상태로 안내한다.
|
||||
- 동시 변경과 DB 중복 키 오류를 처리하며 새 user를 생성하거나 병합하지 않는다.
|
||||
|
||||
## Tech Stack / Project Structure
|
||||
|
||||
NestJS 11, TypeScript, Mongoose 9, Jest 30, pnpm workspace.
|
||||
`apps/api/src/modules/dakao/`의 parser, handler, service, module 및 명령 라우팅을 사용한다.
|
||||
테스트는 구현 옆 `*.spec.ts`, 명세는 `docs/specs/`에 둔다.
|
||||
|
||||
## Commands
|
||||
|
||||
- 관련 테스트: `pnpm --filter api test --runInBand dakao`
|
||||
- 전체 API 테스트: `pnpm --filter api test --runInBand`
|
||||
- 빌드: `pnpm --filter api build`
|
||||
- 변경 파일 lint: `pnpm --filter api exec eslint <changed-files>`
|
||||
- 개발 실행: `pnpm --filter api start:debug`
|
||||
|
||||
## Code Style
|
||||
|
||||
기존 Injectable handler/service와 discriminated command union 패턴을 따른다.
|
||||
|
||||
```typescript
|
||||
return { kind: 'data-transfer', previousNickname: args };
|
||||
```
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
구현 전 실패 테스트를 작성한다. 파싱, 커뮤니티 범위, 성공 후 기존 데이터 보존,
|
||||
대상 없음/중복, ID 충돌, 재시도, 동시 갱신 실패 및 라우팅/응답을 검증한다.
|
||||
관련 테스트 후 전체 API 테스트와 빌드를 수행한다.
|
||||
|
||||
## Boundaries
|
||||
|
||||
- Always: 커뮤니티 범위 제한, 입력 검증, 기존 user 식별자 및 연결 데이터 보존.
|
||||
- Ask first: 스키마 변경, 의존성 추가, 기존 user 병합/삭제.
|
||||
- Never: 운영 DB 직접 수정, 비밀값 커밋, 실패 테스트 제거.
|
||||
|
||||
## Confirmed Policy
|
||||
|
||||
사용자 확인: `riotAccounts`가 등록된 user를 뜻한다. Riot 계정 검증 및 소유권
|
||||
확인은 하지 않으며 운영으로 통제한다. 예전 닉네임으로 조회하여 ID만 변경한다.
|
||||
|
||||
## Implementation Plan and Tasks
|
||||
|
||||
1. 이관 서비스: `dakao-user.service.ts` 및 전용 테스트 파일.
|
||||
- 수락 조건: 기존 데이터 보존, 대상/충돌/재시도/동시 변경 처리.
|
||||
- 검증: 실패 테스트 확인 후 서비스 테스트 통과.
|
||||
2. 명령 parser 및 handler: 구현과 각각의 테스트 4개 파일.
|
||||
- 수락 조건: 공백 포함 닉네임 파싱, 빈 입력 사용법, 결과별 한국어 응답.
|
||||
- 검증: parser/handler 테스트 통과. 작업 1에 의존.
|
||||
3. subscriber 및 module 연결: 구현 2개와 subscriber 테스트.
|
||||
- 수락 조건: 현재 커뮤니티/발신자 ID 전달, 도움말 노출.
|
||||
- 검증: Dakao 테스트, 전체 API 테스트, 빌드, 변경 파일 lint. 작업 2에 의존.
|
||||
|
||||
위험: 동시에 이관되는 user는 기존 ID를 조건으로 갱신하여 덮어쓰기를 막고,
|
||||
새 ID 동시 점유는 기존 unique 인덱스 오류를 충돌 응답으로 변환한다.
|
||||
각 단계에서 테스트를 확인하고 다음 단계로 진행한다.
|
||||
|
||||
## Verification Results
|
||||
|
||||
- 서비스, parser/handler, subscriber 테스트는 기능 미구현 상태의 실패를 확인한 후 통과.
|
||||
- Dakao: 16 suites / 92 tests 통과.
|
||||
- API 전체: 99 suites / 634 tests 통과, 기존 테스트 2개 실패.
|
||||
- `api-performance-report.spec.ts`: Windows `path.relative`의 역슬래시와 기대값 불일치.
|
||||
- `secret.service.spec.ts`: 환경변수에 의존해 누락된 bootstrap secret의 기대 키 불일치.
|
||||
- 두 테스트는 변경하지 않은 파일이며 별도 실행에서도 같은 실패 재현.
|
||||
- API 빌드, 변경 TypeScript 파일 ESLint, `git diff --check` 통과.
|
||||
- 로컬 실행 환경 Node 24.15.0; 저장소 엔진 요구사항은 Node 26.
|
||||
- 실제 카카오톡 메시지 전송 및 운영 DB 이관은 실행하지 않음.
|
||||
- 코드 검토: 커뮤니티 제한, 정확한 닉네임 조회, 등록 계정 필터,
|
||||
ID만 갱신하는 조건부 업데이트, 충돌 응답, DI 및 명령 라우팅 확인.
|
||||
|
||||
## Usage
|
||||
|
||||
새 방에서 `!내전 데이터이관 예전 닉네임`을 실행한다. 따옴표 없이 공백을 포함한
|
||||
닉네임 전체를 입력할 수 있다. 새 ID로 이미 user가 생성되어 있으면 자동 병합하지
|
||||
않고 운영자 문의를 안내한다. 소유권 확인은 운영 정책으로 통제한다.
|
||||
@@ -75,7 +75,7 @@
|
||||
|
||||
세트의 기본 헤더에는 `2:0`도, 세트 승패를 숫자로 바꾼 `1:0`도 넣지 않는다. 필요하면 별도 `시리즈 최종 2:0` 또는 `시리즈 현재 1:0`을 함께 표시한다. `현재/최종`은 공식 시리즈 상태가 결정한다. 동일 두 팀이 승자조와 결승에서 다시 만나면 별개의 `seriesId`와 세트 목록을 가진다.
|
||||
|
||||
표의 라운드 이름은 설명용 예시다. 화면에서는 기존 공식 대진의 라운드 이름을 공용 함수로 재사용하고 내전 상세, 전적, 팀 진행 사이에서 같은 이름을 쓴다. [기존 팀 진행 명세](team-progress-page-ux-refresh.md)
|
||||
표의 라운드 이름은 설명용 예시다. 화면에서는 기존 공식 대진의 라운드 이름을 공용 함수로 재사용하고 내전 상세, 전적, 팀 진행 사이에서 같은 이름을 쓴다. [라운드 이름 공용 함수](../../apps/web/src/components/competition/double-elimination-bracket-layout.ts#L202)
|
||||
|
||||
| 시리즈/슬롯 상태 | 화면 문구와 점수 |
|
||||
| --- | --- |
|
||||
|
||||
@@ -1,175 +0,0 @@
|
||||
# Spec: Refresh Riot ID by PUUID
|
||||
|
||||
## Objective
|
||||
|
||||
Whenever an account is refreshed manually from the personal match-history page
|
||||
or automatically by the stale-account background scheduler, resolve its current
|
||||
Riot ID through Riot Account-V1 using the stored PUUID. If the player changed
|
||||
either their game name or tag line, persist the latest values on the same embedded
|
||||
Riot account so the profile displays the new Riot ID.
|
||||
|
||||
The existing refresh job remains the single user-facing operation. It continues
|
||||
to refresh matches and ranked data, and additionally refreshes identity before
|
||||
emitting its completion event.
|
||||
|
||||
## Approved Product Decisions
|
||||
|
||||
- Use the stored PUUID as the stable identity key; never look up the account by
|
||||
the possibly stale game name and tag line.
|
||||
- Query Riot Account-V1 on every manually queued user-history refresh job and
|
||||
every selected stale-account background refresh rather than applying a name TTL.
|
||||
- Update `gameName` and `tagLine` together only when Riot returns a matching PUUID
|
||||
and both values are non-empty.
|
||||
- Preserve the previous Riot ID if the Account-V1 lookup fails or returns an
|
||||
incomplete or mismatched response.
|
||||
- Treat identity refresh as best effort, matching the existing ranked-data refresh
|
||||
policy: log a failure but allow successful match refresh work to complete.
|
||||
- When a caller does not already know the Riot regional route, resolve it from the
|
||||
user's community and fall back to `asia` only when the community has no route.
|
||||
- Do not increment the background failure counter or enter backoff solely because
|
||||
the identity lookup failed; background statistics enrichment retains its
|
||||
existing success and failure semantics.
|
||||
- Reuse the existing refresh completion event and profile-query invalidation; do
|
||||
not add a new endpoint, response field, socket event, or frontend state path.
|
||||
- Update only the embedded Riot account used by the personal profile. Historical
|
||||
match snapshots retain the names recorded by Riot for those games.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
- NestJS 11, TypeScript 5, Mongoose 9, and Jest under `apps/api`
|
||||
- Riot Account-V1 through the existing `RiotAccountService`
|
||||
- Redis stream jobs through the existing `RiotJobWorkerService`
|
||||
- Scheduled stale-account refresh through `BackgroundRefreshScheduler`
|
||||
- React Query profile invalidation already present in `UserHistoryPage`
|
||||
|
||||
## Commands
|
||||
|
||||
- Focused tests:
|
||||
`pnpm --filter api exec jest --runInBand riot-account-enrichment.service.spec.ts riot-job-worker.service.spec.ts background-refresh.scheduler.spec.ts`
|
||||
- API lint: `pnpm --filter api lint`
|
||||
- API build: `pnpm --filter api build`
|
||||
- Web lint: `pnpm --filter web lint`
|
||||
- Web production build: `pnpm --filter web build:prod`
|
||||
|
||||
## Project Structure
|
||||
|
||||
- `apps/api/src/modules/riot/riot-account.service.ts` owns the validated
|
||||
Account-V1 PUUID lookup.
|
||||
- `apps/api/src/modules/riot/riot-account-enrichment.service.ts` owns the
|
||||
persistence boundary for the embedded Riot account.
|
||||
- `apps/api/src/modules/riot/riot-account-enrichment.service.spec.ts` verifies
|
||||
update, no-op, and failure behavior.
|
||||
- `apps/api/src/modules/riot-job-queue/riot-job-worker.service.ts` orchestrates
|
||||
identity, match, and ranked refresh work before completion.
|
||||
- `apps/api/src/modules/riot-job-queue/riot-job-worker.service.spec.ts` verifies
|
||||
that a personal-history refresh job requests the PUUID-based identity refresh.
|
||||
- `apps/api/src/modules/riot-background-refresh/background-refresh.scheduler.ts`
|
||||
orchestrates best-effort identity refresh for stale accounts before statistics
|
||||
enrichment.
|
||||
- `apps/api/src/modules/riot-background-refresh/background-refresh.scheduler.spec.ts`
|
||||
verifies background invocation, ordering, and failure isolation.
|
||||
- `apps/web/src/pages/UserHistoryPage.tsx` already invalidates the profile query
|
||||
when the refresh socket reports completion and is not modified in this scope.
|
||||
|
||||
## Internal Contract
|
||||
|
||||
Add one focused method to `RiotAccountEnrichmentService`:
|
||||
|
||||
```ts
|
||||
type RefreshRiotIdentityResult = "updated" | "unchanged" | "failed";
|
||||
|
||||
refreshRiotIdentity(params: {
|
||||
userId: mongoose.Types.ObjectId;
|
||||
puuid: string;
|
||||
region?: RiotRegionalRoute;
|
||||
}): Promise<RefreshRiotIdentityResult>;
|
||||
```
|
||||
|
||||
`updated` means both persisted Riot ID fields now match Account-V1. `unchanged`
|
||||
means the validated response matched the stored values and no database write was
|
||||
needed. `failed` means no stored account could be resolved or the external lookup
|
||||
could not safely provide a complete identity; stored values remain unchanged. If
|
||||
`region` is omitted, the service resolves the user's community and uses its
|
||||
configured `riotRegion`, falling back to `asia` only when unavailable.
|
||||
|
||||
## Code Style
|
||||
|
||||
Keep the external validation and persistence decision explicit:
|
||||
|
||||
```ts
|
||||
const identity = await this.accountService.getByPuuid(puuid, { region });
|
||||
if (identity.puuid !== puuid || !identity.gameName || !identity.tagLine) {
|
||||
return "failed";
|
||||
}
|
||||
```
|
||||
|
||||
Use existing single quotes, NestJS logging, Mongoose document mutation, and
|
||||
Prettier formatting. Do not add a generic identity abstraction or new dependency.
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
- Write the enrichment-service tests first and confirm they fail before adding
|
||||
the new method.
|
||||
- Verify a changed game name and tag line are persisted together.
|
||||
- Verify identical values return `unchanged` without saving.
|
||||
- Verify missing values, PUUID mismatch, and Riot lookup errors return `failed`
|
||||
without overwriting or saving the stored identity.
|
||||
- Write the worker orchestration expectation before calling the new method.
|
||||
- Verify a region-less identity refresh uses the user's configured community
|
||||
region.
|
||||
- Write background scheduler expectations before adding identity refresh to the
|
||||
stale-account loop.
|
||||
- Verify identity refresh happens before statistics enrichment and that a rejected
|
||||
identity lookup does not increment background failure counters.
|
||||
- Run focused API tests after each slice, then API lint/build and web lint/build
|
||||
to verify the existing client integration remains valid.
|
||||
|
||||
## Boundaries
|
||||
|
||||
### Always
|
||||
|
||||
- Use the stored PUUID for Account-V1 lookup and verify the returned PUUID.
|
||||
- Validate both Riot ID fields before mutating the database.
|
||||
- Preserve the current Riot ID on any unsafe or failed response.
|
||||
- Keep the existing refresh route, enqueue response, and socket event compatible.
|
||||
- Keep background identity failures independent from enrichment failure counters.
|
||||
- Run focused tests before broader lint and build verification.
|
||||
|
||||
### Ask First
|
||||
|
||||
- Add a database field or migration.
|
||||
- Change refresh failure semantics so an identity lookup failure fails the whole
|
||||
user-history job.
|
||||
- Update historical match snapshots or active match participant display names.
|
||||
- Add a new API response field, endpoint, dependency, or Redis job type.
|
||||
- Commit, push, deploy, or alter CI configuration.
|
||||
|
||||
### Never
|
||||
|
||||
- Resolve identity from the stale stored Riot ID.
|
||||
- Partially update only the game name or only the tag line.
|
||||
- Replace a valid stored identity with empty or mismatched Account-V1 data.
|
||||
- Expose Riot API errors or credentials to the browser.
|
||||
- Mix the change with the separate past-history result-column PR.
|
||||
|
||||
## Success Criteria
|
||||
|
||||
- Clicking `정보 갱신` causes the queued worker to call Account-V1 by the stored
|
||||
PUUID.
|
||||
- Selecting a stale account for background refresh also calls Account-V1 by the
|
||||
stored PUUID before statistics enrichment.
|
||||
- A changed Riot game name or tag line is persisted on the matching embedded
|
||||
account before the completion event is broadcast.
|
||||
- The completion event triggers the existing profile-query invalidation, so the
|
||||
personal history header displays the latest `gameName#tagLine`.
|
||||
- Failed, incomplete, or mismatched Riot identity responses do not overwrite the
|
||||
existing Riot ID and do not prevent otherwise successful match refresh work.
|
||||
- Background identity lookup failures do not increment the account failure counter
|
||||
or prevent otherwise successful background enrichment.
|
||||
- Focused tests, API lint/build, and web lint/production build pass.
|
||||
|
||||
## Open Questions
|
||||
|
||||
None. The user approved this specification and requested implementation. The
|
||||
existing queue and UI invalidation paths support the behavior without a public
|
||||
contract change.
|
||||
@@ -1,162 +0,0 @@
|
||||
# Spec: Series Result History UI
|
||||
|
||||
## Objective
|
||||
|
||||
Replace the compact `Game N - winner` cards below Competition brackets with a
|
||||
chronological, Series-centric result history. Users should be able to scan when a
|
||||
Series was played, its round, participants, official result, and current score,
|
||||
then expand the row to inspect the accepted Games that produced that record.
|
||||
|
||||
This first version is a truthful activity/result history, not a future schedule.
|
||||
It uses only recorded Competition projection data and does not invent scheduled
|
||||
times, venues, replay links, or team logos.
|
||||
|
||||
## Approved Product Decisions
|
||||
|
||||
- Keep the bracket first as the topology view and place the chronological history
|
||||
below it.
|
||||
- Render one primary row per Series, never one primary row per Game.
|
||||
- Include a started `in-progress` Series when it has at least one accepted Game, so
|
||||
completed Games do not disappear while a best-of Series is still running.
|
||||
- Include every completed Series, including draw, walkover, forfeit, and
|
||||
administrative outcomes with no accepted Game.
|
||||
- Exclude inactive, waiting, ready, and game-less in-progress Series because they do
|
||||
not have a truthful result timestamp.
|
||||
- Use the earliest accepted Game `startedAt` as the Series activity time. For a
|
||||
game-less decision, group by `outcome.completedAt` but display no fake start time.
|
||||
- Group and format dates explicitly in `Asia/Seoul`.
|
||||
- Keep individual Games in a native, keyboard-accessible disclosure below the Series
|
||||
row.
|
||||
- Make each disclosed Game row a real link to its internal-stat Game detail. Keep the
|
||||
visible Series-local `ordinal`, but build the route from the globally unique
|
||||
`displayNumber`.
|
||||
- Preserve the current Competition page path in router state so the detail page can
|
||||
return users to the same result view.
|
||||
- Use the coral semantic primary token as an interaction cue on Game links (leading
|
||||
edge, focus ring, subtle state background, and arrow), not as a winner or score
|
||||
color.
|
||||
- Scope that primary override to the result-history section so the exact coral remains
|
||||
consistent in light and dark themes without changing unrelated dark-theme actions.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
- React 19 and TypeScript 6 under `apps/web`
|
||||
- Tailwind CSS 4 and daisyUI semantic tokens
|
||||
- Shared Competition contracts from `@lolympus/contracts`
|
||||
- Node's built-in test runner with TypeScript type stripping for pure model tests
|
||||
|
||||
## Commands
|
||||
|
||||
- Focused RED/GREEN test:
|
||||
`pnpm --filter web exec node --test --experimental-strip-types test/competition-series-history.test.ts`
|
||||
- Full web tests: `pnpm --filter web test`
|
||||
- Web lint: `pnpm --filter web lint`
|
||||
- Web build: `pnpm --filter web build`
|
||||
|
||||
## Project Structure
|
||||
|
||||
- `apps/web/src/components/competition/competition-series-history.ts` derives the
|
||||
stable, timezone-aware history view model without React.
|
||||
- `apps/web/src/components/competition/CompetitionSeriesHistory.tsx` renders the
|
||||
semantic date sections and responsive Series rows.
|
||||
- `apps/web/src/components/competition/CompetitionGameHistory.tsx` renders the
|
||||
disclosed, navigable Game rows and their responsive interaction states.
|
||||
- `apps/web/src/components/competition/CompetitionResults.tsx` replaces the existing
|
||||
completed-Game card grid with the new component and supplies the route context.
|
||||
- `apps/web/src/lib/internal-match-game-selection.ts` keeps explicit Game-detail
|
||||
routes from silently falling back to a different recorded Game.
|
||||
- `apps/web/test/competition-series-history.test.ts` specifies aggregation, ordering,
|
||||
outcome, and formatting behavior.
|
||||
|
||||
## Code Style
|
||||
|
||||
Use contract discriminators and team IDs as the source of truth:
|
||||
|
||||
```ts
|
||||
const shouldInclude =
|
||||
(series.status === "in-progress" && games.length > 0) ||
|
||||
series.status === "completed";
|
||||
|
||||
const winnerTeamId =
|
||||
series.status === "completed" && series.outcome.type !== "draw"
|
||||
? series.outcome.winnerTeamId
|
||||
: undefined;
|
||||
```
|
||||
|
||||
The UI uses flat, full-width rows and existing semantic tokens. It does not reuse
|
||||
the bordered bracket card layout or introduce new dependencies.
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
Develop the pure model test-first. Cover:
|
||||
|
||||
- Games aggregated by `seriesId` and ordered by Series-local `ordinal`;
|
||||
- Series score preserved from A/B entries even when blue/red sides change;
|
||||
- chronological ordering independent of projection graph order;
|
||||
- `Asia/Seoul` grouping across the UTC day boundary;
|
||||
- started in-progress Series and game-less completed decisions;
|
||||
- exclusion of unstarted and orphan data;
|
||||
- played, draw, walkover, forfeit, and administrative status semantics;
|
||||
- deterministic tie-breaking and legacy zero-duration formatting.
|
||||
- Game-detail route generation from `displayNumber`, including rejection of invalid
|
||||
legacy display numbers.
|
||||
- Exact internal Game selection, including a missing-result case when the requested
|
||||
display number is absent from a stale or legacy detail payload.
|
||||
|
||||
After unit tests, run full web tests, changed-file lint, and the TypeScript/Vite build.
|
||||
Review the markup for native keyboard interaction, heading order, visible status text,
|
||||
and mobile layouts down to 320px.
|
||||
|
||||
## Boundaries
|
||||
|
||||
### Always
|
||||
|
||||
- Use `series.entries` for A/B score and `outcome.winnerTeamId` for the official
|
||||
winner; never infer identity from score, array position, or blue/red side.
|
||||
- Keep game-less adjudications visible without presenting `0 : 0` as a played score.
|
||||
- Omit `durationSeconds === 0` because it represents missing legacy data.
|
||||
- Use `displayNumber`, never Series-local `ordinal`, for the internal Game URL.
|
||||
- Keep each Game row as one semantic anchor with no nested interactive control.
|
||||
- Keep link text readable in both themes; coral may indicate interaction but must not
|
||||
be the only visible cue.
|
||||
- Never substitute another Game when the Game number explicitly requested by the URL
|
||||
is not present in the internal-stat payload.
|
||||
- Preserve all unrelated working-tree changes.
|
||||
|
||||
### Ask First
|
||||
|
||||
- Change the public Competition contract, database schema, or projector.
|
||||
- Add Series scheduling or external replay/venue data.
|
||||
- Add a frontend dependency or test framework.
|
||||
|
||||
### Never
|
||||
|
||||
- Present `completedAt` as a scheduled or actual start time.
|
||||
- Reuse free-text `match.schedule` as official Series scheduling data.
|
||||
- Parse `series.code` for identity, winner, or ordering.
|
||||
- Make status or winner understandable only through color.
|
||||
|
||||
## Success Criteria
|
||||
|
||||
- A completed `2 : 1` Series appears as one chronological row with both teams, the
|
||||
official score, round label, status, and an expandable three-Game history.
|
||||
- In-progress Series retain already accepted Games and display `진행 중`.
|
||||
- No-game decisions appear with the correct decision label and no misleading score
|
||||
or start time.
|
||||
- Date grouping and time display are stable in `Asia/Seoul` regardless of runtime
|
||||
timezone.
|
||||
- The layout is readable without horizontal scrolling at 320px and uses the wider
|
||||
double-elimination page naturally on desktop.
|
||||
- Each recorded Game can be opened by pointer or keyboard, lands on its matching
|
||||
internal-stat Game, and provides a return link to the Competition result page.
|
||||
- A temporarily stale or inconsistent detail payload shows an explicit missing-Game
|
||||
state rather than silently rendering the first Game.
|
||||
- Game rows expose an always-visible detail cue and coral hover, active, and focus
|
||||
affordances without changing winner semantics.
|
||||
- Focused/full tests, changed-file lint, and web build pass without modifying
|
||||
unrelated work.
|
||||
|
||||
## Open Questions
|
||||
|
||||
None. The user approved the Series-centric, result-history-first direction and
|
||||
requested implementation.
|
||||
@@ -1,150 +0,0 @@
|
||||
# Spec: Team Progress Page UX Refresh
|
||||
|
||||
## Objective
|
||||
|
||||
Reorganize the team progress page around the participant's primary task: identify
|
||||
the next opponent, understand the Series state, and copy the correct tournament
|
||||
code without cross-referencing separate sections. Keep the existing Competition
|
||||
API and visual language while making status, adjudicated results, copy feedback,
|
||||
the roster, and past results clearer on desktop and mobile.
|
||||
|
||||
The primary user is a team participant preparing to join an official internal-match
|
||||
game. Success means every active Series and its codes form one understandable work
|
||||
area, human-facing Korean labels lead internal identifiers, and the copy flow is
|
||||
accessible and explicit.
|
||||
|
||||
## Approved Product Decisions
|
||||
|
||||
- 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.
|
||||
- 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.
|
||||
- Make copy targets at least 44 CSS pixels high, uniquely label each button, keep
|
||||
the complete code visible/selectable, and announce copy success or failure.
|
||||
- Order the page as header, next matches with codes, compact roster, then recent
|
||||
results. Show two recent results and collapse older entries.
|
||||
- Preserve existing loading, selection, empty, error, revision-consistency, and
|
||||
authorization behavior.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
- React 19 and TypeScript 6 under `apps/web`
|
||||
- Tailwind CSS 4 and daisyUI 5 using the repository's square bordered surfaces
|
||||
- Node's built-in test runner for pure view-model behavior
|
||||
- Existing `lucide-react` icon set; no new dependency
|
||||
|
||||
## Commands
|
||||
|
||||
- Focused tests: `pnpm --filter web exec node --test --experimental-strip-types test/match-team-progress-view.test.ts`
|
||||
- Full web tests: `pnpm --filter web test`
|
||||
- Web lint: `pnpm --filter web lint`
|
||||
- Web build: `pnpm --filter web build`
|
||||
- Development server: `pnpm --filter web start:dev`
|
||||
|
||||
## Project Structure
|
||||
|
||||
- `apps/web/src/pages/MatchTeamProgressPage.tsx` owns queries, snapshot guards,
|
||||
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
|
||||
Series summary, leaving bracket/history card geometry and behavior unchanged.
|
||||
- `apps/web/test/match-team-progress-view.test.ts` specifies the new pure behavior.
|
||||
|
||||
## Code Style
|
||||
|
||||
Keep data transformation outside React and render semantic native controls:
|
||||
|
||||
```ts
|
||||
const seriesCodes = tournamentCodesForSeries(
|
||||
teamView.tournamentCodes,
|
||||
series.seriesId,
|
||||
);
|
||||
|
||||
<button aria-label={`${setLabel} 토너먼트 코드 복사`}>
|
||||
복사
|
||||
</button>
|
||||
```
|
||||
|
||||
Use `text-content-subtle` and `text-content-muted` for secondary text. Semantic
|
||||
colors may provide a border or background accent, while normal-size text remains a
|
||||
high-contrast base-content color.
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
- Test code-to-Series association by exact `seriesId` and deterministic ordinal
|
||||
ordering before adding the UI.
|
||||
- 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.
|
||||
- When the in-app browser is available, runtime verification covers 320px, 768px,
|
||||
1024px, and 1440px; keyboard focus, copy announcements, long-code reflow, and
|
||||
console output are checked manually.
|
||||
|
||||
## Boundaries
|
||||
|
||||
### Always
|
||||
|
||||
- Join assignments to active Series only by the contract's `seriesId`.
|
||||
- Keep the full tournament code selectable and copy the unmodified string.
|
||||
- Preserve native link, button, list, table, heading, and disclosure semantics.
|
||||
- Use the existing design tokens and icon dependency.
|
||||
|
||||
### Ask First
|
||||
|
||||
- Change the API or public contract.
|
||||
- Add a dependency or browser-test framework.
|
||||
- Change tournament-code authorization or visibility policy.
|
||||
- Deploy, push, or alter CI.
|
||||
|
||||
### Never
|
||||
|
||||
- Infer a Series association from global game numbers.
|
||||
- Display an adjudicated `0–0` as if it were a played result.
|
||||
- Expose private facts or fabricate an adjudication reason.
|
||||
- Hide copy failure or rely on color alone for state.
|
||||
- Modify unrelated Competition, bracket, or theme behavior.
|
||||
|
||||
## Success Criteria
|
||||
|
||||
- Each active Series appears as a full-width next-match panel containing only its
|
||||
own ordered code rows.
|
||||
- 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.
|
||||
- Copy buttons have unique accessible names, 44px targets, visible/live feedback,
|
||||
and an explicit failure path.
|
||||
- The roster uses Korean position labels in canonical role order, with the captain
|
||||
marker close to the player name.
|
||||
- At most two recent results are expanded by default; older results are available
|
||||
through a keyboard-accessible disclosure.
|
||||
- Focused and full tests, scoped lint, and build pass. Responsive runtime review is
|
||||
recorded separately when the in-app browser is available.
|
||||
|
||||
## Verification Record
|
||||
|
||||
- Focused view-model tests: 9 passed.
|
||||
- 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.
|
||||
- Full repository lint remains blocked by pre-existing errors in unrelated files.
|
||||
- Runtime screenshot/keyboard verification was not claimed because the required
|
||||
in-app browser was unavailable in this session.
|
||||
|
||||
## Open Questions
|
||||
|
||||
None. The user approved the audit recommendations and requested implementation.
|
||||
@@ -101,7 +101,23 @@ export interface MatchDetailResponse {
|
||||
updatedAt: IsoDateTime;
|
||||
}
|
||||
|
||||
export type MatchSummaryResponse = MatchDetailResponse;
|
||||
export type MatchHistoryResult =
|
||||
| {
|
||||
type: "score";
|
||||
teamAWins: number;
|
||||
teamBWins: number;
|
||||
winnerTeamName?: string;
|
||||
}
|
||||
| { type: "winners"; teamNames: string[] }
|
||||
| {
|
||||
type: "decision";
|
||||
decision: "walkover" | "forfeit" | "administrative" | "draw";
|
||||
winnerTeamName?: string;
|
||||
};
|
||||
|
||||
export interface MatchSummaryResponse extends MatchDetailResponse {
|
||||
historyResult?: MatchHistoryResult;
|
||||
}
|
||||
|
||||
export interface TeamTournamentCodeView {
|
||||
gameSlotId: GameSlotId;
|
||||
@@ -123,7 +139,7 @@ export interface TeamCompetitionViewResponse {
|
||||
}
|
||||
|
||||
export interface MatchListResponse {
|
||||
matches: MatchDetailResponse[];
|
||||
matches: MatchSummaryResponse[];
|
||||
total: number;
|
||||
page: number;
|
||||
limit: number;
|
||||
|
||||
Reference in new issue
Block a user