diff options
| author | FifthWit <fifthwitbusiness@gmail.com> | 2025-01-30 11:10:23 -0600 |
|---|---|---|
| committer | FifthWit <fifthwitbusiness@gmail.com> | 2025-01-30 11:10:23 -0600 |
| commit | 2497acdbcc523d2d3e3f82d0ba92723e609eb57c (patch) | |
| tree | 8364f62b7c7ad2a102d471377858c1696235dd77 /frontend/src/pages/Maplist.tsx | |
| parent | eslint == warning fix (diff) | |
| download | lphub-2497acdbcc523d2d3e3f82d0ba92723e609eb57c.tar.gz lphub-2497acdbcc523d2d3e3f82d0ba92723e609eb57c.tar.bz2 lphub-2497acdbcc523d2d3e3f82d0ba92723e609eb57c.zip | |
removed a lot of unused vars and missing deps, some are set but not read so I just ignored it since I dont want to deal with it
Diffstat (limited to '')
| -rw-r--r-- | frontend/src/pages/Maplist.tsx | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/frontend/src/pages/Maplist.tsx b/frontend/src/pages/Maplist.tsx index 5138964..372b800 100644 --- a/frontend/src/pages/Maplist.tsx +++ b/frontend/src/pages/Maplist.tsx | |||
| @@ -11,7 +11,6 @@ const Maplist: React.FC = () => { | |||
| 11 | const [game, setGame] = React.useState<Game | null>(null); | 11 | const [game, setGame] = React.useState<Game | null>(null); |
| 12 | const [catNum, setCatNum] = React.useState(0); | 12 | const [catNum, setCatNum] = React.useState(0); |
| 13 | const [id, setId] = React.useState(0); | 13 | const [id, setId] = React.useState(0); |
| 14 | const [category, setCategory] = React.useState(0); | ||
| 15 | const [load, setLoad] = React.useState(false); | 14 | const [load, setLoad] = React.useState(false); |
| 16 | const [currentlySelected, setCurrentlySelected] = React.useState<number>(0); | 15 | const [currentlySelected, setCurrentlySelected] = React.useState<number>(0); |
| 17 | const [hasClicked, setHasClicked] = React.useState(false); | 16 | const [hasClicked, setHasClicked] = React.useState(false); |
| @@ -37,7 +36,7 @@ const Maplist: React.FC = () => { | |||
| 37 | }; | 36 | }; |
| 38 | 37 | ||
| 39 | const _handle_dropdown_click = () => { | 38 | const _handle_dropdown_click = () => { |
| 40 | if (dropdownActive == 'none') { | 39 | if (dropdownActive === 'none') { |
| 41 | setDropdownActive('block'); | 40 | setDropdownActive('block'); |
| 42 | } else { | 41 | } else { |
| 43 | setDropdownActive('none'); | 42 | setDropdownActive('none'); |
| @@ -54,7 +53,7 @@ const Maplist: React.FC = () => { | |||
| 54 | const queryParams = new URLSearchParams(location.search); | 53 | const queryParams = new URLSearchParams(location.search); |
| 55 | if (queryParams.get('chapter')) { | 54 | if (queryParams.get('chapter')) { |
| 56 | let cat = parseFloat(queryParams.get('chapter') || ''); | 55 | let cat = parseFloat(queryParams.get('chapter') || ''); |
| 57 | if (gameId == 2) { | 56 | if (gameId === 2) { |
| 58 | cat += 10; | 57 | cat += 10; |
| 59 | } | 58 | } |
| 60 | _fetch_chapters(cat.toString()); | 59 | _fetch_chapters(cat.toString()); |
| @@ -79,14 +78,14 @@ const Maplist: React.FC = () => { | |||
| 79 | setLoad(true); | 78 | setLoad(true); |
| 80 | _fetch_game(); | 79 | _fetch_game(); |
| 81 | _fetch_game_chapters(); | 80 | _fetch_game_chapters(); |
| 82 | }, []); | 81 | }, [location.search]); |
| 83 | 82 | ||
| 84 | useEffect(() => { | 83 | useEffect(() => { |
| 85 | const queryParams = new URLSearchParams(location.search); | 84 | const queryParams = new URLSearchParams(location.search); |
| 86 | if (gameChapters != undefined && !queryParams.get('chapter')) { | 85 | if (gameChapters !== undefined && !queryParams.get('chapter')) { |
| 87 | _fetch_chapters(gameChapters!.chapters[0].id.toString()); | 86 | _fetch_chapters(gameChapters!.chapters[0].id.toString()); |
| 88 | } | 87 | } |
| 89 | }, [gameChapters]); | 88 | }, [gameChapters, location.search]); |
| 90 | 89 | ||
| 91 | return ( | 90 | return ( |
| 92 | <main> | 91 | <main> |
| @@ -126,8 +125,8 @@ const Maplist: React.FC = () => { | |||
| 126 | <button | 125 | <button |
| 127 | key={index} | 126 | key={index} |
| 128 | className={ | 127 | className={ |
| 129 | currentlySelected == cat.category.id || | 128 | currentlySelected === cat.category.id || |
| 130 | (cat.category.id - 1 == catNum && !hasClicked) | 129 | (cat.category.id - 1 === catNum && !hasClicked) |
| 131 | ? 'game-cat-button selected' | 130 | ? 'game-cat-button selected' |
| 132 | : 'game-cat-button' | 131 | : 'game-cat-button' |
| 133 | } | 132 | } |
| @@ -205,15 +204,15 @@ const Maplist: React.FC = () => { | |||
| 205 | {/* <span>Difficulty:</span> */} | 204 | {/* <span>Difficulty:</span> */} |
| 206 | <div | 205 | <div |
| 207 | className={ | 206 | className={ |
| 208 | map.difficulty == 0 | 207 | map.difficulty === 0 |
| 209 | ? 'one' | 208 | ? 'one' |
| 210 | : map.difficulty == 1 | 209 | : map.difficulty === 1 |
| 211 | ? 'two' | 210 | ? 'two' |
| 212 | : map.difficulty == 2 | 211 | : map.difficulty === 2 |
| 213 | ? 'three' | 212 | ? 'three' |
| 214 | : map.difficulty == 3 | 213 | : map.difficulty === 3 |
| 215 | ? 'four' | 214 | ? 'four' |
| 216 | : map.difficulty == 4 | 215 | : map.difficulty === 4 |
| 217 | ? 'five' | 216 | ? 'five' |
| 218 | : 'one' | 217 | : 'one' |
| 219 | } | 218 | } |