Something went wrong. Try again.
An AI-music permissible frontend for plyr.fm.
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485import { View, Text, Pressable } from 'react-native';import { Track } from '../lib/api';import { Colors, Spacing, Typography } from '../constants/theme';
interface TrackCardProps { track: Track; isPlaying: boolean; onPlay: () => void; onPress: () => void;}
export default function TrackCard({ track, isPlaying, onPlay, onPress }: TrackCardProps) { const durationStr = track.duration ? `${Math.floor(track.duration / 60)}:${String(track.duration % 60).padStart(2, '0')}` : null;
return ( <Pressable onPress={onPress} style={{ flexDirection: 'row', alignItems: 'center', backgroundColor: Colors.surface, borderRadius: 12, padding: Spacing.md, marginBottom: Spacing.sm, gap: Spacing.md, }} > {/* Play button */} <Pressable onPress={onPlay} style={{ width: 40, height: 40, borderRadius: 20, backgroundColor: isPlaying ? Colors.playing : Colors.accent, justifyContent: 'center', alignItems: 'center', }} > <Text style={{ color: '#fff', fontSize: 16, fontWeight: '700' }}> {isPlaying ? '⏸' : '▶'} </Text> </Pressable>
{/* Track info */} <View style={{ flex: 1 }}> <Text numberOfLines={1} style={[Typography.subheading, { color: Colors.text }]} > {track.title} </Text> <Text numberOfLines={1} style={[Typography.caption, { color: Colors.textSecondary, marginTop: 2 }]} > {track.artist} {track.album ? ` · ${track.album}` : ''} </Text> </View>
{/* Meta */} <View style={{ alignItems: 'flex-end', gap: 4 }}> {track.isAi && ( <View style={{ backgroundColor: Colors.ai + '22', borderRadius: 6, paddingHorizontal: 6, paddingVertical: 2, }}> <Text style={[Typography.tiny, { color: Colors.ai }]}>AI</Text> </View> )} {durationStr && ( <Text style={[Typography.tiny, { color: Colors.textSecondary }]}> {durationStr} </Text> )} </View> </Pressable> );}