From d19aebd898af77dbc65fabfc4fe905f72769ccc7 Mon Sep 17 00:00:00 2001 From: Wolfboy248 Date: Wed, 11 Dec 2024 09:41:13 +0100 Subject: fix/frontend: games page css rehaul, small maplist fixes --- frontend/src/components/GameCategory.tsx | 8 +++-- frontend/src/components/GameEntry.tsx | 9 ++--- frontend/src/css/Games.module.css | 61 ++++++++++++++++++++++++++++++++ frontend/src/css/Info.module.css | 21 +++++++++++ frontend/src/pages/Games.tsx | 26 +++----------- frontend/src/pages/Maplist.tsx | 6 ++-- 6 files changed, 101 insertions(+), 30 deletions(-) create mode 100644 frontend/src/css/Games.module.css create mode 100644 frontend/src/css/Info.module.css (limited to 'frontend') diff --git a/frontend/src/components/GameCategory.tsx b/frontend/src/components/GameCategory.tsx index d8879ef..80ee416 100644 --- a/frontend/src/components/GameCategory.tsx +++ b/frontend/src/components/GameCategory.tsx @@ -3,6 +3,8 @@ import { Link } from "react-router-dom"; import { Game, GameCategoryPortals } from '@customTypes/Game'; import "@css/Games.css" +import games from "@css/Games.module.css"; +import info from "@css/Info.module.css"; interface GameCategoryProps { game: Game; @@ -11,11 +13,11 @@ interface GameCategoryProps { const GameCategory: React.FC = ({cat, game}) => { return ( - = ({ game }) => { }, [game.category_portals]); return ( -
-
-
+
+
+
{game.name}
-
+
{catInfo.map((cat, index) => { return })} diff --git a/frontend/src/css/Games.module.css b/frontend/src/css/Games.module.css new file mode 100644 index 0000000..4c598cd --- /dev/null +++ b/frontend/src/css/Games.module.css @@ -0,0 +1,61 @@ +.content { + position: relative; + display: flex; + flex-direction: column; + width: 100%; + gap: 24px; + margin-top: 24px; +} + +.content a { + position: relative; + width: 100%; +} + +.game { + display: flex; + width: 100%; + flex-direction: column; + overflow: hidden; + border-radius: 24px; + background-color: var(--primary-dark); +} + +.header { + display: flex; + overflow: hidden; + position: relative; + flex: 1; +} + +.header span { + position: relative; + z-index: 2; + display: flex; + text-align: center; + justify-content: center; + width: 100%; + padding: 24px 0px; + text-wrap: nowrap; +} + +.header div { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 1; + background-size: cover; + filter: blur(4px); +} + +.infoBlockContainer { + flex: 1; + display: flex; + gap: 12px; + margin: 12px; + align-items: center; + justify-content: center; + height: 50%; +} diff --git a/frontend/src/css/Info.module.css b/frontend/src/css/Info.module.css new file mode 100644 index 0000000..144346e --- /dev/null +++ b/frontend/src/css/Info.module.css @@ -0,0 +1,21 @@ +.infoBlock { + background-color: var(--primary); + display: flex; + width: 100%; + border-radius: 18px; + text-align: center; + justify-content: center; + padding: 4px 0px; + text-wrap: nowrap; +} + +.infoBlock > div > span:nth-child(1) { + margin-top: 0px; + font-size: 26px; +} + +.infoBlock > div > span:nth-child(3) { + font-size: 50px; + font-family: BarlowCondensed-Bold; +} + diff --git a/frontend/src/pages/Games.tsx b/frontend/src/pages/Games.tsx index e7e031e..45dd170 100644 --- a/frontend/src/pages/Games.tsx +++ b/frontend/src/pages/Games.tsx @@ -3,36 +3,20 @@ import React from 'react'; import GameEntry from '@components/GameEntry'; import { Game } from '@customTypes/Game'; import "@css/Maps.css" +import gamesCSS from "@css/Games.module.css"; interface GamesProps { games: Game[]; } const Games: React.FC = ({ games }) => { - - const _page_load = () => { - const loaders = document.querySelectorAll(".loader"); - loaders.forEach((loader) => { - (loader as HTMLElement).style.display = "none"; - }); - } - - React.useEffect(() => { - document.querySelectorAll(".games-page-item-body").forEach((game, index) => { - game.innerHTML = ""; - }); - _page_load(); - }, []); - return (
-
-
- {games.map((game, index) => ( - - ))} -
+
+ {games.map((game, index) => ( + + ))}
diff --git a/frontend/src/pages/Maplist.tsx b/frontend/src/pages/Maplist.tsx index 7b4ce06..ecea3e1 100644 --- a/frontend/src/pages/Maplist.tsx +++ b/frontend/src/pages/Maplist.tsx @@ -123,7 +123,9 @@ const Maplist: React.FC = () => { )?.portal_count } -

portals

+

{game?.category_portals.find( + (obj) => obj.category.id === catNum + 1)!.portal_count == 1 ? "portal" : "portals" + }

{game?.category_portals.map((cat, index) => ( @@ -162,7 +164,7 @@ const Maplist: React.FC = () => { {map.is_disabled ? map.category_portals[0].portal_count : map.category_portals.find( (obj) => obj.category.id === catNum + 1 )?.portal_count} - portals + {map.category_portals.find((obj) => obj.category.id === catNum + 1)?.portal_count == 1 ? "portal" : "portals"}
-- cgit v1.2.3