From a2ba84ebf138fc025936b8b6fc7481bd09822ecf Mon Sep 17 00:00:00 2001 From: Guido Jansen Date: Sun, 13 Sep 2026 19:36:09 +0200 Subject: [PATCH] fix(map): EU map drops far-east + shifts right; bump SW cache Drop Russia/Belarus/Ukraine from the EU map (top-right clutter that stretched the frame east) and shift the European mass right so it clears the left-hand text overlay. Bump the map version (v5) and the service-worker cache (v2) so the update actually reaches clients. --- public/map/locality-map.js | 13 +++++++++++-- public/sw.js | 2 +- src/components/LocalityMap.astro | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/public/map/locality-map.js b/public/map/locality-map.js index 08fc667..f7bed22 100644 --- a/public/map/locality-map.js +++ b/public/map/locality-map.js @@ -15,7 +15,10 @@ window.LocalityMap = { render(el, o = {}) { const ISO = { nl: 528, be: 56, de: 276, fr: 250, lu: 442, at: 40, ch: 756, dk: 208, pl: 616, cz: 203, es: 724, pt: 620, it: 380, ie: 372, gb: 826, se: 752, fi: 246, no: 578, ee: 233, lv: 428, lt: 440, hu: 348, sk: 703, si: 705, hr: 191, ro: 642, bg: 100, gr: 300, cy: 196, mt: 470, is: 352, li: 438 }; // ISO numeric codes of the countries we treat as Europe (matches scripts/country-tlds.json). Only // these are ever drawn, so North Africa, the Middle East and the Caucasus never bleed into the frame. - const EUROPE_ISO = new Set([20, 8, 40, 70, 56, 100, 112, 756, 196, 203, 276, 208, 233, 246, 234, 250, 826, 304, 300, 191, 348, 372, 352, 380, 438, 440, 442, 428, 492, 807, 470, 528, 578, 616, 620, 642, 688, 643, 752, 705, 703, 674, 804, 336]); + // EU/EEA + UK + Switzerland + the Balkans + micro-states. The far east (Russia 643, Belarus 112, + // Ukraine 804) is deliberately left out of the MAP so it does not clutter the top-right corner and + // stretch the frame eastward. (Attribution/stats still count those countries; this is map-only.) + const EUROPE_ISO = new Set([20, 8, 40, 70, 56, 100, 756, 196, 203, 276, 208, 233, 246, 234, 250, 826, 304, 300, 191, 348, 372, 352, 380, 438, 440, 442, 428, 492, 807, 470, 528, 578, 616, 620, 642, 688, 752, 705, 703, 674, 336]); const EU27 = ['at','be','bg','hr','cy','cz','dk','ee','fi','fr','de','gr','hu','ie','it','lv','lt','lu','mt','nl','pl','pt','ro','sk','si','es','se']; const EURO = { type: 'MultiPoint', coordinates: [[-11, 35], [32, 35], [32, 71], [-11, 71]] }; const dots = (o.dots || '').split(',').filter(Boolean).map(s => s.split(':').map(Number)); @@ -61,7 +64,13 @@ window.LocalityMap = { render(el, o = {}) { const dx = (W - rightMargin) - pbFit[1][0]; const trFit = proj.translate(); proj.translate([trFit[0] + dx, trFit[1]]); - } else proj.fitExtent([[16, 16], [W - 16, H - 16]], EURO); + } else { + proj.fitExtent([[16, 16], [W - 16, H - 16]], EURO); + // The map is a background behind the left-hand text, so shift the European mass right: put the + // EURO box's west edge ~28% in from the left. The far east is already dropped, so little crops. + const tr = proj.translate(); + proj.translate([tr[0] + W * 0.28 - 16, tr[1]]); + } const path = d3.geoPath(proj); const litSet = new Set(lit.map(c => ISO[c])), activeSet = new Set(active.map(c => ISO[c])); const isLit = f => target ? +f.id === +target.id : (litSet.has(+f.id) || activeSet.has(+f.id)); diff --git a/public/sw.js b/public/sw.js index 0495611..a614359 100644 --- a/public/sw.js +++ b/public/sw.js @@ -1,7 +1,7 @@ // Minimal service worker: offline fallback + cache-first for fingerprinted static assets. // Pages are network-first (fresh when online, cached when offline, then an offline page). // Deliberately does NOT cache OAuth / client-metadata / XRPC — those must always hit the network. -const CACHE = 'atproto-nl-v1'; +const CACHE = 'atproto-nl-v2'; const OFFLINE = '/offline'; self.addEventListener('install', (e) => { diff --git a/src/components/LocalityMap.astro b/src/components/LocalityMap.astro index 0bb834b..5100581 100644 --- a/src/components/LocalityMap.astro +++ b/src/components/LocalityMap.astro @@ -27,7 +27,7 @@ const scope = getScope(import.meta.env.PUBLIC_SITE_SCOPE); // Cache-bust: /public map assets are served without a content hash, so browsers keep the old // locality-map.js after a deploy. Bump this when the map renderer changes; it versions both the // iframe URL (fresh HTML) and the script it loads (fresh JS). -const MAP_VERSION = '4'; +const MAP_VERSION = '5'; const params = new URLSearchParams({ cc: scope.cc, accent: scope.accent }); if (dots) params.set('dots', dots); -- 2.51.2