From cfac59282da55f4791d6352f15887a15e9ff6ec5 Mon Sep 17 00:00:00 2001
From: Wolfboy248 <121288977+Wolfboy248@users.noreply.github.com>
Date: Wed, 10 Jul 2024 21:51:25 +0200
Subject: Games page, maplist page (#153)
Co-authored-by: Wolfboy248 <105884620+Wolfboy248@users.noreply.github.com>
---
frontend/src/components/pages/game.js | 46 +++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
create mode 100644 frontend/src/components/pages/game.js
(limited to 'frontend/src/components/pages/game.js')
diff --git a/frontend/src/components/pages/game.js b/frontend/src/components/pages/game.js
new file mode 100644
index 0000000..017760b
--- /dev/null
+++ b/frontend/src/components/pages/game.js
@@ -0,0 +1,46 @@
+import React, { useEffect, useRef, useState } from 'react';
+import { useLocation, Link } from "react-router-dom";
+
+import "./games.css"
+
+export default function GameEntry({ gameInfo }) {
+ const [gameEntry, setGameEntry] = React.useState(null);
+ const location = useLocation();
+
+ const gameInfoCats = gameInfo.category_portals;
+
+ useEffect(() => {
+ gameInfoCats.forEach(catInfo => {
+ const itemBody = document.createElement("div");
+ const itemTitle = document.createElement("span");
+ const spacing = document.createElement("br");
+ const itemNum = document.createElement("span");
+
+ itemTitle.innerText = catInfo.category.name;
+ itemNum.innerText = catInfo.portal_count;
+ itemTitle.classList.add("games-page-item-body-item-title");
+ itemNum.classList.add("games-page-item-body-item-num");
+ itemBody.appendChild(itemTitle);
+ itemBody.appendChild(spacing);
+ itemBody.appendChild(itemNum);
+ itemBody.className = "games-page-item-body-item";
+
+ // itemBody.innerHTML = `
+ // ${catInfo.category.name}
+ // ${catInfo.portal_count}`
+
+ document.getElementById(`${gameInfo.id}`).appendChild(itemBody);
+ });
+ })
+
+ return (
+