mirror of
https://github.com/myfatemi04/wheelshare-frontend.git
synced 2025-04-21 11:20:17 -04:00
Fix rendering bug
This commit is contained in:
parent
0c2032f9da
commit
89de41967a
|
@ -6,7 +6,7 @@ import {
|
||||||
} from '../api';
|
} from '../api';
|
||||||
import { green, lightgrey } from '../colors';
|
import { green, lightgrey } from '../colors';
|
||||||
import { useMe } from '../hooks';
|
import { useMe } from '../hooks';
|
||||||
import { IEventSignup } from '../types';
|
import { IEvent, IEventSignup } from '../types';
|
||||||
import UIButton from '../UI/UIButton';
|
import UIButton from '../UI/UIButton';
|
||||||
import UIPlacesAutocomplete from '../UI/UIPlacesAutocomplete';
|
import UIPlacesAutocomplete from '../UI/UIPlacesAutocomplete';
|
||||||
import UISecondaryBox from '../UI/UISecondaryBox';
|
import UISecondaryBox from '../UI/UISecondaryBox';
|
||||||
|
@ -16,17 +16,6 @@ import EventCarpools from './EventCarpools';
|
||||||
import EventDetails from './EventDetails';
|
import EventDetails from './EventDetails';
|
||||||
import EventSignups from './EventSignups';
|
import EventSignups from './EventSignups';
|
||||||
|
|
||||||
export type IEvent = {
|
|
||||||
id: number;
|
|
||||||
name: string;
|
|
||||||
group: string;
|
|
||||||
formattedAddress: string;
|
|
||||||
startTime: string;
|
|
||||||
endTime: string;
|
|
||||||
latitude: number;
|
|
||||||
longitude: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
function GroupName({ name }: { name: string }) {
|
function GroupName({ name }: { name: string }) {
|
||||||
return <span style={{ color: '#303030', textAlign: 'center' }}>{name}</span>;
|
return <span style={{ color: '#303030', textAlign: 'center' }}>{name}</span>;
|
||||||
}
|
}
|
||||||
|
@ -108,7 +97,7 @@ export default function Event({ event }: { event: IEvent }) {
|
||||||
return (
|
return (
|
||||||
<UISecondaryBox>
|
<UISecondaryBox>
|
||||||
<UISecondaryHeader>{name}</UISecondaryHeader>
|
<UISecondaryHeader>{name}</UISecondaryHeader>
|
||||||
<GroupName name={group} />
|
<GroupName name={group.name} />
|
||||||
<EventDetails {...{ startTime, endTime, formattedAddress }} />
|
<EventDetails {...{ startTime, endTime, formattedAddress }} />
|
||||||
<UIButton
|
<UIButton
|
||||||
onClick={toggleInterestedThrottled}
|
onClick={toggleInterestedThrottled}
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
// import CallMergeIcon from '@material-ui/icons/CallMerge';
|
// import CallMergeIcon from '@material-ui/icons/CallMerge';
|
||||||
import EmojiPeopleIcon from '@material-ui/icons/EmojiPeople';
|
import EmojiPeopleIcon from '@material-ui/icons/EmojiPeople';
|
||||||
import { useCallback } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
// import ScheduleIcon from '@material-ui/icons/Schedule';
|
|
||||||
import { 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 } from '../types';
|
import { ICarpool, IEvent } from '../types';
|
||||||
import UIButton from '../UI/UIButton';
|
import UIButton from '../UI/UIButton';
|
||||||
import { IEvent } from './Event';
|
|
||||||
|
|
||||||
function CarpoolRow({ carpool }: { carpool: ICarpool }) {
|
function CarpoolRow({ carpool }: { carpool: ICarpool }) {
|
||||||
const PADDING = '1rem';
|
const PADDING = '1rem';
|
||||||
|
|
|
@ -8,7 +8,7 @@ export default function Details({
|
||||||
formattedAddress,
|
formattedAddress,
|
||||||
}: {
|
}: {
|
||||||
startTime: string;
|
startTime: string;
|
||||||
endTime: string;
|
endTime: string | null;
|
||||||
formattedAddress: string;
|
formattedAddress: string;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
|
@ -27,7 +27,9 @@ export default function Details({
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<EventIcon style={{ marginRight: '1rem' }} />
|
<EventIcon style={{ marginRight: '1rem' }} />
|
||||||
{formatStartAndEndTime(startTime, endTime)}
|
{endTime
|
||||||
|
? formatStartAndEndTime(startTime, endTime)
|
||||||
|
: new Date(startTime).toLocaleString()}
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
import PersonAddIcon from '@material-ui/icons/PersonAdd';
|
import PersonAddIcon from '@material-ui/icons/PersonAdd';
|
||||||
import { useMe } from '../hooks';
|
import { useMe } from '../hooks';
|
||||||
import latlongdist, { R_miles } from '../latlongdist';
|
import latlongdist, { R_miles } from '../latlongdist';
|
||||||
import { IEventSignup } from '../types';
|
import { IEventSignup, IEvent } from '../types';
|
||||||
import usePlace from '../usePlace';
|
import usePlace from '../usePlace';
|
||||||
import { IEvent } from './Event';
|
|
||||||
|
|
||||||
export default function EventSignups({
|
export default function EventSignups({
|
||||||
event,
|
event,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import Event, { IEvent } from './Event/Event';
|
import Event from './Event/Event';
|
||||||
|
import { IEvent } from './types';
|
||||||
|
|
||||||
export default function EventStream({ events }: { events: IEvent[] }) {
|
export default function EventStream({ events }: { events: IEvent[] }) {
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { getEvents } from './api';
|
import { getEvents } from './api';
|
||||||
import { IEvent } from './Event/Event';
|
import { IEvent } from './types';
|
||||||
import EventStream from './EventStream';
|
import EventStream from './EventStream';
|
||||||
|
|
||||||
export default function Events() {
|
export default function Events() {
|
||||||
|
|
|
@ -2,10 +2,10 @@ import { useEffect, useState } from 'react';
|
||||||
import { useParams } from 'react-router';
|
import { useParams } from 'react-router';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { getGroup, getGroupEvents } from './api';
|
import { getGroup, getGroupEvents } from './api';
|
||||||
import { IEvent } from './Event/Event';
|
|
||||||
import EventCreatorLink from './EventCreator/EventCreatorLink';
|
import EventCreatorLink from './EventCreator/EventCreatorLink';
|
||||||
import EventStream from './EventStream';
|
import EventStream from './EventStream';
|
||||||
import GroupSettingsLink from './GroupSettings/GroupSettingsLink';
|
import GroupSettingsLink from './GroupSettings/GroupSettingsLink';
|
||||||
|
import { IEvent } from './types';
|
||||||
import UILink from './UI/UILink';
|
import UILink from './UI/UILink';
|
||||||
|
|
||||||
export type IGroup = {
|
export type IGroup = {
|
||||||
|
|
|
@ -53,9 +53,13 @@ export type IEvent = {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
groupId: number;
|
groupId: number;
|
||||||
startTime: Date;
|
group: {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
};
|
||||||
|
startTime: string; // Datestring
|
||||||
duration: number;
|
duration: number;
|
||||||
endTime: Date | null;
|
endTime: string | null; // Datestring
|
||||||
daysOfWeek: number;
|
daysOfWeek: number;
|
||||||
placeId: string;
|
placeId: string;
|
||||||
formattedAddress: string;
|
formattedAddress: string;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user