Improve Map (#29)

* Mostly working map

* Fix tooltip

* Merge position and viewOptions state

* Merge Position and ViewOptions into MapView

* Rework tooltip state and display country flag

* Minor map back button text change

* Rebase to resolve merge conflicts

* Fix tooltip

* Merge position and viewOptions state

* Merge Position and ViewOptions into MapView

* Rework tooltip state and display country flag

* Minor map back button text change

* Delete map from before stuff got moved around

* Use Leaflet map

* Remove outline on click and highlight region on hover

* Remove Antarctica from countries.geojson

* Remove countries with no ISO_A2 (Dhekelia Sovereign Base Area, Somaliland, US Naval Base Guantanamo Bay, Brazilian Island, Northern Cyprus, Cyprus No Mans Area, Siachen Glacier, Baykonur Cosmodrome, Akrotiri Sovereign Base Area, Southern Patagonian Ice Field, Bir Tawil, Indian Ocean Territories, Coral Sea Islands, Spratly Islands, Clipperton Island, Ashmore and Cartier Islands, Bajo Nuevo Bank (Petrel Is.), Serranilla Bank, Scarborough Reef)

* Remove Antarctica from subdivisions.geojson

* Remove subdivisions for countries with no ISO_A2 (Dhekelia Sovereign Base Area, Somaliland, US Naval Base Guantanamo Bay, Northern Cyprus, Siachen Glacier, Baykonur Cosmodrome, Akrotiri Sovereign Base Area, Indian Ocean Territories, Coral Sea Islands, Spratly Islands, Clipperton Island, Ashmore and Cartier Islands)

* Remove react-simple-maps

* package-lock.json change after npm install

* Center tooltip and modify hover opacity

* Center map on load

* Fix tooltips not reflecting updated data

* Remove old countries and subdivisions geojson

* Add new countries and subdivisions json
This commit is contained in:
Edward Cui 2025-03-11 21:03:34 -07:00 committed by GitHub
parent bcc1cc5d29
commit aa62a3c843
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 4097 additions and 582 deletions

View file

@ -56,14 +56,11 @@ class PageviewQueue {
// Process each pageview with its geo data
const processedPageviews = batch.map((pv) => {
const countryCode = geoData?.[pv.ipAddress]?.data?.countryIso || "";
const regionCode =
geoData?.[pv.ipAddress]?.data?.subdivisions?.[0]?.isoCode || "";
const regionCode = geoData?.[pv.ipAddress]?.data?.subdivisions?.[0]?.isoCode || "";
return {
site_id: pv.site_id,
timestamp: DateTime.fromISO(pv.timestamp).toFormat(
"yyyy-MM-dd HH:mm:ss"
),
timestamp: DateTime.fromISO(pv.timestamp).toFormat("yyyy-MM-dd HH:mm:ss"),
session_id: pv.sessionId,
user_id: pv.userId,
hostname: pv.hostname || "",
@ -80,8 +77,8 @@ class PageviewQueue {
screen_height: pv.screenHeight || 0,
device_type: getDeviceType(pv.screenWidth, pv.screenHeight, pv.ua),
country: countryCode,
iso_3166_2: countryCode + "-" + regionCode,
};
iso_3166_2: countryCode && regionCode ? countryCode + "-" + regionCode : "",
}
});
console.info("bulk insert: ", processedPageviews.length);