Skip to content

Commit

Permalink
Merge pull request #198 from Bux42/staging
Browse files Browse the repository at this point in the history
[Release] Use URL mapUId for nav between maps and stats page
  • Loading branch information
MKuijpers authored Feb 25, 2023
2 parents b5c2bd9 + 8556c90 commit 55a6cc0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/pages/maps/[mapUId]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ const Home = (): JSX.Element => {
<Layout>
<MapHeader mapInfo={mapInfo} title="Replay viewer" backUrl="/">
<CleanButton
url={`/maps/${mapInfo?.mapUid}/stats`}
url={`/maps/${mapUId}/stats`}
backColor="hsl(0, 0%, 15%)"
disabled={mapInfo === undefined}
disabled={mapUId === undefined}
>
<div className="flex gap-2 items-center">
<PieChartOutlined />
Expand Down
13 changes: 6 additions & 7 deletions app/pages/maps/[mapUId]/stats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,20 @@ const MapStats = () => {
const [mapStatsType, setMapStatsType] = useState(MapStatsType.GLOBAL);

const router = useRouter();
const { mapUId } = router.query;
const { mapUId: rawMapUId } = router.query;
const mapUId = useMemo(() => (typeof rawMapUId === 'string' ? rawMapUId : undefined), [rawMapUId]);

const {
data: mapReplayData,
isLoading: isLoadingReplays,
} = useMapReplays(typeof mapUId === 'string' ? mapUId : undefined);
} = useMapReplays(mapUId);

const replays = useMemo(
() => mapReplayData?.replays || [],
[mapReplayData?.replays],
);

const {
data: mapInfo,
} = useMapInfo(typeof mapUId === 'string' ? mapUId : undefined);
const { data: mapInfo } = useMapInfo(mapUId);

// If user object changes, set the according map stats type
useEffect(() => {
Expand Down Expand Up @@ -111,9 +110,9 @@ const MapStats = () => {
backUrl="/"
>
<CleanButton
url={`/maps/${mapInfo?.mapUid}`}
url={`/maps/${mapUId}`}
backColor="hsl(0, 0%, 15%)"
disabled={mapInfo === undefined}
disabled={mapUId === undefined}
>
<div className="flex gap-2 items-center">
<PlaySquareOutlined />
Expand Down

1 comment on commit 55a6cc0

@vercel
Copy link

@vercel vercel bot commented on 55a6cc0 Feb 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

tm-dojo – ./

tmdojo.com
tm-dojo-git-main-bux42.vercel.app
tm-dojo-bux42.vercel.app

Please sign in to comment.