fix(frontend): try not to render broken rottentomatoes data

This commit is contained in:
sct
2020-12-19 13:39:48 +09:00
parent 816fec1a83
commit a0c5608aa0
2 changed files with 60 additions and 56 deletions

View File

@@ -397,7 +397,8 @@ const MovieDetails: React.FC<MovieDetailsProps> = ({ movie }) => {
<div className="bg-gray-900 rounded-lg shadow border border-gray-800"> <div className="bg-gray-900 rounded-lg shadow border border-gray-800">
{(data.voteCount > 0 || ratingData) && ( {(data.voteCount > 0 || ratingData) && (
<div className="flex px-4 py-2 border-b border-gray-800 last:border-b-0 items-center justify-center"> <div className="flex px-4 py-2 border-b border-gray-800 last:border-b-0 items-center justify-center">
{ratingData?.criticsRating && ( {ratingData?.criticsRating &&
(ratingData?.criticsScore ?? 0) > 0 && (
<> <>
<span className="text-sm"> <span className="text-sm">
{ratingData.criticsRating === 'Rotten' ? ( {ratingData.criticsRating === 'Rotten' ? (
@@ -411,7 +412,8 @@ const MovieDetails: React.FC<MovieDetailsProps> = ({ movie }) => {
</span> </span>
</> </>
)} )}
{ratingData?.audienceRating && ( {ratingData?.audienceRating &&
(ratingData?.audienceScore ?? 0) > 0 && (
<> <>
<span className="text-sm"> <span className="text-sm">
{ratingData.audienceRating === 'Spilled' ? ( {ratingData.audienceRating === 'Spilled' ? (

View File

@@ -406,7 +406,8 @@ const TvDetails: React.FC<TvDetailsProps> = ({ tv }) => {
<div className="bg-gray-900 rounded-lg shadow border border-gray-800"> <div className="bg-gray-900 rounded-lg shadow border border-gray-800">
{(data.voteCount > 0 || ratingData) && ( {(data.voteCount > 0 || ratingData) && (
<div className="flex px-4 py-2 border-b border-gray-800 last:border-b-0 items-center justify-center"> <div className="flex px-4 py-2 border-b border-gray-800 last:border-b-0 items-center justify-center">
{ratingData?.criticsRating && ( {ratingData?.criticsRating &&
(ratingData?.criticsScore ?? 0) > 0 && (
<> <>
<span className="text-sm"> <span className="text-sm">
{ratingData.criticsRating === 'Rotten' ? ( {ratingData.criticsRating === 'Rotten' ? (
@@ -420,7 +421,8 @@ const TvDetails: React.FC<TvDetailsProps> = ({ tv }) => {
</span> </span>
</> </>
)} )}
{ratingData?.audienceRating && ( {ratingData?.audienceRating &&
(ratingData?.audienceScore ?? 0) > 0 && (
<> <>
<span className="text-sm"> <span className="text-sm">
{ratingData.audienceRating === 'Spilled' ? ( {ratingData.audienceRating === 'Spilled' ? (