diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2025-10-22 13:59:12 +0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-22 12:59:12 +0300 |
| commit | 69aeb7889ac136a8e4fbe7de1330298e30345479 (patch) | |
| tree | 6b2cd2d420105dc7ffad3c3649df359f634cae77 /frontend/src/pages/Profile.tsx | |
| parent | feat/rankings: update wr for 3 maps (#279) (diff) | |
| download | lphub-69aeb7889ac136a8e4fbe7de1330298e30345479.tar.gz lphub-69aeb7889ac136a8e4fbe7de1330298e30345479.tar.bz2 lphub-69aeb7889ac136a8e4fbe7de1330298e30345479.zip | |
feat/frontend: switch to vite, update node to v22 (#281)
Diffstat (limited to 'frontend/src/pages/Profile.tsx')
| -rw-r--r-- | frontend/src/pages/Profile.tsx | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/frontend/src/pages/Profile.tsx b/frontend/src/pages/Profile.tsx index 48233bf..e7b8325 100644 --- a/frontend/src/pages/Profile.tsx +++ b/frontend/src/pages/Profile.tsx | |||
| @@ -1,16 +1,16 @@ | |||
| 1 | import React from 'react'; | 1 | import React from "react"; |
| 2 | import { Link, useNavigate } from 'react-router-dom'; | 2 | import { Link, useNavigate } from "react-router-dom"; |
| 3 | import { Helmet } from 'react-helmet'; | 3 | import { Helmet } from "react-helmet"; |
| 4 | 4 | ||
| 5 | import { SteamIcon, TwitchIcon, YouTubeIcon, PortalIcon, FlagIcon, StatisticsIcon, SortIcon, ThreedotIcon, DownloadIcon, HistoryIcon, DeleteIcon } from '@images/Images'; | 5 | import { SteamIcon, TwitchIcon, YouTubeIcon, PortalIcon, FlagIcon, StatisticsIcon, SortIcon, ThreedotIcon, DownloadIcon, HistoryIcon, DeleteIcon } from "@images/Images"; |
| 6 | import { UserProfile } from '@customTypes/Profile'; | 6 | import { UserProfile } from "@customTypes/Profile"; |
| 7 | import { Game, GameChapters } from '@customTypes/Game'; | 7 | import { Game, GameChapters } from "@customTypes/Game"; |
| 8 | import { Map } from '@customTypes/Map'; | 8 | import { Map } from "@customTypes/Map"; |
| 9 | import { ticks_to_time } from '@utils/Time'; | 9 | import { ticks_to_time } from "@utils/Time"; |
| 10 | import "@css/Profile.css"; | 10 | import "@css/Profile.css"; |
| 11 | import { API } from '@api/Api'; | 11 | import { API } from "@api/Api"; |
| 12 | import useConfirm from '@hooks/UseConfirm'; | 12 | import useConfirm from "@hooks/UseConfirm"; |
| 13 | import useMessage from '@hooks/UseMessage'; | 13 | import useMessage from "@hooks/UseMessage"; |
| 14 | import useMessageLoad from "@hooks/UseMessageLoad"; | 14 | import useMessageLoad from "@hooks/UseMessageLoad"; |
| 15 | 15 | ||
| 16 | interface ProfileProps { | 16 | interface ProfileProps { |
| @@ -193,9 +193,9 @@ const Profile: React.FC<ProfileProps> = ({ profile, token, gameData, onDeleteRec | |||
| 193 | 193 | ||
| 194 | <select id='select-game' | 194 | <select id='select-game' |
| 195 | onChange={() => { | 195 | onChange={() => { |
| 196 | setGame((document.querySelector('#select-game') as HTMLInputElement).value); | 196 | setGame((document.querySelector("#select-game") as HTMLInputElement).value); |
| 197 | setChapter("0"); | 197 | setChapter("0"); |
| 198 | const chapterSelect = document.querySelector('#select-chapter') as HTMLSelectElement; | 198 | const chapterSelect = document.querySelector("#select-chapter") as HTMLSelectElement; |
| 199 | if (chapterSelect) { | 199 | if (chapterSelect) { |
| 200 | chapterSelect.value = "0"; | 200 | chapterSelect.value = "0"; |
| 201 | } | 201 | } |
| @@ -213,7 +213,7 @@ const Profile: React.FC<ProfileProps> = ({ profile, token, gameData, onDeleteRec | |||
| 213 | : chapterData === null ? <select></select> : | 213 | : chapterData === null ? <select></select> : |
| 214 | 214 | ||
| 215 | <select id='select-chapter' | 215 | <select id='select-chapter' |
| 216 | onChange={() => setChapter((document.querySelector('#select-chapter') as HTMLInputElement).value)}> | 216 | onChange={() => setChapter((document.querySelector("#select-chapter") as HTMLInputElement).value)}> |
| 217 | <option value="0" key="0">All Chapters</option> | 217 | <option value="0" key="0">All Chapters</option> |
| 218 | {chapterData.chapters.filter(e => e.is_disabled === false).map((e, i) => ( | 218 | {chapterData.chapters.filter(e => e.is_disabled === false).map((e, i) => ( |
| 219 | <option value={e.id} key={i + 1}>{e.name}</option> | 219 | <option value={e.id} key={i + 1}>{e.name}</option> |
| @@ -222,9 +222,9 @@ const Profile: React.FC<ProfileProps> = ({ profile, token, gameData, onDeleteRec | |||
| 222 | </div> | 222 | </div> |
| 223 | <div id='profileboard-top'> | 223 | <div id='profileboard-top'> |
| 224 | <span><span>Map Name</span><img src={SortIcon} alt="" /></span> | 224 | <span><span>Map Name</span><img src={SortIcon} alt="" /></span> |
| 225 | <span style={{ justifyContent: 'center' }}><span>Portals</span><img src={SortIcon} alt="" /></span> | 225 | <span style={{ justifyContent: "center" }}><span>Portals</span><img src={SortIcon} alt="" /></span> |
| 226 | <span style={{ justifyContent: 'center' }}><span>WRΔ </span><img src={SortIcon} alt="" /></span> | 226 | <span style={{ justifyContent: "center" }}><span>WRΔ </span><img src={SortIcon} alt="" /></span> |
| 227 | <span style={{ justifyContent: 'center' }}><span>Time</span><img src={SortIcon} alt="" /></span> | 227 | <span style={{ justifyContent: "center" }}><span>Time</span><img src={SortIcon} alt="" /></span> |
| 228 | <span> </span> | 228 | <span> </span> |
| 229 | <span><span>Rank</span><img src={SortIcon} alt="" /></span> | 229 | <span><span>Rank</span><img src={SortIcon} alt="" /></span> |
| 230 | <span><span>Date</span><img src={SortIcon} alt="" /></span> | 230 | <span><span>Date</span><img src={SortIcon} alt="" /></span> |
| @@ -239,7 +239,7 @@ const Profile: React.FC<ProfileProps> = ({ profile, token, gameData, onDeleteRec | |||
| 239 | }); | 239 | }); |
| 240 | } | 240 | } |
| 241 | }} | 241 | }} |
| 242 | ><i className='triangle' style={{ position: 'relative', left: '-5px', }}></i> </button> | 242 | ><i className='triangle' style={{ position: "relative", left: "-5px", }}></i> </button> |
| 243 | <span>{pageNumber}/{pageMax}</span> | 243 | <span>{pageNumber}/{pageMax}</span> |
| 244 | <button onClick={() => { | 244 | <button onClick={() => { |
| 245 | if (pageNumber !== pageMax) { | 245 | if (pageNumber !== pageMax) { |
| @@ -250,7 +250,7 @@ const Profile: React.FC<ProfileProps> = ({ profile, token, gameData, onDeleteRec | |||
| 250 | }); | 250 | }); |
| 251 | } | 251 | } |
| 252 | }} | 252 | }} |
| 253 | ><i className='triangle' style={{ position: 'relative', left: '5px', transform: 'rotate(180deg)' }}></i> </button> | 253 | ><i className='triangle' style={{ position: "relative", left: "5px", transform: "rotate(180deg)" }}></i> </button> |
| 254 | </div> | 254 | </div> |
| 255 | </div> | 255 | </div> |
| 256 | </div> | 256 | </div> |
| @@ -272,7 +272,7 @@ const Profile: React.FC<ProfileProps> = ({ profile, token, gameData, onDeleteRec | |||
| 272 | 272 | ||
| 273 | <span style={{ display: "grid" }}>{e.score_count}</span> | 273 | <span style={{ display: "grid" }}>{e.score_count}</span> |
| 274 | 274 | ||
| 275 | <span style={{ display: "grid" }}>{e.score_count - r.map_wr_count > 0 ? `+${e.score_count - r.map_wr_count}` : `-`}</span> | 275 | <span style={{ display: "grid" }}>{e.score_count - r.map_wr_count > 0 ? `+${e.score_count - r.map_wr_count}` : "-"}</span> |
| 276 | <span style={{ display: "grid" }}>{ticks_to_time(e.score_time)}</span> | 276 | <span style={{ display: "grid" }}>{ticks_to_time(e.score_time)}</span> |
| 277 | <span> </span> | 277 | <span> </span> |
| 278 | {i === 0 ? <span>#{r.placement}</span> : <span> </span>} | 278 | {i === 0 ? <span>#{r.placement}</span> : <span> </span>} |
| @@ -300,7 +300,7 @@ const Profile: React.FC<ProfileProps> = ({ profile, token, gameData, onDeleteRec | |||
| 300 | maps.filter(e => e.is_disabled === false).sort((a, b) => a.id - b.id) | 300 | maps.filter(e => e.is_disabled === false).sort((a, b) => a.id - b.id) |
| 301 | .map((r, index) => { | 301 | .map((r, index) => { |
| 302 | if (Math.ceil((index + 1) / 20) === pageNumber) { | 302 | if (Math.ceil((index + 1) / 20) === pageNumber) { |
| 303 | let record = profile.records.find((e) => e.map_id === r.id); | 303 | const record = profile.records.find((e) => e.map_id === r.id); |
| 304 | return record === undefined ? ( | 304 | return record === undefined ? ( |
| 305 | <button className="profileboard-record" key={index} style={{ backgroundColor: "#1b1b20" }}> | 305 | <button className="profileboard-record" key={index} style={{ backgroundColor: "#1b1b20" }}> |
| 306 | <Link to={`/maps/${r.id}`}><span>{r.name}</span></Link> | 306 | <Link to={`/maps/${r.id}`}><span>{r.name}</span></Link> |
| @@ -318,7 +318,7 @@ const Profile: React.FC<ProfileProps> = ({ profile, token, gameData, onDeleteRec | |||
| 318 | {i !== 0 ? <hr style={{ gridColumn: "1 / span 8" }} /> : ""} | 318 | {i !== 0 ? <hr style={{ gridColumn: "1 / span 8" }} /> : ""} |
| 319 | <Link to={`/maps/${r.id}`}><span>{r.name}</span></Link> | 319 | <Link to={`/maps/${r.id}`}><span>{r.name}</span></Link> |
| 320 | <span style={{ display: "grid" }}>{record!.scores[i].score_count}</span> | 320 | <span style={{ display: "grid" }}>{record!.scores[i].score_count}</span> |
| 321 | <span style={{ display: "grid" }}>{record!.scores[i].score_count - record!.map_wr_count > 0 ? `+${record!.scores[i].score_count - record!.map_wr_count}` : `-`}</span> | 321 | <span style={{ display: "grid" }}>{record!.scores[i].score_count - record!.map_wr_count > 0 ? `+${record!.scores[i].score_count - record!.map_wr_count}` : "-"}</span> |
| 322 | <span style={{ display: "grid" }}>{ticks_to_time(record!.scores[i].score_time)}</span> | 322 | <span style={{ display: "grid" }}>{ticks_to_time(record!.scores[i].score_time)}</span> |
| 323 | <span> </span> | 323 | <span> </span> |
| 324 | {i === 0 ? <span>#{record!.placement}</span> : <span> </span>} | 324 | {i === 0 ? <span>#{record!.placement}</span> : <span> </span>} |