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 { lightgrey } from '../colors';
|
||||
import { useMe } from '../hooks';
|
||||
import { ICarpool, IEvent } from '../types';
|
||||
import { IEvent } from '../types';
|
||||
import UIButton from '../UI/UIButton';
|
||||
|
||||
function CarpoolRow({ carpool }: { carpool: ICarpool }) {
|
||||
function CarpoolRow({ carpool }: { carpool: IEvent['carpools'][0] }) {
|
||||
const PADDING = '1rem';
|
||||
return (
|
||||
<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 }) {
|
||||
// eslint-disable-next-line
|
||||
const [carpools, _setCarpools] = useState(dummyCarpoolData);
|
||||
const [creationStatus, setCreationStatus] =
|
||||
useState<null | 'pending' | 'completed' | 'errored'>(null);
|
||||
const me = useMe()!;
|
||||
|
@ -100,7 +80,7 @@ export default function Carpools({ event }: { event: IEvent }) {
|
|||
? 'Created!'
|
||||
: 'Errored'}
|
||||
</UIButton>
|
||||
{carpools.map((carpool) => (
|
||||
{event.carpools.map((carpool) => (
|
||||
<CarpoolRow carpool={carpool} key={carpool.id} />
|
||||
))}
|
||||
</div>
|
||||
|
|
|
@ -57,6 +57,14 @@ export type IEvent = {
|
|||
id: number;
|
||||
name: string;
|
||||
};
|
||||
carpools: {
|
||||
id: number;
|
||||
name: string;
|
||||
members: {
|
||||
id: number;
|
||||
name: string;
|
||||
};
|
||||
}[];
|
||||
startTime: string; // Datestring
|
||||
duration: number;
|
||||
endTime: string | null; // Datestring
|
||||
|
|
Loading…
Reference in New Issue
Block a user