show user bio in event signups

This commit is contained in:
Michael Fatemi 2021-08-22 19:16:35 -04:00
parent cca03563f2
commit 0955d5dd11
3 changed files with 9 additions and 4 deletions

View File

@ -10,9 +10,11 @@ import EventCarpools from './EventCarpools';
import { useMutableEvent } from './EventHooks'; import { useMutableEvent } from './EventHooks';
import EventSignups from './EventSignups'; import EventSignups from './EventSignups';
const defaultMe = { id: 0, name: '', bio: '' };
export default function EventInterestForm() { export default function EventInterestForm() {
const event = useMutableEvent(); const event = useMutableEvent();
const me = useMe() || { id: 0, name: '' }; const me = useMe() || defaultMe;
const placeIdRef = useRef<string | null>(null); const placeIdRef = useRef<string | null>(null);
const canDriveRef = useRef(false); const canDriveRef = useRef(false);
const [note, setNote] = useState(''); const [note, setNote] = useState('');
@ -48,7 +50,7 @@ export default function EventInterestForm() {
const details = await getPlaceDetails(placeId); const details = await getPlaceDetails(placeId);
event.signups[me.id] = { event.signups[me.id] = {
user: { id: me.id, name: me.name }, user: me,
placeId, placeId,
...details, ...details,
canDrive, canDrive,
@ -56,7 +58,7 @@ export default function EventInterestForm() {
}; };
} else { } else {
event.signups[me.id] = { event.signups[me.id] = {
user: { id: me.id, name: me.name }, user: me,
placeId: null, placeId: null,
latitude: null, latitude: null,
longitude: 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 () => { const removeSignup = useCallback(async () => {

View File

@ -59,6 +59,8 @@ function EventSignup({ signup }: { signup: IEventSignup }) {
> >
<span> <span>
<b>{user.name}</b> <b>{user.name}</b>
{user.bio && `, ${user.bio}`}
<br />
{extraDistance && ` +${extraDistance.toFixed(1)} miles`}{' '} {extraDistance && ` +${extraDistance.toFixed(1)} miles`}{' '}
{signup.canDrive && ' (can drive)'} {signup.canDrive && ' (can drive)'}
{signup.note && ( {signup.note && (

View File

@ -101,6 +101,7 @@ export type IEventSignupBase = {
user: { user: {
id: number; id: number;
name: string; name: string;
bio: string;
}; };
canDrive: boolean; canDrive: boolean;
note: string; note: string;