From 6a631744d9c80ff9a1a9f4b278bc0337ecdb494e Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Sun, 26 Oct 2025 13:51:31 +0400 Subject: chore/frontend: semicolon linting (#287) --- frontend/src/components/ConfirmDialog.tsx | 4 +- frontend/src/components/Discussions.tsx | 2 +- frontend/src/components/GameCategory.tsx | 6 +- frontend/src/components/GameEntry.tsx | 4 +- frontend/src/components/Leaderboards.tsx | 8 +-- frontend/src/components/MapEntry.tsx | 4 +- frontend/src/components/MessageDialog.tsx | 6 +- frontend/src/components/MessageDialogLoad.tsx | 6 +- frontend/src/components/ModMenu.tsx | 20 +++--- frontend/src/components/RankingEntry.tsx | 6 +- frontend/src/components/Sidebar.tsx | 90 +++++++++++++-------------- frontend/src/components/Summary.tsx | 10 +-- frontend/src/components/UploadRunDialog.tsx | 46 +++++++------- 13 files changed, 106 insertions(+), 106 deletions(-) (limited to 'frontend/src/components') diff --git a/frontend/src/components/ConfirmDialog.tsx b/frontend/src/components/ConfirmDialog.tsx index d8784d2..dbfbc62 100644 --- a/frontend/src/components/ConfirmDialog.tsx +++ b/frontend/src/components/ConfirmDialog.tsx @@ -1,6 +1,6 @@ import React from "react"; -import "@css/Dialog.css" +import "@css/Dialog.css"; interface ConfirmDialogProps { title: string; @@ -25,7 +25,7 @@ const ConfirmDialog: React.FC = ({ title, subtitle, onConfir - ) + ); }; export default ConfirmDialog; diff --git a/frontend/src/components/Discussions.tsx b/frontend/src/components/Discussions.tsx index 0c37355..51cf06a 100644 --- a/frontend/src/components/Discussions.tsx +++ b/frontend/src/components/Discussions.tsx @@ -4,7 +4,7 @@ import { MapDiscussion, MapDiscussions, MapDiscussionsDetail } from "@customType import { MapDiscussionContent } from "@customTypes/Content"; import { time_ago } from "@utils/Time"; import { API } from "@api/Api"; -import "@css/Maps.css" +import "@css/Maps.css"; import { Link } from "react-router-dom"; import useConfirm from "@hooks/UseConfirm"; diff --git a/frontend/src/components/GameCategory.tsx b/frontend/src/components/GameCategory.tsx index 0d76d3e..79bb3fa 100644 --- a/frontend/src/components/GameCategory.tsx +++ b/frontend/src/components/GameCategory.tsx @@ -2,7 +2,7 @@ import React from "react"; import { Link } from "react-router-dom"; import { Game, GameCategoryPortals } from "@customTypes/Game"; -import "@css/Games.css" +import "@css/Games.css"; interface GameCategoryProps { game: Game; @@ -18,7 +18,7 @@ const GameCategory: React.FC = ({cat, game}) => { {cat.portal_count} - ) -} + ); +}; export default GameCategory; diff --git a/frontend/src/components/GameEntry.tsx b/frontend/src/components/GameEntry.tsx index 454efb1..deeb0ed 100644 --- a/frontend/src/components/GameEntry.tsx +++ b/frontend/src/components/GameEntry.tsx @@ -2,7 +2,7 @@ import React from "react"; import { Link } from "react-router-dom"; import { Game, GameCategoryPortals } from "@customTypes/Game"; -import "@css/Games.css" +import "@css/Games.css"; import GameCategory from "@components/GameCategory"; @@ -25,7 +25,7 @@ const GameEntry: React.FC = ({ game }) => {
{catInfo.map((cat, index) => { - return + return ; })}
diff --git a/frontend/src/components/Leaderboards.tsx b/frontend/src/components/Leaderboards.tsx index 1a4aa48..073c21b 100644 --- a/frontend/src/components/Leaderboards.tsx +++ b/frontend/src/components/Leaderboards.tsx @@ -6,7 +6,7 @@ import { MapLeaderboard } from "@customTypes/Map"; import { ticks_to_time, time_ago } from "@utils/Time"; import { API } from "@api/Api"; import useMessage from "@hooks/UseMessage"; -import "@css/Maps.css" +import "@css/Maps.css"; interface LeaderboardsProps { mapID: string; @@ -26,7 +26,7 @@ const Leaderboards: React.FC = ({ mapID }) => { React.useEffect(() => { _fetch_map_leaderboards(); - }, [pageNumber, navigate]) + }, [pageNumber, navigate]); if (!data) { return ( @@ -103,14 +103,14 @@ const Leaderboards: React.FC = ({ mapID }) => { {r.kind === "multiplayer" ? ( - + ) : r.kind === "singleplayer" && ( - + )} diff --git a/frontend/src/components/MapEntry.tsx b/frontend/src/components/MapEntry.tsx index 88137d8..5c58401 100644 --- a/frontend/src/components/MapEntry.tsx +++ b/frontend/src/components/MapEntry.tsx @@ -6,7 +6,7 @@ const MapEntry: React.FC = () => {
- ) -} + ); +}; export default MapEntry; diff --git a/frontend/src/components/MessageDialog.tsx b/frontend/src/components/MessageDialog.tsx index ae95f8d..e731c73 100644 --- a/frontend/src/components/MessageDialog.tsx +++ b/frontend/src/components/MessageDialog.tsx @@ -1,6 +1,6 @@ import React from "react"; -import "@css/Dialog.css" +import "@css/Dialog.css"; interface MessageDialogProps { title: string; @@ -23,7 +23,7 @@ const MessageDialog: React.FC = ({ title, subtitle, onClose - ) -} + ); +}; export default MessageDialog; diff --git a/frontend/src/components/MessageDialogLoad.tsx b/frontend/src/components/MessageDialogLoad.tsx index 000a2ab..b3726fb 100644 --- a/frontend/src/components/MessageDialogLoad.tsx +++ b/frontend/src/components/MessageDialogLoad.tsx @@ -1,6 +1,6 @@ import React from "react"; -import "@css/Dialog.css" +import "@css/Dialog.css"; interface MessageDialogLoadProps { title: string; @@ -23,7 +23,7 @@ const MessageDialogLoad: React.FC = ({ title, onClose }) - ) -} + ); +}; export default MessageDialogLoad; diff --git a/frontend/src/components/ModMenu.tsx b/frontend/src/components/ModMenu.tsx index 19ce0ce..e7ef25c 100644 --- a/frontend/src/components/ModMenu.tsx +++ b/frontend/src/components/ModMenu.tsx @@ -5,7 +5,7 @@ import { useNavigate } from "react-router-dom"; import { MapSummary } from "@customTypes/Map"; import { ModMenuContent } from "@customTypes/Content"; import { API } from "@api/Api"; -import "@css/ModMenu.css" +import "@css/ModMenu.css"; import useConfirm from "@hooks/UseConfirm"; interface ModMenuProps { @@ -73,7 +73,7 @@ const ModMenu: React.FC = ({ token, data, selectedRun, mapID }) => if (success) { navigate(0); } else { - alert("Error. Check logs.") + alert("Error. Check logs."); } } } @@ -87,7 +87,7 @@ const ModMenu: React.FC = ({ token, data, selectedRun, mapID }) => if (success) { navigate(0); } else { - alert("Error. Check logs.") + alert("Error. Check logs."); } } } @@ -101,7 +101,7 @@ const ModMenu: React.FC = ({ token, data, selectedRun, mapID }) => if (success) { navigate(0); } else { - alert("Error. Check logs.") + alert("Error. Check logs."); } } } @@ -115,7 +115,7 @@ const ModMenu: React.FC = ({ token, data, selectedRun, mapID }) => if (success) { navigate(0); } else { - alert("Error. Check logs.") + alert("Error. Check logs."); } } } @@ -149,17 +149,17 @@ const ModMenu: React.FC = ({ token, data, selectedRun, mapID }) => }, [menu]); React.useEffect(() => { - const modview = document.querySelector("div#modview") as HTMLElement + const modview = document.querySelector("div#modview") as HTMLElement; if (modview) { showButton ? modview.style.transform = "translateY(-68%)" - : modview.style.transform = "translateY(0%)" + : modview.style.transform = "translateY(0%)"; } - const modview_block = document.querySelector("#modview_block") as HTMLElement + const modview_block = document.querySelector("#modview_block") as HTMLElement; if (modview_block) { - showButton ? modview_block.style.display = "none" : modview_block.style.display = "block" + showButton ? modview_block.style.display = "none" : modview_block.style.display = "block"; } - }, [showButton]) + }, [showButton]); return ( <> diff --git a/frontend/src/components/RankingEntry.tsx b/frontend/src/components/RankingEntry.tsx index 9ad9e1c..8db753a 100644 --- a/frontend/src/components/RankingEntry.tsx +++ b/frontend/src/components/RankingEntry.tsx @@ -26,7 +26,7 @@ const RankingEntry: React.FC = (prop) => { {prop.curRankingData.total_score} - ) + ); } else { return (
@@ -39,8 +39,8 @@ const RankingEntry: React.FC = (prop) => {
{prop.currentLeaderboardType == RankingCategories.rankings_singleplayer ? prop.curRankingData.sp_score : prop.currentLeaderboardType == RankingCategories.rankings_multiplayer ? prop.curRankingData.mp_score : prop.curRankingData.overall_score} - ) + ); } -} +}; export default RankingEntry; diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsx index 0a7efa8..8e2573c 100644 --- a/frontend/src/components/Sidebar.tsx +++ b/frontend/src/components/Sidebar.tsx @@ -28,19 +28,19 @@ const Sidebar: React.FC = ({ setToken, profile, setProfile, onUplo const handle_sidebar_click = (clicked_sidebar_idx: number) => { const btn = document.querySelectorAll("button.sidebar-button"); - if (isSidebarOpen) { setSidebarOpen(false); _handle_sidebar_hide() } + if (isSidebarOpen) { setSidebarOpen(false); _handle_sidebar_hide(); } // clusterfuck btn.forEach((e, i) => { - btn[i].classList.remove("sidebar-button-selected") - btn[i].classList.add("sidebar-button-deselected") - }) - btn[clicked_sidebar_idx].classList.add("sidebar-button-selected") - btn[clicked_sidebar_idx].classList.remove("sidebar-button-deselected") + btn[i].classList.remove("sidebar-button-selected"); + btn[i].classList.add("sidebar-button-deselected"); + }); + btn[clicked_sidebar_idx].classList.add("sidebar-button-selected"); + btn[clicked_sidebar_idx].classList.remove("sidebar-button-deselected"); }; const _handle_sidebar_hide = () => { - const btn = document.querySelectorAll("button.sidebar-button") as NodeListOf - const span = document.querySelectorAll("button.sidebar-button>span") as NodeListOf + const btn = document.querySelectorAll("button.sidebar-button") as NodeListOf; + const span = document.querySelectorAll("button.sidebar-button>span") as NodeListOf; const side = document.querySelector("#sidebar-list") as HTMLElement; const searchbar = document.querySelector("#searchbar") as HTMLInputElement; const uploadRunBtn = document.querySelector("#upload-run") as HTMLInputElement; @@ -49,42 +49,42 @@ const Sidebar: React.FC = ({ setToken, profile, setProfile, onUplo if (isSidebarOpen) { if (profile) { const login = document.querySelectorAll(".login>button")[1] as HTMLElement; - login.style.opacity = "1" - uploadRunBtn.style.width = "310px" - uploadRunBtn.style.padding = "0.4em 0 0 11px" - uploadRunSpan.style.opacity = "0" + login.style.opacity = "1"; + uploadRunBtn.style.width = "310px"; + uploadRunBtn.style.padding = "0.4em 0 0 11px"; + uploadRunSpan.style.opacity = "0"; setTimeout(() => { - uploadRunSpan.style.opacity = "1" - }, 100) + uploadRunSpan.style.opacity = "1"; + }, 100); } setSidebarOpen(false); - side.style.width = "320px" + side.style.width = "320px"; btn.forEach((e, i) => { - e.style.width = (window.innerWidth > 1024) ? "310px" : "265px" - e.style.padding = "0.4em 0 0 11px" + e.style.width = (window.innerWidth > 1024) ? "310px" : "265px"; + e.style.padding = "0.4em 0 0 11px"; setTimeout(() => { - span[i].style.opacity = "1" - }, 100) + span[i].style.opacity = "1"; + }, 100); }); - side.style.zIndex = "2" + side.style.zIndex = "2"; } else { if (profile) { const login = document.querySelectorAll(".login>button")[1] as HTMLElement; - login.style.opacity = "0" - uploadRunBtn.style.width = "40px" - uploadRunBtn.style.padding = "0.4em 0 0 5px" - uploadRunSpan.style.opacity = "0" + login.style.opacity = "0"; + uploadRunBtn.style.width = "40px"; + uploadRunBtn.style.padding = "0.4em 0 0 5px"; + uploadRunSpan.style.opacity = "0"; } setSidebarOpen(true); side.style.width = "40px"; searchbar.focus(); btn.forEach((e, i) => { - e.style.width = "40px" - e.style.padding = "0.4em 0 0 5px" - span[i].style.opacity = "0" - }) + e.style.width = "40px"; + e.style.padding = "0.4em 0 0 5px"; + span[i].style.opacity = "0"; + }); setTimeout(() => { - side.style.zIndex = "0" + side.style.zIndex = "0"; }, 300); } }; @@ -94,7 +94,7 @@ const Sidebar: React.FC = ({ setToken, profile, setProfile, onUplo setIsMobileSearchOpen(!isMobileSearchOpen); } else { if (!isSidebarLocked) { - _handle_sidebar_hide() + _handle_sidebar_hide(); setIsSidebarLocked(true); setTimeout(() => setIsSidebarLocked(false), 300); } @@ -124,14 +124,14 @@ const Sidebar: React.FC = ({ setToken, profile, setProfile, onUplo }; React.useEffect(() => { - if (path === "/") { handle_sidebar_click(1) } - else if (path.includes("games")) { handle_sidebar_click(2) } - else if (path.includes("rankings")) { handle_sidebar_click(3) } + if (path === "/") { handle_sidebar_click(1); } + else if (path.includes("games")) { handle_sidebar_click(2); } + else if (path.includes("rankings")) { handle_sidebar_click(3); } // else if (path.includes("news")) { handle_sidebar_click(4) } // else if (path.includes("scorelog")) { handle_sidebar_click(5) } - else if (path.includes("profile")) { handle_sidebar_click(4) } - else if (path.includes("rules")) { handle_sidebar_click(5) } - else if (path.includes("about")) { handle_sidebar_click(6) } + else if (path.includes("profile")) { handle_sidebar_click(4); } + else if (path.includes("rules")) { handle_sidebar_click(5); } + else if (path.includes("about")) { handle_sidebar_click(6); } }, [path]); return ( @@ -225,15 +225,15 @@ const Sidebar: React.FC = ({ setToken, profile, setProfile, onUplo ))} {searchData?.players.map((q, index) => - ( - - pfp - {q.user_name} - - ))} + ( + + pfp + {q.user_name} + + ))} diff --git a/frontend/src/components/Summary.tsx b/frontend/src/components/Summary.tsx index 922960b..ee50ce8 100644 --- a/frontend/src/components/Summary.tsx +++ b/frontend/src/components/Summary.tsx @@ -2,7 +2,7 @@ import React from "react"; import ReactMarkdown from "react-markdown"; import { MapSummary } from "@customTypes/Map"; -import "@css/Maps.css" +import "@css/Maps.css"; interface SummaryProps { selectedRun: number @@ -18,11 +18,11 @@ const Summary: React.FC = ({ selectedRun, setSelectedRun, data }) function _select_run(idx: number, category_id: number) { const r = document.querySelectorAll("button.record"); r.forEach(e => (e as HTMLElement).style.backgroundColor = "#2b2e46"); - (r[idx] as HTMLElement).style.backgroundColor = "#161723" + (r[idx] as HTMLElement).style.backgroundColor = "#161723"; if (data && data.summary.routes.length !== 0) { - idx += data.summary.routes.filter(e => e.category.id < category_id).length // lethimcook + idx += data.summary.routes.filter(e => e.category.id < category_id).length; // lethimcook setSelectedRun(idx); } }; @@ -34,7 +34,7 @@ const Summary: React.FC = ({ selectedRun, setSelectedRun, data }) function _category_change() { const btn = document.querySelectorAll("#section3 #category span button"); - btn.forEach((e) => { (e as HTMLElement).style.backgroundColor = "#2b2e46" }); + btn.forEach((e) => { (e as HTMLElement).style.backgroundColor = "#2b2e46"; }); // heavenly father forgive me for i have sinned. TODO: fix this bullshit with dynamic categories const idx = selectedCategory === 1 ? 0 : data.map.is_coop ? selectedCategory - 3 : selectedCategory - 1; (btn[idx] as HTMLElement).style.backgroundColor = "#202232"; @@ -42,7 +42,7 @@ const Summary: React.FC = ({ selectedRun, setSelectedRun, data }) function _history_change() { const btn = document.querySelectorAll("#section3 #history span button"); - btn.forEach((e) => { (e as HTMLElement).style.backgroundColor = "#2b2e46" }); + btn.forEach((e) => { (e as HTMLElement).style.backgroundColor = "#2b2e46"; }); (historySelected ? btn[1] as HTMLElement : btn[0] as HTMLElement).style.backgroundColor = "#202232"; }; diff --git a/frontend/src/components/UploadRunDialog.tsx b/frontend/src/components/UploadRunDialog.tsx index dd609a1..445fe7c 100644 --- a/frontend/src/components/UploadRunDialog.tsx +++ b/frontend/src/components/UploadRunDialog.tsx @@ -52,7 +52,7 @@ const UploadRunDialog: React.FC = ({ token, open, onClose, } else { fileInputRefPartner.current?.click(); } - } + }; const _handle_drag_over = (e: React.DragEvent, host: boolean) => { e.preventDefault(); @@ -62,7 +62,7 @@ const UploadRunDialog: React.FC = ({ token, open, onClose, } else { setDragHighlightPartner(true); } - } + }; const _handle_drag_leave = (e: React.DragEvent, host: boolean) => { e.preventDefault(); @@ -72,7 +72,7 @@ const UploadRunDialog: React.FC = ({ token, open, onClose, } else { setDragHighlightPartner(false); } - } + }; const _handle_drop = (e: React.DragEvent, host: boolean) => { e.preventDefault(); @@ -80,7 +80,7 @@ const UploadRunDialog: React.FC = ({ token, open, onClose, setDragHighlight(true); _handle_file_change(e.dataTransfer.files, host); - } + }; const _handle_dropdowns = (dropdown: number) => { setDropdown1Vis(false); @@ -91,7 +91,7 @@ const UploadRunDialog: React.FC = ({ token, open, onClose, setDropdown2Vis(!dropdown2Vis); document.querySelector("#dropdown2")?.scrollTo(0, 0); } - } + }; const _handle_game_select = async (game_id: string, game_name: string) => { setLoading(true); @@ -120,16 +120,16 @@ const UploadRunDialog: React.FC = ({ token, open, onClose, if (token) { if (games[selectedGameID].is_coop) { if (uploadRunContent.host_demo === null) { - await message("Error", "You must select a host demo to upload.") - return + await message("Error", "You must select a host demo to upload."); + return; } else if (uploadRunContent.partner_demo === null) { - await message("Error", "You must select a partner demo to upload.") - return + await message("Error", "You must select a partner demo to upload."); + return; } } else { if (uploadRunContent.host_demo === null) { - await message("Error", "You must select a demo to upload.") - return + await message("Error", "You must select a demo to upload."); + return; } } const demo = SourceDemoParser.default() @@ -137,24 +137,24 @@ const UploadRunDialog: React.FC = ({ token, open, onClose, .parse(await uploadRunContent.host_demo.arrayBuffer()); const scoreboard = demo.findPacket((msg) => { return msg instanceof NetMessages.SvcUserMessage && msg.userMessage instanceof ScoreboardTempUpdate; - }) + }); if (!scoreboard) { - await message("Error", "Error while processing demo: Unable to get scoreboard result. Either there is a demo that is corrupt or haven't been recorded in challenge mode.") - return + await message("Error", "Error while processing demo: Unable to get scoreboard result. Either there is a demo that is corrupt or haven't been recorded in challenge mode."); + return; } if (!demo.mapName || !MapNames[demo.mapName]) { - await message("Error", "Error while processing demo: Invalid map name.") - return + await message("Error", "Error while processing demo: Invalid map name."); + return; } if (selectedGameID === 0 && MapNames[demo.mapName] > 60) { - await message("Error", "Error while processing demo: Invalid cooperative demo in singleplayer submission.") - return + await message("Error", "Error while processing demo: Invalid cooperative demo in singleplayer submission."); + return; } else if (selectedGameID === 1 && MapNames[demo.mapName] <= 60) { - await message("Error", "Error while processing demo: Invalid singleplayer demo in cooperative submission.") - return + await message("Error", "Error while processing demo: Invalid singleplayer demo in cooperative submission."); + return; } const { portalScore, timeScore } = scoreboard.userMessage?.as() ?? {}; @@ -207,7 +207,7 @@ const UploadRunDialog: React.FC = ({ token, open, onClose,
{games.map((game) => ( -
{ _handle_game_select(game.id.toString(), game.name); _handle_dropdowns(1) }} key={game.id}>{game.name}
+
{ _handle_game_select(game.id.toString(), game.name); _handle_dropdowns(1); }} key={game.id}>{game.name}
))}
@@ -219,7 +219,7 @@ const UploadRunDialog: React.FC = ({ token, open, onClose,

Host Demo

-
{ _handle_file_click(true) }} onDragOver={(e) => { _handle_drag_over(e, true) }} onDrop={(e) => { _handle_drop(e, true) }} onDragLeave={(e) => { _handle_drag_leave(e, true) }} className={`upload-run-drag-area ${dragHightlight ? "upload-run-drag-area-highlight" : ""} ${uploadRunContent.host_demo ? "upload-run-drag-area-hidden" : ""}`}> +
{ _handle_file_click(true); }} onDragOver={(e) => { _handle_drag_over(e, true); }} onDrop={(e) => { _handle_drop(e, true); }} onDragLeave={(e) => { _handle_drag_leave(e, true); }} className={`upload-run-drag-area ${dragHightlight ? "upload-run-drag-area-highlight" : ""} ${uploadRunContent.host_demo ? "upload-run-drag-area-hidden" : ""}`}> _handle_file_change(e.target.files, true)} /> {!uploadRunContent.host_demo ?
@@ -239,7 +239,7 @@ const UploadRunDialog: React.FC = ({ token, open, onClose, <>

Partner Demo

-
{ _handle_file_click(false) }} onDragOver={(e) => { _handle_drag_over(e, false) }} onDrop={(e) => { _handle_drop(e, false) }} onDragLeave={(e) => { _handle_drag_leave(e, false) }} className={`upload-run-drag-area ${dragHightlightPartner ? "upload-run-drag-area-highlight-partner" : ""} ${uploadRunContent.partner_demo ? "upload-run-drag-area-hidden" : ""}`}> +
{ _handle_file_click(false); }} onDragOver={(e) => { _handle_drag_over(e, false); }} onDrop={(e) => { _handle_drop(e, false); }} onDragLeave={(e) => { _handle_drag_leave(e, false); }} className={`upload-run-drag-area ${dragHightlightPartner ? "upload-run-drag-area-highlight-partner" : ""} ${uploadRunContent.partner_demo ? "upload-run-drag-area-hidden" : ""}`}> _handle_file_change(e.target.files, false)} /> {!uploadRunContent.partner_demo ?
Drag and drop -- cgit v1.2.3