import Link from 'next/link'; import { getCountriesSummary } from '@/lib/queries'; import { countryCodeToFlag, countryCodeToName, formatMinutes } from '@/lib/steam'; // This page queries the DB directly with no dynamic route segment, so // without this Next.js tries to statically pre-render it at BUILD time // (requiring a live DB connection then, not just at request time). export const dynamic = 'force-dynamic'; export default async function CountriesPage() { const countries = await getCountriesSummary(); return (

Countries

Where the server's players connect from, most players first.

{countries.length === 0 ? (
No countries recorded yet.
) : (
Country
Total playtime
Avg per player
{countries.map((c) => (
{countryCodeToFlag(c.current_country)} {countryCodeToName(c.current_country)} {c.current_country && ( {c.current_country} )} {c.player_count} player{c.player_count === 1 ? '' : 's'}
{formatMinutes(c.total_minutes)}
{formatMinutes(Math.round(c.avg_minutes))}
))}
)}
); }