fix(frontend): fix tv shows failing to open when firstAirDate is undefined

fix #347
pull/376/head
sct 4 years ago
parent 647d5efb09
commit c21fa5b535

@ -56,7 +56,7 @@ export interface TvDetails {
profilePath?: string;
}[];
episodeRunTime: number[];
firstAirDate: string;
firstAirDate?: string;
genres: Genre[];
homepage: string;
inProduction: boolean;

@ -21,7 +21,7 @@ interface TitleCardProps {
id: number;
image?: string;
summary?: string;
year: string;
year?: string;
title: string;
userScore: number;
mediaType: MediaType;
@ -169,7 +169,7 @@ const TitleCard: React.FC<TitleCardProps> = ({
>
<div className="absolute bottom-0 w-full left-0 right-0">
<div className="px-2 text-white">
<div className="text-sm">{year}</div>
{year && <div className="text-sm">{year}</div>}
<h1 className="text-xl leading-tight whitespace-normal">
{title}

@ -227,8 +227,12 @@ const TvDetails: React.FC<TvDetailsProps> = ({ tv }) => {
)}
</div>
<h1 className="text-2xl md:text-4xl">
{data.name}{' '}
<span className="text-2xl">({data.firstAirDate.slice(0, 4)})</span>
<span>{data.name}</span>
{data.firstAirDate && (
<span className="text-2xl ml-2">
({data.firstAirDate.slice(0, 4)})
</span>
)}
</h1>
<span className="text-xs md:text-base mt-1 md:mt-0">
{data.genres.map((g) => g.name).join(', ')}

Loading…
Cancel
Save