From 188e806427ff6c9b302d994fc9c84a0300526688 Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Mon, 9 Sep 2024 20:10:16 +0300 Subject: refactor: make names clickable throughout the site, fix user pages --- frontend/src/components/Discussions.tsx | 9 +++++++-- frontend/src/components/Leaderboards.tsx | 13 ++++++++----- frontend/src/components/RankingEntry.tsx | 2 ++ 3 files changed, 17 insertions(+), 7 deletions(-) (limited to 'frontend/src/components') diff --git a/frontend/src/components/Discussions.tsx b/frontend/src/components/Discussions.tsx index 1cd3523..787104b 100644 --- a/frontend/src/components/Discussions.tsx +++ b/frontend/src/components/Discussions.tsx @@ -5,6 +5,7 @@ import { MapDiscussionCommentContent, MapDiscussionContent } from '../types/Cont import { time_ago } from '../utils/Time'; import { API } from '../api/Api'; import "../css/Maps.css" +import { Link } from 'react-router-dom'; interface DiscussionsProps { data?: MapDiscussions; @@ -88,7 +89,9 @@ const Discussions: React.FC = ({ data, isModerator, mapID, onR
- + + +
{discussionThread.discussion.creator.user_name} {time_ago(new Date(discussionThread.discussion.created_at.replace("T", " ").replace("Z", "")))} @@ -98,7 +101,9 @@ const Discussions: React.FC = ({ data, isModerator, mapID, onR discussionThread.discussion.comments.sort((a, b) => new Date(a.date).getTime() - new Date(b.date).getTime()) .map(e => ( <> - + + +
{e.user.user_name} {time_ago(new Date(e.date.replace("T", " ").replace("Z", "")))} diff --git a/frontend/src/components/Leaderboards.tsx b/frontend/src/components/Leaderboards.tsx index badff37..159f3ed 100644 --- a/frontend/src/components/Leaderboards.tsx +++ b/frontend/src/components/Leaderboards.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import { Link } from 'react-router-dom'; import { DownloadIcon, ThreedotIcon } from '../images/Images'; import { MapLeaderboard } from '../types/Map'; @@ -70,11 +71,13 @@ const Leaderboards: React.FC = ({ data }) => { {r.kind === "multiplayer" ? (
-   {r.host.user_name} -   {r.partner.user_name} +   {r.host.user_name} +   {r.partner.user_name} +
+ ) : r.kind === "singleplayer" && ( +
+   {r.user.user_name}
- ) : ( -
  {r.user.user_name}
)} {r.score_count} @@ -88,7 +91,7 @@ const Leaderboards: React.FC = ({ data }) => { - ) : ( + ) : r.kind === "singleplayer" && ( diff --git a/frontend/src/components/RankingEntry.tsx b/frontend/src/components/RankingEntry.tsx index b77bb3d..023a896 100644 --- a/frontend/src/components/RankingEntry.tsx +++ b/frontend/src/components/RankingEntry.tsx @@ -11,8 +11,10 @@ const RankingEntry: React.FC = (curRankingData) => {
{curRankingData.curRankingData.placement}
+ {curRankingData.curRankingData.user.user_name} +
{curRankingData.curRankingData.total_score}
-- cgit v1.2.3