import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client"; import React from "react"; import { Animated, Pressable, StyleSheet, View } from "react-native"; import { Text } from "@/components/common/Text"; import { useTVFocusAnimation } from "@/components/tv/hooks/useTVFocusAnimation"; import { useScaledTVTypography } from "@/constants/TVTypography"; interface TVGuideProgramCellProps { program: BaseItemDto; width: number; isCurrentlyAiring: boolean; onPress: () => void; disabled?: boolean; refSetter?: (ref: View | null) => void; } export const TVGuideProgramCell: React.FC = ({ program, width, isCurrentlyAiring, onPress, disabled = false, refSetter, }) => { const typography = useScaledTVTypography(); const { focused, handleFocus, handleBlur } = useTVFocusAnimation({ scaleAmount: 1, duration: 120, }); const formatTime = (date: string | null | undefined) => { if (!date) return ""; const d = new Date(date); return d.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", hour12: false, }); }; return ( {/* LIVE badge */} {isCurrentlyAiring && ( LIVE )} {/* Program name */} {program.Name} {/* Time range */} {formatTime(program.StartDate)} - {formatTime(program.EndDate)} ); }; const styles = StyleSheet.create({ container: { height: 70, borderRadius: 8, borderWidth: 1, paddingHorizontal: 12, paddingVertical: 8, justifyContent: "center", overflow: "hidden", }, focusedShadow: { shadowColor: "#FFFFFF", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.4, shadowRadius: 12, }, liveBadge: { position: "absolute", top: 6, right: 6, backgroundColor: "#EF4444", paddingHorizontal: 6, paddingVertical: 2, borderRadius: 4, zIndex: 10, elevation: 10, }, liveBadgeText: { color: "#FFFFFF", fontWeight: "bold", }, programName: { fontWeight: "600", marginBottom: 4, }, timeText: { fontWeight: "400", }, });