Fixed: (UI) Show release dates when enabled

pull/8639/head
Bogdan 1 year ago
parent 8eee5a3b1d
commit e0448f7213

@ -16,6 +16,7 @@ import MovieIndexPosterSelect from 'Movie/Index/Select/MovieIndexPosterSelect';
import MoviePoster from 'Movie/MoviePoster'; import MoviePoster from 'Movie/MoviePoster';
import { executeCommand } from 'Store/Actions/commandActions'; import { executeCommand } from 'Store/Actions/commandActions';
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector'; import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
import getRelativeDate from 'Utilities/Date/getRelativeDate';
import translate from 'Utilities/String/translate'; import translate from 'Utilities/String/translate';
import createMovieIndexItemSelector from '../createMovieIndexItemSelector'; import createMovieIndexItemSelector from '../createMovieIndexItemSelector';
import MovieIndexPosterInfo from './MovieIndexPosterInfo'; import MovieIndexPosterInfo from './MovieIndexPosterInfo';
@ -125,6 +126,20 @@ function MovieIndexPoster(props: MovieIndexPosterProps) {
height: `${posterHeight}px`, height: `${posterHeight}px`,
}; };
let releaseDate = '';
let releaseDateType = '';
if (physicalRelease && digitalRelease) {
releaseDate =
physicalRelease < digitalRelease ? physicalRelease : digitalRelease;
releaseDateType = physicalRelease < digitalRelease ? 'Released' : 'Digital';
} else if (physicalRelease && !digitalRelease) {
releaseDate = physicalRelease;
releaseDateType = 'Released';
} else if (digitalRelease && !physicalRelease) {
releaseDate = digitalRelease;
releaseDateType = 'Digital';
}
return ( return (
<div className={styles.content}> <div className={styles.content}>
<div className={styles.posterContainer} title={title}> <div className={styles.posterContainer} title={title}>
@ -214,6 +229,28 @@ function MovieIndexPoster(props: MovieIndexPosterProps) {
<div className={styles.title}>{qualityProfile.name}</div> <div className={styles.title}>{qualityProfile.name}</div>
) : null} ) : null}
{showCinemaRelease && inCinemas ? (
<div className={styles.title}>
<Icon name={icons.IN_CINEMAS} />{' '}
{getRelativeDate(inCinemas, shortDateFormat, showRelativeDates, {
timeFormat,
timeForToday: false,
})}
</div>
) : null}
{showReleaseDate && releaseDate ? (
<div className={styles.title}>
<Icon
name={releaseDateType === 'Digital' ? icons.MOVIE_FILE : icons.DISC}
/>{' '}
{getRelativeDate(releaseDate, shortDateFormat, showRelativeDates, {
timeFormat,
timeForToday: false,
})}
</div>
) : null}
<MovieIndexPosterInfo <MovieIndexPosterInfo
studio={studio} studio={studio}
qualityProfile={qualityProfile} qualityProfile={qualityProfile}

@ -72,7 +72,7 @@ function MovieIndexPosterInfo(props: MovieIndexPosterInfoProps) {
); );
} }
if (sortKey === 'inCinemas' && inCinemas && showCinemaRelease) { if (sortKey === 'inCinemas' && inCinemas && !showCinemaRelease) {
const inCinemasDate = getRelativeDate( const inCinemasDate = getRelativeDate(
inCinemas, inCinemas,
shortDateFormat, shortDateFormat,
@ -90,7 +90,7 @@ function MovieIndexPosterInfo(props: MovieIndexPosterInfoProps) {
); );
} }
if (sortKey === 'digitalRelease' && digitalRelease && showReleaseDate) { if (sortKey === 'digitalRelease' && digitalRelease && !showReleaseDate) {
const digitalReleaseDate = getRelativeDate( const digitalReleaseDate = getRelativeDate(
digitalRelease, digitalRelease,
shortDateFormat, shortDateFormat,
@ -108,7 +108,7 @@ function MovieIndexPosterInfo(props: MovieIndexPosterInfoProps) {
); );
} }
if (sortKey === 'physicalRelease' && physicalRelease && showReleaseDate) { if (sortKey === 'physicalRelease' && physicalRelease && !showReleaseDate) {
const physicalReleaseDate = getRelativeDate( const physicalReleaseDate = getRelativeDate(
physicalRelease, physicalRelease,
shortDateFormat, shortDateFormat,

Loading…
Cancel
Save