'use client'; /** * TopSongsCard — Ranked list of top-earning songs with percentage bars. * * Displays "Mejores Canciones" heading, a ranked list of songs showing * title, composers, income in CLP, and a percentage bar. Includes a * total at the bottom and a "Ver más" link. * * Requirements: 9.1, 9.2, 9.3, 9.4 */ import Link from 'next/link'; import type { PortalTopSong } from '@/lib/mock-data/types'; import { useCompactCurrencyFormatter } from '@/lib/hooks/useCurrencyFormatter'; import { useTranslation } from '@/lib/hooks/useTranslation'; interface TopSongsCardProps { songs: PortalTopSong[]; } export default function TopSongsCard({ songs }: TopSongsCardProps) { const t = useTranslation(); const fmtMoney = useCompactCurrencyFormatter(); const sortedSongs = [...songs].sort((a, b) => b.income - a.income); const totalIncome = songs.reduce((sum, s) => sum + s.income, 0); return (
{index + 1}. {song.title}
{song.composers.join(', ')}