This commit is contained in:
dahyeon committed 2026-04-27 15:00:25 -07:00
1 parent c5d296d403
commit 2250b6072e
22 files changed
+1719 -42

No files matched your search

+15
View File
@@ -334,6 +334,21 @@ export function useDeleteTournamentCode(communityId = DEFAULT_COMMUNITY_ID) {
});
}
export function usePollTournamentResult(communityId = DEFAULT_COMMUNITY_ID) {
return useMutation({
mutationFn: (matchId: string) =>
apiFetch<{
jobId: string;
matchId: string;
priority: 'high' | 'low';
attempt: number;
expandedToAllPuuids: boolean;
}>(`/communities/${communityId}/matches/${matchId}/poll-tournament-result`, {
method: 'POST',
}),
});
}
export function useMe() {
const authUserId = useAuthUserId();
const { accounts, inProgress, instance } = useMsal();
+28 -3
View File
@@ -53,9 +53,27 @@ export interface MatchDetailView {
participants: ParticipantView[];
teams: TeamView[];
result?: {
winner: string;
winner?: string;
winnerSide?: TeamSide;
blueScore: number;
redScore: number;
riotMatchIds: string[];
games: Array<{
gameNumber: number;
riotMatchId: string;
winnerSide: TeamSide;
gameCreation: number;
gameDuration: number;
participants: Array<{
userId: string;
side: TeamSide;
championId: number;
kills: number;
deaths: number;
assists: number;
win: boolean;
}>;
}>;
};
prizes: string[];
notices: string[];
@@ -392,7 +410,7 @@ export function mapApiMatchToMatchDetail(match: ApiMatch): MatchDetailView {
}),
}));
const winnerTeam = match.result
const winnerTeam = match.result?.winnerSide
? teams.find((team) => team.side === match.result?.winnerSide)
: undefined;
@@ -412,9 +430,16 @@ export function mapApiMatchToMatchDetail(match: ApiMatch): MatchDetailView {
teams,
result: match.result
? {
winner: winnerTeam?.name ?? sideLabel(match.result.winnerSide),
winner: match.result.winnerSide
? winnerTeam?.name ?? sideLabel(match.result.winnerSide)
: undefined,
winnerSide: match.result.winnerSide,
blueScore: match.result.blueScore,
redScore: match.result.redScore,
riotMatchIds: match.result.riotMatchIds,
games: [...(match.result.games ?? [])].sort(
(left, right) => left.gameNumber - right.gameNumber,
),
}
: undefined,
prizes: match.prizes,
+21 -1
View File
@@ -146,12 +146,32 @@ export interface ApiMatchTeam {
members: ApiMatchTeamMember[];
}
export interface ApiMatchResult {
export interface ApiMatchGameResultParticipant {
userId: string;
side: TeamSide;
championId: number;
kills: number;
deaths: number;
assists: number;
win: boolean;
}
export interface ApiMatchGameResult {
gameNumber: number;
riotMatchId: string;
winnerSide: TeamSide;
gameCreation: number;
gameDuration: number;
participants: ApiMatchGameResultParticipant[];
}
export interface ApiMatchResult {
winnerSide?: TeamSide;
blueScore: number;
redScore: number;
mvpUserId?: string;
riotMatchIds: string[];
games: ApiMatchGameResult[];
}
export interface ApiMatchScheduleItem {