import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client/models"; import { Image } from "expo-image"; import { useAtom } from "jotai"; import React, { useCallback, useMemo } from "react"; import { TouchableOpacity, View } from "react-native"; import { Text } from "@/components/common/Text"; import useRouter from "@/hooks/useAppRouter"; import { apiAtom } from "@/providers/JellyfinProvider"; import { getPrimaryImageUrl } from "@/utils/jellyfin/image/getPrimaryImageUrl"; interface Props { album: BaseItemDto; width?: number; } export const MusicAlbumCard: React.FC = ({ album, width = 130 }) => { const [api] = useAtom(apiAtom); const router = useRouter(); const imageUrl = useMemo( () => getPrimaryImageUrl({ api, item: album }), [api, album], ); const handlePress = useCallback(() => { router.push({ pathname: "/music/album/[albumId]", params: { albumId: album.Id! }, }); }, [router, album.Id]); return ( {imageUrl ? ( ) : ( 🎵 )} {album.Name} {album.AlbumArtist || album.Artists?.join(", ")} ); };