From de1c2f78d3ad832ead425ef199cd747d74098c31 Mon Sep 17 00:00:00 2001 From: Hugo Gresse Date: Thu, 6 Aug 2020 23:01:12 +0200 Subject: [PATCH] Replace ical usage in Event listing (#19) --- src/organisations/org/event/Event.js | 12 ++++++------ src/organisations/org/event/PassedEvents.js | 8 ++------ src/organisations/org/event/UpcomingEvents.js | 8 ++------ 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/organisations/org/event/Event.js b/src/organisations/org/event/Event.js index c1e737c..01a557a 100644 --- a/src/organisations/org/event/Event.js +++ b/src/organisations/org/event/Event.js @@ -8,17 +8,17 @@ import Button from '@material-ui/core/Button' import AddToCalendar from '@culturehq/add-to-calendar' import './AddToCalendar.css' -const Event = ({ ical, event }) => { +const Event = ({ event }) => { const date = new Date(event.startDate) - const exportedEvent = getEventForExport(ical, event) + const exportedEvent = getEventForExport(event) return ( <> - {ical && ical.name} + {event.icalName} {event.title} @@ -93,13 +93,13 @@ const Event = ({ ical, event }) => { ) } -const getEventForExport = (ical, event) => { +const getEventForExport = event => { const startDate = new Date(event.startDate) const endDate = new Date(event.endDate) const data = { - name: `${event.title} - ${ical.name}`, - details: `${event.title} - ${ical.name}`, + name: `${event.title} - ${event.icalName}`, + details: `${event.title} - ${event.icalName}`, startsAt: startDate.toISOString(), endsAt: endDate.toISOString(), } diff --git a/src/organisations/org/event/PassedEvents.js b/src/organisations/org/event/PassedEvents.js index 1a98aa7..cc15500 100644 --- a/src/organisations/org/event/PassedEvents.js +++ b/src/organisations/org/event/PassedEvents.js @@ -16,7 +16,7 @@ import Box from '@material-ui/core/Box' const PassedEvents = ({ token }) => { const [ { - selectedOrganization: { id, icals, events, eventsLoading }, + selectedOrganization: { id, events, eventsLoading }, }, ] = useStateValue() @@ -40,11 +40,7 @@ const PassedEvents = ({ token }) => { )} {passedEvents.map(event => ( - event.icalId === ical.id)[0]} - event={event} - /> + ))} {passedEvents.length === 0 && ( diff --git a/src/organisations/org/event/UpcomingEvents.js b/src/organisations/org/event/UpcomingEvents.js index a19499f..a7baaaf 100644 --- a/src/organisations/org/event/UpcomingEvents.js +++ b/src/organisations/org/event/UpcomingEvents.js @@ -16,7 +16,7 @@ import CircularProgress from '@material-ui/core/CircularProgress' const UpcomingEvents = ({ token }) => { const [ { - selectedOrganization: { id, icals, events, eventsLoading }, + selectedOrganization: { id, events, eventsLoading }, }, ] = useStateValue() @@ -40,11 +40,7 @@ const UpcomingEvents = ({ token }) => { )} {upcomingEvents.map(event => ( - event.icalId === ical.id)[0]} - event={event} - /> + ))} {upcomingEvents.length === 0 && (