mirror of
https://github.com/myfatemi04/wheelshare-frontend.git
synced 2025-04-09 22:00:16 -04:00
show user bio in event signups
This commit is contained in:
parent
cca03563f2
commit
0955d5dd11
|
@ -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 () => {
|
||||
|
|
|
@ -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 && (
|
||||
|
|
|
@ -101,6 +101,7 @@ export type IEventSignupBase = {
|
|||
user: {
|
||||
id: number;
|
||||
name: string;
|
||||
bio: string;
|
||||
};
|
||||
canDrive: boolean;
|
||||
note: string;
|
||||
|
|
Loading…
Reference in New Issue
Block a user