feat(ui): display season count on TV details page (#1078)

* feat(ui): display season count on TV details page

* feat(lang): add new translation string
This commit is contained in:
TheCatLady
2021-03-03 22:42:19 -05:00
committed by GitHub
parent 0fa005a99c
commit 436523139e
2 changed files with 13 additions and 2 deletions

View File

@@ -72,6 +72,7 @@ const messages = defineMessages({
markavailable: 'Mark as Available', markavailable: 'Mark as Available',
mark4kavailable: 'Mark 4K as Available', mark4kavailable: 'Mark 4K as Available',
allseasonsmarkedavailable: '* All seasons will be marked as available.', allseasonsmarkedavailable: '* All seasons will be marked as available.',
seasons: '{seasonCount} Seasons',
}); });
interface TvDetailsProps { interface TvDetailsProps {
@@ -178,12 +179,21 @@ const TvDetails: React.FC<TvDetailsProps> = ({ tv }) => {
); );
} }
const seasonCount = data.seasons.filter((season) => season.seasonNumber !== 0)
.length;
if (seasonCount) {
seriesAttributes.push(
intl.formatMessage(messages.seasons, { seasonCount: seasonCount })
);
}
if (data.genres.length) { if (data.genres.length) {
seriesAttributes.push(data.genres.map((g) => g.name).join(', ')); seriesAttributes.push(data.genres.map((g) => g.name).join(', '));
} }
const isComplete = const isComplete =
data.seasons.filter((season) => season.seasonNumber !== 0).length <= seasonCount <=
( (
data.mediaInfo?.seasons.filter( data.mediaInfo?.seasons.filter(
(season) => season.status === MediaStatus.AVAILABLE (season) => season.status === MediaStatus.AVAILABLE
@@ -191,7 +201,7 @@ const TvDetails: React.FC<TvDetailsProps> = ({ tv }) => {
).length; ).length;
const is4kComplete = const is4kComplete =
data.seasons.filter((season) => season.seasonNumber !== 0).length <= seasonCount <=
( (
data.mediaInfo?.seasons.filter( data.mediaInfo?.seasons.filter(
(season) => season.status4k === MediaStatus.AVAILABLE (season) => season.status4k === MediaStatus.AVAILABLE

View File

@@ -627,6 +627,7 @@
"components.TvDetails.playonplex": "Play on Plex", "components.TvDetails.playonplex": "Play on Plex",
"components.TvDetails.recommendations": "Recommendations", "components.TvDetails.recommendations": "Recommendations",
"components.TvDetails.recommendationssubtext": "If you liked {title}, you might also like…", "components.TvDetails.recommendationssubtext": "If you liked {title}, you might also like…",
"components.TvDetails.seasons": "{seasonCount} Seasons",
"components.TvDetails.showtype": "Show Type", "components.TvDetails.showtype": "Show Type",
"components.TvDetails.similar": "Similar Series", "components.TvDetails.similar": "Similar Series",
"components.TvDetails.similarsubtext": "Other series similar to {title}", "components.TvDetails.similarsubtext": "Other series similar to {title}",