From ddfe5015c9237fbe0fea44f8bcde31708eb3adac Mon Sep 17 00:00:00 2001 From: Wolfboy248 Date: Tue, 26 Aug 2025 08:20:51 +0200 Subject: Fixed some inconsistant styles and fixed category queryparam in maplist page --- frontend/src/pages/About/About.tsx | 2 +- frontend/src/pages/Games/Games.tsx | 6 ++++-- frontend/src/pages/Home/Homepage.tsx | 4 ++-- frontend/src/pages/Maplist/Components/Map.tsx | 8 ++++++-- frontend/src/pages/Maplist/Maplist.tsx | 21 +++++++++++++-------- frontend/src/pages/Maps/Maps.module.css | 22 ++++++++++++++++++++++ frontend/src/pages/Maps/Maps.tsx | 23 +++++++++++++++-------- frontend/src/pages/Rules/Rules.tsx | 2 +- 8 files changed, 64 insertions(+), 24 deletions(-) create mode 100644 frontend/src/pages/Maps/Maps.module.css (limited to 'frontend/src/pages') diff --git a/frontend/src/pages/About/About.tsx b/frontend/src/pages/About/About.tsx index 0db4bf2..0db6c8a 100644 --- a/frontend/src/pages/About/About.tsx +++ b/frontend/src/pages/About/About.tsx @@ -24,7 +24,7 @@ const About: React.FC = () => { }, []); return ( -
+
LPHUB | About diff --git a/frontend/src/pages/Games/Games.tsx b/frontend/src/pages/Games/Games.tsx index ea46733..2f084f3 100644 --- a/frontend/src/pages/Games/Games.tsx +++ b/frontend/src/pages/Games/Games.tsx @@ -3,6 +3,7 @@ import { Helmet } from "react-helmet"; import GameEntry from "@components/GameEntry.tsx"; import { Game } from "@customTypes/Game.ts"; +import BreadcrumbNav from "@components/BreadcrumbNav/BreadcrumbNav"; interface GamesProps { games: Game[]; @@ -10,11 +11,12 @@ interface GamesProps { const Games: React.FC = ({ games }) => { return ( -
+
LPHUB | Games -
+ +

Games

{games.map((game, index) => ( diff --git a/frontend/src/pages/Home/Homepage.tsx b/frontend/src/pages/Home/Homepage.tsx index e4c2261..9bbf768 100644 --- a/frontend/src/pages/Home/Homepage.tsx +++ b/frontend/src/pages/Home/Homepage.tsx @@ -3,11 +3,11 @@ import { Helmet } from "react-helmet"; const Homepage: React.FC = () => { return ( -
+
LPHUB | Homepage -
+

Welcome to Least Portals Hub!

diff --git a/frontend/src/pages/Maplist/Components/Map.tsx b/frontend/src/pages/Maplist/Components/Map.tsx index 5451830..503c143 100644 --- a/frontend/src/pages/Maplist/Components/Map.tsx +++ b/frontend/src/pages/Maplist/Components/Map.tsx @@ -19,7 +19,7 @@ const Map: React.FC = ({ map, catNum }) => { className="flex h-40 sm:h-48 bg-cover relative" style={{ backgroundImage: `url(${map.image})` }} > -

+
{map.is_disabled ? map.category_portals[0].portal_count @@ -28,7 +28,11 @@ const Map: React.FC = ({ map, catNum }) => { )?.portal_count} - portals + {map.is_disabled + ? map.category_portals[0].portal_count == 1 ? "portal" : "portals" + : map.category_portals.find( + obj => obj.category.id === catNum + 1 + )?.portal_count == 1 ? "portal" : "portals"}
diff --git a/frontend/src/pages/Maplist/Maplist.tsx b/frontend/src/pages/Maplist/Maplist.tsx index d8acdf0..0b64619 100644 --- a/frontend/src/pages/Maplist/Maplist.tsx +++ b/frontend/src/pages/Maplist/Maplist.tsx @@ -28,7 +28,7 @@ const Maplist: React.FC = () => { function _update_currently_selected(catNum2: number) { setCurrentlySelected(catNum2); - navigate("/games/" + game?.id + "?cat=" + catNum2); + // navigate("/games/" + game?.id + "?cat=" + catNum2); setHasClicked(true); } @@ -54,11 +54,16 @@ const Maplist: React.FC = () => { // location query params const queryParams = new URLSearchParams(location.search); if (queryParams.get("chapter")) { - let cat = parseFloat(queryParams.get("chapter") || ""); + let chapter = parseFloat(queryParams.get("chapter") || ""); if (gameId === 2) { - cat += 10; + chapter += 10; } - _fetch_chapters(cat.toString()); + _fetch_chapters(chapter.toString()); + } + + if (queryParams.get("cat")) { + let cat = parseFloat(queryParams.get("cat") || ""); + setCatNum(cat - 1); } const _fetch_game = async () => { @@ -80,7 +85,7 @@ const Maplist: React.FC = () => { setLoad(true); _fetch_game(); _fetch_game_chapters(); - }, [location.search]); + }, [location]); useEffect(() => { const queryParams = new URLSearchParams(location.search); @@ -145,7 +150,7 @@ const Maplist: React.FC = () => {
-
+
{curChapter?.chapter.name.split(" - ")[0]} @@ -155,14 +160,14 @@ const Maplist: React.FC = () => { onClick={_handle_dropdown_click} className="cursor-pointer select-none flex w-fit items-center" > - + {curChapter?.chapter.name.split(" - ")[1]}
{gameChapters?.chapters.map((chapter, i) => { diff --git a/frontend/src/pages/Maps/Maps.module.css b/frontend/src/pages/Maps/Maps.module.css new file mode 100644 index 0000000..5c2b414 --- /dev/null +++ b/frontend/src/pages/Maps/Maps.module.css @@ -0,0 +1,22 @@ +.button-nav { + display: flex; + flex: 1; + gap: 12px; + + align-items: center; + justify-content: center; + cursor: pointer; + + background-color: var(--color-block); + transition: all 0.1s ease; + padding: 8px 0px; + font-size: 28px; +} + +.button-nav:hover { + background-color: var(--color-panel); +} + +.button-nav>span { + transform: translateY(-2px); +} \ No newline at end of file diff --git a/frontend/src/pages/Maps/Maps.tsx b/frontend/src/pages/Maps/Maps.tsx index 03de289..3989b56 100644 --- a/frontend/src/pages/Maps/Maps.tsx +++ b/frontend/src/pages/Maps/Maps.tsx @@ -2,6 +2,8 @@ import React from "react"; import { Link, useLocation } from "react-router-dom"; import { Helmet } from "react-helmet"; +import styles from "./Maps.module.css"; + import { PortalIcon, FlagIcon, ChatIcon } from "../../images/Images.tsx"; import Summary from "@components/Summary.tsx"; import Leaderboards from "@components/Leaderboards.tsx"; @@ -63,22 +65,25 @@ const Maps: React.FC = ({ token, isModerator }) => { if (!mapSummaryData) { // loading placeholder + // TODO: Don't do this return ( <>
+

Loading...

+
- - - @@ -109,19 +114,21 @@ const Maps: React.FC = ({ token, isModerator }) => {
-
+
-
- - - diff --git a/frontend/src/pages/Rules/Rules.tsx b/frontend/src/pages/Rules/Rules.tsx index 20d301c..a94118a 100644 --- a/frontend/src/pages/Rules/Rules.tsx +++ b/frontend/src/pages/Rules/Rules.tsx @@ -25,7 +25,7 @@ const Rules: React.FC = () => { }, []); return ( -
+
LPHUB | Rules -- cgit v1.2.3