Real-time dashboard for monitoring global news, markets, and geopolitical events
TypeScript
Add US state boundary lines to US view
Reggie7603c9ae8236
diff --git a/index.html b/index.htmlindex 237058e..8fb9c9f 100644--- a/index.html+++ b/index.html@@ -5600,6 +5600,7 @@// World map data cachelet worldMapData = null;+ let usStatesData = null;// Load world map TopoJSON dataasync function loadWorldMap() {@@ -5614,6 +5615,19 @@}}+ // Load US states TopoJSON data+ async function loadUSStates() {+ if (usStatesData) return usStatesData;+ try {+ const response = await fetch('https://cdn.jsdelivr.net/npm/us-atlas@3/states-10m.json');+ usStatesData = await response.json();+ return usStatesData;+ } catch (e) {+ console.error('Failed to load US states:', e);+ return null;+ }+ }+// Render the global map - Situation Room Style with accurate bordersasync function renderGlobalMap(activityData, earthquakes = [], allNews = []) {// Cache allNews for popup access@@ -5757,6 +5771,46 @@.attr('stroke', '#0f5040').attr('stroke-width', 0.5);+ // Add US state boundaries (US view only)+ if (isUSView) {+ const usStates = await loadUSStates();+ if (usStates) {+ const states = topojson.feature(usStates, usStates.objects.states);+ const stateBorders = topojson.mesh(usStates, usStates.objects.states, (a, b) => a !== b);++ // Draw state fills+ svg.append('g')+ .attr('class', 'states-layer')+ .selectAll('path')+ .data(states.features)+ .enter()+ .append('path')+ .attr('d', path)+ .attr('fill', '#0a2018')+ .attr('stroke', 'none');++ // Draw state borders+ svg.append('path')+ .datum(stateBorders)+ .attr('class', 'state-borders')+ .attr('d', path)+ .attr('fill', 'none')+ .attr('stroke', '#1a6050')+ .attr('stroke-width', 0.75)+ .attr('stroke-linejoin', 'round');++ // Draw nation border (outline of US)+ const nationBorder = topojson.mesh(usStates, usStates.objects.nation);+ svg.append('path')+ .datum(nationBorder)+ .attr('class', 'nation-border')+ .attr('d', path)+ .attr('fill', 'none')+ .attr('stroke', '#2a8070')+ .attr('stroke-width', 1.5);+ }+ }+// Add undersea cables as SVG paths (global view only)if (mapLayers.cables && !isUSView) {const cableGroup = svg.append('g').attr('class', 'cables-layer');