From 510ce220c9c7641655f96a861f1b13032404d571 Mon Sep 17 00:00:00 2001 From: Michael Fatemi Date: Wed, 11 Aug 2021 17:59:34 -0400 Subject: [PATCH] add captions to act as ui helpers --- .../Event/EventCarpoolCreateButton.tsx | 2 +- src/components/Event/EventCarpools.tsx | 4 +++ src/components/Event/EventInterestForm.tsx | 4 +++ src/components/Event/EventSignups.tsx | 15 +++++++++ src/components/Groups/GroupList.tsx | 31 ++++++++++++------- src/components/UI/UIButton.tsx | 3 +- 6 files changed, 46 insertions(+), 13 deletions(-) diff --git a/src/components/Event/EventCarpoolCreateButton.tsx b/src/components/Event/EventCarpoolCreateButton.tsx index ade65d4..21516d0 100644 --- a/src/components/Event/EventCarpoolCreateButton.tsx +++ b/src/components/Event/EventCarpoolCreateButton.tsx @@ -55,7 +55,7 @@ export default function EventCarpoolCreateButton() { ) : ( <> - Available to drive? + Available to drive?

Carpools

+ + Click to request to + join a carpool. + {event.carpools.map((carpool) => ( + Click to toggle your interest {interested && ( <> + + Click to toggle your driving availability + { canDriveRef.current = !canDriveRef.current; diff --git a/src/components/Event/EventSignups.tsx b/src/components/Event/EventSignups.tsx index 8fd6254..27e6a08 100644 --- a/src/components/Event/EventSignups.tsx +++ b/src/components/Event/EventSignups.tsx @@ -83,6 +83,7 @@ export default function EventSignups() { const { event } = useContext(EventContext); const signups = event.signups; const carpools = event.carpools; + const me = useMe(); const signupsWithoutCarpool = useMemo(() => { // A list of users not in any carpool @@ -94,10 +95,24 @@ export default function EventSignups() { .map((id) => signups[id]); }, [signups, carpools]); + const hasCarpool = useMemo( + () => + event.carpools.some((carpool) => + carpool.members.some((member) => member.id === me?.id) + ), + [event.carpools, me?.id] + ); + return (

People without a carpool

+ {!hasCarpool && ( + + Click to add + someone to the temporary invite list + + )} {signupsWithoutCarpool.map((signup) => ( ))} diff --git a/src/components/Groups/GroupList.tsx b/src/components/Groups/GroupList.tsx index 541e76c..c4b448b 100644 --- a/src/components/Groups/GroupList.tsx +++ b/src/components/Groups/GroupList.tsx @@ -1,30 +1,39 @@ import { IGroup } from '../types'; +import UILink from '../UI/UILink'; import UISecondaryBox from '../UI/UISecondaryBox'; function GroupListItem({ group }: { group: IGroup }) { return ( - -

+ { - window.location.href = `/groups/${group.id}`; + fontSize: '1.5rem', + fontWeight: 'bold', + display: 'block', + marginTop: '1rem', + marginBottom: '1rem', + marginRight: '2rem', }} > {group.name} -

-
+ + View group +
); } export default function GroupList({ groups }: { groups: IGroup[] }) { return ( -
+ {groups.map((group) => ( ))} -
+ ); } diff --git a/src/components/UI/UIButton.tsx b/src/components/UI/UIButton.tsx index 88f76dc..8d25a5d 100644 --- a/src/components/UI/UIButton.tsx +++ b/src/components/UI/UIButton.tsx @@ -5,7 +5,8 @@ const baseStyle: CSSProperties = { borderRadius: '0.5em', textTransform: 'uppercase', fontWeight: 500, - margin: '0.5em', + marginTop: '0.5rem', + marginBottom: '0.5rem', cursor: 'pointer', userSelect: 'none', };