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,