feat: route internal match game details by community

This commit is contained in:
dahyeon committed 2026-06-26 09:41:04 -07:00
1 parent d6e0bbf0e8
commit 51ea9c42d3
6 files changed
+68 -7

No files matched your search

+22 -4
View File
@@ -28,6 +28,10 @@ import {
teamIndexColorClasses,
teamIndexLabel,
} from "../lib/league";
import {
internalMatchDetailPath,
internalMatchGamePath,
} from "../lib/internal-match-routes";
import { LANE_LABELS } from "../lib/riot-history";
type MatchGameDetail = ApiInternalMatchDetailResponse["games"][number];
@@ -1971,10 +1975,12 @@ function GameAnalysisPanel({
function GameTabs({
detail,
communityId,
currentGameNumber,
navigationState,
}: {
detail: ApiInternalMatchDetailResponse;
communityId: string;
currentGameNumber: number;
navigationState: MatchGameNavigationState | undefined;
}) {
@@ -1989,7 +1995,11 @@ function GameTabs({
return (
<Link
key={game.gameNumber}
to={`/match/${detail.match.matchId}/game/${game.gameNumber}`}
to={internalMatchGamePath(
communityId,
detail.match.matchId,
game.gameNumber,
)}
state={navigationState}
className={`min-w-[8rem] border-r border-base-content/8 px-4 py-3 text-xs transition-colors last:border-r-0 ${
active
@@ -2012,11 +2022,13 @@ function GameTabs({
function MatchScoreHero({
detail,
communityId,
selectedGame,
backTarget,
navigationState,
}: {
detail: ApiInternalMatchDetailResponse;
communityId: string;
selectedGame: MatchGameDetail;
backTarget: MatchGameBackTarget;
navigationState: MatchGameNavigationState | undefined;
@@ -2097,6 +2109,7 @@ function MatchScoreHero({
</div>
<GameTabs
detail={detail}
communityId={communityId}
currentGameNumber={selectedGame.gameNumber}
navigationState={navigationState}
/>
@@ -2105,14 +2118,18 @@ function MatchScoreHero({
}
export default function MatchGameDetailPage() {
const { id, gameNumber } = useParams();
const { cid, matchId, id, gameNumber } = useParams();
const location = useLocation();
const [activeTab, setActiveTab] = useState<DetailTab>("scoreboard");
const communityId = cid ?? DEFAULT_COMMUNITY_ID;
const resolvedMatchId = matchId ?? id;
const requestedGameNumber = Number(gameNumber);
const detailQuery = useInternalMatchDetail(id, DEFAULT_COMMUNITY_ID);
const detailQuery = useInternalMatchDetail(resolvedMatchId, communityId);
const { data: ddragon } = useDdragonManifest();
const detail = detailQuery.data;
const fallbackBackTo = `/match/${id ?? ""}`;
const fallbackBackTo = resolvedMatchId
? internalMatchDetailPath(communityId, resolvedMatchId)
: `/communities/${communityId}/internal-stats`;
const backTarget = resolveBackTarget(location.state, fallbackBackTo);
const navigationState = createNavigationState(backTarget, fallbackBackTo);
@@ -2157,6 +2174,7 @@ export default function MatchGameDetailPage() {
<main className="mx-auto max-w-6xl px-4 py-6 sm:px-6">
<MatchScoreHero
detail={detail}
communityId={communityId}
selectedGame={selectedGame}
backTarget={backTarget}
navigationState={navigationState}