diff --git a/src/components/Event/EventInterestForm.tsx b/src/components/Event/EventInterestForm.tsx index 3c62779..43a29e8 100644 --- a/src/components/Event/EventInterestForm.tsx +++ b/src/components/Event/EventInterestForm.tsx @@ -10,9 +10,11 @@ import EventCarpools from './EventCarpools'; import { useMutableEvent } from './EventHooks'; import EventSignups from './EventSignups'; +const defaultMe = { id: 0, name: '', bio: '' }; + export default function EventInterestForm() { const event = useMutableEvent(); - const me = useMe() || { id: 0, name: '' }; + const me = useMe() || defaultMe; const placeIdRef = useRef(null); const canDriveRef = useRef(false); const [note, setNote] = useState(''); @@ -48,7 +50,7 @@ export default function EventInterestForm() { const details = await getPlaceDetails(placeId); event.signups[me.id] = { - user: { id: me.id, name: me.name }, + user: me, placeId, ...details, canDrive, @@ -56,7 +58,7 @@ export default function EventInterestForm() { }; } else { event.signups[me.id] = { - user: { id: me.id, name: me.name }, + user: me, placeId: null, latitude: null, longitude: null, @@ -66,7 +68,7 @@ export default function EventInterestForm() { }; } }, - [event.id, event.signups, me.id, me.name] + [event.id, event.signups, me] ); const removeSignup = useCallback(async () => { diff --git a/src/components/Event/EventSignups.tsx b/src/components/Event/EventSignups.tsx index 9725cac..8c04cc5 100644 --- a/src/components/Event/EventSignups.tsx +++ b/src/components/Event/EventSignups.tsx @@ -59,6 +59,8 @@ function EventSignup({ signup }: { signup: IEventSignup }) { > {user.name} + {user.bio && `, ${user.bio}`} +
{extraDistance && ` +${extraDistance.toFixed(1)} miles`}{' '} {signup.canDrive && ' (can drive)'} {signup.note && ( diff --git a/src/components/types.ts b/src/components/types.ts index 051507c..9433716 100644 --- a/src/components/types.ts +++ b/src/components/types.ts @@ -101,6 +101,7 @@ export type IEventSignupBase = { user: { id: number; name: string; + bio: string; }; canDrive: boolean; note: string;