Real-time dashboard for monitoring global news, markets, and geopolitical events
TypeScript
Add error checks for D3 and TopoJSON in map rendering
Reggied2ae7c7ffb7c
diff --git a/js/map.js b/js/map.jsindex 7646466..71c31fe 100644--- a/js/map.js+++ b/js/map.js@@ -220,10 +220,24 @@ export function updateFlashback(hoursAgo) {// Render the global mapexport async function renderGlobalMap(activityData, earthquakes = [], allNews = [], mapLayers, getMonitorHotspots, fetchFlightData, classifyAircraft, getAircraftArrow) {+ // Check for required globals+ if (typeof d3 === 'undefined') {+ console.error('D3 not loaded');+ return;+ }+ if (typeof topojson === 'undefined') {+ console.error('TopoJSON not loaded');+ return;+ }+// Cache allNews for popup accesswindow.cachedAllNews = allNews;const panel = document.getElementById('mapPanel');+ if (!panel) {+ console.error('mapPanel element not found');+ return;+ }const timestamp = new Date().toISOString().replace('T', ' ').substring(0, 19) + ' UTC';const isUSView = mapViewMode === 'us';