diff options
| author | Wolfboy248 <georgejvindkarlsen@gmail.com> | 2025-08-21 10:33:27 +0200 |
|---|---|---|
| committer | Wolfboy248 <georgejvindkarlsen@gmail.com> | 2025-08-21 10:33:27 +0200 |
| commit | da1fd74f9387149b2b94d62853587a8afdb74ddd (patch) | |
| tree | 57f13021890b6d27848a3379d0869790fd1d7c97 /frontend/src/pages/Maplist/Maplist.tsx | |
| parent | organised pages, started work on theme (diff) | |
| download | lphub-da1fd74f9387149b2b94d62853587a8afdb74ddd.tar.gz lphub-da1fd74f9387149b2b94d62853587a8afdb74ddd.tar.bz2 lphub-da1fd74f9387149b2b94d62853587a8afdb74ddd.zip | |
Reorganised Maplist and Sidebar
Diffstat (limited to '')
| -rw-r--r-- | frontend/src/pages/Maplist/Maplist.tsx | 81 |
1 files changed, 20 insertions, 61 deletions
diff --git a/frontend/src/pages/Maplist/Maplist.tsx b/frontend/src/pages/Maplist/Maplist.tsx index 8d9c14a..a5649db 100644 --- a/frontend/src/pages/Maplist/Maplist.tsx +++ b/frontend/src/pages/Maplist/Maplist.tsx | |||
| @@ -6,6 +6,8 @@ import { API } from "@api/Api.ts"; | |||
| 6 | import { Game } from "@customTypes/Game.ts"; | 6 | import { Game } from "@customTypes/Game.ts"; |
| 7 | import { GameChapter, GamesChapters } from "@customTypes/Chapters.ts"; | 7 | import { GameChapter, GamesChapters } from "@customTypes/Chapters.ts"; |
| 8 | 8 | ||
| 9 | import Map from "./Components/Map"; | ||
| 10 | |||
| 9 | const Maplist: React.FC = () => { | 11 | const Maplist: React.FC = () => { |
| 10 | const [game, setGame] = React.useState<Game | null>(null); | 12 | const [game, setGame] = React.useState<Game | null>(null); |
| 11 | const [catNum, setCatNum] = React.useState(0); | 13 | const [catNum, setCatNum] = React.useState(0); |
| @@ -87,14 +89,14 @@ const Maplist: React.FC = () => { | |||
| 87 | }, [gameChapters, location.search]); | 89 | }, [gameChapters, location.search]); |
| 88 | 90 | ||
| 89 | return ( | 91 | return ( |
| 90 | <div> | 92 | <div className="px-12"> |
| 91 | <Helmet> | 93 | <Helmet> |
| 92 | <title>LPHUB | Maplist</title> | 94 | <title>LPHUB | Maplist</title> |
| 93 | </Helmet> | 95 | </Helmet> |
| 94 | 96 | ||
| 95 | <section className="mt-5"> | 97 | <section className="my-5"> |
| 96 | <Link to="/games"> | 98 | <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"> | 99 | <button className="nav-button rounded-[20px] h-10 bg-surface border-0 text-foreground text-lg font-barlow-semicondensed-regular transition-colors duration-100 hover:bg-surface2 flex items-center px-2"> |
| 98 | <i className="triangle mr-2"></i> | 100 | <i className="triangle mr-2"></i> |
| 99 | <span className="px-2">Games List</span> | 101 | <span className="px-2">Games List</span> |
| 100 | </button> | 102 | </button> |
| @@ -105,36 +107,36 @@ const Maplist: React.FC = () => { | |||
| 105 | <div></div> | 107 | <div></div> |
| 106 | ) : ( | 108 | ) : ( |
| 107 | <section> | 109 | <section> |
| 108 | <h1 className="font-[--font-barlow-condensed-bold] text-3xl sm:text-6xl my-0 text-foreground"> | 110 | <h1 className="text-3xl sm:text-6xl my-0"> |
| 109 | {game?.name} | 111 | {game?.name} |
| 110 | </h1> | 112 | </h1> |
| 111 | 113 | ||
| 112 | <div | 114 | <div |
| 113 | className="text-center rounded-3xl overflow-hidden bg-cover bg-[25%] mt-3 relative" | 115 | className="text-center rounded-3xl overflow-hidden bg-panel bg-[25%] mt-3 relative" |
| 114 | style={{ backgroundImage: `url(${game?.image})` }} | 116 | style={{ backgroundImage: `url(${game?.image})` }} |
| 115 | > | 117 | > |
| 116 | <div className="backdrop-blur-sm flex flex-col w-full"> | 118 | <div className="backdrop-blur-sm flex flex-col w-full"> |
| 117 | <div className="h-full flex flex-col justify-center items-center py-6"> | 119 | <div className="h-full flex justify-center items-center py-6"> |
| 118 | <h2 className="my-5 font-[--font-barlow-semicondensed-semibold] text-4xl sm:text-8xl text-foreground"> | 120 | <span className="font-barlow-semicondensed-semibold text-8xl"> |
| 119 | { | 121 | { |
| 120 | game?.category_portals.find( | 122 | game?.category_portals.find( |
| 121 | obj => obj.category.id === catNum + 1 | 123 | obj => obj.category.id === catNum + 1 |
| 122 | )?.portal_count | 124 | )?.portal_count |
| 123 | } | 125 | } |
| 124 | </h2> | 126 | </span> |
| 125 | <h3 className="font-[--font-barlow-semicondensed-regular] mx-2.5 text-2xl sm:text-4xl my-0 text-foreground"> | 127 | <span className="font-barlow-semicondensed-regular mx-2.5 text-2xl sm:text-4xl my-0 text-foreground"> |
| 126 | portals | 128 | portals |
| 127 | </h3> | 129 | </span> |
| 128 | </div> | 130 | </div> |
| 129 | 131 | ||
| 130 | <div className="flex h-12 bg-surface gap-0.5"> | 132 | <div className="flex h-12 bg-panel gap-0.5"> |
| 131 | {game?.category_portals.map((cat, index) => ( | 133 | {game?.category_portals.map((cat, index) => ( |
| 132 | <button | 134 | <button |
| 133 | key={index} | 135 | 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 ${currentlySelected === cat.category.id || | 136 | className={`border-0 text-foreground font-barlow-semicondensed-regular text-sm sm:text-xl cursor-pointer transition-all duration-100 w-full ${currentlySelected === cat.category.id || |
| 135 | (cat.category.id - 1 === catNum && !hasClicked) | 137 | (cat.category.id - 1 === catNum && !hasClicked) |
| 136 | ? "bg-surface" | 138 | ? "bg-panel" |
| 137 | : "bg-surface1 hover:bg-surface" | 139 | : "bg-block hover:bg-block" |
| 138 | }`} | 140 | }`} |
| 139 | onClick={() => { | 141 | onClick={() => { |
| 140 | setCatNum(cat.category.id - 1); | 142 | setCatNum(cat.category.id - 1); |
| @@ -164,16 +166,16 @@ const Maplist: React.FC = () => { | |||
| 164 | </span> | 166 | </span> |
| 165 | <i className="triangle translate-x-1.5 translate-y-2 -rotate-90"></i> | 167 | <i className="triangle translate-x-1.5 translate-y-2 -rotate-90"></i> |
| 166 | </div> | 168 | </div> |
| 167 | \ | 169 | |
| 168 | <div | 170 | <div |
| 169 | className={`absolute z-[1000] bg-surface1 rounded-2xl overflow-hidden p-1 animate-in fade-in duration-100 ${dropdownActive === "none" ? "hidden" : "block" | 171 | className={`absolute z-[1000] bg-panel rounded-2xl overflow-hidden p-1 animate-in fade-in duration-100 ${dropdownActive === "none" ? "hidden" : "block" |
| 170 | }`} | 172 | }`} |
| 171 | > | 173 | > |
| 172 | {gameChapters?.chapters.map((chapter, i) => { | 174 | {gameChapters?.chapters.map((chapter, i) => { |
| 173 | return ( | 175 | return ( |
| 174 | <div | 176 | <div |
| 175 | key={i} | 177 | key={i} |
| 176 | className="cursor-pointer text-base sm:text-xl rounded-[2000px] p-1 hover:bg-surface text-foreground" | 178 | className="cursor-pointer text-base sm:text-xl rounded-[2000px] p-1 hover:bg-block text-foreground" |
| 177 | onClick={() => { | 179 | onClick={() => { |
| 178 | _fetch_chapters(chapter.id.toString()); | 180 | _fetch_chapters(chapter.id.toString()); |
| 179 | _handle_dropdown_click(); | 181 | _handle_dropdown_click(); |
| @@ -189,50 +191,7 @@ const Maplist: React.FC = () => { | |||
| 189 | <section className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-5 my-5"> | 191 | <section className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-5 my-5"> |
| 190 | {curChapter?.maps.map((map, i) => { | 192 | {curChapter?.maps.map((map, i) => { |
| 191 | return ( | 193 | return ( |
| 192 | <div key={i} className="bg-surface rounded-3xl overflow-hidden"> | 194 | <Map key={i} map={map} catNum={catNum} /> |
| 193 | <Link to={`/maps/${map.id}`}> | ||
| 194 | <span className="text-center text-base sm:text-xl w-full block my-1.5 text-foreground truncate"> | ||
| 195 | {map.name} | ||
| 196 | </span> | ||
| 197 | <div | ||
| 198 | className="flex h-40 sm:h-48 bg-cover relative" | ||
| 199 | style={{ backgroundImage: `url(${map.image})` }} | ||
| 200 | > | ||
| 201 | <div className="backdrop-blur-sm w-full flex items-center justify-center"> | ||
| 202 | <span className="text-2xl sm:text-4xl font-[--font-barlow-semicondensed-semibold] text-white mr-1.5"> | ||
| 203 | {map.is_disabled | ||
| 204 | ? map.category_portals[0].portal_count | ||
| 205 | : map.category_portals.find( | ||
| 206 | obj => obj.category.id === catNum + 1 | ||
| 207 | )?.portal_count} | ||
| 208 | </span> | ||
| 209 | <span className="text-2xl sm:text-4xl font-[--font-barlow-semicondensed-regular] text-white"> | ||
| 210 | portals | ||
| 211 | </span> | ||
| 212 | </div> | ||
| 213 | </div> | ||
| 214 | |||
| 215 | <div className="flex mx-2.5 my-4"> | ||
| 216 | <div className="flex w-full items-center justify-center gap-1.5 rounded-[2000px] ml-0.5 translate-y-px"> | ||
| 217 | {[1, 2, 3, 4, 5].map((point) => ( | ||
| 218 | <div | ||
| 219 | key={point} | ||
| 220 | className={`flex h-0.5 w-full rounded-3xl ${point <= (map.difficulty + 1) | ||
| 221 | ? map.difficulty === 0 | ||
| 222 | ? "bg-green-500" | ||
| 223 | : map.difficulty === 1 || map.difficulty === 2 | ||
| 224 | ? "bg-lime-500" | ||
| 225 | : map.difficulty === 3 | ||
| 226 | ? "bg-red-400" | ||
| 227 | : "bg-red-600" | ||
| 228 | : "bg-surface1" | ||
| 229 | }`} | ||
| 230 | /> | ||
| 231 | ))} | ||
| 232 | </div> | ||
| 233 | </div> | ||
| 234 | </Link> | ||
| 235 | </div> | ||
| 236 | ); | 195 | ); |
| 237 | })} | 196 | })} |
| 238 | </section> | 197 | </section> |