'use client'; import Link from 'next/link'; import { SERVICE_LABELS, type NowPlayingDTO, type StreamingService } from '@musicshare/shared'; import { timeAgo } from '@musicshare/shared'; import { Avatar } from './Avatar'; 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; }) { return (
{showUser && ( {np.user.displayName ?? np.user.username} )} {np.isPlaying ? 'Listening now' : `Played ${timeAgo(np.updatedAt)}`} via {np.sourceApp ?? SERVICE_LABELS[np.source]} {onTogglePin && ( )}
); }