Skip to content

Commit d3fd502

Browse files
authored
feat: add IMDb rating votes count in tooltip (#1696)
* feat: add IMDb rating votes count in tooltip * feat: add IMDb rating votes count in tooltip * feat: add IMDb rating votes count in tooltip
1 parent c0fd81a commit d3fd502

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

server/api/rating/imdbRadarrProxy.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ export interface IMDBRating {
145145
title: string;
146146
url: string;
147147
criticsScore: number;
148+
criticsScoreCount: number;
148149
}
149150

150151
/**
@@ -187,6 +188,7 @@ class IMDBRadarrProxy extends ExternalAPI {
187188
title: data[0].Title,
188189
url: `https://www.imdb.com/title/${data[0].ImdbId}`,
189190
criticsScore: data[0].MovieRatings.Imdb.Value,
191+
criticsScoreCount: data[0].MovieRatings.Imdb.Count,
190192
};
191193
} catch (e) {
192194
throw new Error(

src/components/MovieDetails/index.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ const messages = defineMessages('components.MovieDetails', {
9999
rtcriticsscore: 'Rotten Tomatoes Tomatometer',
100100
rtaudiencescore: 'Rotten Tomatoes Audience Score',
101101
tmdbuserscore: 'TMDB User Score',
102-
imdbuserscore: 'IMDB User Score',
102+
imdbuserscore: 'IMDB User Score – votes: {formattedCount}',
103103
watchlistSuccess: '<strong>{title}</strong> added to watchlist successfully!',
104104
watchlistDeleted:
105105
'<strong>{title}</strong> Removed from watchlist successfully!',
@@ -812,7 +812,18 @@ const MovieDetails = ({ movie }: MovieDetailsProps) => {
812812
</Tooltip>
813813
)}
814814
{ratingData?.imdb?.criticsScore && (
815-
<Tooltip content={intl.formatMessage(messages.imdbuserscore)}>
815+
<Tooltip
816+
content={intl.formatMessage(messages.imdbuserscore, {
817+
formattedCount: intl.formatNumber(
818+
ratingData.imdb.criticsScoreCount,
819+
{
820+
notation: 'compact',
821+
compactDisplay: 'short',
822+
maximumFractionDigits: 1,
823+
}
824+
),
825+
})}
826+
>
816827
<a
817828
href={ratingData.imdb.url}
818829
className="media-rating"

src/i18n/locale/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@
314314
"components.MovieDetails.cast": "Cast",
315315
"components.MovieDetails.digitalrelease": "Digital Release",
316316
"components.MovieDetails.downloadstatus": "Download Status",
317-
"components.MovieDetails.imdbuserscore": "IMDB User Score",
317+
"components.MovieDetails.imdbuserscore": "IMDB User Score – votes: {formattedCount}",
318318
"components.MovieDetails.managemovie": "Manage Movie",
319319
"components.MovieDetails.mark4kavailable": "Mark as Available in 4K",
320320
"components.MovieDetails.markavailable": "Mark as Available",

0 commit comments

Comments
 (0)