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>
This commit is contained in:
Nazim Kri
2026-10-30 09:58:33 -04:00
co-authored by Claude Opus 5.5
parent 2eafbfd3d7
commit e97b2e54ad
21 changed files with 200 additions and 162 deletions
+3 -13
View File
@@ -10,7 +10,6 @@
export interface CountryTheme {
code: string // ISO 3166-1 alpha-2, or a region code like 'CA-QC'
name: string
flagEmoji: string
flagPrimary: string
flagSecondary: string
accent: string // oklch(), CSS custom property value
@@ -23,7 +22,6 @@ export const COUNTRIES: CountryTheme[] = [
{
code: 'CA-QC',
name: 'Québec',
flagEmoji: '⚜️',
flagPrimary: '#1768C4',
flagSecondary: '#183653',
accent: 'oklch(0.62 0.16 255.5)',
@@ -32,7 +30,6 @@ export const COUNTRIES: CountryTheme[] = [
{
code: 'FR',
name: 'France',
flagEmoji: '🇫🇷',
flagPrimary: '#0055A4',
flagSecondary: '#EF4135',
accent: 'oklch(0.63 0.19 28.6)',
@@ -40,8 +37,7 @@ export const COUNTRIES: CountryTheme[] = [
},
{
code: 'US',
name: 'United States',
flagEmoji: '🇺🇸',
name: 'États-Unis',
flagPrimary: '#B22234',
flagSecondary: '#3C3B6E',
accent: 'oklch(0.6 0.17 20.7)',
@@ -49,8 +45,7 @@ export const COUNTRIES: CountryTheme[] = [
},
{
code: 'ES',
name: 'España',
flagEmoji: '🇪🇸',
name: 'Espagne',
flagPrimary: '#AA151B',
flagSecondary: '#F1BF00',
accent: 'oklch(0.76 0.16 89.6)',
@@ -58,8 +53,7 @@ export const COUNTRIES: CountryTheme[] = [
},
{
code: 'IT',
name: 'Italia',
flagEmoji: '🇮🇹',
name: 'Italie',
flagPrimary: '#009246',
flagSecondary: '#CE2B37',
accent: 'oklch(0.65 0.15 151.1)',
@@ -68,7 +62,6 @@ export const COUNTRIES: CountryTheme[] = [
{
code: 'PT',
name: 'Portugal',
flagEmoji: '🇵🇹',
flagPrimary: '#046A38',
flagSecondary: '#DA020E',
accent: 'oklch(0.63 0.14 153.6)',
@@ -77,7 +70,6 @@ export const COUNTRIES: CountryTheme[] = [
{
code: 'DZ',
name: 'Algérie',
flagEmoji: '🇩🇿',
flagPrimary: '#006233',
flagSecondary: '#D21034',
accent: 'oklch(0.6 0.13 153.7)',
@@ -86,7 +78,6 @@ export const COUNTRIES: CountryTheme[] = [
{
code: 'MA',
name: 'Maroc',
flagEmoji: '🇲🇦',
flagPrimary: '#C1272D',
flagSecondary: '#006233',
accent: 'oklch(0.58 0.19 25)',
@@ -99,7 +90,6 @@ export function countryTheme(code: string): CountryTheme {
COUNTRIES.find((c) => c.code === code) ?? {
code,
name: code,
flagEmoji: '🏳️',
flagPrimary: '#D7AE54',
flagSecondary: '#242B36',
accent: FALLBACK_ACCENT,