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

View File

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

View File

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