import {useTranslation} from 'react-i18next'; import {Trophy} from 'lucide-react'; import {Button} from '@/components/ui/button'; import StatsSection from './StatsSection.jsx'; import ChartPicker from './ChartPicker.jsx'; import GamePlayChart from './GamePlayChart.jsx'; import GameRow from './GameRow.jsx'; import {useStatDrill} from './StatDrill.jsx'; import {formatPlaytime} from '../../utils/games.js'; import {playChart} from '../../utils/statCharts.js'; /** * @param chart LIST, BARS, PIE or DONUT * @param onChart `(form)`: shows the picker */ export default function TopGamesStats({topGames, linked = true, chart = 'LIST', onChart}) { const {t} = useTranslation(); const drill = useStatDrill(); const max = Math.max(1, ...topGames.mostPlayed.map((g) => g.minutes)); const form = playChart(chart, topGames.mostPlayed); return ( }> {topGames.mostPlayed.length === 0 ? (

{t('STATS.TOP_GAMES.EMPTY')}

) : form === 'LIST' ? (
    {topGames.mostPlayed.map((g) => (
  1. ))}
) : } {drill && topGames.mostPlayed.length > 0 && ( )} {topGames.mostLoyal && (
{t('STATS.TOP_GAMES.LOYAL')}
)}
); }