Files
lokiloto/components/app-header.tsx
T
Nazim KriandClaude Opus 5.5 e97b2e54ad Country selector in the header, auto-detected and remembered
Replaces the left sidebar with a header dropdown (flag + name), like
1xbet's region picker. The shown country resolves as: saved choice
(cookie, then the member's profile so it follows them across devices),
else Cloudflare's CF-IPCountry (Canada maps to Québec), else Québec.
favoriteCountry becomes nullable so geo-detection isn't overridden by
a default nobody chose. Emoji flags render as letters on Windows, so
flags are now SVGs in /public/flags; country names are in French.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 09:58:33 -04:00

47 lines
1.7 KiB
TypeScript

import Image from "next/image"
import Link from "next/link"
import { Suspense } from "react"
import { UserMenu } from "@/components/user-menu"
import { CountrySwitcher } from "@/components/country-switcher"
import { Skeleton } from "@/components/ui/skeleton"
import { getCurrentMember } from "@/lib/member-auth"
import { resolveCountry } from "@/lib/country-pref"
async function CountrySlot() {
const member = await getCurrentMember()
return <CountrySwitcher active={await resolveCountry(member)} />
}
export function AppHeader() {
return (
<div className="sticky top-0 z-30 h-14 border-b border-border bg-background/85 backdrop-blur">
<div className="mx-auto flex h-full max-w-6xl items-center gap-6 px-4 sm:px-6">
<Link href="/" className="flex shrink-0 items-center gap-2.5">
<Image src="/lokilab/ui/loki-mark.svg" alt="" aria-hidden="true" width={30} height={30} />
<span className="font-display text-xl text-foreground">
Loki<span className="text-gold">Loto</span>
</span>
</Link>
<nav className="hidden items-center gap-5 text-sm text-muted-foreground sm:flex">
<Link href="/" className="transition-colors hover:text-gold">
Résultats
</Link>
<Link href="/classement" className="transition-colors hover:text-gold">
Classement
</Link>
</nav>
<div className="ml-auto flex items-center gap-3">
<Suspense fallback={<Skeleton className="h-9 w-28 rounded-md" />}>
<CountrySlot />
</Suspense>
<Suspense fallback={<Skeleton className="h-8 w-8 rounded-full" />}>
<UserMenu />
</Suspense>
</div>
</div>
</div>
)
}