feat: show country flag next to city names in top villes

Determine country from geoPoint coordinates using bounding boxes
for the main Ğ1 community countries (FR, BE, CH, ES, DE, IT, ...).
Display the emoji flag before each city name in the top villes panel.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
syoul
2026-03-22 18:52:00 +01:00
parent a8792641ab
commit 8d9a9a3c07
4 changed files with 70 additions and 26 deletions
+4 -2
View File
@@ -5,6 +5,7 @@ export interface Transaction {
lng: number;
amount: number; // Ğ1 (pas en centimes)
city: string;
countryCode: string; // ISO 3166-1 alpha-2, ex: "FR"
fromKey: string; // SS58 Ğ1v2 : préfixe "g1", ~50 chars
toKey: string;
}
@@ -75,6 +76,7 @@ function generateTransactions(count: number, maxAgeMs: number): Transaction[] {
lng,
amount,
city: city.name,
countryCode: 'FR',
fromKey: generateKey(),
toKey: generateKey(),
});
@@ -94,10 +96,10 @@ export function computeStats(transactions: Transaction[]) {
const totalVolume = transactions.reduce((sum, tx) => sum + tx.amount, 0);
const transactionCount = transactions.length;
const cityVolumes: Record<string, { volume: number; count: number }> = {};
const cityVolumes: Record<string, { volume: number; count: number; countryCode: string }> = {};
for (const tx of transactions) {
if (!cityVolumes[tx.city]) {
cityVolumes[tx.city] = { volume: 0, count: 0 };
cityVolumes[tx.city] = { volume: 0, count: 0, countryCode: tx.countryCode ?? '' };
}
cityVolumes[tx.city].volume += tx.amount;
cityVolumes[tx.city].count += 1;