furhter bug fixes and updates

This commit is contained in:
jenz
2026-08-22 17:10:27 +02:00
parent 9e8e8378a2
commit 16bb9e14a5
18 changed files with 1070 additions and 256 deletions
@@ -1,6 +1,6 @@
import Link from 'next/link';
import { getCountriesSummary } from '@/lib/queries';
import { countryCodeToFlag, countryCodeToName } from '@/lib/steam';
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
@@ -23,22 +23,29 @@ export default async function CountriesPage() {
<div className="panel p-6 text-sm text-ink-muted">No countries recorded yet.</div>
) : (
<div className="panel divide-y divide-base-border">
<div className="grid grid-cols-[1fr_auto_auto] gap-6 px-4 py-2 text-xs text-ink-faint uppercase tracking-wide">
<div>Country</div>
<div className="text-right w-24">Total playtime</div>
<div className="text-right w-24">Avg per player</div>
</div>
{countries.map((c) => (
<Link
key={c.current_country}
href={`/countries/${encodeURIComponent(c.current_country)}`}
className="flex items-center justify-between px-4 py-3 hover:bg-base transition-colors"
className="grid grid-cols-[1fr_auto_auto] gap-6 items-center px-4 py-3 hover:bg-base transition-colors"
>
<div className="flex items-center gap-3">
<span className="text-lg" aria-hidden>
<div className="flex items-center gap-3 min-w-0">
<span className="text-lg shrink-0" aria-hidden>
{countryCodeToFlag(c.current_country)}
</span>
<span className="text-ink text-sm">{countryCodeToName(c.current_country)}</span>
<span className="text-ink-faint text-xs mono">{c.current_country}</span>
</div>
<div className="text-sm text-ink-muted mono">
{c.player_count} player{c.player_count === 1 ? '' : 's'}
<span className="text-ink text-sm truncate">{countryCodeToName(c.current_country)}</span>
<span className="text-ink-faint text-xs mono shrink-0">{c.current_country}</span>
<span className="text-ink-muted text-xs mono shrink-0">
{c.player_count} player{c.player_count === 1 ? '' : 's'}
</span>
</div>
<div className="text-sm text-ink mono text-right w-24">{formatMinutes(c.total_minutes)}</div>
<div className="text-sm text-ink-muted mono text-right w-24">{formatMinutes(Math.round(c.avg_minutes))}</div>
</Link>
))}
</div>