diff --git a/pages/[subdomain]/play/index.tsx b/pages/[subdomain]/play/index.tsx index ee55e25e0..292cf1a9a 100644 --- a/pages/[subdomain]/play/index.tsx +++ b/pages/[subdomain]/play/index.tsx @@ -1,7 +1,11 @@ import UpsellFullAccount from '@root/components/home/upsellFullAccount'; +import LoadingSpinner from '@root/components/page/loadingSpinner'; +import PlayerRank from '@root/components/profile/playerRank'; import { AppContext } from '@root/contexts/appContext'; import { getGameFromId, getGameIdFromReq } from '@root/helpers/getGameIdFromReq'; +import useSWRHelper from '@root/hooks/useSWRHelper'; import { GetServerSidePropsContext, NextApiRequest } from 'next'; +import Link from 'next/link'; import React, { useContext } from 'react'; import ChapterSelectCard from '../../../components/cards/chapterSelectCard'; import Page from '../../../components/page/page'; @@ -38,14 +42,28 @@ interface PlayPageProps { export default function PlayPage({ reqUser }: PlayPageProps) { const { game } = useContext(AppContext); const chapterUnlocked = reqUser.config?.chapterUnlocked ?? 1; + const { data: profileDataFetched } = useSWRHelper<{levelsSolvedByDifficulty: {[key: string]: number}}>('/api/user/' + reqUser?._id + '?type=levelsSolvedByDifficulty', {}, {}); + + const levelsSolvedByDifficulty = profileDataFetched?.levelsSolvedByDifficulty; return ( -
+
{game.displayName} Official Campaign
+
+ { + levelsSolvedByDifficulty ? + <>
Rank:
+ + + : + } +
+
+