From a8605241fe671d082588b450dac7df849642c9f9 Mon Sep 17 00:00:00 2001 From: Michael Fatemi Date: Sat, 10 Apr 2021 21:22:48 -0400 Subject: [PATCH] update types to use Mongo-style "_id" --- src/components/Group.tsx | 4 ++-- src/components/Pool.tsx | 4 ++-- src/components/Pools.tsx | 4 ++-- src/components/Profile.tsx | 6 +++--- src/types.d.ts | 8 ++++---- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/components/Group.tsx b/src/components/Group.tsx index b6f4b89..6fc6de7 100644 --- a/src/components/Group.tsx +++ b/src/components/Group.tsx @@ -10,7 +10,7 @@ const maybePluralize = (count: number, noun: string, suffix = 's') => const SAMPLE_POOLS: Carpool.Pool[] = [ { - id: '1234', + _id: '1234', title: 'TJ Carpool', description: 'Carpool from TJ track to homes', start_time: '4/10/2021 3:00 PM', @@ -90,7 +90,7 @@ export default function Group() { {pools.map((pool, index) => { return ( - + {pool.title}

diff --git a/src/components/Pool.tsx b/src/components/Pool.tsx index 330365c..5713f45 100644 --- a/src/components/Pool.tsx +++ b/src/components/Pool.tsx @@ -76,7 +76,7 @@ export default function Pool() { const onRegister = useCallback(() => { if (user) { - let userID = user.id; + let userID = user._id; makeAPIPostCall('/join_pool', { id }).then(() => { if (pool) { setPool({ @@ -122,7 +122,7 @@ export default function Pool() { style={{ marginTop: '0.5rem' }} onClick={onRegister} > - {pool.participant_ids.includes(user.id) + {pool.participant_ids.includes(user._id) ? 'Unregister' : 'Register'} diff --git a/src/components/Pools.tsx b/src/components/Pools.tsx index f7a5d1a..b94c135 100644 --- a/src/components/Pools.tsx +++ b/src/components/Pools.tsx @@ -97,7 +97,7 @@ const Pools = () => { className="card card-body text-left" style={{ backgroundColor: background }} > - + {pool.title}

@@ -105,7 +105,7 @@ const Pools = () => {

Start Time: {pool.start_time}

End Time: {pool.end_time}

-

+

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

diff --git a/src/components/Profile.tsx b/src/components/Profile.tsx index 0bbc4b7..97ea5c6 100644 --- a/src/components/Profile.tsx +++ b/src/components/Profile.tsx @@ -56,7 +56,7 @@ const Profile = () => { className={classes.root + 'd-inline-flex'} style={{ margin: '0.5rem' }} > - + {pool.title} @@ -75,14 +75,14 @@ const Profile = () => { size="small" color="primary" onClick={() => { - let link: string = 'localhost:3000/pool/' + pool.id; + let link: string = 'localhost:3000/pool/' + pool._id; navigator.clipboard.writeText(link); }} > Share