diff --git a/src/pages/Profile.jsx b/src/pages/Profile.jsx index a7812e8..8c6ba45 100644 --- a/src/pages/Profile.jsx +++ b/src/pages/Profile.jsx @@ -4,11 +4,12 @@ import { ReactComponent as Codeforces } from "../../assets/codeforces.svg"; import { ReactComponent as Codechef } from "../../assets/codechef.svg"; import atcoder_logo from "../../assets/atCoder_logo.png"; import { useQuery } from "@tanstack/react-query"; -import { useParams } from "react-router-dom"; +import { useParams, useNavigate } from "react-router-dom"; import axios from "axios"; export function Profile() { const { username } = useParams(); + const navigate = useNavigate(); const { status, data, error } = useQuery(["profile"], async () => { let res = await axios.get(`api/users/${username}`); @@ -44,7 +45,7 @@ export function Profile() { <>
-
+
{dataDetails.username}
{dataDetails.first_name + " " + dataDetails.last_name}
@@ -99,16 +100,17 @@ export function Profile() {
-
Contests
+
User Contests
- {dataContests ? ( + {dataContests && dataContests.length > 0 ? ( dataContests.map((contest, index) => { const dt = new Date(Date.parse(contest.start_date_time)); return ( -
navigate(`/contest/${contest.id}`)} >

{contest.name} @@ -125,11 +127,11 @@ export function Profile() { {contest.duration}

-
+ ); }) ) : ( -
No Contest to Show
+
No Contest to Show
)}