'use client'; import { AnimatePresence, motion } from 'motion/react'; import Link from 'next/link'; import { SERVICE_LABELS, timeAgo, type NowPlayingDTO, type StreamingService } from '@musicshare/shared'; import { Avatar } from './Avatar'; import { Equalizer } from './Equalizer'; import { TrackCard } from './TrackCard'; export function NowPlayingCard({ np, preferred, showUser = true, pinned, onTogglePin, }: { np: NowPlayingDTO; preferred: StreamingService | null | undefined; showUser?: boolean; pinned?: boolean; onTogglePin?: () => void; }) { const sourceLabel = np.sourceApp ?? SERVICE_LABELS[np.source]; return (
{/* The card glows with its album art; crossfades when the song changes. */} {np.track.artworkUrl && ( )}
{showUser && ( {np.user.displayName ?? np.user.username} )} {np.isPlaying && } {np.isPlaying ? 'Listening now' : `Played ${timeAgo(np.updatedAt)}`} {' · '} {np.sourceUrl ? ( {sourceLabel} ) : ( sourceLabel )} {onTogglePin && ( {pinned ? '★' : '☆'} )}
); }