From 55d2b50cd3a55415e1ceca03f034256da9554e26 Mon Sep 17 00:00:00 2001 From: syoul Date: Sun, 22 Mar 2026 18:53:42 +0100 Subject: [PATCH] fix: replace emoji flags with text badges, clean city names from postal codes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Emoji flags render as boxes on Linux. Replace with a small FR/BE/CH badge. Also strip postal codes from Cesium+ city names (e.g. "Saint-Jean-de-Laur, 46260" → "Saint-Jean-de-Laur"). Co-Authored-By: Claude Sonnet 4.6 --- src/components/StatsPanel.tsx | 10 +++++++--- src/services/adapters/CesiumAdapter.ts | 11 ++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/components/StatsPanel.tsx b/src/components/StatsPanel.tsx index cd03720..dc90a8d 100644 --- a/src/components/StatsPanel.tsx +++ b/src/components/StatsPanel.tsx @@ -1,6 +1,5 @@ import { useRef } from 'react'; import type { PeriodStats } from '../services/DataService'; -import { countryCodeToFlag } from '../services/adapters/CesiumAdapter'; interface StatsPanelProps { stats: PeriodStats | null; @@ -121,8 +120,13 @@ export function StatsPanel({ stats, loading, periodDays, source }: StatsPanelPro > {MEDALS[i]}
-

- {countryCodeToFlag(city.countryCode)}{city.countryCode ? ' ' : ''}{city.name} +

+ {city.countryCode && ( + + {city.countryCode} + + )} + {city.name}

{city.count} tx

diff --git a/src/services/adapters/CesiumAdapter.ts b/src/services/adapters/CesiumAdapter.ts index 632e486..30651c9 100644 --- a/src/services/adapters/CesiumAdapter.ts +++ b/src/services/adapters/CesiumAdapter.ts @@ -50,12 +50,9 @@ function latLngToCountryCode(lat: number, lng: number): string { return ''; } -/** Convertit un code ISO 3166-1 alpha-2 en emoji drapeau */ -export function countryCodeToFlag(code: string): string { - if (!code || code.length !== 2) return ''; - return String.fromCodePoint( - ...code.toUpperCase().split('').map((c) => 0x1F1E0 - 65 + c.charCodeAt(0)) - ); +/** Nettoie le nom de ville Cesium+ : retire le code postal ("Paris, 75001" → "Paris") */ +export function cleanCityName(city: string): string { + return city.split(',')[0].trim(); } // geoPoint accepte n'importe quel type — Cesium+ utilise plusieurs formats ES geo_point @@ -132,7 +129,7 @@ export async function resolveGeoByKeys( if (!geo) continue; result.set(hit._id, { name: src.title ?? '', - city: src.city ?? 'Inconnue', + city: cleanCityName(src.city ?? 'Inconnue'), countryCode: latLngToCountryCode(geo.lat, geo.lng), lat: geo.lat, lng: geo.lng,