feat: connect tournament views to APIs and recover archived stats
Remove development previews and complete hall of fame, match history, official results, and multi-kill API integration. Fix active match pagination and team-ready controls, preserve basic scoreboards, and recover statistics when Riot archives arrive. Use bounded in-process cache invalidation retries and add the Riot match lookup index migration with regression coverage.
This commit is contained in:
1 parent
20e1e6ec04
commit
0d7617e2d2
70 files changed
+3739
-1793
No files matched your search
@@ -61,6 +61,7 @@ import {
|
||||
} from "../components/competition/match-detail-tabs";
|
||||
import { DEFAULT_COMMUNITY_ID, useAuthUserId } from "../config";
|
||||
import { apiFetch, ApiError } from "../lib/api";
|
||||
import { getMatchStageLabel } from "./home-match-presentation";
|
||||
import { profileIconUrl } from "../lib/ddragon";
|
||||
import {
|
||||
POSITION_ORDER,
|
||||
@@ -1000,6 +1001,9 @@ function MatchRegistration({
|
||||
joining,
|
||||
error,
|
||||
onJoin,
|
||||
cancelling,
|
||||
cancelError,
|
||||
onCancel,
|
||||
}: {
|
||||
match: MatchDetailView;
|
||||
canJoin: boolean;
|
||||
@@ -1008,6 +1012,9 @@ function MatchRegistration({
|
||||
joining: boolean;
|
||||
error: Error | null;
|
||||
onJoin: (position: Position) => void;
|
||||
cancelling: boolean;
|
||||
cancelError: Error | null;
|
||||
onCancel: () => void;
|
||||
}) {
|
||||
const [selectedPosition, setSelectedPosition] = useState<Position>();
|
||||
const position = selectedPosition ?? initialPosition;
|
||||
@@ -1059,6 +1066,13 @@ function MatchRegistration({
|
||||
)
|
||||
)}
|
||||
{error && <ErrorNote className="mt-4" title="참가 신청을 완료하지 못했습니다" description={error.message} />}
|
||||
{match.joined && canJoin && (
|
||||
<Btn className="mt-4" variant="secondary" loading={cancelling}
|
||||
disabled={cancelling} onClick={onCancel}>
|
||||
참가 신청 취소
|
||||
</Btn>
|
||||
)}
|
||||
{cancelError && <ErrorNote className="mt-4" title="참가 신청을 취소하지 못했습니다" description={cancelError.message} />}
|
||||
</Panel>
|
||||
);
|
||||
}
|
||||
@@ -1452,6 +1466,12 @@ export default function MatchDetailPage() {
|
||||
const navigate = useNavigate();
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
const queryClient = useQueryClient();
|
||||
function invalidateMatchLists() {
|
||||
return Promise.all([
|
||||
queryClient.invalidateQueries({ queryKey: ["matches", DEFAULT_COMMUNITY_ID] }),
|
||||
queryClient.invalidateQueries({ queryKey: ["matches-page", DEFAULT_COMMUNITY_ID] }),
|
||||
]);
|
||||
}
|
||||
const authUserId = useAuthUserId();
|
||||
const matchQuery = useMatch(id, DEFAULT_COMMUNITY_ID);
|
||||
const competitionEnabled = Boolean(
|
||||
@@ -1527,9 +1547,7 @@ export default function MatchDetailPage() {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ["match", DEFAULT_COMMUNITY_ID, id ?? null],
|
||||
}),
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ["matches", DEFAULT_COMMUNITY_ID],
|
||||
}),
|
||||
invalidateMatchLists(),
|
||||
]);
|
||||
},
|
||||
onError: () => {
|
||||
@@ -1537,6 +1555,19 @@ export default function MatchDetailPage() {
|
||||
},
|
||||
});
|
||||
|
||||
const cancelJoinMutation = useMutation({
|
||||
mutationFn: () => apiFetch<MatchDetailResponse>(
|
||||
`/communities/${DEFAULT_COMMUNITY_ID}/matches/${id}/participants`,
|
||||
{ method: "DELETE" },
|
||||
),
|
||||
onSettled: async () => {
|
||||
await Promise.all([
|
||||
queryClient.invalidateQueries({ queryKey: ["match", DEFAULT_COMMUNITY_ID, id ?? null] }),
|
||||
invalidateMatchLists(),
|
||||
]);
|
||||
},
|
||||
});
|
||||
|
||||
const addParticipantMutation = useMutation({
|
||||
mutationFn: ({
|
||||
userId,
|
||||
@@ -1557,9 +1588,7 @@ export default function MatchDetailPage() {
|
||||
onSuccess: async () => {
|
||||
await Promise.all([
|
||||
queryClient.invalidateQueries({ queryKey: matchQueryKey }),
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ["matches", DEFAULT_COMMUNITY_ID],
|
||||
}),
|
||||
invalidateMatchLists(),
|
||||
]);
|
||||
},
|
||||
});
|
||||
@@ -1591,9 +1620,7 @@ export default function MatchDetailPage() {
|
||||
},
|
||||
onSettled: () => {
|
||||
void queryClient.invalidateQueries({ queryKey: matchQueryKey });
|
||||
void queryClient.invalidateQueries({
|
||||
queryKey: ["matches", DEFAULT_COMMUNITY_ID],
|
||||
});
|
||||
void invalidateMatchLists();
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1686,6 +1713,7 @@ export default function MatchDetailPage() {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ["auction", DEFAULT_COMMUNITY_ID, id ?? null],
|
||||
}),
|
||||
invalidateMatchLists(),
|
||||
]);
|
||||
navigate(`/match/${id}/auction`);
|
||||
},
|
||||
@@ -1845,13 +1873,15 @@ export default function MatchDetailPage() {
|
||||
}
|
||||
|
||||
const match = mapApiMatchToMatchDetail(matchQuery.data);
|
||||
const si = statusBadge(match.status);
|
||||
const si = { ...statusBadge(match.status), label: getMatchStageLabel(matchQuery.data) };
|
||||
const auctionNotStarted =
|
||||
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");
|
||||
(matchQuery.data.eventProgress?.stage === "team-ready" ||
|
||||
match.status === "in-progress" ||
|
||||
match.status === "finished");
|
||||
const auctionParticipantPool = buildAuctionParticipantPool(
|
||||
matchQuery.data.participants,
|
||||
);
|
||||
@@ -2010,6 +2040,9 @@ export default function MatchDetailPage() {
|
||||
joining={joinMatchMutation.isPending}
|
||||
error={joinMatchMutation.error}
|
||||
onJoin={joinMatchMutation.mutate}
|
||||
cancelling={cancelJoinMutation.isPending}
|
||||
cancelError={cancelJoinMutation.error}
|
||||
onCancel={() => cancelJoinMutation.mutate()}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
||||
Reference in new issue
Block a user