@@ -8,6 +8,7 @@ import { useEffect, useMemo, useRef, useState } from 'react';
88import { GeoJSON , MapContainer } from 'react-leaflet' ;
99import { getCountryPopulation } from '@/lib/data' ;
1010import { useCountries } from '@/lib/geo' ;
11+ import type { LocationData } from '@/types/websites' ;
1112import { CountryFlag } from './icons/CountryFlag' ;
1213
1314interface TooltipContent {
@@ -35,7 +36,7 @@ export function MapComponent({
3536} : {
3637 height : string ;
3738 mode ?: 'total' | 'perCapita' ;
38- locationData ?: any ;
39+ locationData ?: LocationData ;
3940 isLoading ?: boolean ;
4041} ) {
4142 const locationsData = locationData ;
@@ -46,14 +47,14 @@ export function MapComponent({
4647 }
4748
4849 const validCountries = locationsData . countries . filter (
49- ( country : any ) => country . country && country . country . trim ( ) !== ''
50+ ( country ) => country . country && country . country . trim ( ) !== ''
5051 ) ;
5152
5253 const totalVisitors =
53- validCountries . reduce ( ( sum : number , c : any ) => sum + c . visitors , 0 ) || 1 ;
54+ validCountries . reduce ( ( sum , c ) => sum + c . visitors , 0 ) || 1 ;
5455
5556 return {
56- data : validCountries . map ( ( country : any ) => ( {
57+ data : validCountries . map ( ( country ) => ( {
5758 value :
5859 country . country_code ?. toUpperCase ( ) || country . country . toUpperCase ( ) ,
5960 count : country . visitors ,
@@ -85,7 +86,7 @@ export function MapComponent({
8586 return null ;
8687 }
8788
88- return countryData . data . map ( ( item : any ) => {
89+ return countryData . data . map ( ( item ) => {
8990 const population = getCountryPopulation ( item . value ) ;
9091 const perCapitaValue = population > 0 ? item . count / population : 0 ;
9192 return {
@@ -101,7 +102,7 @@ export function MapComponent({
101102 }
102103
103104 const metricToUse = mode === 'perCapita' ? 'perCapita' : 'count' ;
104- const values = processedCountryData ?. map ( ( d : any ) => d [ metricToUse ] ) || [ 0 ] ;
105+ const values = processedCountryData ?. map ( ( d ) => d [ metricToUse ] ) || [ 0 ] ;
105106 const maxValue = Math . max ( ...values ) ;
106107 const minValue = Math . min ( ...values . filter ( ( v : number ) => v > 0 ) ) ;
107108
@@ -135,7 +136,7 @@ export function MapComponent({
135136 const handleStyle = ( feature : Feature < any > ) => {
136137 const dataKey = feature ?. properties ?. ISO_A2 ;
137138 const foundData = processedCountryData ?. find (
138- ( { value } : any ) => value === dataKey
139+ ( { value } ) => value === dataKey
139140 ) ;
140141
141142 const metricValue =
@@ -177,7 +178,7 @@ export function MapComponent({
177178
178179 const name = feature . properties ?. ADMIN ;
179180 const foundData = processedCountryData ?. find (
180- ( { value } : any ) => value === code
181+ ( { value } ) => value === code
181182 ) ;
182183 const count = foundData ?. count || 0 ;
183184 const percentage = foundData ?. percentage || 0 ;
0 commit comments