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 { executeCommand } from 'Store/Actions/commandActions';
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
import getRelativeDate from 'Utilities/Date/getRelativeDate';
import translate from 'Utilities/String/translate';
import createMovieIndexItemSelector from '../createMovieIndexItemSelector';
import MovieIndexPosterInfo from './MovieIndexPosterInfo';
@ -125,6 +126,20 @@ function MovieIndexPoster(props: MovieIndexPosterProps) {
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 (
<div className={styles.content}>
<div className={styles.posterContainer} title={title}>
@ -214,6 +229,28 @@ function MovieIndexPoster(props: MovieIndexPosterProps) {
<div className={styles.title}>{qualityProfile.name}</div>
) : 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
studio={studio}
qualityProfile={qualityProfile}

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

Loading…
Cancel
Save