import { Ionicons } from "@expo/vector-icons"; import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client/models"; import { BlurView } from "expo-blur"; import { Image } from "expo-image"; import { useAtomValue } from "jotai"; import React, { useMemo } from "react"; import { Dimensions, View } from "react-native"; import { Badge } from "@/components/Badge"; import { Text } from "@/components/common/Text"; import { GenreTags } from "@/components/GenreTags"; import { useScaledTVTypography } from "@/constants/TVTypography"; import { apiAtom } from "@/providers/JellyfinProvider"; import { getLogoImageUrlById } from "@/utils/jellyfin/image/getLogoImageUrlById"; const { width: SCREEN_WIDTH } = Dimensions.get("window"); interface TVSeriesHeaderProps { item: BaseItemDto; } export const TVSeriesHeader: React.FC = ({ item }) => { const typography = useScaledTVTypography(); const api = useAtomValue(apiAtom); const logoUrl = useMemo(() => { if (!api || !item) return null; return getLogoImageUrlById({ api, item }); }, [api, item]); const yearString = useMemo(() => { const startYear = item.StartDate ? new Date(item.StartDate).getFullYear() : item.ProductionYear; const endYear = item.EndDate ? new Date(item.EndDate).getFullYear() : null; if (startYear && endYear) { if (startYear === endYear) return String(startYear); return `${startYear} - ${endYear}`; } if (startYear) return String(startYear); return null; }, [item.StartDate, item.EndDate, item.ProductionYear]); return ( {/* Logo or Title */} {logoUrl ? ( ) : ( {item.Name} )} {/* Metadata badges row */} {yearString && ( {yearString} )} {item.OfficialRating && ( )} {item.CommunityRating != null && ( } /> )} {/* Genres */} {item.Genres && item.Genres.length > 0 && ( )} {/* Overview */} {item.Overview && ( {item.Overview} )} ); };