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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user