diff options
Diffstat (limited to 'frontend/src/pages/Maplist/Maplist.tsx')
| -rw-r--r-- | frontend/src/pages/Maplist/Maplist.tsx | 21 |
1 files changed, 13 insertions, 8 deletions
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) => { |