aboutsummaryrefslogtreecommitdiff
path: root/src/components/EventCard/EventCard.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/EventCard/EventCard.tsx')
-rw-r--r--src/components/EventCard/EventCard.tsx20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/components/EventCard/EventCard.tsx b/src/components/EventCard/EventCard.tsx
index 08b67bb..e131b8c 100644
--- a/src/components/EventCard/EventCard.tsx
+++ b/src/components/EventCard/EventCard.tsx
@@ -48,10 +48,12 @@ const EventCard: React.FC<PropTypes> = ({ event, mutate }) => {
const classes = useStyles();
const { user } = useAuth();
const {
+ name,
+ schedule,
status,
- data: {
- name,
- date,
+ nextRunAt,
+ lastRunAt,
+ context: {
participants,
conferenceId,
attendanceId
@@ -62,9 +64,11 @@ const EventCard: React.FC<PropTypes> = ({ event, mutate }) => {
const handleJoin = () => {
if (user) {
- const update = { data: { participants: [...participants, user.username] }};
+ const { context } = event;
+ context.participants.push(user.username);
+
return requests
- .patch(`/events/${event._id}`, update)
+ .patch(`/events/${event._id}`, { context })
.then(() => mutate());
}
};
@@ -81,14 +85,16 @@ const EventCard: React.FC<PropTypes> = ({ event, mutate }) => {
{status === 'running' && <RunningIcon className={classes.running}/>}
{status === 'complete' && <CompleteIcon className={classes.complete} />}
{status === 'failed' && <FailedIcon color="error" />}
- {!status && <NotStartedIcon color="disabled" />}
+ {status === 'notStarted' && <NotStartedIcon color="disabled" />}
</div>
);
return (
<Card variant="outlined">
- <CardHeader title={title} subheader={date} />
+ <CardHeader title={title} subheader={schedule} />
<CardContent>
+ {nextRunAt && <div> Next run at: {new Date(nextRunAt).toLocaleTimeString()} </div>}
+ {lastRunAt && <div> Last run at: {new Date(lastRunAt).toLocaleTimeString()} </div>}
{conferenceId && <div> ConferenceID: {conferenceId} </div>}
{attendanceId && <div> AttendanceID: {attendanceId} </div>}
<div>