aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/pages/Maplist
diff options
context:
space:
mode:
authorWolfboy248 <georgejvindkarlsen@gmail.com>2025-08-26 08:20:51 +0200
committerWolfboy248 <georgejvindkarlsen@gmail.com>2025-08-26 08:20:51 +0200
commitddfe5015c9237fbe0fea44f8bcde31708eb3adac (patch)
treedb7d9812461c0ab0dc39812465f20bc958f9bf67 /frontend/src/pages/Maplist
parentMoved breadcrum navigation into its own component (diff)
downloadlphub-css.tar.gz
lphub-css.tar.bz2
lphub-css.zip
Fixed some inconsistant styles and fixed category queryparam in maplist pagecss
Diffstat (limited to 'frontend/src/pages/Maplist')
-rw-r--r--frontend/src/pages/Maplist/Components/Map.tsx8
-rw-r--r--frontend/src/pages/Maplist/Maplist.tsx21
2 files changed, 19 insertions, 10 deletions
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<MapProps> = ({ map, catNum }) => {
19 className="flex h-40 sm:h-48 bg-cover relative" 19 className="flex h-40 sm:h-48 bg-cover relative"
20 style={{ backgroundImage: `url(${map.image})` }} 20 style={{ backgroundImage: `url(${map.image})` }}
21 > 21 >
22 <div className="backdrop-blur-sm w-full flex items-center justify-center"> 22 <div className="backdrop-blur-[4px] w-full flex items-center justify-center">
23 <span className="text-3xl sm:text-5xl font-barlow-semicondensed-semibold text-white mr-1.5"> 23 <span className="text-3xl sm:text-5xl font-barlow-semicondensed-semibold text-white mr-1.5">
24 {map.is_disabled 24 {map.is_disabled
25 ? map.category_portals[0].portal_count 25 ? map.category_portals[0].portal_count
@@ -28,7 +28,11 @@ const Map: React.FC<MapProps> = ({ map, catNum }) => {
28 )?.portal_count} 28 )?.portal_count}
29 </span> 29 </span>
30 <span className="text-2xl sm:text-4xl font-barlow-semicondensed-regular text-white"> 30 <span className="text-2xl sm:text-4xl font-barlow-semicondensed-regular text-white">
31 portals 31 {map.is_disabled
32 ? map.category_portals[0].portal_count == 1 ? "portal" : "portals"
33 : map.category_portals.find(
34 obj => obj.category.id === catNum + 1
35 )?.portal_count == 1 ? "portal" : "portals"}
32 </span> 36 </span>
33 </div> 37 </div>
34 </div> 38 </div>
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 = () => {
28 28
29 function _update_currently_selected(catNum2: number) { 29 function _update_currently_selected(catNum2: number) {
30 setCurrentlySelected(catNum2); 30 setCurrentlySelected(catNum2);
31 navigate("/games/" + game?.id + "?cat=" + catNum2); 31 // navigate("/games/" + game?.id + "?cat=" + catNum2);
32 setHasClicked(true); 32 setHasClicked(true);
33 } 33 }
34 34
@@ -54,11 +54,16 @@ const Maplist: React.FC = () => {
54 // location query params 54 // location query params
55 const queryParams = new URLSearchParams(location.search); 55 const queryParams = new URLSearchParams(location.search);
56 if (queryParams.get("chapter")) { 56 if (queryParams.get("chapter")) {
57 let cat = parseFloat(queryParams.get("chapter") || ""); 57 let chapter = parseFloat(queryParams.get("chapter") || "");
58 if (gameId === 2) { 58 if (gameId === 2) {
59 cat += 10; 59 chapter += 10;
60 } 60 }
61 _fetch_chapters(cat.toString()); 61 _fetch_chapters(chapter.toString());
62 }
63
64 if (queryParams.get("cat")) {
65 let cat = parseFloat(queryParams.get("cat") || "");
66 setCatNum(cat - 1);
62 } 67 }
63 68
64 const _fetch_game = async () => { 69 const _fetch_game = async () => {
@@ -80,7 +85,7 @@ const Maplist: React.FC = () => {
80 setLoad(true); 85 setLoad(true);
81 _fetch_game(); 86 _fetch_game();
82 _fetch_game_chapters(); 87 _fetch_game_chapters();
83 }, [location.search]); 88 }, [location]);
84 89
85 useEffect(() => { 90 useEffect(() => {
86 const queryParams = new URLSearchParams(location.search); 91 const queryParams = new URLSearchParams(location.search);
@@ -145,7 +150,7 @@ const Maplist: React.FC = () => {
145 </div> 150 </div>
146 151
147 <div> 152 <div>
148 <section> 153 <section className="relative">
149 <div> 154 <div>
150 <span className="text-lg sm:text-lg translate-y-1.5 block mt-2.5 text-foreground"> 155 <span className="text-lg sm:text-lg translate-y-1.5 block mt-2.5 text-foreground">
151 {curChapter?.chapter.name.split(" - ")[0]} 156 {curChapter?.chapter.name.split(" - ")[0]}
@@ -155,14 +160,14 @@ const Maplist: React.FC = () => {
155 onClick={_handle_dropdown_click} 160 onClick={_handle_dropdown_click}
156 className="cursor-pointer select-none flex w-fit items-center" 161 className="cursor-pointer select-none flex w-fit items-center"
157 > 162 >
158 <span className="text-foreground text-base sm:text-2xl"> 163 <span className="sm:text-4xl font-barlow-semicondensed-semibold">
159 {curChapter?.chapter.name.split(" - ")[1]} 164 {curChapter?.chapter.name.split(" - ")[1]}
160 </span> 165 </span>
161 <i className="triangle translate-x-1.5 translate-y-2 -rotate-90"></i> 166 <i className="triangle translate-x-1.5 translate-y-2 -rotate-90"></i>
162 </div> 167 </div>
163 168
164 <div 169 <div
165 className={`absolute z-[1000] bg-panel rounded-2xl overflow-hidden p-1 animate-in fade-in duration-100 ${dropdownActive === "none" ? "hidden" : "block" 170 className={`absolute z-10 bg-panel rounded-2xl overflow-hidden p-1 animate-in fade-in duration-100 ${dropdownActive === "none" ? "hidden" : "block"
166 }`} 171 }`}
167 > 172 >
168 {gameChapters?.chapters.map((chapter, i) => { 173 {gameChapters?.chapters.map((chapter, i) => {