import { useAtomValue } from 'jotai/utils' import React from 'react' import { ActivityIndicator, View } from 'react-native' import FastImage from 'react-native-fast-image' import LinearGradient from 'react-native-linear-gradient' import { artistArtAtomFamily } from '@app/state/music' import colors from '@app/styles/colors' import CoverArt from '@app/components/CoverArt' interface ArtistArtSizeProps { height: number width: number } interface ArtistArtXUpProps extends ArtistArtSizeProps { coverArtUris: string[] } interface ArtistArtProps extends ArtistArtSizeProps { id: string } const PlaceholderContainer: React.FC = ({ height, width, children }) => ( {children} ) const FourUp: React.FC = ({ height, width, coverArtUris }) => { const halfHeight = height / 2 const halfWidth = width / 2 return ( ) } const ThreeUp: React.FC = ({ height, width, coverArtUris }) => { const halfHeight = height / 2 const halfWidth = width / 2 return ( ) } const TwoUp: React.FC = ({ height, width, coverArtUris }) => { const halfHeight = height / 2 return ( ) } const OneUp: React.FC = ({ height, width, coverArtUris }) => { return ( ) } const NoneUp: React.FC = ({ height, width }) => { return ( ) } const ArtistArt: React.FC = ({ id, height, width }) => { const artistArt = useAtomValue(artistArtAtomFamily(id)) const Placeholder = () => { const none = if (!artistArt || !artistArt.coverArtUris) { return none } const { coverArtUris } = artistArt if (coverArtUris.length >= 4) { return } if (coverArtUris.length === 3) { return } if (coverArtUris.length === 2) { return } if (coverArtUris.length === 1) { return } return none } return ( ) } const ArtistArtFallback: React.FC = ({ height, width }) => ( ) const ArtistArtLoader: React.FC = props => ( }> ) export default React.memo(ArtistArtLoader)