aboutsummaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
authorWolfboy248 <121288977+Wolfboy248@users.noreply.github.com>2024-07-11 21:23:32 +0200
committerGitHub <noreply@github.com>2024-07-11 22:23:32 +0300
commit740c6314fba30600b940bb5316b4e7ac2a222323 (patch)
tree606f680162932f2624b5ab55c10ad4a7f29d4a7d /frontend
parentdocs: add missing nosla/sla history (#185) (diff)
downloadlphub-740c6314fba30600b940bb5316b4e7ac2a222323.tar.gz
lphub-740c6314fba30600b940bb5316b4e7ac2a222323.tar.bz2
lphub-740c6314fba30600b940bb5316b4e7ac2a222323.zip
feat: improve maplist url (#183)
Diffstat (limited to 'frontend')
-rw-r--r--frontend/src/App.js2
-rw-r--r--frontend/src/components/pages/game.js2
-rw-r--r--frontend/src/components/pages/maplist.css2
-rw-r--r--frontend/src/components/pages/maplist.js2
-rw-r--r--frontend/src/components/pages/summary.js3
5 files changed, 6 insertions, 5 deletions
diff --git a/frontend/src/App.js b/frontend/src/App.js
index b7bfeb3..5b68ae5 100644
--- a/frontend/src/App.js
+++ b/frontend/src/App.js
@@ -40,7 +40,7 @@ export default function App() {
40 <Route path="/about" element={<About/>}></Route> 40 <Route path="/about" element={<About/>}></Route>
41 <Route path="/maps/*" element={<Summary token={token} mod={mod}/>}></Route> 41 <Route path="/maps/*" element={<Summary token={token} mod={mod}/>}></Route>
42 <Route path="/games" element={<Games/>}></Route> 42 <Route path="/games" element={<Games/>}></Route>
43 <Route path="/games/game" element={<Maplist token={token} mod={mod} />}></Route> 43 <Route path="/games/*" element={<Maplist token={token} mod={mod} />}></Route>
44 <Route path="*" element={<Main text="404 Page not found"/>}></Route> 44 <Route path="*" element={<Main text="404 Page not found"/>}></Route>
45 </Routes> 45 </Routes>
46 </BrowserRouter> 46 </BrowserRouter>
diff --git a/frontend/src/components/pages/game.js b/frontend/src/components/pages/game.js
index 017760b..301e035 100644
--- a/frontend/src/components/pages/game.js
+++ b/frontend/src/components/pages/game.js
@@ -34,7 +34,7 @@ export default function GameEntry({ gameInfo }) {
34 }) 34 })
35 35
36 return ( 36 return (
37 <Link to={"/games/game?game=" + gameInfo.id}><div className='games-page-item'> 37 <Link to={"/games/" + gameInfo.id}><div className='games-page-item'>
38 <div className='games-page-item-header'> 38 <div className='games-page-item-header'>
39 <div style={{backgroundImage: `url(${gameInfo.image})`}} className='games-page-item-header-img'></div> 39 <div style={{backgroundImage: `url(${gameInfo.image})`}} className='games-page-item-header-img'></div>
40 <span><b>{gameInfo.name}</b></span> 40 <span><b>{gameInfo.name}</b></span>
diff --git a/frontend/src/components/pages/maplist.css b/frontend/src/components/pages/maplist.css
index a63c4ec..2f279c3 100644
--- a/frontend/src/components/pages/maplist.css
+++ b/frontend/src/components/pages/maplist.css
@@ -22,7 +22,7 @@ a {
22} 22}
23 23
24.maplist-page-header { 24.maplist-page-header {
25 margin-top: 20px; 25 margin-top: 33px;
26 display: grid; 26 display: grid;
27 margin-bottom: 10px; 27 margin-bottom: 10px;
28} 28}
diff --git a/frontend/src/components/pages/maplist.js b/frontend/src/components/pages/maplist.js
index f4041a2..a7464e9 100644
--- a/frontend/src/components/pages/maplist.js
+++ b/frontend/src/components/pages/maplist.js
@@ -31,7 +31,7 @@ export default function Maplist(prop) {
31 const url = new URL(window.location.href) 31 const url = new URL(window.location.href)
32 32
33 const params = new URLSearchParams(url.search) 33 const params = new URLSearchParams(url.search)
34 gameState = parseFloat(params.get("game")) 34 gameState = parseFloat(location.pathname.split("/")[2])
35 35
36 document.querySelector("#catPortalCount").innerText = data.data[gameState - 1].category_portals[0].portal_count; 36 document.querySelector("#catPortalCount").innerText = data.data[gameState - 1].category_portals[0].portal_count;
37 37
diff --git a/frontend/src/components/pages/summary.js b/frontend/src/components/pages/summary.js
index 9957c5d..d276408 100644
--- a/frontend/src/components/pages/summary.js
+++ b/frontend/src/components/pages/summary.js
@@ -318,6 +318,7 @@ if(window.confirm(`Are you sure you want to remove post: ${post.title}?`)){
318 318
319 319
320if(data!==null){ 320if(data!==null){
321 console.log(data)
321 322
322let current_chapter = data.map.chapter_name 323let current_chapter = data.map.chapter_name
323let isCoop = false; 324let isCoop = false;
@@ -340,7 +341,7 @@ return (
340 <section id='section1' className='summary1'> 341 <section id='section1' className='summary1'>
341 <div> 342 <div>
342 <Link to="/games"><button className='nav-button' style={{borderRadius: "20px 0px 0px 20px"}}><i className='triangle'></i><span>Games list</span></button></Link> 343 <Link to="/games"><button className='nav-button' style={{borderRadius: "20px 0px 0px 20px"}}><i className='triangle'></i><span>Games list</span></button></Link>
343 <Link to={`/games/${data.map.game_name == "Portal 2 - Singleplayer" ? "game?game=1" : data.map.game_name == "Portal 2 - Cooperative" ? "game?game=2" : "psm"}&chapter=${current_chapter}`}><button className='nav-button' style={{borderRadius: "0px 20px 20px 0px", marginLeft: "2px"}}><i className='triangle'></i><span>{data.map.chapter_name}</span></button></Link> 344 <Link to={`/games/${!data.map.is_coop ? "1" : "2"}?chapter=${current_chapter}`}><button className='nav-button' style={{borderRadius: "0px 20px 20px 0px", marginLeft: "2px"}}><i className='triangle'></i><span>{data.map.chapter_name}</span></button></Link>
344 <br/><span><b>{data.map.map_name}</b></span> 345 <br/><span><b>{data.map.map_name}</b></span>
345 </div> 346 </div>
346 347