mirror of
https://github.com/myfatemi04/wheelshare-frontend.git
synced 2025-04-17 17:40:16 -04:00
improve intracarpool ui
This commit is contained in:
parent
8739d84b7b
commit
4084bcfd24
|
@ -205,9 +205,6 @@ export default function Carpool({ id }: { id: number }) {
|
||||||
{isCreator
|
{isCreator
|
||||||
? 'You are the creator of this carpool.'
|
? 'You are the creator of this carpool.'
|
||||||
: `${creatorName} is the creator of this carpool`}
|
: `${creatorName} is the creator of this carpool`}
|
||||||
<UILink href={'/events/' + carpool.event.id}>
|
|
||||||
{carpool.event.name}
|
|
||||||
</UILink>
|
|
||||||
<CarpoolTopButtons />
|
<CarpoolTopButtons />
|
||||||
<CarpoolDetails />
|
<CarpoolDetails />
|
||||||
<Members>
|
<Members>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import EventIcon from '@material-ui/icons/Event';
|
import EventIcon from '@material-ui/icons/Event';
|
||||||
import LocationOnIcon from '@material-ui/icons/LocationOn';
|
import LocationOnIcon from '@material-ui/icons/LocationOn';
|
||||||
import { useCallback } from 'react';
|
import { useCallback, useContext, useMemo } from 'react';
|
||||||
import { useContext } from 'react';
|
import formatStartAndEndTime from '../../lib/dates';
|
||||||
import { setCarpoolNote } from '../api';
|
import { setCarpoolNote } from '../api';
|
||||||
|
import UILink from '../UI/UILink';
|
||||||
import { CarpoolContext } from './Carpool';
|
import { CarpoolContext } from './Carpool';
|
||||||
import CarpoolNote from './CarpoolNote';
|
import CarpoolNote from './CarpoolNote';
|
||||||
|
|
||||||
|
@ -17,14 +17,36 @@ export default function CarpoolDetails() {
|
||||||
},
|
},
|
||||||
[carpool]
|
[carpool]
|
||||||
);
|
);
|
||||||
|
const startTime = carpool.event.startTime;
|
||||||
|
const endTime = useMemo(
|
||||||
|
() =>
|
||||||
|
startTime
|
||||||
|
? new Date(new Date(startTime).getTime() + carpool.event.duration * 60)
|
||||||
|
: null,
|
||||||
|
[carpool.event.duration, startTime]
|
||||||
|
);
|
||||||
|
const formattedDate = useMemo(() => {
|
||||||
|
if (startTime) {
|
||||||
|
if (endTime) {
|
||||||
|
return formatStartAndEndTime(startTime, endTime.toISOString());
|
||||||
|
} else {
|
||||||
|
return new Date(startTime).toLocaleString();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}, [startTime, endTime]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ width: '80%' }}>
|
<div style={{ width: '80%' }}>
|
||||||
|
<h3>Event Details</h3>
|
||||||
|
<UILink href={'/events/' + carpool.event.id}>{carpool.event.name}</UILink>
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
color: '#303030',
|
color: '#303030',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
|
marginTop: '1rem',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<LocationOnIcon style={{ marginRight: '1rem' }} />
|
<LocationOnIcon style={{ marginRight: '1rem' }} />
|
||||||
|
@ -38,7 +60,7 @@ export default function CarpoolDetails() {
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<EventIcon style={{ marginRight: '1rem' }} />
|
<EventIcon style={{ marginRight: '1rem' }} />
|
||||||
DAWN - DUSK
|
{formattedDate && `${formattedDate}`}
|
||||||
</div>
|
</div>
|
||||||
<CarpoolNote note={carpool.note} setNote={onSaveCarpoolNote} />
|
<CarpoolNote note={carpool.note} setNote={onSaveCarpoolNote} />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -32,9 +32,7 @@ export default function CarpoolNote({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ margin: '1rem 0rem', maxWidth: '100%' }}>
|
<div style={{ margin: '1rem 0rem', maxWidth: '100%' }}>
|
||||||
<b>Note</b>
|
<h3>Description</h3>
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
{editing ? (
|
{editing ? (
|
||||||
<div>
|
<div>
|
||||||
<UITextInput
|
<UITextInput
|
||||||
|
|
|
@ -24,6 +24,9 @@ export type ICarpool = {
|
||||||
latitude: number;
|
latitude: number;
|
||||||
longitude: number;
|
longitude: number;
|
||||||
placeId: string;
|
placeId: string;
|
||||||
|
startTime: string | null;
|
||||||
|
endTime: string | null;
|
||||||
|
duration: number;
|
||||||
};
|
};
|
||||||
creatorId: number;
|
creatorId: number;
|
||||||
members: {
|
members: {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user