diff --git a/assets/images/not-rotten-tomatoes.svg b/assets/images/not-rotten-tomatoes.svg new file mode 100644 index 00000000..18fa58b8 --- /dev/null +++ b/assets/images/not-rotten-tomatoes.svg @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/components/Ratings.tsx b/components/Ratings.tsx index e5eb8fc3..f18a0843 100644 --- a/components/Ratings.tsx +++ b/components/Ratings.tsx @@ -3,11 +3,10 @@ import { View, ViewProps } from "react-native"; import { Badge } from "./Badge"; import { Ionicons } from "@expo/vector-icons"; import { Image } from "expo-image"; -import {MovieResult, TvResult} from "@/utils/jellyseerr/server/models/Search"; -import {useJellyseerr} from "@/hooks/useJellyseerr"; -import {useQuery} from "@tanstack/react-query"; -import {MediaType} from "@/utils/jellyseerr/server/constants/media"; - +import { MovieResult, TvResult } from "@/utils/jellyseerr/server/models/Search"; +import { useJellyseerr } from "@/hooks/useJellyseerr"; +import { useQuery } from "@tanstack/react-query"; +import { MediaType } from "@/utils/jellyseerr/server/constants/media"; interface Props extends ViewProps { item?: BaseItemDto | null; } @@ -21,7 +20,7 @@ export const Ratings: React.FC = ({ item, ...props }) => { )} {item.CommunityRating && ( } /> @@ -32,7 +31,11 @@ export const Ratings: React.FC = ({ item, ...props }) => { variant="gray" iconLeft={ = ({ item, ...props }) => { ); }; - -export const JellyserrRatings: React.FC<{result: MovieResult | TvResult}> = ({ result }) => { - const {jellyseerrApi} = useJellyseerr(); +export const JellyserrRatings: React.FC<{ result: MovieResult | TvResult }> = ({ + result, +}) => { + const { jellyseerrApi } = useJellyseerr(); const { data, isLoading } = useQuery({ - queryKey: ['jellyseerr', result.id, result.mediaType, 'ratings'], + queryKey: ["jellyseerr", result.id, result.mediaType, "ratings"], queryFn: async () => { return result.mediaType === MediaType.MOVIE ? jellyseerrApi?.movieRatings(result.id) - : jellyseerrApi?.tvRatings(result.id) + : jellyseerrApi?.tvRatings(result.id); }, staleTime: (5).minutesToMilliseconds(), retry: false, enabled: !!jellyseerrApi, }); - return (isLoading || !!result.voteCount || + return ( + (isLoading || + !!result.voteCount || (data?.criticsRating && !!data?.criticsScore) || (data?.audienceRating && !!data?.audienceScore)) && ( @@ -72,7 +78,7 @@ export const JellyserrRatings: React.FC<{result: MovieResult | TvResult}> = ({ r = ({ r = ({ r )} ) -} \ No newline at end of file + ); +};