Skip to content

Commit

Permalink
fix(frontend): fix tv shows failing to open when firstAirDate is unde…
Browse files Browse the repository at this point in the history
…fined

fix #347
  • Loading branch information
sct committed Dec 17, 2020
1 parent 647d5ef commit c21fa5b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion server/models/Tv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export interface TvDetails {
profilePath?: string;
}[];
episodeRunTime: number[];
firstAirDate: string;
firstAirDate?: string;
genres: Genre[];
homepage: string;
inProduction: boolean;
Expand Down
4 changes: 2 additions & 2 deletions src/components/TitleCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface TitleCardProps {
id: number;
image?: string;
summary?: string;
year: string;
year?: string;
title: string;
userScore: number;
mediaType: MediaType;
Expand Down Expand Up @@ -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}
Expand Down
8 changes: 6 additions & 2 deletions src/components/TvDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(', ')}
Expand Down

0 comments on commit c21fa5b

Please sign in to comment.