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 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<string | null>(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 () => {

View File

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

View File

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