feat: throw 404 when movie/tv show doesnt exist

also adds site webmanifest for mobile icons and title changes for tv/movie pages
This commit is contained in:
sct
2020-11-24 02:19:04 +00:00
parent 886389a361
commit 0601b44687
15 changed files with 128 additions and 55 deletions

View File

@@ -15,6 +15,7 @@ import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
import { LanguageContext } from '../../context/LanguageContext';
import type Media from '../../../server/entity/Media';
import type { MediaResultsResponse } from '../../../server/interfaces/api/mediaInterfaces';
import type { RequestResultsResponse } from '../../../server/interfaces/api/requestInterfaces';
import RequestCard from '../RequestCard';
const messages = defineMessages({
@@ -70,9 +71,9 @@ const Discover: React.FC = () => {
'/api/v1/media?filter=available&take=20&sort=modified'
);
const { data: requests, error: requestError } = useSWR<MediaRequest[]>(
'/api/v1/request?filter=unavailable&take=20&sort=modified&skip=0'
);
const { data: requests, error: requestError } = useSWR<
RequestResultsResponse
>('/api/v1/request?filter=unavailable&take=20&sort=modified&skip=0');
return (
<>
@@ -125,8 +126,8 @@ const Discover: React.FC = () => {
<Slider
sliderKey="requests"
isLoading={!requests && !requestError}
isEmpty={!!requests && !requestError && requests.length === 0}
items={requests?.map((request) => (
isEmpty={!!requests && !requestError && requests.results.length === 0}
items={(requests?.results ?? []).map((request) => (
<RequestCard
key={`request-slider-item-${request.id}`}
request={request}

View File

@@ -35,6 +35,7 @@ import RTAudFresh from '../../assets/rt_aud_fresh.svg';
import RTAudRotten from '../../assets/rt_aud_rotten.svg';
import type { RTRating } from '../../../server/api/rottentomatoes';
import Error from '../../pages/_error';
import Head from 'next/head';
const messages = defineMessages({
releasedate: 'Release Date',
@@ -128,6 +129,9 @@ const MovieDetails: React.FC<MovieDetailsProps> = ({ movie }) => {
backgroundImage: `linear-gradient(180deg, rgba(17, 24, 39, 0.47) 0%, rgba(17, 24, 39, 1) 100%), url(//image.tmdb.org/t/p/w1920_and_h800_multi_faces/${data.backdropPath})`,
}}
>
<Head>
<title>{data.title} - Overseerr</title>
</Head>
<RequestModal
tmdbId={data.id}
show={showRequestModal}

View File

@@ -26,6 +26,7 @@ import RTRotten from '../../assets/rt_rotten.svg';
import RTAudFresh from '../../assets/rt_aud_fresh.svg';
import RTAudRotten from '../../assets/rt_aud_rotten.svg';
import type { RTRating } from '../../../server/api/rottentomatoes';
import Head from 'next/head';
const messages = defineMessages({
userrating: 'User Rating',
@@ -131,6 +132,9 @@ const TvDetails: React.FC<TvDetailsProps> = ({ tv }) => {
backgroundImage: `linear-gradient(180deg, rgba(17, 24, 39, 0.47) 0%, rgba(17, 24, 39, 1) 100%), url(//image.tmdb.org/t/p/w1920_and_h800_multi_faces/${data.backdropPath})`,
}}
>
<Head>
<title>{data.name} - Overseerr</title>
</Head>
<RequestModal
tmdbId={data.id}
show={showRequestModal}

View File

@@ -73,7 +73,7 @@ const UserList: React.FC = () => {
</td>
<td className="px-6 py-4 whitespace-nowrap">
<div className="text-sm leading-5 text-white">
{user.requests.length}
{user.requestCount}
</div>
</td>
<td className="px-6 py-4 whitespace-nowrap">