aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/pages/Maplist.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/pages/Maplist.tsx')
-rw-r--r--frontend/src/pages/Maplist.tsx131
1 files changed, 71 insertions, 60 deletions
diff --git a/frontend/src/pages/Maplist.tsx b/frontend/src/pages/Maplist.tsx
index a7242ef..8343129 100644
--- a/frontend/src/pages/Maplist.tsx
+++ b/frontend/src/pages/Maplist.tsx
@@ -2,7 +2,6 @@ import React, { useEffect } from "react";
2import { Link, useLocation, useNavigate, useParams } from "react-router-dom"; 2import { Link, useLocation, useNavigate, useParams } from "react-router-dom";
3import { Helmet } from "react-helmet"; 3import { Helmet } from "react-helmet";
4 4
5import "@css/Maplist.css";
6import { API } from "@api/Api"; 5import { API } from "@api/Api";
7import { Game } from "@customTypes/Game"; 6import { Game } from "@customTypes/Game";
8import { GameChapter, GamesChapters } from "@customTypes/Chapters"; 7import { GameChapter, GamesChapters } from "@customTypes/Chapters";
@@ -92,44 +91,52 @@ const Maplist: React.FC = () => {
92 <Helmet> 91 <Helmet>
93 <title>LPHUB | Maplist</title> 92 <title>LPHUB | Maplist</title>
94 </Helmet> 93 </Helmet>
95 <section style={{ marginTop: "20px" }}> 94
95 <section className="mt-5">
96 <Link to="/games"> 96 <Link to="/games">
97 <button className="nav-button" style={{ borderRadius: "20px" }}> 97 <button className="nav-button rounded-[20px] h-10 bg-surface border-0 text-foreground text-lg font-[--font-barlow-semicondensed-regular] transition-colors duration-100 hover:bg-surface2 flex items-center px-2">
98 <i className="triangle"></i> 98 <i className="triangle mr-2"></i>
99 <span>Games List</span> 99 <span className="px-2">Games List</span>
100 </button> 100 </button>
101 </Link> 101 </Link>
102 </section> 102 </section>
103
103 {load ? ( 104 {load ? (
104 <div></div> 105 <div></div>
105 ) : ( 106 ) : (
106 <section> 107 <section>
107 <h1>{game?.name}</h1> 108 <h1 className="font-[--font-barlow-condensed-bold] text-6xl my-0 text-foreground">
109 {game?.name}
110 </h1>
111
108 <div 112 <div
113 className="text-center rounded-3xl overflow-hidden bg-cover bg-[25%] mt-3 relative"
109 style={{ backgroundImage: `url(${game?.image})` }} 114 style={{ backgroundImage: `url(${game?.image})` }}
110 className="game-header"
111 > 115 >
112 <div className="blur"> 116 <div className="backdrop-blur-sm flex flex-col w-full">
113 <div className="game-header-portal-count"> 117 <div className="h-full flex flex-col justify-center items-center">
114 <h2 className="portal-count"> 118 <h2 className="my-5 font-[--font-barlow-semicondensed-semibold] text-8xl text-foreground">
115 { 119 {
116 game?.category_portals.find( 120 game?.category_portals.find(
117 obj => obj.category.id === catNum + 1 121 obj => obj.category.id === catNum + 1
118 )?.portal_count 122 )?.portal_count
119 } 123 }
120 </h2> 124 </h2>
121 <h3>portals</h3> 125 <h3 className="font-[--font-barlow-semicondensed-regular] mx-2.5 text-4xl my-0 text-foreground">
126 portals
127 </h3>
122 </div> 128 </div>
123 <div className="game-header-categories"> 129
130 <div className="flex h-12 bg-surface gap-0.5">
124 {game?.category_portals.map((cat, index) => ( 131 {game?.category_portals.map((cat, index) => (
125 <button 132 <button
126 key={index} 133 key={index}
127 className={ 134 className={`border-0 text-foreground font-[--font-barlow-semicondensed-regular] text-xl cursor-pointer transition-all duration-100 w-full ${
128 currentlySelected === cat.category.id || 135 currentlySelected === cat.category.id ||
129 (cat.category.id - 1 === catNum && !hasClicked) 136 (cat.category.id - 1 === catNum && !hasClicked)
130 ? "game-cat-button selected" 137 ? "bg-surface"
131 : "game-cat-button" 138 : "bg-surface1 hover:bg-surface"
132 } 139 }`}
133 onClick={() => { 140 onClick={() => {
134 setCatNum(cat.category.id - 1); 141 setCatNum(cat.category.id - 1);
135 _update_currently_selected(cat.category.id); 142 _update_currently_selected(cat.category.id);
@@ -143,31 +150,32 @@ const Maplist: React.FC = () => {
143 </div> 150 </div>
144 151
145 <div> 152 <div>
146 <section className="chapter-select-container"> 153 <section>
147 <div> 154 <div>
148 <span 155 <span className="text-lg translate-y-1.5 block mt-2.5 text-foreground">
149 style={{
150 fontSize: "18px",
151 transform: "translateY(5px)",
152 display: "block",
153 marginTop: "10px",
154 }}
155 >
156 {curChapter?.chapter.name.split(" - ")[0]} 156 {curChapter?.chapter.name.split(" - ")[0]}
157 </span> 157 </span>
158 </div> 158 </div>
159 <div onClick={_handle_dropdown_click} className="dropdown"> 159 <div
160 <span>{curChapter?.chapter.name.split(" - ")[1]}</span> 160 onClick={_handle_dropdown_click}
161 <i className="triangle"></i> 161 className="cursor-pointer select-none flex w-fit items-center"
162 >
163 <span className="text-foreground text-2xl">
164 {curChapter?.chapter.name.split(" - ")[1]}
165 </span>
166 <i className="triangle translate-x-1.5 translate-y-2 -rotate-90"></i>
162 </div> 167 </div>
168 \
163 <div 169 <div
164 className="dropdown-elements" 170 className={`absolute z-[1000] bg-surface1 rounded-2xl overflow-hidden p-1 animate-in fade-in duration-100 ${
165 style={{ display: dropdownActive }} 171 dropdownActive === "none" ? "hidden" : "block"
172 }`}
166 > 173 >
167 {gameChapters?.chapters.map((chapter, i) => { 174 {gameChapters?.chapters.map((chapter, i) => {
168 return ( 175 return (
169 <div 176 <div
170 className="dropdown-element" 177 key={i}
178 className="cursor-pointer text-xl rounded-[2000px] p-1 hover:bg-surface text-foreground"
171 onClick={() => { 179 onClick={() => {
172 _fetch_chapters(chapter.id.toString()); 180 _fetch_chapters(chapter.id.toString());
173 _handle_dropdown_click(); 181 _handle_dropdown_click();
@@ -179,49 +187,52 @@ const Maplist: React.FC = () => {
179 })} 187 })}
180 </div> 188 </div>
181 </section> 189 </section>
182 <section className="maplist"> 190
191 <section className="grid grid-cols-4 gap-5 my-5">
183 {curChapter?.maps.map((map, i) => { 192 {curChapter?.maps.map((map, i) => {
184 return ( 193 return (
185 <div className="maplist-entry"> 194 <div key={i} className="bg-surface rounded-3xl overflow-hidden">
186 <Link to={`/maps/${map.id}`}> 195 <Link to={`/maps/${map.id}`}>
187 <span>{map.name}</span> 196 <span className="text-center text-xl w-full block my-1.5 text-foreground">
197 {map.name}
198 </span>
188 <div 199 <div
189 className="map-entry-image" 200 className="flex h-48 bg-cover relative"
190 style={{ backgroundImage: `url(${map.image})` }} 201 style={{ backgroundImage: `url(${map.image})` }}
191 > 202 >
192 <div className="blur map"> 203 <div className="backdrop-blur-sm w-full flex items-center justify-center">
193 <span> 204 <span className="text-4xl font-[--font-barlow-semicondensed-semibold] text-white mr-1.5">
194 {map.is_disabled 205 {map.is_disabled
195 ? map.category_portals[0].portal_count 206 ? map.category_portals[0].portal_count
196 : map.category_portals.find( 207 : map.category_portals.find(
197 obj => obj.category.id === catNum + 1 208 obj => obj.category.id === catNum + 1
198 )?.portal_count} 209 )?.portal_count}
199 </span> 210 </span>
200 <span>portals</span> 211 <span className="text-4xl font-[--font-barlow-semicondensed-regular] text-white">
212 portals
213 </span>
201 </div> 214 </div>
202 </div> 215 </div>
203 <div className="difficulty-bar"> 216
204 {/* <span>Difficulty:</span> */} 217 {/* Difficulty rating */}
205 <div 218 <div className="flex mx-2.5 my-4">
206 className={ 219 <div className="flex w-full items-center justify-center gap-1.5 rounded-[2000px] ml-0.5 translate-y-px">
207 map.difficulty === 0 220 {[1, 2, 3, 4, 5].map((point) => (
208 ? "one" 221 <div
209 : map.difficulty === 1 222 key={point}
210 ? "two" 223 className={`flex h-0.5 w-full rounded-3xl ${
211 : map.difficulty === 2 224 point <= (map.difficulty + 1)
212 ? "three" 225 ? map.difficulty === 0
213 : map.difficulty === 3 226 ? "bg-green-500"
214 ? "four" 227 : map.difficulty === 1 || map.difficulty === 2
215 : map.difficulty === 4 228 ? "bg-lime-500"
216 ? "five" 229 : map.difficulty === 3
217 : "one" 230 ? "bg-red-400"
218 } 231 : "bg-red-600"
219 > 232 : "bg-surface1"
220 <div className="difficulty-point"></div> 233 }`}
221 <div className="difficulty-point"></div> 234 />
222 <div className="difficulty-point"></div> 235 ))}
223 <div className="difficulty-point"></div>
224 <div className="difficulty-point"></div>
225 </div> 236 </div>
226 </div> 237 </div>
227 </Link> 238 </Link>