diff --git a/frontend/src/App/State/CalendarAppState.ts b/frontend/src/App/State/CalendarAppState.ts index d439c62b59..0fcf1692da 100644 --- a/frontend/src/App/State/CalendarAppState.ts +++ b/frontend/src/App/State/CalendarAppState.ts @@ -7,6 +7,9 @@ import { CalendarItem } from 'typings/Calendar'; interface CalendarOptions { showMovieInformation: boolean; + showCinemaRelease: boolean; + showDigitalRelease: boolean; + showPhysicalRelease: boolean; showCutoffUnmetIcon: boolean; fullColorEvents: boolean; } diff --git a/frontend/src/Calendar/CalendarPage.tsx b/frontend/src/Calendar/CalendarPage.tsx index 0c78a62109..96e59cc444 100644 --- a/frontend/src/Calendar/CalendarPage.tsx +++ b/frontend/src/Calendar/CalendarPage.tsx @@ -48,9 +48,10 @@ function createMissingMovieIdsSelector() { if ( !movie.movieFileId && + inCinemas && moment(inCinemas).isAfter(start) && moment(inCinemas).isBefore(end) && - isBefore(movie.inCinemas) && + isBefore(inCinemas) && !queueDetails.some( (details) => !!details.movie && details.movie.id === movie.id ) diff --git a/frontend/src/Calendar/Day/CalendarDay.tsx b/frontend/src/Calendar/Day/CalendarDay.tsx index 5ccc892672..1f02df3459 100644 --- a/frontend/src/Calendar/Day/CalendarDay.tsx +++ b/frontend/src/Calendar/Day/CalendarDay.tsx @@ -21,27 +21,29 @@ function sort(items: CalendarEventModel[]) { function createCalendarEventsConnector(date: string) { return createSelector( (state: AppState) => state.calendar.items, - (items) => { + (state: AppState) => state.calendar.options, + (items, options) => { + const { showCinemaRelease, showDigitalRelease, showPhysicalRelease } = + options; const momentDate = moment(date); const filtered = items.filter( ({ inCinemas, digitalRelease, physicalRelease }) => { return ( - (inCinemas && momentDate.isSame(moment(inCinemas), 'day')) || - (digitalRelease && + (showCinemaRelease && + inCinemas && + momentDate.isSame(moment(inCinemas), 'day')) || + (showDigitalRelease && + digitalRelease && momentDate.isSame(moment(digitalRelease), 'day')) || - (physicalRelease && + (showPhysicalRelease && + physicalRelease && momentDate.isSame(moment(physicalRelease), 'day')) ); } ); - return sort( - filtered.map((item) => ({ - isGroup: false, - ...item, - })) - ); + return sort(filtered); } ); } diff --git a/frontend/src/Calendar/Events/CalendarEvent.tsx b/frontend/src/Calendar/Events/CalendarEvent.tsx index 117130b18c..c4800fceca 100644 --- a/frontend/src/Calendar/Events/CalendarEvent.tsx +++ b/frontend/src/Calendar/Events/CalendarEvent.tsx @@ -52,8 +52,14 @@ function CalendarEvent({ const { enableColorImpairedMode } = useSelector(createUISettingsSelector()); - const { showMovieInformation, showCutoffUnmetIcon, fullColorEvents } = - useSelector((state: AppState) => state.calendar.options); + const { + showMovieInformation, + showCinemaRelease, + showDigitalRelease, + showPhysicalRelease, + showCutoffUnmetIcon, + fullColorEvents, + } = useSelector((state: AppState) => state.calendar.options); const isDownloading = !!(queueItem || grabbed); const statusStyle = getStatusStyle( @@ -70,20 +76,40 @@ function CalendarEvent({ const types = []; - if (inCinemas && momentDate.isSame(moment(inCinemas), 'day')) { + if ( + showCinemaRelease && + inCinemas && + momentDate.isSame(moment(inCinemas), 'day') + ) { types.push('Cinemas'); } - if (digitalRelease && momentDate.isSame(moment(digitalRelease), 'day')) { + if ( + showDigitalRelease && + digitalRelease && + momentDate.isSame(moment(digitalRelease), 'day') + ) { types.push('Digital'); } - if (physicalRelease && momentDate.isSame(moment(physicalRelease), 'day')) { + if ( + showPhysicalRelease && + physicalRelease && + momentDate.isSame(moment(physicalRelease), 'day') + ) { types.push('Physical'); } return types; - }, [date, inCinemas, digitalRelease, physicalRelease]); + }, [ + date, + showCinemaRelease, + showDigitalRelease, + showPhysicalRelease, + inCinemas, + digitalRelease, + physicalRelease, + ]); return (
state.calendar.options); + const { + showMovieInformation, + showCinemaRelease, + showDigitalRelease, + showPhysicalRelease, + showCutoffUnmetIcon, + fullColorEvents, + } = useSelector((state: AppState) => state.calendar.options); const uiSettings = useSelector(createUISettingsSelector()); @@ -96,6 +102,57 @@ function CalendarOptionsModalContent({ /> + + {translate('ShowCinemaRelease')} + + + + + + {translate('ShowDigitalRelease')} + + + + + + {translate('ShowPhysicalRelease')} + + + + {translate('IconForCutoffUnmet')} diff --git a/frontend/src/Store/Actions/calendarActions.js b/frontend/src/Store/Actions/calendarActions.js index ffcd540b5d..a43424a13e 100644 --- a/frontend/src/Store/Actions/calendarActions.js +++ b/frontend/src/Store/Actions/calendarActions.js @@ -43,6 +43,9 @@ export const defaultState = { options: { showMovieInformation: true, + showCinemaRelease: true, + showDigitalRelease: true, + showPhysicalRelease: true, showCutoffUnmetIcon: false, fullColorEvents: false }, diff --git a/src/NzbDrone.Core/Localization/Core/en.json b/src/NzbDrone.Core/Localization/Core/en.json index 9fbef0ecec..69fdcf96d5 100644 --- a/src/NzbDrone.Core/Localization/Core/en.json +++ b/src/NzbDrone.Core/Localization/Core/en.json @@ -1762,10 +1762,14 @@ "ShortDateFormat": "Short Date Format", "ShowAdvanced": "Show Advanced", "ShowCertification": "Show Certification", + "ShowCinemaRelease": "Show Cinema Release", + "ShowCinemaReleaseCalendarHelpText": "Show cinema releases in the calendar events", "ShowCinemaReleaseDate": "Show Cinema Release Date", "ShowCinemaReleaseDatePosterHelpText": "Show cinema release date under poster", "ShowCollectionDetails": "Show Collection Status", "ShowDateAdded": "Show Date Added", + "ShowDigitalRelease": "Show Digital Release", + "ShowDigitalReleaseCalendarHelpText": "Show digital releases in the calendar events", "ShowDigitalReleaseDate": "Show Digital Release Date", "ShowDigitalReleaseDatePosterHelpText": "Show digital release date under poster", "ShowGenres": "Show Genres", @@ -1777,6 +1781,8 @@ "ShowMovieInformationHelpText": "Show movie genres and certification", "ShowOverview": "Show Overview", "ShowPath": "Show Path", + "ShowPhysicalRelease": "Show Physical Release", + "ShowPhysicalReleaseCalendarHelpText": "Show physical releases in the calendar events", "ShowPhysicalReleaseDate": "Show Physical Release Date", "ShowPhysicalReleaseDatePosterHelpText": "Show physical release date under poster", "ShowPosters": "Show Posters",