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>
15 lines
491 B
TypeScript
15 lines
491 B
TypeScript
import { cn } from "@/lib/utils"
|
|
|
|
/** SVG flag from /public/flags — emoji flags don't render on Windows. */
|
|
export function Flag({ code, className }: { code: string; className?: string }) {
|
|
return (
|
|
// eslint-disable-next-line @next/next/no-img-element
|
|
<img
|
|
src={`/flags/${code.toLowerCase()}.svg`}
|
|
alt=""
|
|
aria-hidden="true"
|
|
className={cn("inline-block h-[14px] w-[21px] shrink-0 rounded-[2px] object-cover ring-1 ring-black/20", className)}
|
|
/>
|
|
)
|
|
}
|