From fd3389c004bf5ee9caeafc72e913b4ad3d1acf9e Mon Sep 17 00:00:00 2001 From: Michael Fatemi Date: Sat, 10 Apr 2021 20:51:11 -0400 Subject: [PATCH] improve Group landing page --- src/components/Group.tsx | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/components/Group.tsx b/src/components/Group.tsx index 9b8a5bc..4a6ba93 100644 --- a/src/components/Group.tsx +++ b/src/components/Group.tsx @@ -1,5 +1,7 @@ import { useState, useEffect } from 'react'; import { useParams } from 'react-router-dom'; +import Button from '@material-ui/core/Button'; +import Card from '@material-ui/core/Card'; import Typography from '@material-ui/core/Typography'; import { makeAPIGetCall } from '../api/utils'; @@ -40,7 +42,13 @@ export default function Group() { const [pools, setPools] = useState(SAMPLE_POOLS); useEffect(() => { - makeAPIGetCall('/group', { id }).then((res) => setGroup(res.data.data)); + makeAPIGetCall('/group', { groupID: id }).then((res) => { + setGroup(res.data.data); + }); + + makeAPIGetCall('/group_pools', { groupID: id }).then((res) => { + setPools(res.data.data); + }); }, [id]); if (!group) { @@ -63,23 +71,16 @@ export default function Group() { Pools - +
-

{pools.map((pool, index) => { - let background; - if (index % 2 === 0) { - background = '#F1EAE8'; - } else { - background = '#FFFFFF'; - } return ( -
+ {pool.title} @@ -91,7 +92,7 @@ export default function Group() {

{maybePluralize(pool.comments.length, 'comment')}

-
+ ); })}