import { Image } from 'expo-image'; import { Linking, Pressable, StyleSheet, Text, View } from 'react-native'; import { SERVICE_LABELS, STREAMING_SERVICES, openUrl, type StreamingService, type TrackDTO } from '@musicshare/shared'; import { showError } from '@/lib/errors'; import { colors, fonts, radius, space } from '@/lib/theme'; import { Button } from './ui'; /** * Links are https universal/app links, so Linking.openURL hands them to the * native Spotify / Apple Music / YouTube Music app when it's installed. */ const open = (url: string) => Linking.openURL(url).catch((e) => showError(e, "Couldn't open link")); export function TrackCard({ track, preferred }: { track: TrackDTO; preferred: StreamingService | null | undefined }) { const primary = preferred ? openUrl(track, preferred) : null; const others = STREAMING_SERVICES.filter((s) => s !== preferred); return ( {track.artworkUrl ? ( ) : ( ♪ )} {track.title} {track.artist} {track.album ? · {track.album} : null} {preferred && primary && (