From 81342e2579165ebfdb28c749dc5225141721a419 Mon Sep 17 00:00:00 2001 From: FifthWit Date: Thu, 30 Jan 2025 13:11:48 -0600 Subject: switched to double quotes --- frontend/src/pages/User.tsx | 184 ++++++++++++++++++++++---------------------- 1 file changed, 92 insertions(+), 92 deletions(-) (limited to 'frontend/src/pages/User.tsx') diff --git a/frontend/src/pages/User.tsx b/frontend/src/pages/User.tsx index 29d0041..0198034 100644 --- a/frontend/src/pages/User.tsx +++ b/frontend/src/pages/User.tsx @@ -1,6 +1,6 @@ -import React from 'react'; -import { Link, useLocation, useNavigate } from 'react-router-dom'; -import { Helmet } from 'react-helmet'; +import React from "react"; +import { Link, useLocation, useNavigate } from "react-router-dom"; +import { Helmet } from "react-helmet"; import { SteamIcon, @@ -13,14 +13,14 @@ import { ThreedotIcon, DownloadIcon, HistoryIcon, -} from '@images/Images'; -import { UserProfile } from '@customTypes/Profile'; -import { Game, GameChapters } from '@customTypes/Game'; -import { Map } from '@customTypes/Map'; -import { API } from '@api/Api'; -import { ticks_to_time } from '@utils/Time'; -import '@css/Profile.css'; -import useMessage from '@hooks/UseMessage'; +} from "@images/Images"; +import { UserProfile } from "@customTypes/Profile"; +import { Game, GameChapters } from "@customTypes/Game"; +import { Map } from "@customTypes/Map"; +import { API } from "@api/Api"; +import { ticks_to_time } from "@utils/Time"; +import "@css/Profile.css"; +import useMessage from "@hooks/UseMessage"; interface UserProps { profile?: UserProfile; @@ -37,8 +37,8 @@ const User: React.FC = ({ token, profile, gameData }) => { const [pageNumber, setPageNumber] = React.useState(1); const [pageMax, setPageMax] = React.useState(0); - const [game, setGame] = React.useState('0'); - const [chapter, setChapter] = React.useState('0'); + const [game, setGame] = React.useState("0"); + const [chapter, setChapter] = React.useState("0"); const [chapterData, setChapterData] = React.useState( null ); @@ -48,9 +48,9 @@ const User: React.FC = ({ token, profile, gameData }) => { const navigate = useNavigate(); const _fetch_user = React.useCallback(async () => { - const userID = location.pathname.split('/')[2]; + const userID = location.pathname.split("/")[2]; if (token && profile && profile.profile && profile.steam_id === userID) { - navigate('/profile'); + navigate("/profile"); return; } const userData = await API.get_user(userID); @@ -58,7 +58,7 @@ const User: React.FC = ({ token, profile, gameData }) => { }, [location.pathname, token, profile, navigate]); const _get_game_chapters = React.useCallback(async () => { - if (game !== '0') { + if (game !== "0") { const gameChapters = await API.get_games_chapters(game); setChapterData(gameChapters); } else { @@ -68,7 +68,7 @@ const User: React.FC = ({ token, profile, gameData }) => { }, [game, user]); const _get_game_maps = React.useCallback(async () => { - if (chapter === '0') { + if (chapter === "0") { const gameMaps = await API.get_game_maps(game); setMaps(gameMaps); setPageMax(Math.ceil(gameMaps.length / 20)); @@ -92,7 +92,7 @@ const User: React.FC = ({ token, profile, gameData }) => { }, [user, game, location, _get_game_chapters]); React.useEffect(() => { - if (user && game !== '0') { + if (user && game !== "0") { _get_game_maps(); } }, [user, game, chapter, location, _get_game_maps]); @@ -116,8 +116,8 @@ const User: React.FC = ({ token, profile, gameData }) => {
{user.user_name}
- {user.country_code === 'XX' ? ( - '' + {user.country_code === "XX" ? ( + "" ) : ( = ({ token, profile, gameData }) => {
- {user.links.steam === '-' ? ( - '' + {user.links.steam === "-" ? ( + "" ) : ( Steam )} - {user.links.twitch === '-' ? ( - '' + {user.links.twitch === "-" ? ( + "" ) : ( Twitch )} - {user.links.youtube === '-' ? ( - '' + {user.links.youtube === "-" ? ( + "" ) : ( Youtube )} - {user.links.p2sr === '-' ? ( - '' + {user.links.p2sr === "-" ? ( + "" ) : ( - P2SR + P2SR )}
@@ -172,8 +172,8 @@ const User: React.FC = ({ token, profile, gameData }) => { Overall {user.rankings.overall.rank === 0 - ? 'N/A ' - : '#' + user.rankings.overall.rank + ' '} + ? "N/A " + : "#" + user.rankings.overall.rank + " "} ({user.rankings.overall.completion_count}/ {user.rankings.overall.completion_total}) @@ -184,8 +184,8 @@ const User: React.FC = ({ token, profile, gameData }) => { Singleplayer {user.rankings.singleplayer.rank === 0 - ? 'N/A ' - : '#' + user.rankings.singleplayer.rank + ' '} + ? "N/A " + : "#" + user.rankings.singleplayer.rank + " "} ({user.rankings.singleplayer.completion_count}/ {user.rankings.singleplayer.completion_total}) @@ -196,8 +196,8 @@ const User: React.FC = ({ token, profile, gameData }) => { Cooperative {user.rankings.cooperative.rank === 0 - ? 'N/A ' - : '#' + user.rankings.cooperative.rank + ' '} + ? "N/A " + : "#" + user.rankings.cooperative.rank + " "} ({user.rankings.cooperative.completion_count}/ {user.rankings.cooperative.completion_total}) @@ -227,15 +227,15 @@ const User: React.FC = ({ token, profile, gameData }) => { id="select-game" onChange={() => { setGame( - (document.querySelector('#select-game') as HTMLInputElement) + (document.querySelector("#select-game") as HTMLInputElement) .value ); - setChapter('0'); + setChapter("0"); const chapterSelect = document.querySelector( - '#select-chapter' + "#select-chapter" ) as HTMLSelectElement; if (chapterSelect) { - chapterSelect.value = '0'; + chapterSelect.value = "0"; } }} > @@ -250,7 +250,7 @@ const User: React.FC = ({ token, profile, gameData }) => { )} - {game === '0' ? ( + {game === "0" ? ( @@ -263,7 +263,7 @@ const User: React.FC = ({ token, profile, gameData }) => { setChapter( ( document.querySelector( - '#select-chapter' + "#select-chapter" ) as HTMLInputElement ).value ) @@ -287,15 +287,15 @@ const User: React.FC = ({ token, profile, gameData }) => { Map Name - + Portals - + WRΔ - + Time @@ -315,18 +315,18 @@ const User: React.FC = ({ token, profile, gameData }) => { if (pageNumber !== 1) { setPageNumber(prevPageNumber => prevPageNumber - 1); const records = document.querySelectorAll( - '.profileboard-record' + ".profileboard-record" ); records.forEach(r => { - (r as HTMLInputElement).style.height = '44px'; + (r as HTMLInputElement).style.height = "44px"; }); } }} > {' '} + style={{ position: "relative", left: "-5px" }} + >{" "} {pageNumber}/{pageMax} @@ -336,10 +336,10 @@ const User: React.FC = ({ token, profile, gameData }) => { if (pageNumber !== pageMax) { setPageNumber(prevPageNumber => prevPageNumber + 1); const records = document.querySelectorAll( - '.profileboard-record' + ".profileboard-record" ); records.forEach(r => { - (r as HTMLInputElement).style.height = '44px'; + (r as HTMLInputElement).style.height = "44px"; }); } }} @@ -347,18 +347,18 @@ const User: React.FC = ({ token, profile, gameData }) => { {' '} + >{" "}
- {game === '0' ? ( + {game === "0" ? ( user.records .sort((a, b) => a.map_id - b.map_id) .map((r, index) => @@ -367,33 +367,33 @@ const User: React.FC = ({ token, profile, gameData }) => { {r.scores.map((e, i) => ( <> {i !== 0 ? ( -
+
) : ( - '' + "" )} {r.map_name} - {e.score_count} + {e.score_count} - + {e.score_count - r.map_wr_count > 0 ? `+${e.score_count - r.map_wr_count}` : `-`} - + {ticks_to_time(e.score_time)} {i === 0 ? #{r.placement} : } - {e.date.split('T')[0]} - + {e.date.split("T")[0]} + ) : ( - '' + "" )} ))} ) : ( - '' + "" ) ) ) : maps ? ( @@ -457,42 +457,42 @@ const User: React.FC = ({ token, profile, gameData }) => { ) : ( ) : ( - '' + "" )} -- cgit v1.2.3