datastake-daf 0.6.280 β†’ 0.6.282

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19321,6 +19321,34 @@ const Style$A = dt.div`
19321
19321
  position: relative;
19322
19322
  width: 100%;
19323
19323
  height: 472px;
19324
+
19325
+ /* CRITICAL: Protect against Leaflet CSS interference */
19326
+ .daf-simple-globe-container {
19327
+ position: relative;
19328
+ width: 100%;
19329
+ height: 100%;
19330
+
19331
+ /* Override Leaflet CSS that interferes with Mapbox */
19332
+ .mapboxgl-canvas-container {
19333
+ position: relative !important;
19334
+ left: auto !important;
19335
+ top: auto !important;
19336
+ }
19337
+
19338
+ .mapboxgl-canvas-container canvas {
19339
+ position: relative !important;
19340
+ left: auto !important;
19341
+ top: auto !important;
19342
+ transform: none !important;
19343
+ }
19344
+
19345
+ /* Protect markers from Leaflet positioning */
19346
+ .daf-globe-marker {
19347
+ position: relative !important;
19348
+ left: auto !important;
19349
+ top: auto !important;
19350
+ }
19351
+ }
19324
19352
 
19325
19353
  .filter-cont {
19326
19354
  position: absolute;
@@ -19374,6 +19402,7 @@ const Style$A = dt.div`
19374
19402
  height: 100%;
19375
19403
  }
19376
19404
 
19405
+ /* Narrow marker styling used by legacy components; avoid width/height overrides for SimpleGlobe */
19377
19406
  .map-marker {
19378
19407
  text-align: center;
19379
19408
  width 100%;
@@ -19939,14 +19968,26 @@ const useGlobe = ({
19939
19968
  const addedSources = React.useRef(new Set());
19940
19969
  const isMounted = React.useRef(true);
19941
19970
  const addAllDataToMap = React.useCallback(() => {
19942
- if (!data || !mapRef || !mapRef.isStyleLoaded()) {
19971
+ console.log('πŸš€ [GLOBE HOOK] addAllDataToMap called');
19972
+ console.log('πŸš€ [GLOBE HOOK] data:', data);
19973
+ console.log('πŸš€ [GLOBE HOOK] mapRef exists:', !!mapRef);
19974
+ console.log('πŸš€ [GLOBE HOOK] style loaded:', mapRef?.isStyleLoaded());
19975
+ if (!data || !mapRef) {
19976
+ console.log('❌ [GLOBE HOOK] addAllDataToMap early return - missing data or mapRef');
19977
+ return;
19978
+ }
19979
+ if (!mapRef.isStyleLoaded()) {
19980
+ console.log('⏳ [GLOBE HOOK] Style not loaded yet, retrying in 100ms...');
19981
+ setTimeout(() => {
19982
+ addAllDataToMap();
19983
+ }, 100);
19943
19984
  return;
19944
19985
  }
19945
-
19946
- // Prevent multiple calls with empty data
19947
19986
  if (data.length === 0) {
19987
+ console.log('❌ [GLOBE HOOK] addAllDataToMap early return - no data');
19948
19988
  return;
19949
19989
  }
19990
+ console.log('βœ… [GLOBE HOOK] Starting to add markers to map...');
19950
19991
 
19951
19992
  // Clear existing markers using functional update to avoid dependency issues
19952
19993
  setMapMarkers(currentMarkers => {
@@ -19998,8 +20039,13 @@ const useGlobe = ({
19998
20039
  if (data && mapRef) {
19999
20040
  const newMarkers = [];
20000
20041
  const maxTotal = Math.max(...(data || []).map(d => d.total || 0));
20042
+ console.log('🎯 [GLOBE HOOK] Processing data items:', data.length);
20001
20043
  data.forEach((d, i) => {
20044
+ console.log(`🎯 [GLOBE HOOK] Processing item ${i}:`, d);
20045
+ console.log(`🎯 [GLOBE HOOK] Item ${i} marker:`, d?.marker);
20046
+ console.log(`🎯 [GLOBE HOOK] Item ${i} lat/lng:`, d?.marker?.lat, d?.marker?.lng);
20002
20047
  if (d?.marker?.lat && d?.marker?.lng) {
20048
+ console.log(`βœ… [GLOBE HOOK] Item ${i} has valid coordinates, creating marker...`);
20003
20049
  let marker;
20004
20050
  let iconClassName = "";
20005
20051
  let iconSize = [25, 25];
@@ -20079,6 +20125,7 @@ const useGlobe = ({
20079
20125
  el.style.fontWeight = 'bold';
20080
20126
  el.innerHTML = `<span>${d.total || 0}</span>`;
20081
20127
  marker = new mapboxgl.Marker(el).setLngLat([d.marker.lng, d.marker.lat]).setPopup(new mapboxgl.Popup().setDOMContent(div)).addTo(mapRef);
20128
+ console.log(`πŸŽ‰ [GLOBE HOOK] Marker ${i} added to map at:`, [d.marker.lng, d.marker.lat]);
20082
20129
  } else if (type === "territory") {
20083
20130
  // Handle territory polygons
20084
20131
  if (d.area && Array.isArray(d.area)) {
@@ -20148,6 +20195,7 @@ const useGlobe = ({
20148
20195
  }));
20149
20196
  roots.current.push(root);
20150
20197
  marker = new mapboxgl.Marker(el).setLngLat([d.marker.lng, d.marker.lat]).setPopup(new mapboxgl.Popup().setDOMContent(div)).addTo(mapRef);
20198
+ console.log(`πŸŽ‰ [GLOBE HOOK] Default marker ${i} added to map at:`, [d.marker.lng, d.marker.lat]);
20151
20199
  }
20152
20200
 
20153
20201
  // Add click handler
@@ -20181,6 +20229,7 @@ const useGlobe = ({
20181
20229
  mapboxgl.accessToken = MAP_TOKEN;
20182
20230
 
20183
20231
  // Create the map with Mapbox GL JS - 3D globe
20232
+ console.log('πŸ—ΊοΈ [GLOBE HOOK] Creating map with style:', STYLE_URL);
20184
20233
  const map = new mapboxgl.Map({
20185
20234
  container: container.current,
20186
20235
  style: STYLE_URL,
@@ -20199,8 +20248,13 @@ const useGlobe = ({
20199
20248
 
20200
20249
  // Configure the map when style loads
20201
20250
  map.on('style.load', () => {
20251
+ console.log('🎨 [GLOBE HOOK] Style loaded event triggered');
20252
+ console.log('🎨 [GLOBE HOOK] Map style loaded:', map.isStyleLoaded());
20253
+
20202
20254
  // Wait a bit for the style to fully load
20203
20255
  setTimeout(() => {
20256
+ console.log('🎨 [GLOBE HOOK] After timeout - Map style loaded:', map.isStyleLoaded());
20257
+
20204
20258
  // Set fog for the space background effect with stars - simplified to avoid errors
20205
20259
  try {
20206
20260
  map.setFog({
@@ -20296,9 +20350,10 @@ const useGlobe = ({
20296
20350
 
20297
20351
  // Add navigation controls
20298
20352
  map.addControl(new mapboxgl.NavigationControl(), 'top-right');
20353
+ console.log('πŸ—ΊοΈ [GLOBE HOOK] Map created successfully');
20299
20354
  return map;
20300
20355
  } catch (error) {
20301
- console.error('Error creating Mapbox GL JS globe:', error);
20356
+ console.error('❌ [GLOBE HOOK] Error creating Mapbox GL JS globe:', error);
20302
20357
  return null;
20303
20358
  }
20304
20359
  }, []);
@@ -20311,9 +20366,12 @@ const useGlobe = ({
20311
20366
  // }, [initialMarkerSetIsDone]);
20312
20367
 
20313
20368
  React.useEffect(() => {
20369
+ console.log('πŸ”„ [GLOBE HOOK] useEffect for map creation - mapRef:', !!mapRef);
20314
20370
  if (!mapRef) {
20371
+ console.log('πŸ”„ [GLOBE HOOK] Creating map instance...');
20315
20372
  const instance = createInstance();
20316
20373
  if (instance) {
20374
+ console.log('πŸ”„ [GLOBE HOOK] Map instance created, setting mapRef');
20317
20375
  setMapRef(instance);
20318
20376
 
20319
20377
  // Add comprehensive resize detection for Mapbox GL JS responsiveness
@@ -20394,14 +20452,22 @@ const useGlobe = ({
20394
20452
  }
20395
20453
  }, [polygon, mapRef]);
20396
20454
  React.useEffect(() => {
20455
+ console.log('πŸ“₯ [GLOBE HOOK] allData received:', allData);
20456
+ console.log('πŸ“₯ [GLOBE HOOK] allData length:', allData?.length);
20397
20457
  if (allData) {
20398
20458
  if (allData.length === 0) {
20459
+ console.log('⚠️ [GLOBE HOOK] Empty data array');
20399
20460
  setEmptyStateIsVisible(true);
20400
20461
  } else if (emptyStateIsVisible) {
20401
20462
  setEmptyStateIsVisible(false);
20402
20463
  }
20403
- setData(filterValidGPS(allData));
20464
+ console.log('πŸ” [GLOBE HOOK] Filtering data with filterValidGPS...');
20465
+ const filteredData = filterValidGPS(allData);
20466
+ console.log('πŸ” [GLOBE HOOK] filtered data result:', filteredData);
20467
+ console.log('πŸ” [GLOBE HOOK] filtered data length:', filteredData.length);
20468
+ setData(filteredData);
20404
20469
  } else {
20470
+ console.log('❌ [GLOBE HOOK] No allData provided');
20405
20471
  setData(null);
20406
20472
  }
20407
20473
  }, [allData, emptyStateIsVisible]);
@@ -20431,7 +20497,19 @@ const useGlobe = ({
20431
20497
  }
20432
20498
  }, [user, mapRef, allData]);
20433
20499
  React.useEffect(() => {
20434
- if (mapRef && data && !initialMarkerSetIsDone && mapRef.isStyleLoaded()) {
20500
+ console.log('πŸ”„ [GLOBE HOOK] useEffect triggered:', {
20501
+ mapRef: !!mapRef,
20502
+ data: !!data,
20503
+ dataLength: data?.length,
20504
+ initialMarkerSetIsDone,
20505
+ styleLoaded: mapRef?.isStyleLoaded()
20506
+ });
20507
+ if (mapRef && data && !initialMarkerSetIsDone) {
20508
+ console.log('πŸš€ [GLOBE HOOK] Attempting to add markers...');
20509
+ console.log('πŸš€ [GLOBE HOOK] Style loaded check:', mapRef.isStyleLoaded());
20510
+
20511
+ // Try to add markers immediately, and if style isn't loaded,
20512
+ // the addAllDataToMap function will handle it
20435
20513
  setInitialMarkerSetIsDone(true);
20436
20514
  addAllDataToMap();
20437
20515
  }
@@ -20644,7 +20722,7 @@ function Globe(_ref) {
20644
20722
  renderSider = null,
20645
20723
  renderMarker = null,
20646
20724
  type = "default",
20647
- showSider = true,
20725
+ showSider = false,
20648
20726
  filtersConfig,
20649
20727
  onFilterChange = () => {},
20650
20728
  isSatellite = false,
@@ -20654,15 +20732,29 @@ function Globe(_ref) {
20654
20732
  onUnmount
20655
20733
  } = _ref;
20656
20734
  // Map data to include marker coordinates
20657
- const mappedData = React.useMemo(() => data.map(d => {
20658
- var _d$gps, _d$gps2;
20659
- return _objectSpread2(_objectSpread2({}, d), {}, {
20660
- marker: {
20661
- lat: d === null || d === void 0 || (_d$gps = d.gps) === null || _d$gps === void 0 ? void 0 : _d$gps.latitude,
20662
- lng: d === null || d === void 0 || (_d$gps2 = d.gps) === null || _d$gps2 === void 0 ? void 0 : _d$gps2.longitude
20663
- }
20735
+ const mappedData = React.useMemo(() => {
20736
+ console.log('πŸ“Š [GLOBE COMPONENT] Original data received:', data);
20737
+ console.log('πŸ“Š [GLOBE COMPONENT] Data length:', data === null || data === void 0 ? void 0 : data.length);
20738
+ if (!data || data.length === 0) {
20739
+ console.log('❌ [GLOBE COMPONENT] No data to map');
20740
+ return [];
20741
+ }
20742
+ const mapped = data.map((d, i) => {
20743
+ var _d$gps, _d$gps2;
20744
+ console.log("\uD83D\uDCCA [GLOBE COMPONENT] Mapping item ".concat(i, ":"), d);
20745
+ console.log("\uD83D\uDCCA [GLOBE COMPONENT] Item ".concat(i, " GPS:"), d === null || d === void 0 ? void 0 : d.gps);
20746
+ const result = _objectSpread2(_objectSpread2({}, d), {}, {
20747
+ marker: {
20748
+ lat: d === null || d === void 0 || (_d$gps = d.gps) === null || _d$gps === void 0 ? void 0 : _d$gps.latitude,
20749
+ lng: d === null || d === void 0 || (_d$gps2 = d.gps) === null || _d$gps2 === void 0 ? void 0 : _d$gps2.longitude
20750
+ }
20751
+ });
20752
+ console.log("\uD83D\uDCCA [GLOBE COMPONENT] Item ".concat(i, " mapped result:"), result);
20753
+ return result;
20664
20754
  });
20665
- }), [data]);
20755
+ console.log('πŸ“Š [GLOBE COMPONENT] Final mapped data:', mapped);
20756
+ return mapped;
20757
+ }, [data]);
20666
20758
 
20667
20759
  // Get resize context for sidebar state changes
20668
20760
  const {
@@ -20846,6 +20938,461 @@ Globe.propTypes = {
20846
20938
  nameAsSiderTitle: PropTypes__default["default"].bool
20847
20939
  };
20848
20940
 
20941
+ const SimpleGlobe = _ref => {
20942
+ let {
20943
+ projects = [],
20944
+ mapConfig = {},
20945
+ showSider = false,
20946
+ onProjectClick = () => {},
20947
+ type = "default",
20948
+ color = "var(--color-primary-60)",
20949
+ renderTooltip: renderTooltip$1 = null
20950
+ } = _ref;
20951
+ const mapContainer = React.useRef(null);
20952
+ const map = React.useRef(null);
20953
+ const boundsRef = React.useRef(null);
20954
+ React.useEffect(() => {
20955
+ if (map.current) return; // Initialize map only once
20956
+
20957
+ console.log('πŸ—ΊοΈ [SIMPLE GLOBE] Creating map...');
20958
+
20959
+ // Set Mapbox access token
20960
+ mapboxgl.accessToken = 'pk.eyJ1IjoicmVkaXM5OTkiLCJhIjoiY2x4YWV5MzA5MmtuZzJpcXM5Y201Z2E2YiJ9.m5bwPg-Tj4Akesl1yQUa3w';
20961
+
20962
+ // Create map with custom Straatos style (with fallback)
20963
+ try {
20964
+ map.current = new mapboxgl.Map({
20965
+ container: mapContainer.current,
20966
+ style: 'mapbox://styles/pietragottardo/cm9tt9zfi00d101pg1vdx26si',
20967
+ center: [0, 0],
20968
+ zoom: mapConfig.maxZoom || 3,
20969
+ projection: 'globe',
20970
+ attributionControl: false
20971
+ });
20972
+ console.log('πŸ—ΊοΈ [SIMPLE GLOBE] Custom style loaded successfully');
20973
+ } catch (error) {
20974
+ console.warn('⚠️ [SIMPLE GLOBE] Custom style failed, using fallback:', error);
20975
+ // Fallback to standard style
20976
+ map.current = new mapboxgl.Map({
20977
+ container: mapContainer.current,
20978
+ style: 'mapbox://styles/mapbox/satellite-v9',
20979
+ center: [0, 0],
20980
+ zoom: mapConfig.maxZoom || 3,
20981
+ projection: 'globe',
20982
+ attributionControl: false
20983
+ });
20984
+ }
20985
+
20986
+ // Add markers when map loads
20987
+ map.current.on('load', () => {
20988
+ console.log('πŸ—ΊοΈ [SIMPLE GLOBE] Map loaded, adding markers...');
20989
+
20990
+ // Hide Mapbox logo and attribution completely
20991
+ map.current.getContainer();
20992
+ const style = document.createElement('style');
20993
+ style.textContent = "\n .mapboxgl-ctrl-logo,\n .mapboxgl-ctrl-attrib,\n .mapboxgl-ctrl-bottom-left,\n .mapboxgl-ctrl-bottom-right {\n display: none !important;\n }\n .mapboxgl-canvas-container {\n overflow: hidden !important;\n }\n .mapboxgl-canvas {\n overflow: hidden !important;\n }\n /* CRITICAL: Override Leaflet CSS interference with Mapbox */\n .daf-simple-globe-container .mapboxgl-canvas-container {\n position: relative !important;\n left: auto !important;\n top: auto !important;\n }\n .daf-simple-globe-container .mapboxgl-canvas-container canvas {\n position: relative !important;\n left: auto !important;\n top: auto !important;\n transform: none !important;\n }\n /* Prevent Leaflet styles from affecting Mapbox markers */\n .daf-simple-globe-container .daf-globe-marker {\n position: relative !important;\n left: auto !important;\n top: auto !important;\n }\n ";
20994
+ document.head.appendChild(style);
20995
+
20996
+ // Set the space background with stars
20997
+ try {
20998
+ map.current.setFog({
20999
+ 'color': 'rgb(0, 0, 0)',
21000
+ 'high-color': 'rgb(0, 0, 0)',
21001
+ 'horizon-blend': 0.1,
21002
+ 'space-color': 'rgb(0, 0, 0)',
21003
+ 'star-intensity': 0.6
21004
+ });
21005
+ console.log('✨ [SIMPLE GLOBE] Space background with stars set');
21006
+ } catch (e) {
21007
+ console.log('⚠️ [SIMPLE GLOBE] Could not set fog, trying alternative...');
21008
+ // Fallback: try simpler fog configuration
21009
+ try {
21010
+ map.current.setFog({
21011
+ 'color': 'rgb(0, 0, 0)',
21012
+ 'high-color': 'rgb(0, 0, 0)',
21013
+ 'horizon-blend': 0.1
21014
+ });
21015
+ console.log('✨ [SIMPLE GLOBE] Alternative space background set');
21016
+ } catch (e2) {
21017
+ console.log('⚠️ [SIMPLE GLOBE] Could not set any fog configuration');
21018
+ }
21019
+ }
21020
+
21021
+ // Calculate bounds to fit all markers
21022
+ const bounds = new mapboxgl.LngLatBounds();
21023
+ let hasValidCoordinates = false;
21024
+ projects.forEach((project, index) => {
21025
+ console.log("\uD83D\uDCCD [SIMPLE GLOBE] Adding marker ".concat(index, ":"), project);
21026
+
21027
+ // Create marker element based on type
21028
+ const el = document.createElement('div');
21029
+ // Use a scoped class to avoid picking up broad styles like `.map-marker { width:100% }`
21030
+ el.className = 'daf-globe-marker';
21031
+ el.style.cursor = 'pointer';
21032
+ el.style.boxShadow = '0px 3.45px 3.45px 0px #00000029';
21033
+ el.style.display = 'flex';
21034
+ el.style.alignItems = 'center';
21035
+ el.style.justifyContent = 'center';
21036
+ // Ensure proper positioning and prevent CSS interference
21037
+ el.style.position = 'relative';
21038
+ el.style.left = 'auto';
21039
+ el.style.top = 'auto';
21040
+ el.style.transform = 'none';
21041
+ el.style.zIndex = '1000';
21042
+ if (type === "location") {
21043
+ // Location marker - SVG map pin style
21044
+ el.style.width = '28px';
21045
+ el.style.height = '33px';
21046
+ el.innerHTML = "\n <svg\n width=\"28\"\n height=\"33\"\n viewBox=\"0 0 28 33\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M5.14346 4.87419C10.0688 -0.15896 18.0528 -0.162058 22.9757 4.86861C27.6563 9.65161 27.8841 17.2616 23.6622 22.3255H23.6608C23.427 22.6141 23.1808 22.894 22.9211 23.1623L14.0671 32.2101L5.44057 23.3948L5.13868 23.096C0.215857 18.0655 0.218422 9.90737 5.14346 4.87419Z\"\n fill=\"".concat(color, "\"\n stroke=\"white\"\n />\n </svg>\n ");
21047
+ } else {
21048
+ // Default circular marker style
21049
+ el.style.width = '30px';
21050
+ el.style.height = '30px';
21051
+ el.style.backgroundColor = color;
21052
+ el.style.borderRadius = '50%';
21053
+ el.style.border = '2px solid white';
21054
+ el.style.color = 'white';
21055
+ el.style.fontWeight = 'bold';
21056
+ el.style.fontSize = '14px';
21057
+ el.style.textAlign = 'center';
21058
+ el.style.lineHeight = '1';
21059
+ el.innerHTML = "<span style=\"display: block; line-height: 1;\">".concat(project.percentageCompletion || 0, "</span>");
21060
+ }
21061
+
21062
+ // Create popup content using custom renderTooltip or default
21063
+ let popupContent;
21064
+ if (renderTooltip$1 && typeof renderTooltip$1 === 'function') {
21065
+ // Use custom renderTooltip function (same as MineSiteMap)
21066
+ const tooltipData = renderTooltip$1(project);
21067
+ popupContent = renderTooltip({
21068
+ title: project.name,
21069
+ subTitle: project.sectoralScope || 'Project',
21070
+ items: tooltipData,
21071
+ link: false
21072
+ });
21073
+ } else {
21074
+ // Use default tooltip structure
21075
+ const tooltipData = [{
21076
+ label: "Country",
21077
+ value: project.country || 'N/A'
21078
+ }, {
21079
+ label: "Sectoral Scope",
21080
+ value: project.sectoralScope || 'Project'
21081
+ }];
21082
+ popupContent = renderTooltip({
21083
+ title: project.name,
21084
+ subTitle: project.sectoralScope || 'Project',
21085
+ items: tooltipData,
21086
+ link: false
21087
+ });
21088
+ }
21089
+
21090
+ // Create popup
21091
+ const popup = new mapboxgl.Popup({
21092
+ offset: 25,
21093
+ closeButton: true,
21094
+ closeOnClick: false
21095
+ }).setHTML(popupContent);
21096
+
21097
+ // Ensure coordinates are valid numbers and in correct order
21098
+ const lng = Number(project.longitude);
21099
+ const lat = Number(project.latitude);
21100
+ console.log("\uD83D\uDCCD [SIMPLE GLOBE] Marker ".concat(index, " coordinates:"), {
21101
+ original: {
21102
+ longitude: project.longitude,
21103
+ latitude: project.latitude
21104
+ },
21105
+ processed: {
21106
+ lng,
21107
+ lat
21108
+ },
21109
+ project: project.name
21110
+ });
21111
+
21112
+ // Validate coordinates
21113
+ if (isNaN(lng) || isNaN(lat) || lng < -180 || lng > 180 || lat < -90 || lat > 90) {
21114
+ console.error("\u274C [SIMPLE GLOBE] Invalid coordinates for project ".concat(index, ":"), {
21115
+ lng,
21116
+ lat,
21117
+ original: {
21118
+ longitude: project.longitude,
21119
+ latitude: project.latitude
21120
+ },
21121
+ project: project.name
21122
+ });
21123
+ return;
21124
+ }
21125
+
21126
+ // Add coordinates to bounds
21127
+ bounds.extend([lng, lat]);
21128
+ hasValidCoordinates = true;
21129
+
21130
+ // Create marker with explicit positioning
21131
+ const marker = new mapboxgl.Marker({
21132
+ element: el,
21133
+ anchor: 'center'
21134
+ }).setLngLat([lng, lat]).setPopup(popup).addTo(map.current);
21135
+
21136
+ // Add click handler
21137
+ el.addEventListener('click', () => {
21138
+ console.log('πŸ“ [SIMPLE GLOBE] Marker clicked:', project);
21139
+ onProjectClick(project);
21140
+ });
21141
+
21142
+ // Verify marker position after a short delay
21143
+ setTimeout(() => {
21144
+ const markerLngLat = marker.getLngLat();
21145
+ console.log("\uD83D\uDD0D [SIMPLE GLOBE] Marker ".concat(index, " position verification:"), {
21146
+ expected: [lng, lat],
21147
+ actual: [markerLngLat.lng, markerLngLat.lat],
21148
+ project: project.name,
21149
+ match: Math.abs(markerLngLat.lng - lng) < 0.0001 && Math.abs(markerLngLat.lat - lat) < 0.0001
21150
+ });
21151
+ }, 100);
21152
+ console.log("\u2705 [SIMPLE GLOBE] Marker ".concat(index, " added at:"), [lng, lat]);
21153
+ });
21154
+
21155
+ // Fit map to show all markers if we have valid coordinates
21156
+ if (hasValidCoordinates && !bounds.isEmpty()) {
21157
+ console.log('πŸ—ΊοΈ [SIMPLE GLOBE] Fitting map to bounds:', bounds);
21158
+ map.current.fitBounds(bounds, {
21159
+ padding: {
21160
+ top: 20,
21161
+ bottom: 20,
21162
+ left: 20,
21163
+ right: 20
21164
+ },
21165
+ maxZoom: 6,
21166
+ duration: 1000
21167
+ });
21168
+ boundsRef.current = bounds;
21169
+ } else {
21170
+ boundsRef.current = null;
21171
+ }
21172
+ });
21173
+ return () => {
21174
+ if (map.current) {
21175
+ map.current.remove();
21176
+ map.current = null;
21177
+ }
21178
+ };
21179
+ }, [projects, onProjectClick, mapConfig]);
21180
+ const zoomIn = () => map.current && map.current.zoomIn();
21181
+ const zoomOut = () => map.current && map.current.zoomOut();
21182
+ const recenter = () => {
21183
+ if (!map.current) return;
21184
+ if (boundsRef.current && !boundsRef.current.isEmpty()) {
21185
+ map.current.fitBounds(boundsRef.current, {
21186
+ padding: {
21187
+ top: 20,
21188
+ bottom: 20,
21189
+ left: 20,
21190
+ right: 20
21191
+ },
21192
+ maxZoom: 6,
21193
+ duration: 800
21194
+ });
21195
+ return;
21196
+ }
21197
+ map.current.easeTo({
21198
+ center: [0, 0],
21199
+ zoom: 3,
21200
+ duration: 800
21201
+ });
21202
+ };
21203
+ const pitchUp = () => {
21204
+ var _map$current$getPitch, _map$current;
21205
+ if (!map.current) return;
21206
+ const next = Math.min((((_map$current$getPitch = (_map$current = map.current).getPitch) === null || _map$current$getPitch === void 0 ? void 0 : _map$current$getPitch.call(_map$current)) || 0) + 10, 85);
21207
+ map.current.setPitch(next);
21208
+ };
21209
+ const pitchDown = () => {
21210
+ var _map$current$getPitch2, _map$current2;
21211
+ if (!map.current) return;
21212
+ const next = Math.max((((_map$current$getPitch2 = (_map$current2 = map.current).getPitch) === null || _map$current$getPitch2 === void 0 ? void 0 : _map$current$getPitch2.call(_map$current2)) || 0) - 10, 0);
21213
+ map.current.setPitch(next);
21214
+ };
21215
+ return /*#__PURE__*/jsxRuntime.jsx(Style$A, {
21216
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
21217
+ className: "daf-simple-globe-container",
21218
+ style: {
21219
+ width: '100%',
21220
+ height: '100%',
21221
+ overflow: 'hidden',
21222
+ position: 'relative'
21223
+ },
21224
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
21225
+ ref: mapContainer,
21226
+ className: "daf-globe-map-container",
21227
+ style: {
21228
+ width: '100%',
21229
+ height: '100%',
21230
+ overflow: 'hidden',
21231
+ position: 'relative'
21232
+ }
21233
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
21234
+ className: "map-control-buttons",
21235
+ children: [/*#__PURE__*/jsxRuntime.jsx("button", {
21236
+ type: "button",
21237
+ "aria-label": "Zoom in",
21238
+ onClick: zoomIn,
21239
+ children: "+"
21240
+ }), /*#__PURE__*/jsxRuntime.jsx("button", {
21241
+ type: "button",
21242
+ "aria-label": "Zoom out",
21243
+ onClick: zoomOut,
21244
+ children: "\u2212"
21245
+ }), /*#__PURE__*/jsxRuntime.jsx("button", {
21246
+ type: "button",
21247
+ "aria-label": "Recenter",
21248
+ onClick: recenter,
21249
+ children: "\u25CE"
21250
+ }), /*#__PURE__*/jsxRuntime.jsx("button", {
21251
+ type: "button",
21252
+ "aria-label": "Pitch up",
21253
+ onClick: pitchUp,
21254
+ children: "^"
21255
+ }), /*#__PURE__*/jsxRuntime.jsx("button", {
21256
+ type: "button",
21257
+ "aria-label": "Pitch down",
21258
+ onClick: pitchDown,
21259
+ children: "\u02C5"
21260
+ })]
21261
+ })]
21262
+ })
21263
+ });
21264
+ };
21265
+
21266
+ const SimpleGlobeTestDebug = _ref => {
21267
+ let {
21268
+ projects = []
21269
+ } = _ref;
21270
+ const mapContainer = React.useRef(null);
21271
+ const map = React.useRef(null);
21272
+ React.useEffect(() => {
21273
+ if (map.current) return;
21274
+ console.log('πŸ§ͺ [DEBUG TEST] Creating minimal map...');
21275
+
21276
+ // Set Mapbox access token
21277
+ mapboxgl.accessToken = 'pk.eyJ1IjoicmVkaXM5OTkiLCJhIjoiY2x4YWV5MzA5MmtuZzJpcXM5Y201Z2E2YiJ9.m5bwPg-Tj4Akesl1yQUa3w';
21278
+
21279
+ // Create minimal map
21280
+ map.current = new mapboxgl.Map({
21281
+ container: mapContainer.current,
21282
+ style: 'mapbox://styles/mapbox/satellite-v9',
21283
+ center: [0, 0],
21284
+ zoom: 2,
21285
+ projection: 'globe'
21286
+ });
21287
+
21288
+ // Add markers when map loads
21289
+ map.current.on('load', () => {
21290
+ console.log('πŸ§ͺ [DEBUG TEST] Map loaded, adding test markers...');
21291
+ projects.forEach((project, index) => {
21292
+ console.log("\uD83E\uDDEA [DEBUG TEST] Processing project ".concat(index, ":"), project);
21293
+
21294
+ // Create simple marker
21295
+ const el = document.createElement('div');
21296
+ el.style.width = '20px';
21297
+ el.style.height = '20px';
21298
+ el.style.backgroundColor = '#FF0000';
21299
+ el.style.borderRadius = '50%';
21300
+ el.style.border = '2px solid white';
21301
+ el.style.cursor = 'pointer';
21302
+ el.style.boxShadow = '0px 3px 6px rgba(0,0,0,0.3)';
21303
+
21304
+ // Get coordinates
21305
+ const lng = Number(project.longitude);
21306
+ const lat = Number(project.latitude);
21307
+ console.log("\uD83E\uDDEA [DEBUG TEST] Coordinates for ".concat(project.name, ":"), {
21308
+ original: {
21309
+ longitude: project.longitude,
21310
+ latitude: project.latitude
21311
+ },
21312
+ processed: {
21313
+ lng,
21314
+ lat
21315
+ },
21316
+ valid: !isNaN(lng) && !isNaN(lat) && lng >= -180 && lng <= 180 && lat >= -90 && lat <= 90
21317
+ });
21318
+ if (isNaN(lng) || isNaN(lat) || lng < -180 || lng > 180 || lat < -90 || lat > 90) {
21319
+ console.error("\u274C [DEBUG TEST] Invalid coordinates for ".concat(project.name, ":"), {
21320
+ lng,
21321
+ lat
21322
+ });
21323
+ return;
21324
+ }
21325
+
21326
+ // Create popup
21327
+ const popup = new mapboxgl.Popup({
21328
+ offset: 25
21329
+ }).setHTML("\n <div style=\"padding: 8px;\">\n <h3 style=\"margin: 0 0 8px 0; font-size: 14px;\">".concat(project.name, "</h3>\n <p style=\"margin: 0; font-size: 12px; color: #666;\">\n Lat: ").concat(lat.toFixed(4), ", Lng: ").concat(lng.toFixed(4), "\n </p>\n <p style=\"margin: 4px 0 0 0; font-size: 12px;\">\n ").concat(project.projectDescription || 'No description', "\n </p>\n </div>\n "));
21330
+
21331
+ // Add marker with explicit positioning
21332
+ const marker = new mapboxgl.Marker({
21333
+ element: el,
21334
+ anchor: 'center'
21335
+ }).setLngLat([lng, lat]).setPopup(popup).addTo(map.current);
21336
+
21337
+ // Verify position after a delay
21338
+ setTimeout(() => {
21339
+ const markerLngLat = marker.getLngLat();
21340
+ const positionMatch = Math.abs(markerLngLat.lng - lng) < 0.0001 && Math.abs(markerLngLat.lat - lat) < 0.0001;
21341
+ console.log("\uD83D\uDD0D [DEBUG TEST] Position verification for ".concat(project.name, ":"), {
21342
+ expected: [lng, lat],
21343
+ actual: [markerLngLat.lng, markerLngLat.lat],
21344
+ match: positionMatch,
21345
+ difference: {
21346
+ lng: Math.abs(markerLngLat.lng - lng),
21347
+ lat: Math.abs(markerLngLat.lat - lat)
21348
+ }
21349
+ });
21350
+ if (!positionMatch) {
21351
+ console.error("\u274C [DEBUG TEST] Position mismatch for ".concat(project.name, "!"));
21352
+ }
21353
+ }, 200);
21354
+ console.log("\u2705 [DEBUG TEST] Marker added for ".concat(project.name, " at:"), [lng, lat]);
21355
+ });
21356
+ });
21357
+ return () => {
21358
+ if (map.current) {
21359
+ map.current.remove();
21360
+ map.current = null;
21361
+ }
21362
+ };
21363
+ }, [projects]);
21364
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
21365
+ style: {
21366
+ width: '100%',
21367
+ height: '600px',
21368
+ border: '2px solid #ccc',
21369
+ position: 'relative'
21370
+ },
21371
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
21372
+ ref: mapContainer,
21373
+ style: {
21374
+ width: '100%',
21375
+ height: '100%',
21376
+ position: 'relative'
21377
+ }
21378
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
21379
+ style: {
21380
+ position: 'absolute',
21381
+ top: '10px',
21382
+ left: '10px',
21383
+ background: 'rgba(255,255,255,0.9)',
21384
+ padding: '8px',
21385
+ borderRadius: '4px',
21386
+ fontSize: '12px',
21387
+ zIndex: 1000
21388
+ },
21389
+ children: [/*#__PURE__*/jsxRuntime.jsx("strong", {
21390
+ children: "Debug Test Map"
21391
+ }), /*#__PURE__*/jsxRuntime.jsx("br", {}), "Projects: ", projects.length, /*#__PURE__*/jsxRuntime.jsx("br", {}), "Check console for position verification"]
21392
+ })]
21393
+ });
21394
+ };
21395
+
20849
21396
  function WidgetPlaceholder(_ref) {
20850
21397
  let {
20851
21398
  icon = "",
@@ -61668,6 +62215,8 @@ exports.SelectFiltersTimeFrame = Timeframe;
61668
62215
  exports.SettingsPopover = SettingsPopover;
61669
62216
  exports.Sidenav = Sidenav;
61670
62217
  exports.SidenavMenu = SidenavMenu;
62218
+ exports.SimpleGlobe = SimpleGlobe;
62219
+ exports.SimpleGlobeTestDebug = SimpleGlobeTestDebug;
61671
62220
  exports.StackChart = StackChart;
61672
62221
  exports.StakeholderMappings = index$1;
61673
62222
  exports.Steps = DAFSteps;