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.tsx271
1 files changed, 135 insertions, 136 deletions
diff --git a/frontend/src/pages/Maplist.tsx b/frontend/src/pages/Maplist.tsx
index 8343129..2f0491e 100644
--- a/frontend/src/pages/Maplist.tsx
+++ b/frontend/src/pages/Maplist.tsx
@@ -87,161 +87,160 @@ const Maplist: React.FC = () => {
87 }, [gameChapters, location.search]); 87 }, [gameChapters, location.search]);
88 88
89 return ( 89 return (
90 <main> 90 <main className="*:text-foreground w-[calc(100vw-80px)] relative left-0 ml-20 min-h-screen p-4 sm:p-8">
91 <Helmet> 91 <Helmet>
92 <title>LPHUB | Maplist</title> 92 <title>LPHUB | Maplist</title>
93 </Helmet> 93 </Helmet>
94 94
95 <section className="mt-5"> 95 <section className="mt-5">
96 <Link to="/games"> 96 <Link to="/games">
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"> 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 mr-2"></i> 98 <i className="triangle mr-2"></i>
99 <span className="px-2">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
104 {load ? ( 104 {load ? (
105 <div></div> 105 <div></div>
106 ) : ( 106 ) : (
107 <section> 107 <section>
108 <h1 className="font-[--font-barlow-condensed-bold] text-6xl my-0 text-foreground"> 108 <h1 className="font-[--font-barlow-condensed-bold] text-3xl sm:text-6xl my-0 text-foreground">
109 {game?.name} 109 {game?.name}
110 </h1> 110 </h1>
111
112 <div
113 className="text-center rounded-3xl overflow-hidden bg-cover bg-[25%] mt-3 relative"
114 style={{ backgroundImage: `url(${game?.image})` }}
115 >
116 <div className="backdrop-blur-sm flex flex-col w-full">
117 <div className="h-full flex flex-col justify-center items-center py-6">
118 <h2 className="my-5 font-[--font-barlow-semicondensed-semibold] text-4xl sm:text-8xl text-foreground">
119 {
120 game?.category_portals.find(
121 obj => obj.category.id === catNum + 1
122 )?.portal_count
123 }
124 </h2>
125 <h3 className="font-[--font-barlow-semicondensed-regular] mx-2.5 text-2xl sm:text-4xl my-0 text-foreground">
126 portals
127 </h3>
128 </div>
129
130 <div className="flex h-12 bg-surface gap-0.5">
131 {game?.category_portals.map((cat, index) => (
132 <button
133 key={index}
134 className={`border-0 text-foreground font-[--font-barlow-semicondensed-regular] text-sm sm:text-xl cursor-pointer transition-all duration-100 w-full ${
135 currentlySelected === cat.category.id ||
136 (cat.category.id - 1 === catNum && !hasClicked)
137 ? "bg-surface"
138 : "bg-surface1 hover:bg-surface"
139 }`}
140 onClick={() => {
141 setCatNum(cat.category.id - 1);
142 _update_currently_selected(cat.category.id);
143 }}
144 >
145 <span className="truncate">{cat.category.name}</span>
146 </button>
147 ))}
148 </div>
149 </div>
150 </div>
111 151
152 <div>
153 <section>
154 <div>
155 <span className="text-lg sm:text-lg translate-y-1.5 block mt-2.5 text-foreground">
156 {curChapter?.chapter.name.split(" - ")[0]}
157 </span>
158 </div>
159 <div
160 onClick={_handle_dropdown_click}
161 className="cursor-pointer select-none flex w-fit items-center"
162 >
163 <span className="text-foreground text-base sm:text-2xl">
164 {curChapter?.chapter.name.split(" - ")[1]}
165 </span>
166 <i className="triangle translate-x-1.5 translate-y-2 -rotate-90"></i>
167 </div>
168 \
112 <div 169 <div
113 className="text-center rounded-3xl overflow-hidden bg-cover bg-[25%] mt-3 relative" 170 className={`absolute z-[1000] bg-surface1 rounded-2xl overflow-hidden p-1 animate-in fade-in duration-100 ${
114 style={{ backgroundImage: `url(${game?.image})` }} 171 dropdownActive === "none" ? "hidden" : "block"
172 }`}
115 > 173 >
116 <div className="backdrop-blur-sm flex flex-col w-full"> 174 {gameChapters?.chapters.map((chapter, i) => {
117 <div className="h-full flex flex-col justify-center items-center"> 175 return (
118 <h2 className="my-5 font-[--font-barlow-semicondensed-semibold] text-8xl text-foreground"> 176 <div
119 { 177 key={i}
120 game?.category_portals.find( 178 className="cursor-pointer text-base sm:text-xl rounded-[2000px] p-1 hover:bg-surface text-foreground"
121 obj => obj.category.id === catNum + 1 179 onClick={() => {
122 )?.portal_count 180 _fetch_chapters(chapter.id.toString());
123 } 181 _handle_dropdown_click();
124 </h2> 182 }}
125 <h3 className="font-[--font-barlow-semicondensed-regular] mx-2.5 text-4xl my-0 text-foreground"> 183 >
126 portals 184 {chapter.name}
127 </h3>
128 </div>
129
130 <div className="flex h-12 bg-surface gap-0.5">
131 {game?.category_portals.map((cat, index) => (
132 <button
133 key={index}
134 className={`border-0 text-foreground font-[--font-barlow-semicondensed-regular] text-xl cursor-pointer transition-all duration-100 w-full ${
135 currentlySelected === cat.category.id ||
136 (cat.category.id - 1 === catNum && !hasClicked)
137 ? "bg-surface"
138 : "bg-surface1 hover:bg-surface"
139 }`}
140 onClick={() => {
141 setCatNum(cat.category.id - 1);
142 _update_currently_selected(cat.category.id);
143 }}
144 >
145 <span>{cat.category.name}</span>
146 </button>
147 ))}
148 </div>
149 </div> 185 </div>
186 );
187 })}
150 </div> 188 </div>
189 </section>
151 190
152 <div> 191 <section className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-5 my-5">
153 <section> 192 {curChapter?.maps.map((map, i) => {
154 <div> 193 return (
155 <span className="text-lg translate-y-1.5 block mt-2.5 text-foreground"> 194 <div key={i} className="bg-surface rounded-3xl overflow-hidden">
156 {curChapter?.chapter.name.split(" - ")[0]} 195 <Link to={`/maps/${map.id}`}>
157 </span> 196 <span className="text-center text-base sm:text-xl w-full block my-1.5 text-foreground truncate">
158 </div> 197 {map.name}
159 <div 198 </span>
160 onClick={_handle_dropdown_click} 199 <div
161 className="cursor-pointer select-none flex w-fit items-center" 200 className="flex h-40 sm:h-48 bg-cover relative"
201 style={{ backgroundImage: `url(${map.image})` }}
162 > 202 >
163 <span className="text-foreground text-2xl"> 203 <div className="backdrop-blur-sm w-full flex items-center justify-center">
164 {curChapter?.chapter.name.split(" - ")[1]} 204 <span className="text-2xl sm:text-4xl font-[--font-barlow-semicondensed-semibold] text-white mr-1.5">
205 {map.is_disabled
206 ? map.category_portals[0].portal_count
207 : map.category_portals.find(
208 obj => obj.category.id === catNum + 1
209 )?.portal_count}
210 </span>
211 <span className="text-2xl sm:text-4xl font-[--font-barlow-semicondensed-regular] text-white">
212 portals
165 </span> 213 </span>
166 <i className="triangle translate-x-1.5 translate-y-2 -rotate-90"></i>
167 </div> 214 </div>
168 \
169 <div
170 className={`absolute z-[1000] bg-surface1 rounded-2xl overflow-hidden p-1 animate-in fade-in duration-100 ${
171 dropdownActive === "none" ? "hidden" : "block"
172 }`}
173 >
174 {gameChapters?.chapters.map((chapter, i) => {
175 return (
176 <div
177 key={i}
178 className="cursor-pointer text-xl rounded-[2000px] p-1 hover:bg-surface text-foreground"
179 onClick={() => {
180 _fetch_chapters(chapter.id.toString());
181 _handle_dropdown_click();
182 }}
183 >
184 {chapter.name}
185 </div>
186 );
187 })}
188 </div> 215 </div>
189 </section> 216
190 217 <div className="flex mx-2.5 my-4">
191 <section className="grid grid-cols-4 gap-5 my-5"> 218 <div className="flex w-full items-center justify-center gap-1.5 rounded-[2000px] ml-0.5 translate-y-px">
192 {curChapter?.maps.map((map, i) => { 219 {[1, 2, 3, 4, 5].map((point) => (
193 return ( 220 <div
194 <div key={i} className="bg-surface rounded-3xl overflow-hidden"> 221 key={point}
195 <Link to={`/maps/${map.id}`}> 222 className={`flex h-0.5 w-full rounded-3xl ${
196 <span className="text-center text-xl w-full block my-1.5 text-foreground"> 223 point <= (map.difficulty + 1)
197 {map.name} 224 ? map.difficulty === 0
198 </span> 225 ? "bg-green-500"
199 <div 226 : map.difficulty === 1 || map.difficulty === 2
200 className="flex h-48 bg-cover relative" 227 ? "bg-lime-500"
201 style={{ backgroundImage: `url(${map.image})` }} 228 : map.difficulty === 3
202 > 229 ? "bg-red-400"
203 <div className="backdrop-blur-sm w-full flex items-center justify-center"> 230 : "bg-red-600"
204 <span className="text-4xl font-[--font-barlow-semicondensed-semibold] text-white mr-1.5"> 231 : "bg-surface1"
205 {map.is_disabled 232 }`}
206 ? map.category_portals[0].portal_count 233 />
207 : map.category_portals.find( 234 ))}
208 obj => obj.category.id === catNum + 1 235 </div>
209 )?.portal_count} 236 </div>
210 </span> 237 </Link>
211 <span className="text-4xl font-[--font-barlow-semicondensed-regular] text-white"> 238 </div>
212 portals 239 );
213 </span> 240 })}
214 </div>
215 </div>
216
217 {/* Difficulty rating */}
218 <div className="flex mx-2.5 my-4">
219 <div className="flex w-full items-center justify-center gap-1.5 rounded-[2000px] ml-0.5 translate-y-px">
220 {[1, 2, 3, 4, 5].map((point) => (
221 <div
222 key={point}
223 className={`flex h-0.5 w-full rounded-3xl ${
224 point <= (map.difficulty + 1)
225 ? map.difficulty === 0
226 ? "bg-green-500"
227 : map.difficulty === 1 || map.difficulty === 2
228 ? "bg-lime-500"
229 : map.difficulty === 3
230 ? "bg-red-400"
231 : "bg-red-600"
232 : "bg-surface1"
233 }`}
234 />
235 ))}
236 </div>
237 </div>
238 </Link>
239 </div>
240 );
241 })}
242 </section>
243 </div>
244 </section> 241 </section>
242 </div>
243 </section>
245 )} 244 )}
246 </main> 245 </main>
247 ); 246 );