import React, { memo } from 'react'; import { useTranslation } from 'react-i18next'; import { ExternalLink, Play, TrendingUp } from 'lucide-react'; import type { SubsonicSong } from '../../api/subsonicTypes'; import { formatTime } from '../../utils/nowPlayingHelpers'; interface TopSongsCardProps { artistName: string; artistId?: string; songs: SubsonicSong[]; currentTrackId: string; onNavigate: (path: string) => void; onPlay: (song: SubsonicSong) => void; } const TopSongsCard = memo(function TopSongsCard({ artistName, artistId, songs, currentTrackId, onNavigate, onPlay }: TopSongsCardProps) { const { t } = useTranslation(); const top = songs.slice(0, 8); if (top.length === 0) return null; return (

{t('nowPlaying.topSongs', { defaultValue: 'Most played by this artist' })}

{artistId && ( )}
{top.map((s, idx) => { const isActive = s.id === currentTrackId; return (
onPlay(s)} data-tooltip={t('contextMenu.playNow')}> {idx + 1}
{s.title} {s.album && {s.album}}
{formatTime(s.duration)}
); })}
{t('nowPlaying.topSongsCredit', { name: artistName, defaultValue: 'Top tracks from {{name}}' })}
); }); export default TopSongsCard;