From ff3fd0bb1ebe485daa7ca7781dadf8d15854fc6c Mon Sep 17 00:00:00 2001 From: nitsua Date: Sat, 12 Sep 2020 21:39:46 -0400 Subject: [PATCH] Fix: Address issue with incorrect dates showing on the calendar agenda and add icons for which date type it is --- frontend/src/Calendar/Agenda/AgendaEvent.css | 5 ++ frontend/src/Calendar/Agenda/AgendaEvent.js | 49 +++++++++++++++---- .../Calendar/Agenda/AgendaEventConnector.js | 8 ++- 3 files changed, 51 insertions(+), 11 deletions(-) diff --git a/frontend/src/Calendar/Agenda/AgendaEvent.css b/frontend/src/Calendar/Agenda/AgendaEvent.css index 2b39f677b..af2cbde38 100644 --- a/frontend/src/Calendar/Agenda/AgendaEvent.css +++ b/frontend/src/Calendar/Agenda/AgendaEvent.css @@ -90,3 +90,8 @@ flex: 0 0 100%; } } + +.dateIcon { + display: inline; + margin-right: 10px; +} diff --git a/frontend/src/Calendar/Agenda/AgendaEvent.js b/frontend/src/Calendar/Agenda/AgendaEvent.js index f0216c9a4..e7115dee7 100644 --- a/frontend/src/Calendar/Agenda/AgendaEvent.js +++ b/frontend/src/Calendar/Agenda/AgendaEvent.js @@ -44,6 +44,8 @@ class AgendaEvent extends Component { genres, isAvailable, inCinemas, + digitalRelease, + physicalRelease, monitored, hasFile, grabbed, @@ -52,10 +54,29 @@ class AgendaEvent extends Component { showMovieInformation, showCutoffUnmetIcon, longDateFormat, - colorImpairedMode + colorImpairedMode, + startDate, + endDate } = this.props; - const startTime = moment(inCinemas); + const agendaStart = Date.parse(startDate); + const agendaEnd = Date.parse(endDate); + const cinemaDate = Date.parse(inCinemas); + const digitalDate = Date.parse(digitalRelease); + let startTime = physicalRelease; + let releaseIcon = icons.DISC; + + if (digitalDate >= agendaStart && digitalDate <= agendaEnd) { + startTime = digitalRelease; + releaseIcon = icons.MOVIE_FILE; + } + + if (cinemaDate >= agendaStart && cinemaDate <= agendaEnd) { + startTime = inCinemas; + releaseIcon = icons.IN_CINEMAS; + } + + startTime = moment(startTime); const downloading = !!(queueItem || grabbed); const isMonitored = monitored; const statusStyle = getStatusStyle(hasFile, downloading, isAvailable, isMonitored); @@ -71,12 +92,18 @@ class AgendaEvent extends Component { )} to={link} > -
- { - showDate && - startTime.format(longDateFormat) - } -
+ { + showDate && +
+
+ +
+ {startTime.format(longDateFormat)} +
+ }
{ + (state) => state.calendar.start, + (state) => state.calendar.end, + (calendarOptions, movie, movieFile, queueItem, uiSettings, startDate, endDate) => { return { movie, movieFile, @@ -21,7 +23,9 @@ function createMapStateToProps() { ...calendarOptions, timeFormat: uiSettings.timeFormat, longDateFormat: uiSettings.longDateFormat, - colorImpairedMode: uiSettings.enableColorImpairedMode + colorImpairedMode: uiSettings.enableColorImpairedMode, + startDate, + endDate }; } );