'use client' import { useState } from 'react' export interface SongCardProps { id: string title: string artistName: string coverUrl?: string duration: number plays?: number onPlay?: () => void onClick?: () => void } export function SongCard({ id, title, artistName, coverUrl, duration, plays = 0, onPlay, onClick }: SongCardProps) { const [isHovered, setIsHovered] = useState(false) const formatDuration = (seconds: number) => { const mins = Math.floor(seconds / 60) const secs = seconds % 60 return `${mins}:${secs.toString().padStart(2, '0')}` } const formatPlays = (count: number) => { if (count >= 1000000) return `${(count / 1000000).toFixed(1)}M` if (count >= 1000) return `${(count / 1000).toFixed(1)}K` return count.toString() } return (
setIsHovered(true)} onMouseLeave={() => setIsHovered(false)} onClick={onClick} >
{/* Cover Image */}
{coverUrl ? ( {title} ) : (
)}
{/* Play Button Overlay */} {isHovered && onPlay && ( )}
{/* Song Info */}

{title}

{artistName}

{/* Stats */}
{plays > 0 && (
{formatPlays(plays)}
)} {formatDuration(duration)}
) }