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/Leaderboards.tsx | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

(limited to 'frontend/src/components/Leaderboards.tsx')

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<LeaderboardsProps> = ({ data }) => {
             <span> </span>
             {r.kind === "multiplayer" ? (
               <div>
-                <span><img src={r.host.avatar_link} alt='' /> &nbsp; {r.host.user_name}</span>
-                <span><img src={r.partner.avatar_link} alt='' /> &nbsp; {r.partner.user_name}</span>
+                  <Link to={`/users/${r.host.steam_id}`}><span><img src={r.host.avatar_link} alt='' /> &nbsp; {r.host.user_name}</span></Link>
+                  <Link to={`/users/${r.partner.steam_id}`}><span><img src={r.partner.avatar_link} alt='' /> &nbsp; {r.partner.user_name}</span></Link>
+              </div>
+            ) : r.kind === "singleplayer" && (
+              <div>
+                  <Link to={`/users/${r.user.steam_id}`}><span><img src={r.user.avatar_link} alt='' /> &nbsp; {r.user.user_name}</span></Link>
               </div>
-            ) : (
-              <div><span><img src={r.user.avatar_link} alt='' /> &nbsp; {r.user.user_name}</span></div>
             )}
 
             <span>{r.score_count}</span>
@@ -88,7 +91,7 @@ const Leaderboards: React.FC<LeaderboardsProps> = ({ data }) => {
                 <button onClick={() => window.location.href = `https://lp.ardapektezol.com/api/v1/demos?uuid=${r.partner_demo_id}`}><img src={DownloadIcon} alt="download" style={{ filter: "hue-rotate(160deg) contrast(60%) saturate(1000%)" }} /></button>
                 <button onClick={() => window.location.href = `https://lp.ardapektezol.com/api/v1/demos?uuid=${r.host_demo_id}`}><img src={DownloadIcon} alt="download" style={{ filter: "hue-rotate(300deg) contrast(60%) saturate(1000%)" }} /></button>
               </span>
-            ) : (
+            ) : r.kind === "singleplayer" && (
 
               <span>
                 <button onClick={() => { window.alert(`Demo ID: ${r.demo_id}`) }}><img src={ThreedotIcon} alt="demo_id" /></button>
-- 
cgit v1.2.3

