fix: replace emoji flags with text badges, clean city names from postal codes
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user