From ac8baa590958c257f4be3ba469d88d27f3e42a75 Mon Sep 17 00:00:00 2001 From: Uruk Date: Fri, 22 May 2026 01:46:45 +0200 Subject: [PATCH] refactor: restore shared POSTER_CAROUSEL_HEIGHT constant The constant had been inlined as a duplicated local in two files and as a magic 220 in two others. Restore a single source of truth in constants/Values.ts. --- components/MoreMoviesWithActor.tsx | 4 +--- components/SimilarItems.tsx | 5 +---- components/series/CastAndCrew.tsx | 3 ++- components/series/CurrentSeries.tsx | 3 ++- constants/Values.ts | 2 ++ 5 files changed, 8 insertions(+), 9 deletions(-) create mode 100644 constants/Values.ts diff --git a/components/MoreMoviesWithActor.tsx b/components/MoreMoviesWithActor.tsx index 6a8d2ca4..c3e4d0ca 100644 --- a/components/MoreMoviesWithActor.tsx +++ b/components/MoreMoviesWithActor.tsx @@ -11,11 +11,9 @@ import { Text } from "@/components/common/Text"; import { TouchableItemRouter } from "@/components/common/TouchableItemRouter"; import { ItemCardText } from "@/components/ItemCardText"; import MoviePoster from "@/components/posters/MoviePoster"; +import { POSTER_CAROUSEL_HEIGHT } from "@/constants/Values"; import { apiAtom, userAtom } from "@/providers/JellyfinProvider"; -// Matches `w-28` poster cards (approx 112px wide, 10/15 aspect ratio) + 2 lines of text. -const POSTER_CAROUSEL_HEIGHT = 220; - interface Props extends ViewProps { actorId: string; actorName?: string | null; diff --git a/components/SimilarItems.tsx b/components/SimilarItems.tsx index 7ed99535..ce09cbcf 100644 --- a/components/SimilarItems.tsx +++ b/components/SimilarItems.tsx @@ -6,11 +6,8 @@ import { useMemo } from "react"; import { useTranslation } from "react-i18next"; import { View, type ViewProps } from "react-native"; import MoviePoster from "@/components/posters/MoviePoster"; +import { POSTER_CAROUSEL_HEIGHT } from "@/constants/Values"; import { apiAtom, userAtom } from "@/providers/JellyfinProvider"; - -// Matches `w-28` poster cards (approx 112px wide, 10/15 aspect ratio) + 2 lines of text. -const POSTER_CAROUSEL_HEIGHT = 220; - import { HorizontalScroll } from "./common/HorizontalScroll"; import { Text } from "./common/Text"; import { TouchableItemRouter } from "./common/TouchableItemRouter"; diff --git a/components/series/CastAndCrew.tsx b/components/series/CastAndCrew.tsx index 97114840..06bf47be 100644 --- a/components/series/CastAndCrew.tsx +++ b/components/series/CastAndCrew.tsx @@ -8,6 +8,7 @@ import type React from "react"; import { useMemo } from "react"; import { useTranslation } from "react-i18next"; import { TouchableOpacity, View, type ViewProps } from "react-native"; +import { POSTER_CAROUSEL_HEIGHT } from "@/constants/Values"; import useRouter from "@/hooks/useAppRouter"; import { apiAtom } from "@/providers/JellyfinProvider"; import { getPrimaryImageUrl } from "@/utils/jellyfin/image/getPrimaryImageUrl"; @@ -52,7 +53,7 @@ export const CastAndCrew: React.FC = ({ item, loading, ...props }) => { i.Id?.toString() || ""} - height={220} + height={POSTER_CAROUSEL_HEIGHT} data={destinctPeople} renderItem={(i) => ( = ({ item, ...props }) => { (