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.tsx14
1 files changed, 7 insertions, 7 deletions
diff --git a/frontend/src/pages/Maplist.tsx b/frontend/src/pages/Maplist.tsx
index bda24cd..dc655ca 100644
--- a/frontend/src/pages/Maplist.tsx
+++ b/frontend/src/pages/Maplist.tsx
@@ -34,7 +34,7 @@ const Maplist: React.FC = () => {
34 const _fetch_chapters = async (chapter_id: string) => { 34 const _fetch_chapters = async (chapter_id: string) => {
35 const chapters = await API.get_chapters(chapter_id); 35 const chapters = await API.get_chapters(chapter_id);
36 setCurChapter(chapters); 36 setCurChapter(chapters);
37 } 37 };
38 38
39 const _handle_dropdown_click = () => { 39 const _handle_dropdown_click = () => {
40 if (dropdownActive == "none") { 40 if (dropdownActive == "none") {
@@ -42,7 +42,7 @@ const Maplist: React.FC = () => {
42 } else { 42 } else {
43 setDropdownActive("none"); 43 setDropdownActive("none");
44 } 44 }
45 } 45 };
46 46
47 // im sorry but im too lazy to fix this right now 47 // im sorry but im too lazy to fix this right now
48 useEffect(() => { 48 useEffect(() => {
@@ -73,7 +73,7 @@ const Maplist: React.FC = () => {
73 const games_chapters = await API.get_games_chapters(gameId.toString()); 73 const games_chapters = await API.get_games_chapters(gameId.toString());
74 setGameChapters(games_chapters); 74 setGameChapters(games_chapters);
75 setNumChapters(games_chapters.chapters.length); 75 setNumChapters(games_chapters.chapters.length);
76 } 76 };
77 77
78 setLoad(true); 78 setLoad(true);
79 _fetch_game(); 79 _fetch_game();
@@ -85,7 +85,7 @@ const Maplist: React.FC = () => {
85 if (gameChapters != undefined && !queryParams.get("chapter")) { 85 if (gameChapters != undefined && !queryParams.get("chapter")) {
86 _fetch_chapters(gameChapters!.chapters[0].id.toString()); 86 _fetch_chapters(gameChapters!.chapters[0].id.toString());
87 } 87 }
88 }, [gameChapters]) 88 }, [gameChapters]);
89 89
90 90
91 91
@@ -124,7 +124,7 @@ const Maplist: React.FC = () => {
124 </div> 124 </div>
125 <div className="game-header-categories"> 125 <div className="game-header-categories">
126 {game?.category_portals.map((cat, index) => ( 126 {game?.category_portals.map((cat, index) => (
127 <button key={index} className={currentlySelected == cat.category.id || cat.category.id - 1 == catNum && !hasClicked ? "game-cat-button selected" : "game-cat-button"} onClick={() => { setCatNum(cat.category.id - 1); _update_currently_selected(cat.category.id) }}> 127 <button key={index} className={currentlySelected == cat.category.id || cat.category.id - 1 == catNum && !hasClicked ? "game-cat-button selected" : "game-cat-button"} onClick={() => { setCatNum(cat.category.id - 1); _update_currently_selected(cat.category.id); }}>
128 <span>{cat.category.name}</span> 128 <span>{cat.category.name}</span>
129 </button> 129 </button>
130 ))} 130 ))}
@@ -143,7 +143,7 @@ const Maplist: React.FC = () => {
143 </div> 143 </div>
144 <div className="dropdown-elements" style={{ display: dropdownActive }}> 144 <div className="dropdown-elements" style={{ display: dropdownActive }}>
145 {gameChapters?.chapters.map((chapter, i) => { 145 {gameChapters?.chapters.map((chapter, i) => {
146 return <div className="dropdown-element" onClick={() => { _fetch_chapters(chapter.id.toString()); _handle_dropdown_click() }}>{chapter.name}</div> 146 return <div className="dropdown-element" onClick={() => { _fetch_chapters(chapter.id.toString()); _handle_dropdown_click(); }}>{chapter.name}</div>;
147 }) 147 })
148 148
149 } 149 }
@@ -173,7 +173,7 @@ const Maplist: React.FC = () => {
173 </div> 173 </div>
174 </div> 174 </div>
175 </Link> 175 </Link>
176 </div> 176 </div>;
177 })} 177 })}
178 </section> 178 </section>
179 </div> 179 </div>