import { router } from 'expo-router'; import { Pressable, StyleSheet, Text, View } from 'react-native'; import { SERVICE_LABELS, timeAgo, type NowPlayingDTO, type StreamingService } from '@musicshare/shared'; import { colors, space } from '@/lib/theme'; import { Avatar } from './Avatar'; import { TrackCard } from './TrackCard'; import { Card } from './ui'; export function NowPlayingCard({ np, preferred, showUser = true, pinned, onTogglePin, }: { np: NowPlayingDTO; preferred: StreamingService | null | undefined; showUser?: boolean; pinned?: boolean; onTogglePin?: () => void; }) { return ( {showUser && ( router.push(`/u/${np.user.username}`)} accessibilityRole="link"> {np.user.displayName ?? np.user.username} )} {np.isPlaying && } {np.isPlaying ? 'Listening now' : `Played ${timeAgo(np.updatedAt)}`} · {SERVICE_LABELS[np.source]} {onTogglePin && ( {pinned ? '★' : '☆'} )} ); } const styles = StyleSheet.create({ header: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: space.sm }, user: { flexDirection: 'row', alignItems: 'center', gap: space.sm, flexShrink: 1 }, name: { color: colors.text, fontWeight: '700', fontSize: 15, flexShrink: 1 }, statusRow: { flexDirection: 'row', alignItems: 'center', gap: space.xs, flexShrink: 0 }, dot: { width: 8, height: 8, borderRadius: 4, backgroundColor: colors.live }, status: { color: colors.muted, fontSize: 13 }, via: { color: colors.muted }, pin: { color: colors.muted, fontSize: 20, marginLeft: space.xs }, });