From 681f7d3ba097cd8d204ff3ac4dae01432d323e5b Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Thu, 30 Jan 2025 14:43:17 +0300 Subject: feat/frontend: dynamic title and meta descriptions (#261) --- frontend/src/pages/Maplist.tsx | 48 +++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 22 deletions(-) (limited to 'frontend/src/pages/Maplist.tsx') diff --git a/frontend/src/pages/Maplist.tsx b/frontend/src/pages/Maplist.tsx index 8fc52b0..04938cf 100644 --- a/frontend/src/pages/Maplist.tsx +++ b/frontend/src/pages/Maplist.tsx @@ -1,5 +1,6 @@ import React, { useEffect } from "react"; import { Link, useLocation, useNavigate, useParams } from "react-router-dom"; +import { Helmet } from "react-helmet"; import "@css/Maplist.css"; import { API } from "@api/Api"; @@ -25,9 +26,9 @@ const Maplist: React.FC = () => { const navigate = useNavigate(); function _update_currently_selected(catNum2: number) { - setCurrentlySelected(catNum2); - navigate("/games/" + game?.id + "?cat=" + catNum2); - setHasClicked(true); + setCurrentlySelected(catNum2); + navigate("/games/" + game?.id + "?cat=" + catNum2); + setHasClicked(true); } const _fetch_chapters = async (chapter_id: string) => { @@ -52,12 +53,12 @@ const Maplist: React.FC = () => { // location query params const queryParams = new URLSearchParams(location.search); if (queryParams.get("chapter")) { - let cat = parseFloat(queryParams.get("chapter") || ""); - if (gameId == 2) { - cat += 10; - } - _fetch_chapters(cat.toString()); - } + let cat = parseFloat(queryParams.get("chapter") || ""); + if (gameId == 2) { + cat += 10; + } + _fetch_chapters(cat.toString()); + } const _fetch_game = async () => { const games = await API.get_games(); @@ -68,7 +69,7 @@ const Maplist: React.FC = () => { setLoad(false); } }; - + const _fetch_game_chapters = async () => { const games_chapters = await API.get_games_chapters(gameId.toString()); setGameChapters(games_chapters); @@ -81,7 +82,7 @@ const Maplist: React.FC = () => { }, []); useEffect(() => { - const queryParams = new URLSearchParams(location.search); + const queryParams = new URLSearchParams(location.search); if (gameChapters != undefined && !queryParams.get("chapter")) { _fetch_chapters(gameChapters!.chapters[0].id.toString()); } @@ -91,6 +92,9 @@ const Maplist: React.FC = () => { return (
+ + LPHUB | Maplist +
))} @@ -132,26 +136,26 @@ const Maplist: React.FC = () => {
- {curChapter?.chapter.name.split(" - ")[0]} + {curChapter?.chapter.name.split(" - ")[0]}
{curChapter?.chapter.name.split(" - ")[1]}
-
+
{gameChapters?.chapters.map((chapter, i) => { - return
{_fetch_chapters(chapter.id.toString()); _handle_dropdown_click()}}>{chapter.name}
+ return
{ _fetch_chapters(chapter.id.toString()); _handle_dropdown_click() }}>{chapter.name}
}) }
- {curChapter?.maps.map((map, i) => { - return
- + {curChapter?.maps.map((map, i) => { + return
+ {map.name} -
+
{map.is_disabled ? map.category_portals[0].portal_count : map.category_portals.find( (obj) => obj.category.id === catNum + 1 @@ -169,9 +173,9 @@ const Maplist: React.FC = () => {
- -
- })} + +
+ })}
-- cgit v1.2.3 From 6a163167c81689f07e76e7ff9ab7449f88ca0ea4 Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Wed, 19 Mar 2025 15:38:58 +0000 Subject: feat/frontend: adjust difficulty to 1-10 scale (#268) --- frontend/src/components/Summary.tsx | 21 ++++++++++----------- frontend/src/pages/Maplist.tsx | 2 +- 2 files changed, 11 insertions(+), 12 deletions(-) (limited to 'frontend/src/pages/Maplist.tsx') diff --git a/frontend/src/components/Summary.tsx b/frontend/src/components/Summary.tsx index 4bcaa6a..2fec182 100644 --- a/frontend/src/components/Summary.tsx +++ b/frontend/src/components/Summary.tsx @@ -140,18 +140,17 @@ const Summary: React.FC = ({ selectedRun, setSelectedRun, data })
Difficulty - {data.summary.routes[selectedRun].rating === 0 && (N/A)} - {data.summary.routes[selectedRun].rating === 1 && (Very easy)} - {data.summary.routes[selectedRun].rating === 2 && (Easy)} - {data.summary.routes[selectedRun].rating === 3 && (Medium)} - {data.summary.routes[selectedRun].rating === 4 && (Hard)} - {data.summary.routes[selectedRun].rating === 5 && (Very hard)} + {data.summary.routes[selectedRun].rating <= 2 && (Very easy)} + {data.summary.routes[selectedRun].rating <= 4 && (Easy)} + {data.summary.routes[selectedRun].rating <= 6 && (Medium)} + {data.summary.routes[selectedRun].rating <= 8 && (Hard)} + {data.summary.routes[selectedRun].rating <= 10 && (Very hard)}
- {data.summary.routes[selectedRun].rating === 1 ? (
) : (
)} - {data.summary.routes[selectedRun].rating === 2 ? (
) : (
)} - {data.summary.routes[selectedRun].rating === 3 ? (
) : (
)} - {data.summary.routes[selectedRun].rating === 4 ? (
) : (
)} - {data.summary.routes[selectedRun].rating === 5 ? (
) : (
)} + {data.summary.routes[selectedRun].rating <= 2 ? (
) : (
)} + {data.summary.routes[selectedRun].rating <= 4 ? (
) : (
)} + {data.summary.routes[selectedRun].rating <= 6 ? (
) : (
)} + {data.summary.routes[selectedRun].rating <= 8 ? (
) : (
)} + {data.summary.routes[selectedRun].rating <= 10 ? (
) : (
)}
diff --git a/frontend/src/pages/Maplist.tsx b/frontend/src/pages/Maplist.tsx index 04938cf..76f9a52 100644 --- a/frontend/src/pages/Maplist.tsx +++ b/frontend/src/pages/Maplist.tsx @@ -165,7 +165,7 @@ const Maplist: React.FC = () => {
{/* Difficulty: */} -
+
-- cgit v1.2.3