diff options
| -rw-r--r-- | frontend/src/components/pages/home.js | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/frontend/src/components/pages/home.js b/frontend/src/components/pages/home.js index c2376f2..0a46bec 100644 --- a/frontend/src/components/pages/home.js +++ b/frontend/src/components/pages/home.js | |||
| @@ -7,67 +7,67 @@ import Record from '../record'; | |||
| 7 | export default function Homepage({ token }) { | 7 | export default function Homepage({ token }) { |
| 8 | const [profile, setProfile] = useState(null); | 8 | const [profile, setProfile] = useState(null); |
| 9 | 9 | ||
| 10 | useEffect(() => { | 10 | // useEffect(() => { |
| 11 | 11 | ||
| 12 | if (!token) { | 12 | // if (!token) { |
| 13 | return; | 13 | // return; |
| 14 | } | 14 | // } |
| 15 | 15 | ||
| 16 | async function home() { | 16 | // async function home() { |
| 17 | 17 | ||
| 18 | const profileResponse = await fetch(`https://lp.ardapektezol.com/api/v1/profile`, { | 18 | // const profileResponse = await fetch(`https://lp.ardapektezol.com/api/v1/profile`, { |
| 19 | headers: { | 19 | // headers: { |
| 20 | Authorization: token | 20 | // Authorization: token |
| 21 | } | 21 | // } |
| 22 | }) | 22 | // }) |
| 23 | 23 | ||
| 24 | const profileData = await profileResponse.json(); | 24 | // const profileData = await profileResponse.json(); |
| 25 | 25 | ||
| 26 | setProfile(profileData); | 26 | // setProfile(profileData); |
| 27 | 27 | ||
| 28 | const gamesResponse = await fetch("https://lp.ardapektezol.com/api/v1/games", { | 28 | // const gamesResponse = await fetch("https://lp.ardapektezol.com/api/v1/games", { |
| 29 | headers: { | 29 | // headers: { |
| 30 | Authorization: token | 30 | // Authorization: token |
| 31 | } | 31 | // } |
| 32 | }); | 32 | // }); |
| 33 | 33 | ||
| 34 | const gamesData = await gamesResponse.json(); | 34 | // const gamesData = await gamesResponse.json(); |
| 35 | 35 | ||
| 36 | const recommendedMapImg = document.querySelector("#recommendedMapImg"); | 36 | // const recommendedMapImg = document.querySelector("#recommendedMapImg"); |
| 37 | 37 | ||
| 38 | recommendedMapImg.style.backgroundImage = `url(${gamesData.data[0].image})` | 38 | // recommendedMapImg.style.backgroundImage = `url(${gamesData.data[0].image})` |
| 39 | 39 | ||
| 40 | const column1 = document.querySelector("#column1"); | 40 | // const column1 = document.querySelector("#column1"); |
| 41 | const column2 = document.querySelector("#column2"); | 41 | // const column2 = document.querySelector("#column2"); |
| 42 | 42 | ||
| 43 | column2.style.height = column1.clientHeight + "px"; | 43 | // column2.style.height = column1.clientHeight + "px"; |
| 44 | 44 | ||
| 45 | const panels = document.querySelectorAll(".homepage-panel"); | 45 | // const panels = document.querySelectorAll(".homepage-panel"); |
| 46 | panels.forEach(e => { | 46 | // panels.forEach(e => { |
| 47 | // this is cuz react is silly | 47 | // // this is cuz react is silly |
| 48 | if (e.innerHTML.includes('<div class="homepage-panel-title-div">')) { | 48 | // if (e.innerHTML.includes('<div class="homepage-panel-title-div">')) { |
| 49 | return | 49 | // return |
| 50 | } | 50 | // } |
| 51 | const title = e.getAttribute("title"); | 51 | // const title = e.getAttribute("title"); |
| 52 | 52 | ||
| 53 | const titleDiv = document.createElement("div"); | 53 | // const titleDiv = document.createElement("div"); |
| 54 | const titleSpan = document.createElement("span"); | 54 | // const titleSpan = document.createElement("span"); |
| 55 | 55 | ||
| 56 | titleDiv.classList.add("homepage-panel-title-div") | 56 | // titleDiv.classList.add("homepage-panel-title-div") |
| 57 | 57 | ||
| 58 | titleSpan.innerText = title | 58 | // titleSpan.innerText = title |
| 59 | 59 | ||
| 60 | titleDiv.appendChild(titleSpan) | 60 | // titleDiv.appendChild(titleSpan) |
| 61 | e.insertBefore(titleDiv, e.firstChild) | 61 | // e.insertBefore(titleDiv, e.firstChild) |
| 62 | }); | 62 | // }); |
| 63 | } | 63 | // } |
| 64 | try { | 64 | // try { |
| 65 | home(); | 65 | // home(); |
| 66 | } catch (e) { | 66 | // } catch (e) { |
| 67 | console.log("error while setting up home page:", e); | 67 | // console.log("error while setting up home page:", e); |
| 68 | } | 68 | // } |
| 69 | 69 | ||
| 70 | }, [token]); | 70 | // }, [token]); |
| 71 | 71 | ||
| 72 | const newsList = [ | 72 | const newsList = [ |
| 73 | { | 73 | { |