started adding new option for cinema release

This commit is contained in:
Robin Dadswell 2021-01-12 20:34:40 +00:00 committed by Qstick
parent 11b4967629
commit efd3aad6b0
3 changed files with 45 additions and 11 deletions

View File

@ -103,6 +103,7 @@ class MovieIndexPoster extends Component {
showRelativeDates, showRelativeDates,
shortDateFormat, shortDateFormat,
showReleaseDate, showReleaseDate,
showCinemaRelease,
inCinemas, inCinemas,
physicalRelease, physicalRelease,
digitalRelease, digitalRelease,
@ -133,17 +134,13 @@ class MovieIndexPoster extends Component {
}; };
let releaseDate = ''; let releaseDate = '';
if (showReleaseDate) {
releaseDate = inCinemas; if (physicalRelease && digitalRelease) {
if (!inCinemas) { releaseDate = (physicalRelease < digitalRelease) ? physicalRelease : digitalRelease;
if (physicalRelease && digitalRelease) { } else if (physicalRelease && !digitalRelease) {
releaseDate = (physicalRelease < digitalRelease) ? physicalRelease : digitalRelease; releaseDate = physicalRelease;
} else if (physicalRelease && !digitalRelease) { } else if (digitalRelease && !physicalRelease) {
releaseDate = physicalRelease; releaseDate = digitalRelease;
} else if (digitalRelease && !physicalRelease) {
releaseDate = digitalRelease;
}
}
} }
return ( return (
@ -272,6 +269,21 @@ class MovieIndexPoster extends Component {
</div> </div>
} }
{
showCinemaRelease &&
<div className={styles.title}>
{getRelativeDate(
inCinemas,
shortDateFormat,
showRelativeDates,
{
timeFormat,
timeForToday: false
}
)}
</div>
}
{ {
showReleaseDate && showReleaseDate &&
<div className={styles.title}> <div className={styles.title}>
@ -336,6 +348,7 @@ MovieIndexPoster.propTypes = {
showSearchAction: PropTypes.bool.isRequired, showSearchAction: PropTypes.bool.isRequired,
showRelativeDates: PropTypes.bool.isRequired, showRelativeDates: PropTypes.bool.isRequired,
shortDateFormat: PropTypes.string.isRequired, shortDateFormat: PropTypes.string.isRequired,
showCinemaRelease: PropTypes.bool.isRequired,
showReleaseDate: PropTypes.bool.isRequired, showReleaseDate: PropTypes.bool.isRequired,
inCinemas: PropTypes.string, inCinemas: PropTypes.string,
physicalRelease: PropTypes.string, physicalRelease: PropTypes.string,

View File

@ -212,6 +212,7 @@ class MovieIndexPosters extends Component {
showTitle, showTitle,
showMonitored, showMonitored,
showQualityProfile, showQualityProfile,
showCinemaRelease,
showReleaseDate showReleaseDate
} = posterOptions; } = posterOptions;
@ -242,6 +243,7 @@ class MovieIndexPosters extends Component {
showMonitored={showMonitored} showMonitored={showMonitored}
showQualityProfile={showQualityProfile} showQualityProfile={showQualityProfile}
showReleaseDate={showReleaseDate} showReleaseDate={showReleaseDate}
showCinemaRelease={showCinemaRelease}
showRelativeDates={showRelativeDates} showRelativeDates={showRelativeDates}
shortDateFormat={shortDateFormat} shortDateFormat={shortDateFormat}
timeFormat={timeFormat} timeFormat={timeFormat}

View File

@ -33,6 +33,7 @@ class MovieIndexPosterOptionsModalContent extends Component {
showTitle: props.showTitle, showTitle: props.showTitle,
showMonitored: props.showMonitored, showMonitored: props.showMonitored,
showQualityProfile: props.showQualityProfile, showQualityProfile: props.showQualityProfile,
showCinemaRelease: props.showCinemaRelease,
showReleaseDate: props.showReleaseDate, showReleaseDate: props.showReleaseDate,
showSearchAction: props.showSearchAction showSearchAction: props.showSearchAction
}; };
@ -71,6 +72,10 @@ class MovieIndexPosterOptionsModalContent extends Component {
state.showQualityProfile = showQualityProfile; state.showQualityProfile = showQualityProfile;
} }
if (showCinemaRelease != prevProps.showCinemaRelease) {
state.showCinemaRelease = showCinemaRelease;
}
if (showReleaseDate !== prevProps.showReleaseDate) { if (showReleaseDate !== prevProps.showReleaseDate) {
state.showReleaseDate = showReleaseDate; state.showReleaseDate = showReleaseDate;
} }
@ -109,6 +114,7 @@ class MovieIndexPosterOptionsModalContent extends Component {
showTitle, showTitle,
showMonitored, showMonitored,
showQualityProfile, showQualityProfile,
showCinemaRelease,
showReleaseDate, showReleaseDate,
showSearchAction showSearchAction
} = this.state; } = this.state;
@ -181,6 +187,18 @@ class MovieIndexPosterOptionsModalContent extends Component {
/> />
</FormGroup> </FormGroup>
<FormGroup>
<FormLabel>{translate('ShowCinemaRelease')}</FormLabel>
<FormInputGroup
type={inputTypes.CHECK}
name="showCinemaRelease"
value={showCinemaRelease}
helpText={translate('showCinemaReleaseHelpText')}
onChange={this.onChangePosterOption}
/>
</FormGroup>
<FormGroup> <FormGroup>
<FormLabel>{translate('ShowReleaseDate')}</FormLabel> <FormLabel>{translate('ShowReleaseDate')}</FormLabel>
@ -225,6 +243,7 @@ MovieIndexPosterOptionsModalContent.propTypes = {
showMonitored: PropTypes.bool.isRequired, showMonitored: PropTypes.bool.isRequired,
showQualityProfile: PropTypes.bool.isRequired, showQualityProfile: PropTypes.bool.isRequired,
detailedProgressBar: PropTypes.bool.isRequired, detailedProgressBar: PropTypes.bool.isRequired,
showCinemaRelease: PropTypes.bool.isRequired,
showReleaseDate: PropTypes.bool.isRequired, showReleaseDate: PropTypes.bool.isRequired,
showSearchAction: PropTypes.bool.isRequired, showSearchAction: PropTypes.bool.isRequired,
onChangePosterOption: PropTypes.func.isRequired, onChangePosterOption: PropTypes.func.isRequired,