diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2025-07-24 14:40:22 +0300 |
|---|---|---|
| committer | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2025-07-24 14:40:22 +0300 |
| commit | b0d199936b546c75d4b19d99591237f0bf97fe55 (patch) | |
| tree | e9391880e7db2bd1ea8ff25d91aeea8dd98f186e /frontend/src/pages | |
| parent | fix/frontend: fixed sidebar title size, removed unnecessary imports (diff) | |
| parent | feat/backend: add newrelic integration (#274) (diff) | |
| download | lphub-css-overhaul.tar.gz lphub-css-overhaul.tar.bz2 lphub-css-overhaul.zip | |
Merge branch 'main' into css-overhaulcss-overhaul
Diffstat (limited to '')
| -rw-r--r-- | frontend/src/pages/About.tsx | 4 | ||||
| -rw-r--r-- | frontend/src/pages/Games.tsx | 4 | ||||
| -rw-r--r-- | frontend/src/pages/Homepage.tsx | 6 | ||||
| -rw-r--r-- | frontend/src/pages/Maplist.tsx | 50 | ||||
| -rw-r--r-- | frontend/src/pages/Maps.tsx | 41 | ||||
| -rw-r--r-- | frontend/src/pages/Profile.tsx | 9 | ||||
| -rw-r--r-- | frontend/src/pages/Rankings.tsx | 30 | ||||
| -rw-r--r-- | frontend/src/pages/Rules.tsx | 4 | ||||
| -rw-r--r-- | frontend/src/pages/User.tsx | 9 |
9 files changed, 99 insertions, 58 deletions
diff --git a/frontend/src/pages/About.tsx b/frontend/src/pages/About.tsx index fe2e25a..b7bd534 100644 --- a/frontend/src/pages/About.tsx +++ b/frontend/src/pages/About.tsx | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | import React from 'react'; | 1 | import React from 'react'; |
| 2 | import ReactMarkdown from 'react-markdown'; | 2 | import ReactMarkdown from 'react-markdown'; |
| 3 | import { Helmet } from 'react-helmet'; | ||
| 3 | 4 | ||
| 4 | import '@css/About.css'; | 5 | import '@css/About.css'; |
| 5 | 6 | ||
| @@ -28,6 +29,9 @@ const About: React.FC = () => { | |||
| 28 | 29 | ||
| 29 | return ( | 30 | return ( |
| 30 | <main> | 31 | <main> |
| 32 | <Helmet> | ||
| 33 | <title>LPHUB | About</title> | ||
| 34 | </Helmet> | ||
| 31 | <ReactMarkdown>{aboutText}</ReactMarkdown> | 35 | <ReactMarkdown>{aboutText}</ReactMarkdown> |
| 32 | </main> | 36 | </main> |
| 33 | ); | 37 | ); |
diff --git a/frontend/src/pages/Games.tsx b/frontend/src/pages/Games.tsx index e0320af..5e0d5bf 100644 --- a/frontend/src/pages/Games.tsx +++ b/frontend/src/pages/Games.tsx | |||
| @@ -1,4 +1,5 @@ | |||
| 1 | import React from 'react'; | 1 | import React from 'react'; |
| 2 | import { Helmet } from 'react-helmet'; | ||
| 2 | 3 | ||
| 3 | import GameEntry from '@components/GameEntry'; | 4 | import GameEntry from '@components/GameEntry'; |
| 4 | import { Game } from '@customTypes/Game'; | 5 | import { Game } from '@customTypes/Game'; |
| @@ -11,6 +12,9 @@ interface GamesProps { | |||
| 11 | const Games: React.FC<GamesProps> = ({ games }) => { | 12 | const Games: React.FC<GamesProps> = ({ games }) => { |
| 12 | return ( | 13 | return ( |
| 13 | <main> | 14 | <main> |
| 15 | <Helmet> | ||
| 16 | <title>LPHUB | Games</title> | ||
| 17 | </Helmet> | ||
| 14 | <section> | 18 | <section> |
| 15 | <div className={gamesCSS.content}> | 19 | <div className={gamesCSS.content}> |
| 16 | {games.map((game, index) => ( | 20 | {games.map((game, index) => ( |
diff --git a/frontend/src/pages/Homepage.tsx b/frontend/src/pages/Homepage.tsx index 68562b6..4f46af5 100644 --- a/frontend/src/pages/Homepage.tsx +++ b/frontend/src/pages/Homepage.tsx | |||
| @@ -1,11 +1,15 @@ | |||
| 1 | import React from 'react'; | 1 | import React from 'react'; |
| 2 | import { Helmet } from 'react-helmet'; | ||
| 2 | 3 | ||
| 3 | const Homepage: React.FC = () => { | 4 | const Homepage: React.FC = () => { |
| 4 | 5 | ||
| 5 | return ( | 6 | return ( |
| 6 | <main> | 7 | <main> |
| 8 | <Helmet> | ||
| 9 | <title>LPHUB | Homepage</title> | ||
| 10 | </Helmet> | ||
| 7 | <section> | 11 | <section> |
| 8 | <p/> | 12 | <p /> |
| 9 | <h1>Welcome to Least Portals Hub!</h1> | 13 | <h1>Welcome to Least Portals Hub!</h1> |
| 10 | <p>At the moment, LPHUB is in beta state. This means that the site has only the core functionalities enabled for providing both collaborative information and competitive leaderboards.</p> | 14 | <p>At the moment, LPHUB is in beta state. This means that the site has only the core functionalities enabled for providing both collaborative information and competitive leaderboards.</p> |
| 11 | <p>The website should feel intuitive to navigate around. For any type of feedback, reach us at LPHUB Discord server.</p> | 15 | <p>The website should feel intuitive to navigate around. For any type of feedback, reach us at LPHUB Discord server.</p> |
diff --git a/frontend/src/pages/Maplist.tsx b/frontend/src/pages/Maplist.tsx index ecea3e1..b9e17f7 100644 --- a/frontend/src/pages/Maplist.tsx +++ b/frontend/src/pages/Maplist.tsx | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | import React, { useEffect } from "react"; | 1 | import React, { useEffect } from "react"; |
| 2 | import { Link, useLocation, useNavigate, useParams } from "react-router-dom"; | 2 | import { Link, useLocation, useNavigate, useParams } from "react-router-dom"; |
| 3 | import { Helmet } from "react-helmet"; | ||
| 3 | 4 | ||
| 4 | import "@css/Maplist.css"; | 5 | import "@css/Maplist.css"; |
| 5 | import { API } from "@api/Api"; | 6 | import { API } from "@api/Api"; |
| @@ -25,9 +26,9 @@ const Maplist: React.FC = () => { | |||
| 25 | const navigate = useNavigate(); | 26 | const navigate = useNavigate(); |
| 26 | 27 | ||
| 27 | function _update_currently_selected(catNum2: number) { | 28 | function _update_currently_selected(catNum2: number) { |
| 28 | setCurrentlySelected(catNum2); | 29 | setCurrentlySelected(catNum2); |
| 29 | navigate("/games/" + game?.id + "?cat=" + catNum2); | 30 | navigate("/games/" + game?.id + "?cat=" + catNum2); |
| 30 | setHasClicked(true); | 31 | setHasClicked(true); |
| 31 | } | 32 | } |
| 32 | 33 | ||
| 33 | const _fetch_chapters = async (chapter_id: string) => { | 34 | const _fetch_chapters = async (chapter_id: string) => { |
| @@ -52,12 +53,12 @@ const Maplist: React.FC = () => { | |||
| 52 | // location query params | 53 | // location query params |
| 53 | const queryParams = new URLSearchParams(location.search); | 54 | const queryParams = new URLSearchParams(location.search); |
| 54 | if (queryParams.get("chapter")) { | 55 | if (queryParams.get("chapter")) { |
| 55 | let cat = parseFloat(queryParams.get("chapter") || ""); | 56 | let cat = parseFloat(queryParams.get("chapter") || ""); |
| 56 | if (gameId == 2) { | 57 | if (gameId == 2) { |
| 57 | cat += 10; | 58 | cat += 10; |
| 58 | } | 59 | } |
| 59 | _fetch_chapters(cat.toString()); | 60 | _fetch_chapters(cat.toString()); |
| 60 | } | 61 | } |
| 61 | 62 | ||
| 62 | const _fetch_game = async () => { | 63 | const _fetch_game = async () => { |
| 63 | const games = await API.get_games(); | 64 | const games = await API.get_games(); |
| @@ -68,7 +69,7 @@ const Maplist: React.FC = () => { | |||
| 68 | setLoad(false); | 69 | setLoad(false); |
| 69 | } | 70 | } |
| 70 | }; | 71 | }; |
| 71 | 72 | ||
| 72 | const _fetch_game_chapters = async () => { | 73 | const _fetch_game_chapters = async () => { |
| 73 | const games_chapters = await API.get_games_chapters(gameId.toString()); | 74 | const games_chapters = await API.get_games_chapters(gameId.toString()); |
| 74 | setGameChapters(games_chapters); | 75 | setGameChapters(games_chapters); |
| @@ -81,7 +82,7 @@ const Maplist: React.FC = () => { | |||
| 81 | }, []); | 82 | }, []); |
| 82 | 83 | ||
| 83 | useEffect(() => { | 84 | useEffect(() => { |
| 84 | const queryParams = new URLSearchParams(location.search); | 85 | const queryParams = new URLSearchParams(location.search); |
| 85 | if (gameChapters != undefined && !queryParams.get("chapter")) { | 86 | if (gameChapters != undefined && !queryParams.get("chapter")) { |
| 86 | _fetch_chapters(gameChapters!.chapters[0].id.toString()); | 87 | _fetch_chapters(gameChapters!.chapters[0].id.toString()); |
| 87 | } | 88 | } |
| @@ -97,6 +98,9 @@ const Maplist: React.FC = () => { | |||
| 97 | 98 | ||
| 98 | return ( | 99 | return ( |
| 99 | <main> | 100 | <main> |
| 101 | <Helmet> | ||
| 102 | <title>LPHUB | Maplist</title> | ||
| 103 | </Helmet> | ||
| 100 | <section style={{ marginTop: "20px" }}> | 104 | <section style={{ marginTop: "20px" }}> |
| 101 | <Link to="/games"> | 105 | <Link to="/games"> |
| 102 | <button className="nav-button" style={{ borderRadius: "20px" }}> | 106 | <button className="nav-button" style={{ borderRadius: "20px" }}> |
| @@ -129,7 +133,7 @@ const Maplist: React.FC = () => { | |||
| 129 | </div> | 133 | </div> |
| 130 | <div className="game-header-categories"> | 134 | <div className="game-header-categories"> |
| 131 | {game?.category_portals.map((cat, index) => ( | 135 | {game?.category_portals.map((cat, index) => ( |
| 132 | <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)}}> | 136 | <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) }}> |
| 133 | <span>{cat.category.name}</span> | 137 | <span>{cat.category.name}</span> |
| 134 | </button> | 138 | </button> |
| 135 | ))} | 139 | ))} |
| @@ -140,26 +144,26 @@ const Maplist: React.FC = () => { | |||
| 140 | <div> | 144 | <div> |
| 141 | <section className="chapter-select-container"> | 145 | <section className="chapter-select-container"> |
| 142 | <div> | 146 | <div> |
| 143 | <span style={{fontSize: "18px", transform: "translateY(5px)", display: "block", marginTop: "10px"}}>{curChapter?.chapter.name.split(" - ")[0]}</span> | 147 | <span style={{ fontSize: "18px", transform: "translateY(5px)", display: "block", marginTop: "10px" }}>{curChapter?.chapter.name.split(" - ")[0]}</span> |
| 144 | </div> | 148 | </div> |
| 145 | <div onClick={_handle_dropdown_click} className="dropdown"> | 149 | <div onClick={_handle_dropdown_click} className="dropdown"> |
| 146 | <span>{curChapter?.chapter.name.split(" - ")[1]}</span> | 150 | <span>{curChapter?.chapter.name.split(" - ")[1]}</span> |
| 147 | <i className="triangle"></i> | 151 | <i className="triangle"></i> |
| 148 | </div> | 152 | </div> |
| 149 | <div className="dropdown-elements" style={{display: dropdownActive}}> | 153 | <div className="dropdown-elements" style={{ display: dropdownActive }}> |
| 150 | {gameChapters?.chapters.map((chapter, i) => { | 154 | {gameChapters?.chapters.map((chapter, i) => { |
| 151 | return <div className="dropdown-element" onClick={() => {_fetch_chapters(chapter.id.toString()); _handle_dropdown_click()}}>{chapter.name}</div> | 155 | return <div className="dropdown-element" onClick={() => { _fetch_chapters(chapter.id.toString()); _handle_dropdown_click() }}>{chapter.name}</div> |
| 152 | }) | 156 | }) |
| 153 | 157 | ||
| 154 | } | 158 | } |
| 155 | </div> | 159 | </div> |
| 156 | </section> | 160 | </section> |
| 157 | <section className="maplist"> | 161 | <section className="maplist"> |
| 158 | {curChapter?.maps.map((map, i) => { | 162 | {curChapter?.maps.map((map, i) => { |
| 159 | return <div className="maplist-entry"> | 163 | return <div className="maplist-entry"> |
| 160 | <Link to={`/maps/${map.id}`}> | 164 | <Link to={`/maps/${map.id}`}> |
| 161 | <span>{map.name}</span> | 165 | <span>{map.name}</span> |
| 162 | <div className="map-entry-image" style={{backgroundImage: `url(${map.image})`}}> | 166 | <div className="map-entry-image" style={{ backgroundImage: `url(${map.image})` }}> |
| 163 | <div className="blur map"> | 167 | <div className="blur map"> |
| 164 | <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( |
| 165 | (obj) => obj.category.id === catNum + 1 | 169 | (obj) => obj.category.id === catNum + 1 |
| @@ -169,7 +173,7 @@ const Maplist: React.FC = () => { | |||
| 169 | </div> | 173 | </div> |
| 170 | <div className="difficulty-bar"> | 174 | <div className="difficulty-bar"> |
| 171 | {/* <span>Difficulty:</span> */} | 175 | {/* <span>Difficulty:</span> */} |
| 172 | <div className={map.difficulty == 0 ? "one" : map.difficulty == 1 ? "two" : map.difficulty == 2 ? "three" : map.difficulty == 3 ? "four" : map.difficulty == 4 ? "five" : "one"}> | 176 | <div className={map.difficulty <= 2 ? "one" : map.difficulty <= 4 ? "two" : map.difficulty <= 6 ? "three" : map.difficulty <= 8 ? "four" : map.difficulty <= 10 ? "five" : "one"}> |
| 173 | <div className="difficulty-point"></div> | 177 | <div className="difficulty-point"></div> |
| 174 | <div className="difficulty-point"></div> | 178 | <div className="difficulty-point"></div> |
| 175 | <div className="difficulty-point"></div> | 179 | <div className="difficulty-point"></div> |
| @@ -177,9 +181,9 @@ const Maplist: React.FC = () => { | |||
| 177 | <div className="difficulty-point"></div> | 181 | <div className="difficulty-point"></div> |
| 178 | </div> | 182 | </div> |
| 179 | </div> | 183 | </div> |
| 180 | </Link> | 184 | </Link> |
| 181 | </div> | 185 | </div> |
| 182 | })} | 186 | })} |
| 183 | </section> | 187 | </section> |
| 184 | </div> | 188 | </div> |
| 185 | </section> | 189 | </section> |
diff --git a/frontend/src/pages/Maps.tsx b/frontend/src/pages/Maps.tsx index f1daa36..fb13563 100644 --- a/frontend/src/pages/Maps.tsx +++ b/frontend/src/pages/Maps.tsx | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | import React from 'react'; | 1 | import React from 'react'; |
| 2 | import { Link, useLocation } from 'react-router-dom'; | 2 | import { Link, useLocation } from 'react-router-dom'; |
| 3 | import { Helmet } from 'react-helmet'; | ||
| 3 | 4 | ||
| 4 | import { PortalIcon, FlagIcon, ChatIcon } from '@images/Images'; | 5 | import { PortalIcon, FlagIcon, ChatIcon } from '@images/Images'; |
| 5 | import Summary from '@components/Summary'; | 6 | import Summary from '@components/Summary'; |
| @@ -35,7 +36,7 @@ const Maps: React.FC<MapProps> = ({ token, isModerator }) => { | |||
| 35 | }; | 36 | }; |
| 36 | 37 | ||
| 37 | const _fetch_map_leaderboards = async () => { | 38 | const _fetch_map_leaderboards = async () => { |
| 38 | const mapLeaderboards = await API.get_map_leaderboard(mapID); | 39 | const mapLeaderboards = await API.get_map_leaderboard(mapID, "1"); |
| 39 | setMapLeaderboardData(mapLeaderboards); | 40 | setMapLeaderboardData(mapLeaderboards); |
| 40 | }; | 41 | }; |
| 41 | 42 | ||
| @@ -53,26 +54,32 @@ const Maps: React.FC<MapProps> = ({ token, isModerator }) => { | |||
| 53 | if (!mapSummaryData) { | 54 | if (!mapSummaryData) { |
| 54 | // loading placeholder | 55 | // loading placeholder |
| 55 | return ( | 56 | return ( |
| 56 | <main> | 57 | <> |
| 57 | <section id='section1' className='summary1'> | 58 | <main> |
| 58 | <div> | 59 | <section id='section1' className='summary1'> |
| 59 | <Link to="/games"><button className='nav-button' style={{ borderRadius: "20px 20px 20px 20px" }}><i className='triangle'></i><span>Games List</span></button></Link> | 60 | <div> |
| 60 | </div> | 61 | <Link to="/games"><button className='nav-button' style={{ borderRadius: "20px 20px 20px 20px" }}><i className='triangle'></i><span>Games List</span></button></Link> |
| 61 | </section> | 62 | </div> |
| 62 | 63 | </section> | |
| 63 | <section id='section2' className='summary1'> | 64 | |
| 64 | <button className='nav-button'><img src={PortalIcon} alt="" /><span>Summary</span></button> | 65 | <section id='section2' className='summary1'> |
| 65 | <button className='nav-button'><img src={FlagIcon} alt="" /><span>Leaderboards</span></button> | 66 | <button className='nav-button'><img src={PortalIcon} alt="" /><span>Summary</span></button> |
| 66 | <button className='nav-button'><img src={ChatIcon} alt="" /><span>Discussions</span></button> | 67 | <button className='nav-button'><img src={FlagIcon} alt="" /><span>Leaderboards</span></button> |
| 67 | </section> | 68 | <button className='nav-button'><img src={ChatIcon} alt="" /><span>Discussions</span></button> |
| 68 | 69 | </section> | |
| 69 | <section id='section6' className='summary2' /> | 70 | |
| 70 | </main> | 71 | <section id='section6' className='summary2' /> |
| 72 | </main> | ||
| 73 | </> | ||
| 71 | ); | 74 | ); |
| 72 | } | 75 | } |
| 73 | 76 | ||
| 74 | return ( | 77 | return ( |
| 75 | <> | 78 | <> |
| 79 | <Helmet> | ||
| 80 | <title>LPHUB | {mapSummaryData.map.map_name}</title> | ||
| 81 | <meta name="description" content={mapSummaryData.map.map_name} /> | ||
| 82 | </Helmet> | ||
| 76 | {isModerator && <ModMenu token={token} data={mapSummaryData} selectedRun={selectedRun} mapID={mapID} />} | 83 | {isModerator && <ModMenu token={token} data={mapSummaryData} selectedRun={selectedRun} mapID={mapID} />} |
| 77 | 84 | ||
| 78 | <div id='background-image'> | 85 | <div id='background-image'> |
| @@ -94,7 +101,7 @@ const Maps: React.FC<MapProps> = ({ token, isModerator }) => { | |||
| 94 | </section> | 101 | </section> |
| 95 | 102 | ||
| 96 | {navState === 0 && <Summary selectedRun={selectedRun} setSelectedRun={setSelectedRun} data={mapSummaryData} />} | 103 | {navState === 0 && <Summary selectedRun={selectedRun} setSelectedRun={setSelectedRun} data={mapSummaryData} />} |
| 97 | {navState === 1 && <Leaderboards data={mapLeaderboardData} />} | 104 | {navState === 1 && <Leaderboards mapID={mapID} />} |
| 98 | {navState === 2 && <Discussions data={mapDiscussionsData} token={token} isModerator={isModerator} mapID={mapID} onRefresh={() => _fetch_map_discussions()} />} | 105 | {navState === 2 && <Discussions data={mapDiscussionsData} token={token} isModerator={isModerator} mapID={mapID} onRefresh={() => _fetch_map_discussions()} />} |
| 99 | </main> | 106 | </main> |
| 100 | </> | 107 | </> |
diff --git a/frontend/src/pages/Profile.tsx b/frontend/src/pages/Profile.tsx index 00d8f4e..ee56999 100644 --- a/frontend/src/pages/Profile.tsx +++ b/frontend/src/pages/Profile.tsx | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | import React from 'react'; | 1 | import React from 'react'; |
| 2 | import { Link, useNavigate } from 'react-router-dom'; | 2 | import { Link, useNavigate } from 'react-router-dom'; |
| 3 | import { Helmet } from 'react-helmet'; | ||
| 3 | 4 | ||
| 4 | import { SteamIcon, TwitchIcon, YouTubeIcon, PortalIcon, FlagIcon, StatisticsIcon, SortIcon, ThreedotIcon, DownloadIcon, HistoryIcon, DeleteIcon } from '@images/Images'; | 5 | import { SteamIcon, TwitchIcon, YouTubeIcon, PortalIcon, FlagIcon, StatisticsIcon, SortIcon, ThreedotIcon, DownloadIcon, HistoryIcon, DeleteIcon } from '@images/Images'; |
| 5 | import { UserProfile } from '@customTypes/Profile'; | 6 | import { UserProfile } from '@customTypes/Profile'; |
| @@ -109,6 +110,10 @@ const Profile: React.FC<ProfileProps> = ({ profile, token, gameData, onDeleteRec | |||
| 109 | 110 | ||
| 110 | return ( | 111 | return ( |
| 111 | <div style={{position: "absolute", width: "calc(100% - 50px)", left: "350px"}}> | 112 | <div style={{position: "absolute", width: "calc(100% - 50px)", left: "350px"}}> |
| 113 | <Helmet> | ||
| 114 | <title>LPHUB | {profile.user_name}</title> | ||
| 115 | <meta name="description" content={profile.user_name} /> | ||
| 116 | </Helmet> | ||
| 112 | {MessageDialogComponent} | 117 | {MessageDialogComponent} |
| 113 | {MessageDialogLoadComponent} | 118 | {MessageDialogLoadComponent} |
| 114 | {ConfirmDialogComponent} | 119 | {ConfirmDialogComponent} |
| @@ -267,7 +272,7 @@ const Profile: React.FC<ProfileProps> = ({ profile, token, gameData, onDeleteRec | |||
| 267 | 272 | ||
| 268 | <span style={{ display: "grid" }}>{e.score_count}</span> | 273 | <span style={{ display: "grid" }}>{e.score_count}</span> |
| 269 | 274 | ||
| 270 | <span style={{ display: "grid" }}>{e.score_count - r.map_wr_count > 0 ? `+${e.score_count - r.map_wr_count}` : e.score_count - r.map_wr_count}</span> | 275 | <span style={{ display: "grid" }}>{e.score_count - r.map_wr_count > 0 ? `+${e.score_count - r.map_wr_count}` : `-`}</span> |
| 271 | <span style={{ display: "grid" }}>{ticks_to_time(e.score_time)}</span> | 276 | <span style={{ display: "grid" }}>{ticks_to_time(e.score_time)}</span> |
| 272 | <span> </span> | 277 | <span> </span> |
| 273 | {i === 0 ? <span>#{r.placement}</span> : <span> </span>} | 278 | {i === 0 ? <span>#{r.placement}</span> : <span> </span>} |
| @@ -313,7 +318,7 @@ const Profile: React.FC<ProfileProps> = ({ profile, token, gameData, onDeleteRec | |||
| 313 | {i !== 0 ? <hr style={{ gridColumn: "1 / span 8" }} /> : ""} | 318 | {i !== 0 ? <hr style={{ gridColumn: "1 / span 8" }} /> : ""} |
| 314 | <Link to={`/maps/${r.id}`}><span>{r.name}</span></Link> | 319 | <Link to={`/maps/${r.id}`}><span>{r.name}</span></Link> |
| 315 | <span style={{ display: "grid" }}>{record!.scores[i].score_count}</span> | 320 | <span style={{ display: "grid" }}>{record!.scores[i].score_count}</span> |
| 316 | <span style={{ display: "grid" }}>{record!.scores[i].score_count - record!.map_wr_count > 0 ? `+${record!.scores[i].score_count - record!.map_wr_count}` : record!.scores[i].score_count - record!.map_wr_count}</span> | 321 | <span style={{ display: "grid" }}>{record!.scores[i].score_count - record!.map_wr_count > 0 ? `+${record!.scores[i].score_count - record!.map_wr_count}` : `-`}</span> |
| 317 | <span style={{ display: "grid" }}>{ticks_to_time(record!.scores[i].score_time)}</span> | 322 | <span style={{ display: "grid" }}>{ticks_to_time(record!.scores[i].score_time)}</span> |
| 318 | <span> </span> | 323 | <span> </span> |
| 319 | {i === 0 ? <span>#{record!.placement}</span> : <span> </span>} | 324 | {i === 0 ? <span>#{record!.placement}</span> : <span> </span>} |
diff --git a/frontend/src/pages/Rankings.tsx b/frontend/src/pages/Rankings.tsx index cdb87a8..71aa427 100644 --- a/frontend/src/pages/Rankings.tsx +++ b/frontend/src/pages/Rankings.tsx | |||
| @@ -1,4 +1,5 @@ | |||
| 1 | import React, { useEffect } from "react"; | 1 | import React, { useEffect } from "react"; |
| 2 | import { Helmet } from "react-helmet"; | ||
| 2 | 3 | ||
| 3 | import RankingEntry from "@components/RankingEntry"; | 4 | import RankingEntry from "@components/RankingEntry"; |
| 4 | import { Ranking, SteamRanking, RankingType, SteamRankingType } from "@customTypes/Ranking"; | 5 | import { Ranking, SteamRanking, RankingType, SteamRankingType } from "@customTypes/Ranking"; |
| @@ -13,9 +14,9 @@ const Rankings: React.FC = () => { | |||
| 13 | official, | 14 | official, |
| 14 | unofficial | 15 | unofficial |
| 15 | } | 16 | } |
| 16 | const [currentRankingType, setCurrentRankingType] = React.useState<LeaderboardTypes>(LeaderboardTypes.official); | 17 | const [currentRankingType, setCurrentRankingType] = React.useState<LeaderboardTypes>(LeaderboardTypes.official); |
| 17 | 18 | ||
| 18 | const [leaderboardLoad, setLeaderboardLoad] = React.useState<boolean>(false); | 19 | const [leaderboardLoad, setLeaderboardLoad] = React.useState<boolean>(false); |
| 19 | 20 | ||
| 20 | enum RankingCategories { | 21 | enum RankingCategories { |
| 21 | rankings_overall, | 22 | rankings_overall, |
| @@ -26,7 +27,7 @@ const Rankings: React.FC = () => { | |||
| 26 | const [load, setLoad] = React.useState<boolean>(false); | 27 | const [load, setLoad] = React.useState<boolean>(false); |
| 27 | 28 | ||
| 28 | const _fetch_rankings = async () => { | 29 | const _fetch_rankings = async () => { |
| 29 | setLeaderboardLoad(false); | 30 | setLeaderboardLoad(false); |
| 30 | const rankings = await API.get_official_rankings(); | 31 | const rankings = await API.get_official_rankings(); |
| 31 | setLeaderboardData(rankings); | 32 | setLeaderboardData(rankings); |
| 32 | if (currentLeaderboardType == RankingCategories.rankings_singleplayer) { | 33 | if (currentLeaderboardType == RankingCategories.rankings_singleplayer) { |
| @@ -37,12 +38,12 @@ const Rankings: React.FC = () => { | |||
| 37 | setCurrentLeaderboard(rankings.rankings_overall) | 38 | setCurrentLeaderboard(rankings.rankings_overall) |
| 38 | } | 39 | } |
| 39 | setLoad(true); | 40 | setLoad(true); |
| 40 | setLeaderboardLoad(true); | 41 | setLeaderboardLoad(true); |
| 41 | } | 42 | } |
| 42 | 43 | ||
| 43 | const __dev_fetch_unofficial_rankings = async () => { | 44 | const __dev_fetch_unofficial_rankings = async () => { |
| 44 | try { | 45 | try { |
| 45 | setLeaderboardLoad(false); | 46 | setLeaderboardLoad(false); |
| 46 | const rankings = await API.get_unofficial_rankings(); | 47 | const rankings = await API.get_unofficial_rankings(); |
| 47 | setLeaderboardData(rankings); | 48 | setLeaderboardData(rankings); |
| 48 | if (currentLeaderboardType == RankingCategories.rankings_singleplayer) { | 49 | if (currentLeaderboardType == RankingCategories.rankings_singleplayer) { |
| @@ -53,7 +54,7 @@ const Rankings: React.FC = () => { | |||
| 53 | } else { | 54 | } else { |
| 54 | setCurrentLeaderboard(rankings.rankings_overall) | 55 | setCurrentLeaderboard(rankings.rankings_overall) |
| 55 | } | 56 | } |
| 56 | setLeaderboardLoad(true); | 57 | setLeaderboardLoad(true); |
| 57 | } catch (e) { | 58 | } catch (e) { |
| 58 | console.log(e) | 59 | console.log(e) |
| 59 | } | 60 | } |
| @@ -88,12 +89,15 @@ const Rankings: React.FC = () => { | |||
| 88 | 89 | ||
| 89 | return ( | 90 | return ( |
| 90 | <main> | 91 | <main> |
| 92 | <Helmet> | ||
| 93 | <title>LPHUB | Rankings</title> | ||
| 94 | </Helmet> | ||
| 91 | <section className="nav-container nav-1"> | 95 | <section className="nav-container nav-1"> |
| 92 | <div> | 96 | <div> |
| 93 | <button onClick={() => {_fetch_rankings(); setCurrentRankingType(LeaderboardTypes.official)}} className={`nav-1-btn ${currentRankingType == LeaderboardTypes.official ? "selected" : ""}`}> | 97 | <button onClick={() => { _fetch_rankings(); setCurrentRankingType(LeaderboardTypes.official) }} className={`nav-1-btn ${currentRankingType == LeaderboardTypes.official ? "selected" : ""}`}> |
| 94 | <span>Official (LPHUB)</span> | 98 | <span>Official (LPHUB)</span> |
| 95 | </button> | 99 | </button> |
| 96 | <button onClick={() => {__dev_fetch_unofficial_rankings(); setCurrentRankingType(LeaderboardTypes.unofficial)}} className={`nav-1-btn ${currentRankingType == LeaderboardTypes.unofficial ? "selected" : ""}`}> | 100 | <button onClick={() => { __dev_fetch_unofficial_rankings(); setCurrentRankingType(LeaderboardTypes.unofficial) }} className={`nav-1-btn ${currentRankingType == LeaderboardTypes.unofficial ? "selected" : ""}`}> |
| 97 | <span>Unofficial (Steam)</span> | 101 | <span>Unofficial (Steam)</span> |
| 98 | </button> | 102 | </button> |
| 99 | </div> | 103 | </div> |
| @@ -128,11 +132,11 @@ const Rankings: React.FC = () => { | |||
| 128 | }) | 132 | }) |
| 129 | } | 133 | } |
| 130 | 134 | ||
| 131 | {leaderboardLoad ? null : | 135 | {leaderboardLoad ? null : |
| 132 | <div style={{display: "flex", justifyContent: "center", margin: "30px 0px"}}> | 136 | <div style={{ display: "flex", justifyContent: "center", margin: "30px 0px" }}> |
| 133 | <span className="loader"></span> | 137 | <span className="loader"></span> |
| 134 | </div> | 138 | </div> |
| 135 | } | 139 | } |
| 136 | </div> | 140 | </div> |
| 137 | </section> | 141 | </section> |
| 138 | : null} | 142 | : null} |
diff --git a/frontend/src/pages/Rules.tsx b/frontend/src/pages/Rules.tsx index b5625ce..9f57b7e 100644 --- a/frontend/src/pages/Rules.tsx +++ b/frontend/src/pages/Rules.tsx | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | import React from 'react'; | 1 | import React from 'react'; |
| 2 | import ReactMarkdown from 'react-markdown'; | 2 | import ReactMarkdown from 'react-markdown'; |
| 3 | import { Helmet } from 'react-helmet'; | ||
| 3 | 4 | ||
| 4 | import '@css/Rules.css'; | 5 | import '@css/Rules.css'; |
| 5 | 6 | ||
| @@ -29,6 +30,9 @@ const Rules: React.FC = () => { | |||
| 29 | 30 | ||
| 30 | return ( | 31 | return ( |
| 31 | <main> | 32 | <main> |
| 33 | <Helmet> | ||
| 34 | <title>LPHUB | Rules</title> | ||
| 35 | </Helmet> | ||
| 32 | <ReactMarkdown>{rulesText}</ReactMarkdown> | 36 | <ReactMarkdown>{rulesText}</ReactMarkdown> |
| 33 | </main> | 37 | </main> |
| 34 | ); | 38 | ); |
diff --git a/frontend/src/pages/User.tsx b/frontend/src/pages/User.tsx index f90d1aa..d43c0c6 100644 --- a/frontend/src/pages/User.tsx +++ b/frontend/src/pages/User.tsx | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | import React from 'react'; | 1 | import React from 'react'; |
| 2 | import { Link, useLocation, useNavigate } from 'react-router-dom'; | 2 | import { Link, useLocation, useNavigate } from 'react-router-dom'; |
| 3 | import { Helmet } from 'react-helmet'; | ||
| 3 | 4 | ||
| 4 | import { SteamIcon, TwitchIcon, YouTubeIcon, PortalIcon, FlagIcon, StatisticsIcon, SortIcon, ThreedotIcon, DownloadIcon, HistoryIcon } from '@images/Images'; | 5 | import { SteamIcon, TwitchIcon, YouTubeIcon, PortalIcon, FlagIcon, StatisticsIcon, SortIcon, ThreedotIcon, DownloadIcon, HistoryIcon } from '@images/Images'; |
| 5 | import { UserProfile } from '@customTypes/Profile'; | 6 | import { UserProfile } from '@customTypes/Profile'; |
| @@ -92,6 +93,10 @@ const User: React.FC<UserProps> = ({ token, profile, gameData }) => { | |||
| 92 | 93 | ||
| 93 | return ( | 94 | return ( |
| 94 | <main> | 95 | <main> |
| 96 | <Helmet> | ||
| 97 | <title>LPHUB | {user.user_name}</title> | ||
| 98 | <meta name="description" content={user.user_name} /> | ||
| 99 | </Helmet> | ||
| 95 | {MessageDialogComponent} | 100 | {MessageDialogComponent} |
| 96 | <section id='section1' className='profile'> | 101 | <section id='section1' className='profile'> |
| 97 | <div> | 102 | <div> |
| @@ -236,7 +241,7 @@ const User: React.FC<UserProps> = ({ token, profile, gameData }) => { | |||
| 236 | 241 | ||
| 237 | <span style={{ display: "grid" }}>{e.score_count}</span> | 242 | <span style={{ display: "grid" }}>{e.score_count}</span> |
| 238 | 243 | ||
| 239 | <span style={{ display: "grid" }}>{e.score_count - r.map_wr_count > 0 ? `+${e.score_count - r.map_wr_count}` : e.score_count - r.map_wr_count}</span> | 244 | <span style={{ display: "grid" }}>{e.score_count - r.map_wr_count > 0 ? `+${e.score_count - r.map_wr_count}` : `-`}</span> |
| 240 | <span style={{ display: "grid" }}>{ticks_to_time(e.score_time)}</span> | 245 | <span style={{ display: "grid" }}>{ticks_to_time(e.score_time)}</span> |
| 241 | <span> </span> | 246 | <span> </span> |
| 242 | {i === 0 ? <span>#{r.placement}</span> : <span> </span>} | 247 | {i === 0 ? <span>#{r.placement}</span> : <span> </span>} |
| @@ -281,7 +286,7 @@ const User: React.FC<UserProps> = ({ token, profile, gameData }) => { | |||
| 281 | {i !== 0 ? <hr style={{ gridColumn: "1 / span 8" }} /> : ""} | 286 | {i !== 0 ? <hr style={{ gridColumn: "1 / span 8" }} /> : ""} |
| 282 | <Link to={`/maps/${r.id}`}><span>{r.name}</span></Link> | 287 | <Link to={`/maps/${r.id}`}><span>{r.name}</span></Link> |
| 283 | <span style={{ display: "grid" }}>{record!.scores[i].score_count}</span> | 288 | <span style={{ display: "grid" }}>{record!.scores[i].score_count}</span> |
| 284 | <span style={{ display: "grid" }}>{record!.scores[i].score_count - record!.map_wr_count > 0 ? `+${record!.scores[i].score_count - record!.map_wr_count}` : record!.scores[i].score_count - record!.map_wr_count}</span> | 289 | <span style={{ display: "grid" }}>{record!.scores[i].score_count - record!.map_wr_count > 0 ? `+${record!.scores[i].score_count - record!.map_wr_count}` : `-`}</span> |
| 285 | <span style={{ display: "grid" }}>{ticks_to_time(record!.scores[i].score_time)}</span> | 290 | <span style={{ display: "grid" }}>{ticks_to_time(record!.scores[i].score_time)}</span> |
| 286 | <span> </span> | 291 | <span> </span> |
| 287 | {i === 0 ? <span>#{record!.placement}</span> : <span> </span>} | 292 | {i === 0 ? <span>#{record!.placement}</span> : <span> </span>} |