mirror of
https://github.com/myfatemi04/wheelshare-frontend.git
synced 2025-04-21 11:20:17 -04:00
Make event carpools use real data
This commit is contained in:
parent
3e9bb1490f
commit
43a16a57cc
|
@ -4,10 +4,10 @@ import { useCallback, useState } from 'react';
|
||||||
import { createCarpool } from '../api';
|
import { createCarpool } from '../api';
|
||||||
import { lightgrey } from '../colors';
|
import { lightgrey } from '../colors';
|
||||||
import { useMe } from '../hooks';
|
import { useMe } from '../hooks';
|
||||||
import { ICarpool, IEvent } from '../types';
|
import { IEvent } from '../types';
|
||||||
import UIButton from '../UI/UIButton';
|
import UIButton from '../UI/UIButton';
|
||||||
|
|
||||||
function CarpoolRow({ carpool }: { carpool: ICarpool }) {
|
function CarpoolRow({ carpool }: { carpool: IEvent['carpools'][0] }) {
|
||||||
const PADDING = '1rem';
|
const PADDING = '1rem';
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
@ -44,27 +44,7 @@ function CarpoolRow({ carpool }: { carpool: ICarpool }) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const dummyCarpoolData: ICarpool[] = [
|
|
||||||
{
|
|
||||||
id: 0,
|
|
||||||
name: 'carpoollo2398',
|
|
||||||
eventId: 0,
|
|
||||||
event: {
|
|
||||||
id: 0,
|
|
||||||
name: 'test event',
|
|
||||||
latitude: 0,
|
|
||||||
longitude: 0,
|
|
||||||
formattedAddress: 'your house',
|
|
||||||
placeId: 'secret',
|
|
||||||
},
|
|
||||||
members: [],
|
|
||||||
invitations: [],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
export default function Carpools({ event }: { event: IEvent }) {
|
export default function Carpools({ event }: { event: IEvent }) {
|
||||||
// eslint-disable-next-line
|
|
||||||
const [carpools, _setCarpools] = useState(dummyCarpoolData);
|
|
||||||
const [creationStatus, setCreationStatus] =
|
const [creationStatus, setCreationStatus] =
|
||||||
useState<null | 'pending' | 'completed' | 'errored'>(null);
|
useState<null | 'pending' | 'completed' | 'errored'>(null);
|
||||||
const me = useMe()!;
|
const me = useMe()!;
|
||||||
|
@ -100,7 +80,7 @@ export default function Carpools({ event }: { event: IEvent }) {
|
||||||
? 'Created!'
|
? 'Created!'
|
||||||
: 'Errored'}
|
: 'Errored'}
|
||||||
</UIButton>
|
</UIButton>
|
||||||
{carpools.map((carpool) => (
|
{event.carpools.map((carpool) => (
|
||||||
<CarpoolRow carpool={carpool} key={carpool.id} />
|
<CarpoolRow carpool={carpool} key={carpool.id} />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -57,6 +57,14 @@ export type IEvent = {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
};
|
};
|
||||||
|
carpools: {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
members: {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
};
|
||||||
|
}[];
|
||||||
startTime: string; // Datestring
|
startTime: string; // Datestring
|
||||||
duration: number;
|
duration: number;
|
||||||
endTime: string | null; // Datestring
|
endTime: string | null; // Datestring
|
||||||
|
|
Loading…
Reference in New Issue
Block a user