diff options
Diffstat (limited to 'frontend/src/pages/Maplist.tsx')
| -rw-r--r-- | frontend/src/pages/Maplist.tsx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/frontend/src/pages/Maplist.tsx b/frontend/src/pages/Maplist.tsx index 76f9a52..b9e17f7 100644 --- a/frontend/src/pages/Maplist.tsx +++ b/frontend/src/pages/Maplist.tsx | |||
| @@ -88,7 +88,13 @@ const Maplist: React.FC = () => { | |||
| 88 | } | 88 | } |
| 89 | }, [gameChapters]) | 89 | }, [gameChapters]) |
| 90 | 90 | ||
| 91 | 91 | useEffect(() => { | |
| 92 | const queryParams = new URLSearchParams(location.search); | ||
| 93 | const cat = queryParams.get("cat"); | ||
| 94 | if (cat != null) { | ||
| 95 | setCatNum(parseFloat(cat) - 1); | ||
| 96 | } | ||
| 97 | }, [location]) | ||
| 92 | 98 | ||
| 93 | return ( | 99 | return ( |
| 94 | <main> | 100 | <main> |
| @@ -121,7 +127,9 @@ const Maplist: React.FC = () => { | |||
| 121 | )?.portal_count | 127 | )?.portal_count |
| 122 | } | 128 | } |
| 123 | </h2> | 129 | </h2> |
| 124 | <h3>portals</h3> | 130 | <h3>{game?.category_portals.find( |
| 131 | (obj) => obj.category.id === catNum + 1)!.portal_count == 1 ? "portal" : "portals" | ||
| 132 | }</h3> | ||
| 125 | </div> | 133 | </div> |
| 126 | <div className="game-header-categories"> | 134 | <div className="game-header-categories"> |
| 127 | {game?.category_portals.map((cat, index) => ( | 135 | {game?.category_portals.map((cat, index) => ( |
| @@ -160,7 +168,7 @@ const Maplist: React.FC = () => { | |||
| 160 | <span>{map.is_disabled ? map.category_portals[0].portal_count : map.category_portals.find( | 168 | <span>{map.is_disabled ? map.category_portals[0].portal_count : map.category_portals.find( |
| 161 | (obj) => obj.category.id === catNum + 1 | 169 | (obj) => obj.category.id === catNum + 1 |
| 162 | )?.portal_count}</span> | 170 | )?.portal_count}</span> |
| 163 | <span>portals</span> | 171 | <span>{map.category_portals.find((obj) => obj.category.id === catNum + 1)?.portal_count == 1 ? "portal" : "portals"}</span> |
| 164 | </div> | 172 | </div> |
| 165 | </div> | 173 | </div> |
| 166 | <div className="difficulty-bar"> | 174 | <div className="difficulty-bar"> |