Skip to content

Commit

Permalink
Merge pull request #29 from NwinNwin/steven-about+page
Browse files Browse the repository at this point in the history
added live stats in about page
  • Loading branch information
stevem-zhou authored Sep 20, 2023
2 parents d8838d5 + 174eb6a commit 1c8f98e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/components/AboutPage/AboutPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export default function AboutPage() {
const navigate = useNavigate();
const [screenWidth, setScreenWidth] = useState(window.screen.width);
const [data, setData] = useState([]);
const [leaderboard, setLeaderboard] = useState([]);
console.log("leaderboard", leaderboard);
console.log("data", data);

window.onresize = () => {
setScreenWidth(window.screen.width);
Expand All @@ -27,9 +30,14 @@ export default function AboutPage() {
useEffect(() => {
const getData = async () => {
axios
.get("http://localhost:3001/items")
.get(`${process.env.REACT_APP_AWS_BACKEND_URL}/items/`)
.then((data) => setData(data.data))
.catch((err) => console.log(err));

axios
.get(`${process.env.REACT_APP_AWS_BACKEND_URL}/leaderboard/`)
.then((leaderboardData) => setLeaderboard(leaderboardData.data))
.catch((err) => console.log(err));
};
getData();
}, []);
Expand Down Expand Up @@ -97,15 +105,15 @@ export default function AboutPage() {
</Flex>
<Flex direction={"column"} m={"1%"}>
<Text fontWeight={600} fontSize={{ base: "1.3rem", md: "2.4rem" }}>
0
{data.filter((item) => item.isresolved).length}
</Text>
<Text fontSize={{ base: "0.8rem", md: "1.2rem" }}>
Successful Returns
</Text>
</Flex>
<Flex direction={"column"} m={"1%"}>
<Text fontWeight={600} fontSize={{ base: "1.3rem", md: "2.4rem" }}>
{data.length}
{leaderboard.length}
</Text>
<Text fontSize={{ base: "0.8rem", md: "1.2rem" }}>Active Users</Text>
</Flex>
Expand Down

0 comments on commit 1c8f98e

Please sign in to comment.