diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2024-09-09 20:10:16 +0300 |
|---|---|---|
| committer | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2024-09-09 20:10:16 +0300 |
| commit | 188e806427ff6c9b302d994fc9c84a0300526688 (patch) | |
| tree | de6b28b307efc181a26ff422895246b25d70de8a /frontend/src/components | |
| parent | refactor: upload run form, lots of random shit (diff) | |
| download | lphub-188e806427ff6c9b302d994fc9c84a0300526688.tar.gz lphub-188e806427ff6c9b302d994fc9c84a0300526688.tar.bz2 lphub-188e806427ff6c9b302d994fc9c84a0300526688.zip | |
refactor: make names clickable throughout the site, fix user pages
Diffstat (limited to '')
| -rw-r--r-- | frontend/src/components/Discussions.tsx | 9 | ||||
| -rw-r--r-- | frontend/src/components/Leaderboards.tsx | 13 | ||||
| -rw-r--r-- | frontend/src/components/RankingEntry.tsx | 2 |
3 files changed, 17 insertions, 7 deletions
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 | |||
| 5 | import { time_ago } from '../utils/Time'; | 5 | import { time_ago } from '../utils/Time'; |
| 6 | import { API } from '../api/Api'; | 6 | import { API } from '../api/Api'; |
| 7 | import "../css/Maps.css" | 7 | import "../css/Maps.css" |
| 8 | import { Link } from 'react-router-dom'; | ||
| 8 | 9 | ||
| 9 | interface DiscussionsProps { | 10 | interface DiscussionsProps { |
| 10 | data?: MapDiscussions; | 11 | data?: MapDiscussions; |
| @@ -88,7 +89,9 @@ const Discussions: React.FC<DiscussionsProps> = ({ data, isModerator, mapID, onR | |||
| 88 | </div> | 89 | </div> |
| 89 | 90 | ||
| 90 | <div> | 91 | <div> |
| 91 | <img src={discussionThread.discussion.creator.avatar_link} alt="" /> | 92 | <Link to={`/users/${discussionThread.discussion.creator.steam_id}`}> |
| 93 | <img src={discussionThread.discussion.creator.avatar_link} alt="" /> | ||
| 94 | </Link> | ||
| 92 | <div> | 95 | <div> |
| 93 | <span>{discussionThread.discussion.creator.user_name}</span> | 96 | <span>{discussionThread.discussion.creator.user_name}</span> |
| 94 | <span>{time_ago(new Date(discussionThread.discussion.created_at.replace("T", " ").replace("Z", "")))}</span> | 97 | <span>{time_ago(new Date(discussionThread.discussion.created_at.replace("T", " ").replace("Z", "")))}</span> |
| @@ -98,7 +101,9 @@ const Discussions: React.FC<DiscussionsProps> = ({ data, isModerator, mapID, onR | |||
| 98 | discussionThread.discussion.comments.sort((a, b) => new Date(a.date).getTime() - new Date(b.date).getTime()) | 101 | discussionThread.discussion.comments.sort((a, b) => new Date(a.date).getTime() - new Date(b.date).getTime()) |
| 99 | .map(e => ( | 102 | .map(e => ( |
| 100 | <> | 103 | <> |
| 101 | <img src={e.user.avatar_link} alt="" /> | 104 | <Link to={`/users/${e.user.steam_id}`}> |
| 105 | <img src={e.user.avatar_link} alt="" /> | ||
| 106 | </Link> | ||
| 102 | <div> | 107 | <div> |
| 103 | <span>{e.user.user_name}</span> | 108 | <span>{e.user.user_name}</span> |
| 104 | <span>{time_ago(new Date(e.date.replace("T", " ").replace("Z", "")))}</span> | 109 | <span>{time_ago(new Date(e.date.replace("T", " ").replace("Z", "")))}</span> |
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 @@ | |||
| 1 | import React from 'react'; | 1 | import React from 'react'; |
| 2 | import { Link } from 'react-router-dom'; | ||
| 2 | 3 | ||
| 3 | import { DownloadIcon, ThreedotIcon } from '../images/Images'; | 4 | import { DownloadIcon, ThreedotIcon } from '../images/Images'; |
| 4 | import { MapLeaderboard } from '../types/Map'; | 5 | import { MapLeaderboard } from '../types/Map'; |
| @@ -70,11 +71,13 @@ const Leaderboards: React.FC<LeaderboardsProps> = ({ data }) => { | |||
| 70 | <span> </span> | 71 | <span> </span> |
| 71 | {r.kind === "multiplayer" ? ( | 72 | {r.kind === "multiplayer" ? ( |
| 72 | <div> | 73 | <div> |
| 73 | <span><img src={r.host.avatar_link} alt='' /> {r.host.user_name}</span> | 74 | <Link to={`/users/${r.host.steam_id}`}><span><img src={r.host.avatar_link} alt='' /> {r.host.user_name}</span></Link> |
| 74 | <span><img src={r.partner.avatar_link} alt='' /> {r.partner.user_name}</span> | 75 | <Link to={`/users/${r.partner.steam_id}`}><span><img src={r.partner.avatar_link} alt='' /> {r.partner.user_name}</span></Link> |
| 76 | </div> | ||
| 77 | ) : r.kind === "singleplayer" && ( | ||
| 78 | <div> | ||
| 79 | <Link to={`/users/${r.user.steam_id}`}><span><img src={r.user.avatar_link} alt='' /> {r.user.user_name}</span></Link> | ||
| 75 | </div> | 80 | </div> |
| 76 | ) : ( | ||
| 77 | <div><span><img src={r.user.avatar_link} alt='' /> {r.user.user_name}</span></div> | ||
| 78 | )} | 81 | )} |
| 79 | 82 | ||
| 80 | <span>{r.score_count}</span> | 83 | <span>{r.score_count}</span> |
| @@ -88,7 +91,7 @@ const Leaderboards: React.FC<LeaderboardsProps> = ({ data }) => { | |||
| 88 | <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> | 91 | <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> |
| 89 | <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> | 92 | <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> |
| 90 | </span> | 93 | </span> |
| 91 | ) : ( | 94 | ) : r.kind === "singleplayer" && ( |
| 92 | 95 | ||
| 93 | <span> | 96 | <span> |
| 94 | <button onClick={() => { window.alert(`Demo ID: ${r.demo_id}`) }}><img src={ThreedotIcon} alt="demo_id" /></button> | 97 | <button onClick={() => { window.alert(`Demo ID: ${r.demo_id}`) }}><img src={ThreedotIcon} alt="demo_id" /></button> |
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<RankingEntryProps> = (curRankingData) => { | |||
| 11 | <div className='leaderboard-entry'> | 11 | <div className='leaderboard-entry'> |
| 12 | <span>{curRankingData.curRankingData.placement}</span> | 12 | <span>{curRankingData.curRankingData.placement}</span> |
| 13 | <div> | 13 | <div> |
| 14 | <Link to={`/users/${curRankingData.curRankingData.user.steam_id}`}> | ||
| 14 | <img src={curRankingData.curRankingData.user.avatar_link}></img> | 15 | <img src={curRankingData.curRankingData.user.avatar_link}></img> |
| 15 | <span>{curRankingData.curRankingData.user.user_name}</span> | 16 | <span>{curRankingData.curRankingData.user.user_name}</span> |
| 17 | </Link> | ||
| 16 | </div> | 18 | </div> |
| 17 | <span>{curRankingData.curRankingData.total_score}</span> | 19 | <span>{curRankingData.curRankingData.total_score}</span> |
| 18 | </div> | 20 | </div> |