mirror of
https://github.com/sct/overseerr.git
synced 2025-09-17 17:24:35 +02:00
fix(frontend): hide Request More button if all current seasons are available
fixes #343
This commit is contained in:
@@ -116,7 +116,7 @@ class RottenTomatoes {
|
|||||||
|
|
||||||
public async getTVRatings(
|
public async getTVRatings(
|
||||||
name: string,
|
name: string,
|
||||||
year: number
|
year?: number
|
||||||
): Promise<RTRating | null> {
|
): Promise<RTRating | null> {
|
||||||
try {
|
try {
|
||||||
const response = await this.axios.get<RTMultiSearchResponse>(
|
const response = await this.axios.get<RTMultiSearchResponse>(
|
||||||
@@ -126,9 +126,13 @@ class RottenTomatoes {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const tvshow = response.data.tvSeries.find(
|
let tvshow: RTTvSearchResult | undefined = response.data.tvSeries[0];
|
||||||
|
|
||||||
|
if (year) {
|
||||||
|
tvshow = response.data.tvSeries.find(
|
||||||
(series) => series.startYear === year
|
(series) => series.startYear === year
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (!tvshow) {
|
if (!tvshow) {
|
||||||
return null;
|
return null;
|
||||||
|
@@ -106,7 +106,7 @@ tvRoutes.get('/:id/ratings', async (req, res, next) => {
|
|||||||
|
|
||||||
const rtratings = await rtapi.getTVRatings(
|
const rtratings = await rtapi.getTVRatings(
|
||||||
tv.name,
|
tv.name,
|
||||||
Number(tv.first_air_date.slice(0, 4))
|
tv.first_air_date ? Number(tv.first_air_date.slice(0, 4)) : undefined
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!rtratings) {
|
if (!rtratings) {
|
||||||
|
@@ -138,6 +138,14 @@ const TvDetails: React.FC<TvDetailsProps> = ({ tv }) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isComplete =
|
||||||
|
data.seasons.filter((season) => season.seasonNumber !== 0).length <=
|
||||||
|
(
|
||||||
|
data.mediaInfo?.seasons.filter(
|
||||||
|
(season) => season.status === MediaStatus.AVAILABLE
|
||||||
|
) ?? []
|
||||||
|
).length;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="bg-cover bg-center -mx-4 -mt-2 px-4 sm:px-8 pt-4 "
|
className="bg-cover bg-center -mx-4 -mt-2 px-4 sm:px-8 pt-4 "
|
||||||
@@ -267,7 +275,9 @@ const TvDetails: React.FC<TvDetailsProps> = ({ tv }) => {
|
|||||||
<FormattedMessage {...messages.request} />
|
<FormattedMessage {...messages.request} />
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{data.mediaInfo && data.mediaInfo.status !== MediaStatus.UNKNOWN && (
|
{data.mediaInfo &&
|
||||||
|
data.mediaInfo.status !== MediaStatus.UNKNOWN &&
|
||||||
|
!isComplete && (
|
||||||
<ButtonWithDropdown
|
<ButtonWithDropdown
|
||||||
dropdownIcon={
|
dropdownIcon={
|
||||||
<svg
|
<svg
|
||||||
|
Reference in New Issue
Block a user