mirror of
https://github.com/fallenbagel/jellyseerr.git
synced 2025-12-31 19:59:31 -05:00
feat(ui): added content ratings for tv shows and movie ratings (#878)
This commit is contained in:
@@ -129,7 +129,22 @@ const MovieDetails: React.FC<MovieDetailsProps> = ({ movie }) => {
|
||||
revalidate();
|
||||
};
|
||||
|
||||
const movieAttributes = [];
|
||||
const movieAttributes: React.ReactNode[] = [];
|
||||
|
||||
if (
|
||||
data.releases.results.length &&
|
||||
(data.releases.results.find((r) => r.iso_3166_1 === 'US')?.release_dates[0]
|
||||
.certification ||
|
||||
data.releases.results[0].release_dates[0].certification)
|
||||
) {
|
||||
movieAttributes.push(
|
||||
<span className="p-0.5 py-0 border rounded-md">
|
||||
{data.releases.results.find((r) => r.iso_3166_1 === 'US')
|
||||
?.release_dates[0].certification ||
|
||||
data.releases.results[0].release_dates[0].certification}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
if (data.runtime) {
|
||||
movieAttributes.push(
|
||||
@@ -369,7 +384,13 @@ const MovieDetails: React.FC<MovieDetailsProps> = ({ movie }) => {
|
||||
)}
|
||||
</h1>
|
||||
<span className="mt-1 text-xs lg:text-base lg:mt-0">
|
||||
{movieAttributes.join(' | ')}
|
||||
{movieAttributes
|
||||
.map((t, k) => <span key={k}>{t}</span>)
|
||||
.reduce((prev, curr) => (
|
||||
<>
|
||||
{prev} | {curr}
|
||||
</>
|
||||
))}
|
||||
</span>
|
||||
</div>
|
||||
<div className="relative z-10 flex flex-wrap justify-center flex-shrink-0 mt-4 sm:justify-end sm:flex-nowrap lg:mt-0">
|
||||
|
||||
@@ -133,6 +133,26 @@ const TvDetails: React.FC<TvDetailsProps> = ({ tv }) => {
|
||||
revalidate();
|
||||
};
|
||||
|
||||
const seriesAttributes: React.ReactNode[] = [];
|
||||
|
||||
if (
|
||||
data.contentRatings.results.length &&
|
||||
data.contentRatings.results.find(
|
||||
(r) => r.iso_3166_1 === 'US' || data.contentRatings.results[0].rating
|
||||
)
|
||||
) {
|
||||
seriesAttributes.push(
|
||||
<span className="p-0.5 py-0 border rounded-md">
|
||||
{data.contentRatings.results.find((r) => r.iso_3166_1 === 'US')
|
||||
?.rating || data.contentRatings.results[0].rating}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
if (data.genres.length) {
|
||||
seriesAttributes.push(data.genres.map((g) => g.name).join(', '));
|
||||
}
|
||||
|
||||
const isComplete =
|
||||
data.seasons.filter((season) => season.seasonNumber !== 0).length <=
|
||||
(
|
||||
@@ -392,7 +412,13 @@ const TvDetails: React.FC<TvDetailsProps> = ({ tv }) => {
|
||||
)}
|
||||
</h1>
|
||||
<span className="mt-1 text-xs lg:text-base lg:mt-0">
|
||||
{data.genres.map((g) => g.name).join(', ')}
|
||||
{seriesAttributes
|
||||
.map((t, k) => <span key={k}>{t}</span>)
|
||||
.reduce((prev, curr) => (
|
||||
<>
|
||||
{prev} | {curr}
|
||||
</>
|
||||
))}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex flex-wrap justify-center flex-shrink-0 mt-4 sm:flex-nowrap sm:justify-end lg:mt-0">
|
||||
|
||||
Reference in New Issue
Block a user