fix: update document.title on every page via useEffect
All pages are 'use client' so metadata exports don't work. Each page now sets document.title via useEffect — static pages with a fixed string, dynamic pages keyed on data so the title reflects the loaded content. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
import { useQuery, gql } from '@/lib/graphql/hooks'
|
||||
import { useEffect } from 'react'
|
||||
import Link from 'next/link'
|
||||
import { TeamFlag } from '@/components/team-flag'
|
||||
|
||||
@@ -57,6 +58,8 @@ interface MatchRow { id: number; year: number; round: string; date?: string | nu
|
||||
interface ETStats { totalKnockoutMatches: number; wentToExtraTime: number; wentToPenalties: number; extraTimePct: number; penaltiesPct: number }
|
||||
|
||||
export default function StatsPage() {
|
||||
useEffect(() => { document.title = 'Statistics · World Cup' }, [])
|
||||
|
||||
const { data, loading } = useQuery(STATS_QUERY)
|
||||
|
||||
const tournaments: Tournament[] = (data?.tournaments ?? []).filter((t: Tournament) => t.totalGoals != null).sort((a: Tournament, b: Tournament) => a.year - b.year)
|
||||
|
||||
Reference in New Issue
Block a user