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/Profile.tsx | 200 ++++++++++++++++++++--------------------- 1 file changed, 100 insertions(+), 100 deletions(-) (limited to 'frontend/src/pages/Profile.tsx') diff --git a/frontend/src/pages/Profile.tsx b/frontend/src/pages/Profile.tsx index 8acf746..e2d6000 100644 --- a/frontend/src/pages/Profile.tsx +++ b/frontend/src/pages/Profile.tsx @@ -1,6 +1,6 @@ -import React from 'react'; -import { Link, useNavigate } from 'react-router-dom'; -import { Helmet } from 'react-helmet'; +import React from "react"; +import { Link, useNavigate } from "react-router-dom"; +import { Helmet } from "react-helmet"; import { SteamIcon, @@ -14,16 +14,16 @@ import { DownloadIcon, HistoryIcon, DeleteIcon, -} from '@images/Images'; -import { UserProfile } from '@customTypes/Profile'; -import { Game, GameChapters } from '@customTypes/Game'; -import { Map } from '@customTypes/Map'; -import { ticks_to_time } from '@utils/Time'; -import '@css/Profile.css'; -import { API } from '@api/Api'; -import useConfirm from '@hooks/UseConfirm'; -import useMessage from '@hooks/UseMessage'; -import useMessageLoad from '@hooks/UseMessageLoad'; +} from "@images/Images"; +import { UserProfile } from "@customTypes/Profile"; +import { Game, GameChapters } from "@customTypes/Game"; +import { Map } from "@customTypes/Map"; +import { ticks_to_time } from "@utils/Time"; +import "@css/Profile.css"; +import { API } from "@api/Api"; +import useConfirm from "@hooks/UseConfirm"; +import useMessage from "@hooks/UseMessage"; +import useMessageLoad from "@hooks/UseMessageLoad"; interface ProfileProps { profile?: UserProfile; @@ -46,8 +46,8 @@ const Profile: React.FC = ({ 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 ); @@ -62,17 +62,17 @@ const Profile: React.FC = ({ }; const _get_game_chapters = React.useCallback(async () => { - if (game && game !== '0') { + if (game && game !== "0") { const gameChapters = await API.get_games_chapters(game); setChapterData(gameChapters); - } else if (game && game === '0') { + } else if (game && game === "0") { setPageMax(Math.ceil(profile!.records.length / 20)); setPageNumber(1); } }, [game, profile]); 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)); @@ -87,29 +87,29 @@ const Profile: React.FC = ({ const _delete_submission = async (map_id: number, record_id: number) => { const userConfirmed = await confirm( - 'Delete Record', - 'Are you sure you want to delete this record?' + "Delete Record", + "Are you sure you want to delete this record?" ); if (!userConfirmed) { return; } - messageLoad('Deleting...'); + messageLoad("Deleting..."); const api_success = await API.delete_map_record(token!, map_id, record_id); messageLoadClose(); if (api_success) { - await message('Delete Record', 'Successfully deleted record.'); + await message("Delete Record", "Successfully deleted record."); onDeleteRecord(); } else { - await message('Delete Record', 'Could not delete record.'); + await message("Delete Record", "Could not delete record."); } }; React.useEffect(() => { if (!profile) { - navigate('/'); + navigate("/"); } }, [profile, navigate]); @@ -120,7 +120,7 @@ const Profile: React.FC = ({ }, [profile, game, _get_game_chapters]); React.useEffect(() => { - if (profile && game !== '0') { + if (profile && game !== "0") { _get_game_maps(); } }, [profile, game, chapter, chapterData, _get_game_maps]); @@ -156,8 +156,8 @@ const Profile: React.FC = ({
{profile.user_name}
- {profile.country_code === 'XX' ? ( - '' + {profile.country_code === "XX" ? ( + "" ) : ( = ({
- {profile.links.steam === '-' ? ( - '' + {profile.links.steam === "-" ? ( + "" ) : ( Steam )} - {profile.links.twitch === '-' ? ( - '' + {profile.links.twitch === "-" ? ( + "" ) : ( Twitch )} - {profile.links.youtube === '-' ? ( - '' + {profile.links.youtube === "-" ? ( + "" ) : ( Youtube )} - {profile.links.p2sr === '-' ? ( - '' + {profile.links.p2sr === "-" ? ( + "" ) : ( - P2SR + P2SR )}
@@ -212,8 +212,8 @@ const Profile: React.FC = ({ Overall {profile.rankings.overall.rank === 0 - ? 'N/A ' - : '#' + profile.rankings.overall.rank + ' '} + ? "N/A " + : "#" + profile.rankings.overall.rank + " "} ({profile.rankings.overall.completion_count}/ {profile.rankings.overall.completion_total}) @@ -224,8 +224,8 @@ const Profile: React.FC = ({ Singleplayer {profile.rankings.singleplayer.rank === 0 - ? 'N/A ' - : '#' + profile.rankings.singleplayer.rank + ' '} + ? "N/A " + : "#" + profile.rankings.singleplayer.rank + " "} ({profile.rankings.singleplayer.completion_count}/ {profile.rankings.singleplayer.completion_total}) @@ -236,8 +236,8 @@ const Profile: React.FC = ({ Cooperative {profile.rankings.cooperative.rank === 0 - ? 'N/A ' - : '#' + profile.rankings.cooperative.rank + ' '} + ? "N/A " + : "#" + profile.rankings.cooperative.rank + " "} ({profile.rankings.cooperative.completion_count}/ {profile.rankings.cooperative.completion_total}) @@ -267,15 +267,15 @@ const Profile: React.FC = ({ 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"; } }} > @@ -290,7 +290,7 @@ const Profile: React.FC = ({ )} - {game === '0' ? ( + {game === "0" ? ( @@ -303,7 +303,7 @@ const Profile: React.FC = ({ setChapter( ( document.querySelector( - '#select-chapter' + "#select-chapter" ) as HTMLInputElement ).value ) @@ -327,15 +327,15 @@ const Profile: React.FC = ({ Map Name - + Portals - + WRΔ - + Time @@ -355,18 +355,18 @@ const Profile: React.FC = ({ 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} @@ -376,10 +376,10 @@ const Profile: React.FC = ({ 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"; }); } }} @@ -387,18 +387,18 @@ const Profile: React.FC = ({ {' '} + >{" "}
- {game === '0' ? ( + {game === "0" ? ( profile.records .sort((a, b) => a.map_id - b.map_id) .map((r, index) => @@ -407,25 +407,25 @@ const Profile: React.FC = ({ {r.scores.map((e, i) => ( <> {i !== 0 ? ( -
+
) : ( - '' + "" )} {r.map_name} - + {e.score_count} - + {e.score_count - r.map_wr_count > 0 ? `+${e.score_count - r.map_wr_count}` : `-`} - + {ticks_to_time(e.score_time)} @@ -434,13 +434,13 @@ const Profile: React.FC = ({ ) : ( )} - {e.date.split('T')[0]} - + {e.date.split("T")[0]} + ) : ( - '' + "" )} ))} ) : ( - '' + "" ) ) ) : maps ? ( @@ -511,42 +511,42 @@ const Profile: React.FC = ({ ) : ( ) : ( - '' + "" )} -- cgit v1.2.3