1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-27 18:30:45 +00:00

Fix: Address issue with incorrect dates showing on the calendar agenda and add icons for which date type it is

This commit is contained in:
nitsua 2020-09-12 21:39:46 -04:00 committed by Qstick
parent 0100819ae4
commit ff3fd0bb1e
3 changed files with 51 additions and 11 deletions

View file

@ -90,3 +90,8 @@
flex: 0 0 100%; flex: 0 0 100%;
} }
} }
.dateIcon {
display: inline;
margin-right: 10px;
}

View file

@ -44,6 +44,8 @@ class AgendaEvent extends Component {
genres, genres,
isAvailable, isAvailable,
inCinemas, inCinemas,
digitalRelease,
physicalRelease,
monitored, monitored,
hasFile, hasFile,
grabbed, grabbed,
@ -52,10 +54,29 @@ class AgendaEvent extends Component {
showMovieInformation, showMovieInformation,
showCutoffUnmetIcon, showCutoffUnmetIcon,
longDateFormat, longDateFormat,
colorImpairedMode colorImpairedMode,
startDate,
endDate
} = this.props; } = 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 downloading = !!(queueItem || grabbed);
const isMonitored = monitored; const isMonitored = monitored;
const statusStyle = getStatusStyle(hasFile, downloading, isAvailable, isMonitored); const statusStyle = getStatusStyle(hasFile, downloading, isAvailable, isMonitored);
@ -71,12 +92,18 @@ class AgendaEvent extends Component {
)} )}
to={link} to={link}
> >
<div className={styles.date}>
{ {
showDate && showDate &&
startTime.format(longDateFormat) <div className={styles.date}>
} <div className={styles.dateIcon}>
<Icon
name={releaseIcon}
kind={kinds.DEFAULT}
/>
</div> </div>
{startTime.format(longDateFormat)}
</div>
}
<div <div
className={classNames( className={classNames(
@ -140,6 +167,8 @@ AgendaEvent.propTypes = {
genres: PropTypes.arrayOf(PropTypes.string).isRequired, genres: PropTypes.arrayOf(PropTypes.string).isRequired,
isAvailable: PropTypes.bool.isRequired, isAvailable: PropTypes.bool.isRequired,
inCinemas: PropTypes.string, inCinemas: PropTypes.string,
digitalRelease: PropTypes.string,
physicalRelease: PropTypes.string,
monitored: PropTypes.bool.isRequired, monitored: PropTypes.bool.isRequired,
hasFile: PropTypes.bool.isRequired, hasFile: PropTypes.bool.isRequired,
grabbed: PropTypes.bool, grabbed: PropTypes.bool,
@ -149,7 +178,9 @@ AgendaEvent.propTypes = {
showCutoffUnmetIcon: PropTypes.bool.isRequired, showCutoffUnmetIcon: PropTypes.bool.isRequired,
timeFormat: PropTypes.string.isRequired, timeFormat: PropTypes.string.isRequired,
longDateFormat: PropTypes.string.isRequired, longDateFormat: PropTypes.string.isRequired,
colorImpairedMode: PropTypes.bool.isRequired colorImpairedMode: PropTypes.bool.isRequired,
startDate: PropTypes.date,
endDate: PropTypes.date
}; };
AgendaEvent.defaultProps = { AgendaEvent.defaultProps = {

View file

@ -13,7 +13,9 @@ function createMapStateToProps() {
createMovieFileSelector(), createMovieFileSelector(),
createQueueItemSelector(), createQueueItemSelector(),
createUISettingsSelector(), createUISettingsSelector(),
(calendarOptions, movie, movieFile, queueItem, uiSettings) => { (state) => state.calendar.start,
(state) => state.calendar.end,
(calendarOptions, movie, movieFile, queueItem, uiSettings, startDate, endDate) => {
return { return {
movie, movie,
movieFile, movieFile,
@ -21,7 +23,9 @@ function createMapStateToProps() {
...calendarOptions, ...calendarOptions,
timeFormat: uiSettings.timeFormat, timeFormat: uiSettings.timeFormat,
longDateFormat: uiSettings.longDateFormat, longDateFormat: uiSettings.longDateFormat,
colorImpairedMode: uiSettings.enableColorImpairedMode colorImpairedMode: uiSettings.enableColorImpairedMode,
startDate,
endDate
}; };
} }
); );