'use client' import { useQuery, gql } from '@/lib/graphql/hooks' import Link from 'next/link' import { TeamFlag } from '@/components/team-flag' import { FireIcon, CalendarDaysIcon, TrophyIcon } from '@heroicons/react/24/outline' const HISTORY_QUERY = gql` query History { tournaments { year host winner runnerUp thirdPlace fourthPlace totalGoals matchesCount teamsCount avgGoalsPerGame topScorers(limit: 1) { playerName goals team { name iso2 } } } } ` interface Tournament { year: number; host: string; winner?: string | null; runnerUp?: string | null thirdPlace?: string | null; fourthPlace?: string | null totalGoals?: number | null; matchesCount?: number | null; teamsCount?: number | null avgGoalsPerGame?: string | number | null topScorers: Array<{ playerName: string; goals: number; team?: { name: string; iso2?: string | null } | null }> } export function HistoryClient() { const { data, loading } = useQuery(HISTORY_QUERY) const tournaments: Tournament[] = data?.tournaments ?? [] const is2026InProgress = !tournaments.find(t => t.year === 2026)?.winner return (
Every edition — Uruguay 1930 through 2026 · {tournaments.length} tournaments
{loading && !data && (