datastake-daf 0.6.284 β 0.6.286
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.
- package/dist/components/index.js +216 -4
- package/package.json +1 -1
- package/src/@daf/core/components/Dashboard/Globe/NoConflictGlobe.jsx +488 -0
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobe.jsx +26 -4
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobe.stories.js +5 -5
- package/src/index.js +1 -0
package/dist/components/index.js
CHANGED
|
@@ -21079,14 +21079,16 @@ const SimpleGlobe = _ref => {
|
|
|
21079
21079
|
const lat = Number(project.latitude);
|
|
21080
21080
|
console.log("\uD83D\uDCCD [SIMPLE GLOBE] Marker ".concat(index, " coordinates:"), {
|
|
21081
21081
|
lng,
|
|
21082
|
-
lat
|
|
21082
|
+
lat,
|
|
21083
|
+
project: project.name
|
|
21083
21084
|
});
|
|
21084
21085
|
|
|
21085
21086
|
// Validate coordinates
|
|
21086
21087
|
if (isNaN(lng) || isNaN(lat) || lng < -180 || lng > 180 || lat < -90 || lat > 90) {
|
|
21087
21088
|
console.error("\u274C [SIMPLE GLOBE] Invalid coordinates for project ".concat(index, ":"), {
|
|
21088
21089
|
lng,
|
|
21089
|
-
lat
|
|
21090
|
+
lat,
|
|
21091
|
+
project: project.name
|
|
21090
21092
|
});
|
|
21091
21093
|
return;
|
|
21092
21094
|
}
|
|
@@ -21095,14 +21097,28 @@ const SimpleGlobe = _ref => {
|
|
|
21095
21097
|
bounds.extend([lng, lat]);
|
|
21096
21098
|
hasValidCoordinates = true;
|
|
21097
21099
|
|
|
21098
|
-
//
|
|
21099
|
-
new mapboxgl.Marker(
|
|
21100
|
+
// Create marker with explicit positioning and anchor
|
|
21101
|
+
const marker = new mapboxgl.Marker({
|
|
21102
|
+
element: el,
|
|
21103
|
+
anchor: 'center'
|
|
21104
|
+
}).setLngLat([lng, lat]).setPopup(popup).addTo(map.current);
|
|
21100
21105
|
|
|
21101
21106
|
// Add click handler
|
|
21102
21107
|
el.addEventListener('click', () => {
|
|
21103
21108
|
console.log('π [SIMPLE GLOBE] Marker clicked:', project);
|
|
21104
21109
|
onProjectClick(project);
|
|
21105
21110
|
});
|
|
21111
|
+
|
|
21112
|
+
// Verify marker position after a short delay (like other Globe components)
|
|
21113
|
+
setTimeout(() => {
|
|
21114
|
+
const markerLngLat = marker.getLngLat();
|
|
21115
|
+
console.log("\uD83D\uDD0D [SIMPLE GLOBE] Marker ".concat(index, " position verification:"), {
|
|
21116
|
+
expected: [lng, lat],
|
|
21117
|
+
actual: [markerLngLat.lng, markerLngLat.lat],
|
|
21118
|
+
project: project.name,
|
|
21119
|
+
match: Math.abs(markerLngLat.lng - lng) < 0.0001 && Math.abs(markerLngLat.lat - lat) < 0.0001
|
|
21120
|
+
});
|
|
21121
|
+
}, 100);
|
|
21106
21122
|
console.log("\u2705 [SIMPLE GLOBE] Marker ".concat(index, " added at:"), [lng, lat]);
|
|
21107
21123
|
});
|
|
21108
21124
|
|
|
@@ -21408,6 +21424,201 @@ const IsolatedGlobe = _ref => {
|
|
|
21408
21424
|
});
|
|
21409
21425
|
};
|
|
21410
21426
|
|
|
21427
|
+
const NoConflictGlobe = _ref => {
|
|
21428
|
+
let {
|
|
21429
|
+
projects = [],
|
|
21430
|
+
mapConfig = {},
|
|
21431
|
+
onProjectClick = () => {},
|
|
21432
|
+
type = "default",
|
|
21433
|
+
color = "#00809E"
|
|
21434
|
+
} = _ref;
|
|
21435
|
+
const mapContainer = React.useRef(null);
|
|
21436
|
+
const map = React.useRef(null);
|
|
21437
|
+
const boundsRef = React.useRef(null);
|
|
21438
|
+
React.useEffect(() => {
|
|
21439
|
+
if (map.current) return;
|
|
21440
|
+
console.log('πΊοΈ [NO CONFLICT GLOBE] Creating map with aggressive isolation...');
|
|
21441
|
+
|
|
21442
|
+
// Set Mapbox access token
|
|
21443
|
+
mapboxgl.accessToken = 'pk.eyJ1IjoicmVkaXM5OTkiLCJhIjoiY2x4YWV5MzA5MmtuZzJpcXM5Y201Z2E2YiJ9.m5bwPg-Tj4Akesl1yQUa3w';
|
|
21444
|
+
|
|
21445
|
+
// Create map
|
|
21446
|
+
map.current = new mapboxgl.Map({
|
|
21447
|
+
container: mapContainer.current,
|
|
21448
|
+
style: 'mapbox://styles/mapbox/satellite-v9',
|
|
21449
|
+
center: [0, 0],
|
|
21450
|
+
zoom: mapConfig.maxZoom || 3,
|
|
21451
|
+
projection: 'globe',
|
|
21452
|
+
attributionControl: false
|
|
21453
|
+
});
|
|
21454
|
+
|
|
21455
|
+
// Add markers when map loads
|
|
21456
|
+
map.current.on('load', () => {
|
|
21457
|
+
console.log('πΊοΈ [NO CONFLICT GLOBE] Map loaded, adding markers...');
|
|
21458
|
+
|
|
21459
|
+
// Inject aggressive CSS isolation
|
|
21460
|
+
const styleId = 'no-conflict-globe-styles';
|
|
21461
|
+
let existingStyle = document.getElementById(styleId);
|
|
21462
|
+
if (!existingStyle) {
|
|
21463
|
+
const style = document.createElement('style');
|
|
21464
|
+
style.id = styleId;
|
|
21465
|
+
style.textContent = "\n /* NO CONFLICT GLOBE - Aggressive CSS Isolation */\n .no-conflict-globe-container {\n position: relative !important;\n width: 100% !important;\n height: 100% !important;\n overflow: hidden !important;\n font: 12px/20px Helvetica Neue, Arial, Helvetica, sans-serif !important;\n -webkit-tap-highlight-color: rgb(0 0 0/0) !important;\n isolation: isolate !important;\n }\n \n .no-conflict-globe-container .mapboxgl-canvas-container {\n position: relative !important;\n left: 0 !important;\n top: 0 !important;\n transform: none !important;\n width: 100% !important;\n height: 100% !important;\n overflow: hidden !important;\n isolation: isolate !important;\n }\n \n .no-conflict-globe-container .mapboxgl-canvas-container canvas {\n position: absolute !important;\n left: 0 !important;\n top: 0 !important;\n transform: none !important;\n width: 100% !important;\n height: 100% !important;\n isolation: isolate !important;\n }\n \n /* Override ALL possible Leaflet CSS interference */\n .no-conflict-globe-container .mapboxgl-marker {\n position: absolute !important;\n left: auto !important;\n top: auto !important;\n transform: none !important;\n pointer-events: auto !important;\n z-index: 1000 !important;\n isolation: isolate !important;\n }\n \n .no-conflict-globe-container .mapboxgl-marker .no-conflict-marker {\n position: relative !important;\n left: auto !important;\n top: auto !important;\n transform: none !important;\n pointer-events: auto !important;\n cursor: pointer !important;\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n isolation: isolate !important;\n }\n \n /* Override Leaflet pane positioning */\n .no-conflict-globe-container .mapboxgl-marker-pane {\n position: absolute !important;\n left: 0 !important;\n top: 0 !important;\n transform: none !important;\n z-index: 600 !important;\n isolation: isolate !important;\n }\n \n .no-conflict-globe-container .mapboxgl-tile-container {\n position: absolute !important;\n left: 0 !important;\n top: 0 !important;\n transform: none !important;\n isolation: isolate !important;\n }\n \n .no-conflict-globe-container .mapboxgl-zoom-animated {\n transform-origin: 0 0 !important;\n isolation: isolate !important;\n }\n \n .no-conflict-globe-container .mapboxgl-marker.leaflet-interactive {\n cursor: pointer !important;\n }\n \n /* Popup styles with isolation */\n .no-conflict-globe-container .mapboxgl-popup {\n position: absolute !important;\n left: auto !important;\n top: auto !important;\n transform: none !important;\n z-index: 700 !important;\n text-align: center !important;\n margin-bottom: 20px !important;\n isolation: isolate !important;\n }\n \n .no-conflict-globe-container .mapboxgl-popup-content-wrapper {\n padding: 1px !important;\n text-align: left !important;\n border-radius: 12px !important;\n background: white !important;\n color: #333 !important;\n box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4) !important;\n isolation: isolate !important;\n }\n \n .no-conflict-globe-container .mapboxgl-popup-content {\n margin: 13px 24px 13px 20px !important;\n line-height: 1.3 !important;\n font-size: 13px !important;\n min-height: 1px !important;\n isolation: isolate !important;\n }\n \n .no-conflict-globe-container .mapboxgl-popup-content p {\n margin: 17px 0 !important;\n }\n \n .no-conflict-globe-container .mapboxgl-popup-tip-container {\n width: 40px !important;\n height: 20px !important;\n position: absolute !important;\n left: 50% !important;\n margin-top: -1px !important;\n margin-left: -20px !important;\n overflow: hidden !important;\n pointer-events: none !important;\n isolation: isolate !important;\n }\n \n .no-conflict-globe-container .mapboxgl-popup-tip {\n width: 17px !important;\n height: 17px !important;\n padding: 1px !important;\n margin: -10px auto 0 !important;\n pointer-events: auto !important;\n transform: rotate(45deg) !important;\n background: white !important;\n box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4) !important;\n isolation: isolate !important;\n }\n \n .no-conflict-globe-container .mapboxgl-popup-close-button {\n position: absolute !important;\n top: 0 !important;\n right: 0 !important;\n border: none !important;\n text-align: center !important;\n width: 24px !important;\n height: 24px !important;\n font: 16px/24px Tahoma, Verdana, sans-serif !important;\n color: #757575 !important;\n text-decoration: none !important;\n background: transparent !important;\n cursor: pointer !important;\n isolation: isolate !important;\n }\n \n .no-conflict-globe-container .mapboxgl-popup-close-button:hover {\n color: #585858 !important;\n }\n \n /* Hide Mapbox attribution completely */\n .no-conflict-globe-container .mapboxgl-ctrl-attribution {\n display: none !important;\n }\n \n .no-conflict-globe-container .mapboxgl-ctrl-logo {\n display: none !important;\n }\n \n /* Override any Leaflet pane positioning */\n .no-conflict-globe-container .mapboxgl-overlay-pane {\n position: absolute !important;\n left: 0 !important;\n top: 0 !important;\n transform: none !important;\n z-index: 400 !important;\n isolation: isolate !important;\n }\n \n .no-conflict-globe-container .mapboxgl-shadow-pane {\n position: absolute !important;\n left: 0 !important;\n top: 0 !important;\n transform: none !important;\n z-index: 500 !important;\n isolation: isolate !important;\n }\n \n .no-conflict-globe-container .mapboxgl-tooltip-pane {\n position: absolute !important;\n left: 0 !important;\n top: 0 !important;\n transform: none !important;\n z-index: 650 !important;\n isolation: isolate !important;\n }\n \n .no-conflict-globe-container .mapboxgl-popup-pane {\n position: absolute !important;\n left: 0 !important;\n top: 0 !important;\n transform: none !important;\n z-index: 700 !important;\n isolation: isolate !important;\n }\n \n /* Override any Leaflet div icon styles */\n .no-conflict-globe-container .mapboxgl-marker .leaflet-div-icon {\n background: none !important;\n border: none !important;\n position: relative !important;\n left: auto !important;\n top: auto !important;\n transform: none !important;\n }\n \n /* Override any Leaflet marker icon styles */\n .no-conflict-globe-container .mapboxgl-marker .leaflet-marker-icon {\n position: relative !important;\n left: auto !important;\n top: auto !important;\n transform: none !important;\n }\n \n /* Override any Leaflet marker shadow styles */\n .no-conflict-globe-container .mapboxgl-marker .leaflet-marker-shadow {\n display: none !important;\n }\n \n /* Override any Leaflet interactive styles */\n .no-conflict-globe-container .mapboxgl-marker.leaflet-interactive {\n cursor: pointer !important;\n pointer-events: auto !important;\n }\n \n /* Override any Leaflet zoom animations */\n .no-conflict-globe-container .mapboxgl-zoom-animated {\n transform-origin: 0 0 !important;\n }\n \n /* Override any Leaflet tile styles */\n .no-conflict-globe-container .mapboxgl-tile {\n position: absolute !important;\n left: 0 !important;\n top: 0 !important;\n transform: none !important;\n }\n \n /* Override any Leaflet image layer styles */\n .no-conflict-globe-container .mapboxgl-image-layer {\n position: absolute !important;\n left: 0 !important;\n top: 0 !important;\n transform: none !important;\n }\n ";
|
|
21466
|
+
document.head.appendChild(style);
|
|
21467
|
+
}
|
|
21468
|
+
|
|
21469
|
+
// Calculate bounds to fit all markers
|
|
21470
|
+
const bounds = new mapboxgl.LngLatBounds();
|
|
21471
|
+
let hasValidCoordinates = false;
|
|
21472
|
+
projects.forEach((project, index) => {
|
|
21473
|
+
console.log("\uD83D\uDCCD [NO CONFLICT GLOBE] Adding marker ".concat(index, ":"), project);
|
|
21474
|
+
|
|
21475
|
+
// Create marker element with unique class
|
|
21476
|
+
const el = document.createElement('div');
|
|
21477
|
+
el.className = 'no-conflict-marker';
|
|
21478
|
+
el.style.cursor = 'pointer';
|
|
21479
|
+
el.style.boxShadow = '0px 3.45px 3.45px 0px #00000029';
|
|
21480
|
+
el.style.display = 'flex';
|
|
21481
|
+
el.style.alignItems = 'center';
|
|
21482
|
+
el.style.justifyContent = 'center';
|
|
21483
|
+
el.style.position = 'relative';
|
|
21484
|
+
el.style.left = 'auto';
|
|
21485
|
+
el.style.top = 'auto';
|
|
21486
|
+
el.style.transform = 'none';
|
|
21487
|
+
el.style.zIndex = '1000';
|
|
21488
|
+
el.style.isolation = 'isolate';
|
|
21489
|
+
if (type === "location") {
|
|
21490
|
+
// Location marker - SVG map pin style
|
|
21491
|
+
el.style.width = '28px';
|
|
21492
|
+
el.style.height = '33px';
|
|
21493
|
+
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 ");
|
|
21494
|
+
} else {
|
|
21495
|
+
// Default circular marker style
|
|
21496
|
+
el.style.width = '30px';
|
|
21497
|
+
el.style.height = '30px';
|
|
21498
|
+
el.style.backgroundColor = color;
|
|
21499
|
+
el.style.borderRadius = '50%';
|
|
21500
|
+
el.style.border = '2px solid white';
|
|
21501
|
+
el.style.color = 'white';
|
|
21502
|
+
el.style.fontWeight = 'bold';
|
|
21503
|
+
el.style.fontSize = '14px';
|
|
21504
|
+
el.style.textAlign = 'center';
|
|
21505
|
+
el.style.lineHeight = '1';
|
|
21506
|
+
el.innerHTML = "<span style=\"display: block; line-height: 1;\">".concat(project.percentageCompletion || 0, "</span>");
|
|
21507
|
+
}
|
|
21508
|
+
|
|
21509
|
+
// Create popup content
|
|
21510
|
+
const popupContent = "\n <div style=\"padding: 12px; min-width: 200px;\">\n <h3 style=\"margin: 0 0 8px 0; font-size: 16px; color: #333;\">".concat(project.name, "</h3>\n <p style=\"margin: 0 0 4px 0; font-size: 12px; color: #666;\">\n <strong>Country:</strong> ").concat(project.country || 'N/A', "\n </p>\n <p style=\"margin: 0 0 4px 0; font-size: 12px; color: #666;\">\n <strong>Sector:</strong> ").concat(project.sectoralScope || 'Project', "\n </p>\n <p style=\"margin: 0 0 4px 0; font-size: 12px; color: #666;\">\n <strong>Completion:</strong> ").concat(project.percentageCompletion || 0, "%\n </p>\n <p style=\"margin: 4px 0 0 0; font-size: 12px; color: #666;\">\n <strong>Coordinates:</strong> ").concat(Number(project.latitude).toFixed(4), ", ").concat(Number(project.longitude).toFixed(4), "\n </p>\n </div>\n ");
|
|
21511
|
+
|
|
21512
|
+
// Create popup
|
|
21513
|
+
const popup = new mapboxgl.Popup({
|
|
21514
|
+
offset: 25,
|
|
21515
|
+
closeButton: true,
|
|
21516
|
+
closeOnClick: false
|
|
21517
|
+
}).setHTML(popupContent);
|
|
21518
|
+
|
|
21519
|
+
// Ensure coordinates are valid numbers
|
|
21520
|
+
const lng = Number(project.longitude);
|
|
21521
|
+
const lat = Number(project.latitude);
|
|
21522
|
+
console.log("\uD83D\uDCCD [NO CONFLICT GLOBE] Marker ".concat(index, " coordinates:"), {
|
|
21523
|
+
original: {
|
|
21524
|
+
longitude: project.longitude,
|
|
21525
|
+
latitude: project.latitude
|
|
21526
|
+
},
|
|
21527
|
+
processed: {
|
|
21528
|
+
lng,
|
|
21529
|
+
lat
|
|
21530
|
+
},
|
|
21531
|
+
project: project.name
|
|
21532
|
+
});
|
|
21533
|
+
|
|
21534
|
+
// Validate coordinates
|
|
21535
|
+
if (isNaN(lng) || isNaN(lat) || lng < -180 || lng > 180 || lat < -90 || lat > 90) {
|
|
21536
|
+
console.error("\u274C [NO CONFLICT GLOBE] Invalid coordinates for project ".concat(index, ":"), {
|
|
21537
|
+
lng,
|
|
21538
|
+
lat,
|
|
21539
|
+
original: {
|
|
21540
|
+
longitude: project.longitude,
|
|
21541
|
+
latitude: project.latitude
|
|
21542
|
+
},
|
|
21543
|
+
project: project.name
|
|
21544
|
+
});
|
|
21545
|
+
return;
|
|
21546
|
+
}
|
|
21547
|
+
|
|
21548
|
+
// Add coordinates to bounds
|
|
21549
|
+
bounds.extend([lng, lat]);
|
|
21550
|
+
hasValidCoordinates = true;
|
|
21551
|
+
|
|
21552
|
+
// Create marker with explicit positioning
|
|
21553
|
+
const marker = new mapboxgl.Marker({
|
|
21554
|
+
element: el,
|
|
21555
|
+
anchor: 'center'
|
|
21556
|
+
}).setLngLat([lng, lat]).setPopup(popup).addTo(map.current);
|
|
21557
|
+
|
|
21558
|
+
// Add click handler
|
|
21559
|
+
el.addEventListener('click', () => {
|
|
21560
|
+
console.log('π [NO CONFLICT GLOBE] Marker clicked:', project);
|
|
21561
|
+
onProjectClick(project);
|
|
21562
|
+
});
|
|
21563
|
+
|
|
21564
|
+
// Verify marker position after a short delay
|
|
21565
|
+
setTimeout(() => {
|
|
21566
|
+
const markerLngLat = marker.getLngLat();
|
|
21567
|
+
console.log("\uD83D\uDD0D [NO CONFLICT GLOBE] Marker ".concat(index, " position verification:"), {
|
|
21568
|
+
expected: [lng, lat],
|
|
21569
|
+
actual: [markerLngLat.lng, markerLngLat.lat],
|
|
21570
|
+
project: project.name,
|
|
21571
|
+
match: Math.abs(markerLngLat.lng - lng) < 0.0001 && Math.abs(markerLngLat.lat - lat) < 0.0001
|
|
21572
|
+
});
|
|
21573
|
+
}, 100);
|
|
21574
|
+
console.log("\u2705 [NO CONFLICT GLOBE] Marker ".concat(index, " added at:"), [lng, lat]);
|
|
21575
|
+
});
|
|
21576
|
+
|
|
21577
|
+
// Fit map to show all markers if we have valid coordinates
|
|
21578
|
+
if (hasValidCoordinates && !bounds.isEmpty()) {
|
|
21579
|
+
console.log('πΊοΈ [NO CONFLICT GLOBE] Fitting map to bounds:', bounds);
|
|
21580
|
+
map.current.fitBounds(bounds, {
|
|
21581
|
+
padding: {
|
|
21582
|
+
top: 20,
|
|
21583
|
+
bottom: 20,
|
|
21584
|
+
left: 20,
|
|
21585
|
+
right: 20
|
|
21586
|
+
},
|
|
21587
|
+
maxZoom: 6,
|
|
21588
|
+
duration: 1000
|
|
21589
|
+
});
|
|
21590
|
+
boundsRef.current = bounds;
|
|
21591
|
+
} else {
|
|
21592
|
+
boundsRef.current = null;
|
|
21593
|
+
}
|
|
21594
|
+
});
|
|
21595
|
+
return () => {
|
|
21596
|
+
if (map.current) {
|
|
21597
|
+
map.current.remove();
|
|
21598
|
+
map.current = null;
|
|
21599
|
+
}
|
|
21600
|
+
};
|
|
21601
|
+
}, [projects, onProjectClick, mapConfig]);
|
|
21602
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
21603
|
+
className: "no-conflict-globe-container",
|
|
21604
|
+
style: {
|
|
21605
|
+
width: '100%',
|
|
21606
|
+
height: '100%',
|
|
21607
|
+
position: 'relative',
|
|
21608
|
+
isolation: 'isolate'
|
|
21609
|
+
},
|
|
21610
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
21611
|
+
ref: mapContainer,
|
|
21612
|
+
style: {
|
|
21613
|
+
width: '100%',
|
|
21614
|
+
height: '100%',
|
|
21615
|
+
position: 'relative',
|
|
21616
|
+
isolation: 'isolate'
|
|
21617
|
+
}
|
|
21618
|
+
})
|
|
21619
|
+
});
|
|
21620
|
+
};
|
|
21621
|
+
|
|
21411
21622
|
function WidgetPlaceholder(_ref) {
|
|
21412
21623
|
let {
|
|
21413
21624
|
icon = "",
|
|
@@ -62203,6 +62414,7 @@ exports.MoreTags = MoreTags;
|
|
|
62203
62414
|
exports.MultiBarProgress = MultiBarProgress;
|
|
62204
62415
|
exports.MultiColorProgressBar = MultiColorProgressBar;
|
|
62205
62416
|
exports.Multiselect = Multiselect;
|
|
62417
|
+
exports.NoConflictGlobe = NoConflictGlobe;
|
|
62206
62418
|
exports.NotFound = NotFound;
|
|
62207
62419
|
exports.Pagination = Pagination;
|
|
62208
62420
|
exports.PdfForm = PdfForm;
|
package/package.json
CHANGED
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import mapboxgl from 'mapbox-gl';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* NoConflictGlobe - Mapbox component with aggressive CSS isolation
|
|
6
|
+
* Uses unique CSS classes and inline styles to prevent any conflicts
|
|
7
|
+
*/
|
|
8
|
+
const NoConflictGlobe = ({
|
|
9
|
+
projects = [],
|
|
10
|
+
mapConfig = {},
|
|
11
|
+
onProjectClick = () => {},
|
|
12
|
+
type = "default",
|
|
13
|
+
color = "#00809E"
|
|
14
|
+
}) => {
|
|
15
|
+
const mapContainer = useRef(null);
|
|
16
|
+
const map = useRef(null);
|
|
17
|
+
const boundsRef = useRef(null);
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (map.current) return;
|
|
21
|
+
|
|
22
|
+
console.log('πΊοΈ [NO CONFLICT GLOBE] Creating map with aggressive isolation...');
|
|
23
|
+
|
|
24
|
+
// Set Mapbox access token
|
|
25
|
+
mapboxgl.accessToken = 'pk.eyJ1IjoicmVkaXM5OTkiLCJhIjoiY2x4YWV5MzA5MmtuZzJpcXM5Y201Z2E2YiJ9.m5bwPg-Tj4Akesl1yQUa3w';
|
|
26
|
+
|
|
27
|
+
// Create map
|
|
28
|
+
map.current = new mapboxgl.Map({
|
|
29
|
+
container: mapContainer.current,
|
|
30
|
+
style: 'mapbox://styles/mapbox/satellite-v9',
|
|
31
|
+
center: [0, 0],
|
|
32
|
+
zoom: mapConfig.maxZoom || 3,
|
|
33
|
+
projection: 'globe',
|
|
34
|
+
attributionControl: false
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Add markers when map loads
|
|
38
|
+
map.current.on('load', () => {
|
|
39
|
+
console.log('πΊοΈ [NO CONFLICT GLOBE] Map loaded, adding markers...');
|
|
40
|
+
|
|
41
|
+
// Inject aggressive CSS isolation
|
|
42
|
+
const styleId = 'no-conflict-globe-styles';
|
|
43
|
+
let existingStyle = document.getElementById(styleId);
|
|
44
|
+
if (!existingStyle) {
|
|
45
|
+
const style = document.createElement('style');
|
|
46
|
+
style.id = styleId;
|
|
47
|
+
style.textContent = `
|
|
48
|
+
/* NO CONFLICT GLOBE - Aggressive CSS Isolation */
|
|
49
|
+
.no-conflict-globe-container {
|
|
50
|
+
position: relative !important;
|
|
51
|
+
width: 100% !important;
|
|
52
|
+
height: 100% !important;
|
|
53
|
+
overflow: hidden !important;
|
|
54
|
+
font: 12px/20px Helvetica Neue, Arial, Helvetica, sans-serif !important;
|
|
55
|
+
-webkit-tap-highlight-color: rgb(0 0 0/0) !important;
|
|
56
|
+
isolation: isolate !important;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.no-conflict-globe-container .mapboxgl-canvas-container {
|
|
60
|
+
position: relative !important;
|
|
61
|
+
left: 0 !important;
|
|
62
|
+
top: 0 !important;
|
|
63
|
+
transform: none !important;
|
|
64
|
+
width: 100% !important;
|
|
65
|
+
height: 100% !important;
|
|
66
|
+
overflow: hidden !important;
|
|
67
|
+
isolation: isolate !important;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.no-conflict-globe-container .mapboxgl-canvas-container canvas {
|
|
71
|
+
position: absolute !important;
|
|
72
|
+
left: 0 !important;
|
|
73
|
+
top: 0 !important;
|
|
74
|
+
transform: none !important;
|
|
75
|
+
width: 100% !important;
|
|
76
|
+
height: 100% !important;
|
|
77
|
+
isolation: isolate !important;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* Override ALL possible Leaflet CSS interference */
|
|
81
|
+
.no-conflict-globe-container .mapboxgl-marker {
|
|
82
|
+
position: absolute !important;
|
|
83
|
+
left: auto !important;
|
|
84
|
+
top: auto !important;
|
|
85
|
+
transform: none !important;
|
|
86
|
+
pointer-events: auto !important;
|
|
87
|
+
z-index: 1000 !important;
|
|
88
|
+
isolation: isolate !important;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.no-conflict-globe-container .mapboxgl-marker .no-conflict-marker {
|
|
92
|
+
position: relative !important;
|
|
93
|
+
left: auto !important;
|
|
94
|
+
top: auto !important;
|
|
95
|
+
transform: none !important;
|
|
96
|
+
pointer-events: auto !important;
|
|
97
|
+
cursor: pointer !important;
|
|
98
|
+
display: flex !important;
|
|
99
|
+
align-items: center !important;
|
|
100
|
+
justify-content: center !important;
|
|
101
|
+
isolation: isolate !important;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Override Leaflet pane positioning */
|
|
105
|
+
.no-conflict-globe-container .mapboxgl-marker-pane {
|
|
106
|
+
position: absolute !important;
|
|
107
|
+
left: 0 !important;
|
|
108
|
+
top: 0 !important;
|
|
109
|
+
transform: none !important;
|
|
110
|
+
z-index: 600 !important;
|
|
111
|
+
isolation: isolate !important;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.no-conflict-globe-container .mapboxgl-tile-container {
|
|
115
|
+
position: absolute !important;
|
|
116
|
+
left: 0 !important;
|
|
117
|
+
top: 0 !important;
|
|
118
|
+
transform: none !important;
|
|
119
|
+
isolation: isolate !important;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.no-conflict-globe-container .mapboxgl-zoom-animated {
|
|
123
|
+
transform-origin: 0 0 !important;
|
|
124
|
+
isolation: isolate !important;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.no-conflict-globe-container .mapboxgl-marker.leaflet-interactive {
|
|
128
|
+
cursor: pointer !important;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/* Popup styles with isolation */
|
|
132
|
+
.no-conflict-globe-container .mapboxgl-popup {
|
|
133
|
+
position: absolute !important;
|
|
134
|
+
left: auto !important;
|
|
135
|
+
top: auto !important;
|
|
136
|
+
transform: none !important;
|
|
137
|
+
z-index: 700 !important;
|
|
138
|
+
text-align: center !important;
|
|
139
|
+
margin-bottom: 20px !important;
|
|
140
|
+
isolation: isolate !important;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.no-conflict-globe-container .mapboxgl-popup-content-wrapper {
|
|
144
|
+
padding: 1px !important;
|
|
145
|
+
text-align: left !important;
|
|
146
|
+
border-radius: 12px !important;
|
|
147
|
+
background: white !important;
|
|
148
|
+
color: #333 !important;
|
|
149
|
+
box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4) !important;
|
|
150
|
+
isolation: isolate !important;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.no-conflict-globe-container .mapboxgl-popup-content {
|
|
154
|
+
margin: 13px 24px 13px 20px !important;
|
|
155
|
+
line-height: 1.3 !important;
|
|
156
|
+
font-size: 13px !important;
|
|
157
|
+
min-height: 1px !important;
|
|
158
|
+
isolation: isolate !important;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.no-conflict-globe-container .mapboxgl-popup-content p {
|
|
162
|
+
margin: 17px 0 !important;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.no-conflict-globe-container .mapboxgl-popup-tip-container {
|
|
166
|
+
width: 40px !important;
|
|
167
|
+
height: 20px !important;
|
|
168
|
+
position: absolute !important;
|
|
169
|
+
left: 50% !important;
|
|
170
|
+
margin-top: -1px !important;
|
|
171
|
+
margin-left: -20px !important;
|
|
172
|
+
overflow: hidden !important;
|
|
173
|
+
pointer-events: none !important;
|
|
174
|
+
isolation: isolate !important;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.no-conflict-globe-container .mapboxgl-popup-tip {
|
|
178
|
+
width: 17px !important;
|
|
179
|
+
height: 17px !important;
|
|
180
|
+
padding: 1px !important;
|
|
181
|
+
margin: -10px auto 0 !important;
|
|
182
|
+
pointer-events: auto !important;
|
|
183
|
+
transform: rotate(45deg) !important;
|
|
184
|
+
background: white !important;
|
|
185
|
+
box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4) !important;
|
|
186
|
+
isolation: isolate !important;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.no-conflict-globe-container .mapboxgl-popup-close-button {
|
|
190
|
+
position: absolute !important;
|
|
191
|
+
top: 0 !important;
|
|
192
|
+
right: 0 !important;
|
|
193
|
+
border: none !important;
|
|
194
|
+
text-align: center !important;
|
|
195
|
+
width: 24px !important;
|
|
196
|
+
height: 24px !important;
|
|
197
|
+
font: 16px/24px Tahoma, Verdana, sans-serif !important;
|
|
198
|
+
color: #757575 !important;
|
|
199
|
+
text-decoration: none !important;
|
|
200
|
+
background: transparent !important;
|
|
201
|
+
cursor: pointer !important;
|
|
202
|
+
isolation: isolate !important;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.no-conflict-globe-container .mapboxgl-popup-close-button:hover {
|
|
206
|
+
color: #585858 !important;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/* Hide Mapbox attribution completely */
|
|
210
|
+
.no-conflict-globe-container .mapboxgl-ctrl-attribution {
|
|
211
|
+
display: none !important;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.no-conflict-globe-container .mapboxgl-ctrl-logo {
|
|
215
|
+
display: none !important;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/* Override any Leaflet pane positioning */
|
|
219
|
+
.no-conflict-globe-container .mapboxgl-overlay-pane {
|
|
220
|
+
position: absolute !important;
|
|
221
|
+
left: 0 !important;
|
|
222
|
+
top: 0 !important;
|
|
223
|
+
transform: none !important;
|
|
224
|
+
z-index: 400 !important;
|
|
225
|
+
isolation: isolate !important;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.no-conflict-globe-container .mapboxgl-shadow-pane {
|
|
229
|
+
position: absolute !important;
|
|
230
|
+
left: 0 !important;
|
|
231
|
+
top: 0 !important;
|
|
232
|
+
transform: none !important;
|
|
233
|
+
z-index: 500 !important;
|
|
234
|
+
isolation: isolate !important;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.no-conflict-globe-container .mapboxgl-tooltip-pane {
|
|
238
|
+
position: absolute !important;
|
|
239
|
+
left: 0 !important;
|
|
240
|
+
top: 0 !important;
|
|
241
|
+
transform: none !important;
|
|
242
|
+
z-index: 650 !important;
|
|
243
|
+
isolation: isolate !important;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.no-conflict-globe-container .mapboxgl-popup-pane {
|
|
247
|
+
position: absolute !important;
|
|
248
|
+
left: 0 !important;
|
|
249
|
+
top: 0 !important;
|
|
250
|
+
transform: none !important;
|
|
251
|
+
z-index: 700 !important;
|
|
252
|
+
isolation: isolate !important;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/* Override any Leaflet div icon styles */
|
|
256
|
+
.no-conflict-globe-container .mapboxgl-marker .leaflet-div-icon {
|
|
257
|
+
background: none !important;
|
|
258
|
+
border: none !important;
|
|
259
|
+
position: relative !important;
|
|
260
|
+
left: auto !important;
|
|
261
|
+
top: auto !important;
|
|
262
|
+
transform: none !important;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/* Override any Leaflet marker icon styles */
|
|
266
|
+
.no-conflict-globe-container .mapboxgl-marker .leaflet-marker-icon {
|
|
267
|
+
position: relative !important;
|
|
268
|
+
left: auto !important;
|
|
269
|
+
top: auto !important;
|
|
270
|
+
transform: none !important;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/* Override any Leaflet marker shadow styles */
|
|
274
|
+
.no-conflict-globe-container .mapboxgl-marker .leaflet-marker-shadow {
|
|
275
|
+
display: none !important;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/* Override any Leaflet interactive styles */
|
|
279
|
+
.no-conflict-globe-container .mapboxgl-marker.leaflet-interactive {
|
|
280
|
+
cursor: pointer !important;
|
|
281
|
+
pointer-events: auto !important;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/* Override any Leaflet zoom animations */
|
|
285
|
+
.no-conflict-globe-container .mapboxgl-zoom-animated {
|
|
286
|
+
transform-origin: 0 0 !important;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/* Override any Leaflet tile styles */
|
|
290
|
+
.no-conflict-globe-container .mapboxgl-tile {
|
|
291
|
+
position: absolute !important;
|
|
292
|
+
left: 0 !important;
|
|
293
|
+
top: 0 !important;
|
|
294
|
+
transform: none !important;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/* Override any Leaflet image layer styles */
|
|
298
|
+
.no-conflict-globe-container .mapboxgl-image-layer {
|
|
299
|
+
position: absolute !important;
|
|
300
|
+
left: 0 !important;
|
|
301
|
+
top: 0 !important;
|
|
302
|
+
transform: none !important;
|
|
303
|
+
}
|
|
304
|
+
`;
|
|
305
|
+
document.head.appendChild(style);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// Calculate bounds to fit all markers
|
|
309
|
+
const bounds = new mapboxgl.LngLatBounds();
|
|
310
|
+
let hasValidCoordinates = false;
|
|
311
|
+
|
|
312
|
+
projects.forEach((project, index) => {
|
|
313
|
+
console.log(`π [NO CONFLICT GLOBE] Adding marker ${index}:`, project);
|
|
314
|
+
|
|
315
|
+
// Create marker element with unique class
|
|
316
|
+
const el = document.createElement('div');
|
|
317
|
+
el.className = 'no-conflict-marker';
|
|
318
|
+
el.style.cursor = 'pointer';
|
|
319
|
+
el.style.boxShadow = '0px 3.45px 3.45px 0px #00000029';
|
|
320
|
+
el.style.display = 'flex';
|
|
321
|
+
el.style.alignItems = 'center';
|
|
322
|
+
el.style.justifyContent = 'center';
|
|
323
|
+
el.style.position = 'relative';
|
|
324
|
+
el.style.left = 'auto';
|
|
325
|
+
el.style.top = 'auto';
|
|
326
|
+
el.style.transform = 'none';
|
|
327
|
+
el.style.zIndex = '1000';
|
|
328
|
+
el.style.isolation = 'isolate';
|
|
329
|
+
|
|
330
|
+
if (type === "location") {
|
|
331
|
+
// Location marker - SVG map pin style
|
|
332
|
+
el.style.width = '28px';
|
|
333
|
+
el.style.height = '33px';
|
|
334
|
+
el.innerHTML = `
|
|
335
|
+
<svg
|
|
336
|
+
width="28"
|
|
337
|
+
height="33"
|
|
338
|
+
viewBox="0 0 28 33"
|
|
339
|
+
fill="none"
|
|
340
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
341
|
+
>
|
|
342
|
+
<path
|
|
343
|
+
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"
|
|
344
|
+
fill="${color}"
|
|
345
|
+
stroke="white"
|
|
346
|
+
/>
|
|
347
|
+
</svg>
|
|
348
|
+
`;
|
|
349
|
+
} else {
|
|
350
|
+
// Default circular marker style
|
|
351
|
+
el.style.width = '30px';
|
|
352
|
+
el.style.height = '30px';
|
|
353
|
+
el.style.backgroundColor = color;
|
|
354
|
+
el.style.borderRadius = '50%';
|
|
355
|
+
el.style.border = '2px solid white';
|
|
356
|
+
el.style.color = 'white';
|
|
357
|
+
el.style.fontWeight = 'bold';
|
|
358
|
+
el.style.fontSize = '14px';
|
|
359
|
+
el.style.textAlign = 'center';
|
|
360
|
+
el.style.lineHeight = '1';
|
|
361
|
+
el.innerHTML = `<span style="display: block; line-height: 1;">${project.percentageCompletion || 0}</span>`;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// Create popup content
|
|
365
|
+
const popupContent = `
|
|
366
|
+
<div style="padding: 12px; min-width: 200px;">
|
|
367
|
+
<h3 style="margin: 0 0 8px 0; font-size: 16px; color: #333;">${project.name}</h3>
|
|
368
|
+
<p style="margin: 0 0 4px 0; font-size: 12px; color: #666;">
|
|
369
|
+
<strong>Country:</strong> ${project.country || 'N/A'}
|
|
370
|
+
</p>
|
|
371
|
+
<p style="margin: 0 0 4px 0; font-size: 12px; color: #666;">
|
|
372
|
+
<strong>Sector:</strong> ${project.sectoralScope || 'Project'}
|
|
373
|
+
</p>
|
|
374
|
+
<p style="margin: 0 0 4px 0; font-size: 12px; color: #666;">
|
|
375
|
+
<strong>Completion:</strong> ${project.percentageCompletion || 0}%
|
|
376
|
+
</p>
|
|
377
|
+
<p style="margin: 4px 0 0 0; font-size: 12px; color: #666;">
|
|
378
|
+
<strong>Coordinates:</strong> ${Number(project.latitude).toFixed(4)}, ${Number(project.longitude).toFixed(4)}
|
|
379
|
+
</p>
|
|
380
|
+
</div>
|
|
381
|
+
`;
|
|
382
|
+
|
|
383
|
+
// Create popup
|
|
384
|
+
const popup = new mapboxgl.Popup({
|
|
385
|
+
offset: 25,
|
|
386
|
+
closeButton: true,
|
|
387
|
+
closeOnClick: false
|
|
388
|
+
}).setHTML(popupContent);
|
|
389
|
+
|
|
390
|
+
// Ensure coordinates are valid numbers
|
|
391
|
+
const lng = Number(project.longitude);
|
|
392
|
+
const lat = Number(project.latitude);
|
|
393
|
+
|
|
394
|
+
console.log(`π [NO CONFLICT GLOBE] Marker ${index} coordinates:`, {
|
|
395
|
+
original: { longitude: project.longitude, latitude: project.latitude },
|
|
396
|
+
processed: { lng, lat },
|
|
397
|
+
project: project.name
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
// Validate coordinates
|
|
401
|
+
if (isNaN(lng) || isNaN(lat) || lng < -180 || lng > 180 || lat < -90 || lat > 90) {
|
|
402
|
+
console.error(`β [NO CONFLICT GLOBE] Invalid coordinates for project ${index}:`, {
|
|
403
|
+
lng, lat,
|
|
404
|
+
original: { longitude: project.longitude, latitude: project.latitude },
|
|
405
|
+
project: project.name
|
|
406
|
+
});
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// Add coordinates to bounds
|
|
411
|
+
bounds.extend([lng, lat]);
|
|
412
|
+
hasValidCoordinates = true;
|
|
413
|
+
|
|
414
|
+
// Create marker with explicit positioning
|
|
415
|
+
const marker = new mapboxgl.Marker({
|
|
416
|
+
element: el,
|
|
417
|
+
anchor: 'center'
|
|
418
|
+
})
|
|
419
|
+
.setLngLat([lng, lat])
|
|
420
|
+
.setPopup(popup)
|
|
421
|
+
.addTo(map.current);
|
|
422
|
+
|
|
423
|
+
// Add click handler
|
|
424
|
+
el.addEventListener('click', () => {
|
|
425
|
+
console.log('π [NO CONFLICT GLOBE] Marker clicked:', project);
|
|
426
|
+
onProjectClick(project);
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
// Verify marker position after a short delay
|
|
430
|
+
setTimeout(() => {
|
|
431
|
+
const markerLngLat = marker.getLngLat();
|
|
432
|
+
console.log(`π [NO CONFLICT GLOBE] Marker ${index} position verification:`, {
|
|
433
|
+
expected: [lng, lat],
|
|
434
|
+
actual: [markerLngLat.lng, markerLngLat.lat],
|
|
435
|
+
project: project.name,
|
|
436
|
+
match: Math.abs(markerLngLat.lng - lng) < 0.0001 && Math.abs(markerLngLat.lat - lat) < 0.0001
|
|
437
|
+
});
|
|
438
|
+
}, 100);
|
|
439
|
+
|
|
440
|
+
console.log(`β
[NO CONFLICT GLOBE] Marker ${index} added at:`, [lng, lat]);
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
// Fit map to show all markers if we have valid coordinates
|
|
444
|
+
if (hasValidCoordinates && !bounds.isEmpty()) {
|
|
445
|
+
console.log('πΊοΈ [NO CONFLICT GLOBE] Fitting map to bounds:', bounds);
|
|
446
|
+
map.current.fitBounds(bounds, {
|
|
447
|
+
padding: { top: 20, bottom: 20, left: 20, right: 20 },
|
|
448
|
+
maxZoom: 6,
|
|
449
|
+
duration: 1000
|
|
450
|
+
});
|
|
451
|
+
boundsRef.current = bounds;
|
|
452
|
+
} else {
|
|
453
|
+
boundsRef.current = null;
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
return () => {
|
|
458
|
+
if (map.current) {
|
|
459
|
+
map.current.remove();
|
|
460
|
+
map.current = null;
|
|
461
|
+
}
|
|
462
|
+
};
|
|
463
|
+
}, [projects, onProjectClick, mapConfig]);
|
|
464
|
+
|
|
465
|
+
return (
|
|
466
|
+
<div
|
|
467
|
+
className="no-conflict-globe-container"
|
|
468
|
+
style={{
|
|
469
|
+
width: '100%',
|
|
470
|
+
height: '100%',
|
|
471
|
+
position: 'relative',
|
|
472
|
+
isolation: 'isolate'
|
|
473
|
+
}}
|
|
474
|
+
>
|
|
475
|
+
<div
|
|
476
|
+
ref={mapContainer}
|
|
477
|
+
style={{
|
|
478
|
+
width: '100%',
|
|
479
|
+
height: '100%',
|
|
480
|
+
position: 'relative',
|
|
481
|
+
isolation: 'isolate'
|
|
482
|
+
}}
|
|
483
|
+
/>
|
|
484
|
+
</div>
|
|
485
|
+
);
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
export default NoConflictGlobe;
|
|
@@ -221,11 +221,19 @@ const SimpleGlobe = ({
|
|
|
221
221
|
const lng = Number(project.longitude);
|
|
222
222
|
const lat = Number(project.latitude);
|
|
223
223
|
|
|
224
|
-
console.log(`π [SIMPLE GLOBE] Marker ${index} coordinates:`, {
|
|
224
|
+
console.log(`π [SIMPLE GLOBE] Marker ${index} coordinates:`, {
|
|
225
|
+
lng,
|
|
226
|
+
lat,
|
|
227
|
+
project: project.name
|
|
228
|
+
});
|
|
225
229
|
|
|
226
230
|
// Validate coordinates
|
|
227
231
|
if (isNaN(lng) || isNaN(lat) || lng < -180 || lng > 180 || lat < -90 || lat > 90) {
|
|
228
|
-
console.error(`β [SIMPLE GLOBE] Invalid coordinates for project ${index}:`, {
|
|
232
|
+
console.error(`β [SIMPLE GLOBE] Invalid coordinates for project ${index}:`, {
|
|
233
|
+
lng,
|
|
234
|
+
lat,
|
|
235
|
+
project: project.name
|
|
236
|
+
});
|
|
229
237
|
return;
|
|
230
238
|
}
|
|
231
239
|
|
|
@@ -233,8 +241,11 @@ const SimpleGlobe = ({
|
|
|
233
241
|
bounds.extend([lng, lat]);
|
|
234
242
|
hasValidCoordinates = true;
|
|
235
243
|
|
|
236
|
-
//
|
|
237
|
-
const marker = new mapboxgl.Marker(
|
|
244
|
+
// Create marker with explicit positioning and anchor
|
|
245
|
+
const marker = new mapboxgl.Marker({
|
|
246
|
+
element: el,
|
|
247
|
+
anchor: 'center'
|
|
248
|
+
})
|
|
238
249
|
.setLngLat([lng, lat])
|
|
239
250
|
.setPopup(popup)
|
|
240
251
|
.addTo(map.current);
|
|
@@ -244,6 +255,17 @@ const SimpleGlobe = ({
|
|
|
244
255
|
console.log('π [SIMPLE GLOBE] Marker clicked:', project);
|
|
245
256
|
onProjectClick(project);
|
|
246
257
|
});
|
|
258
|
+
|
|
259
|
+
// Verify marker position after a short delay (like other Globe components)
|
|
260
|
+
setTimeout(() => {
|
|
261
|
+
const markerLngLat = marker.getLngLat();
|
|
262
|
+
console.log(`π [SIMPLE GLOBE] Marker ${index} position verification:`, {
|
|
263
|
+
expected: [lng, lat],
|
|
264
|
+
actual: [markerLngLat.lng, markerLngLat.lat],
|
|
265
|
+
project: project.name,
|
|
266
|
+
match: Math.abs(markerLngLat.lng - lng) < 0.0001 && Math.abs(markerLngLat.lat - lat) < 0.0001
|
|
267
|
+
});
|
|
268
|
+
}, 100);
|
|
247
269
|
|
|
248
270
|
console.log(`β
[SIMPLE GLOBE] Marker ${index} added at:`, [lng, lat]);
|
|
249
271
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import SimpleGlobe from "./SimpleGlobe";
|
|
2
2
|
import SimpleGlobeDebug from "./SimpleGlobeDebug";
|
|
3
|
-
import
|
|
3
|
+
import NoConflictGlobe from "./NoConflictGlobe";
|
|
4
4
|
import CSSInJSGlobe from "./CSSInJSGlobe";
|
|
5
5
|
import ThemeLayout from "../../ThemeLayout";
|
|
6
6
|
import Widget from "../Widget";
|
|
@@ -285,14 +285,14 @@ export const DebugVersion = {
|
|
|
285
285
|
)
|
|
286
286
|
};
|
|
287
287
|
|
|
288
|
-
export const
|
|
289
|
-
name: "
|
|
288
|
+
export const NoConflictVersion = {
|
|
289
|
+
name: "No Conflict Version (Aggressive CSS Isolation)",
|
|
290
290
|
render: () => (
|
|
291
291
|
<div style={{ margin: "3em" }}>
|
|
292
292
|
<ThemeLayout>
|
|
293
|
-
<Widget title="
|
|
293
|
+
<Widget title="No Conflict Globe (Aggressive CSS Isolation)" className="no-px no-pb-body">
|
|
294
294
|
<div style={{ width: '100%', height: '600px' }}>
|
|
295
|
-
<
|
|
295
|
+
<NoConflictGlobe projects={SAMPLE_PROJECTS} type="location" color="#4ECDC4" />
|
|
296
296
|
</div>
|
|
297
297
|
</Widget>
|
|
298
298
|
</ThemeLayout>
|
package/src/index.js
CHANGED
|
@@ -64,6 +64,7 @@ export { default as InExpandableWidgetMap } from "./@daf/core/components/Dashboa
|
|
|
64
64
|
export { default as Globe } from "./@daf/core/components/Dashboard/Globe/index.jsx";
|
|
65
65
|
export { default as SimpleGlobe } from "./@daf/core/components/Dashboard/Globe/SimpleGlobe.jsx";
|
|
66
66
|
export { default as IsolatedGlobe } from "./@daf/core/components/Dashboard/Globe/IsolatedGlobe.jsx";
|
|
67
|
+
export { default as NoConflictGlobe } from "./@daf/core/components/Dashboard/Globe/NoConflictGlobe.jsx";
|
|
67
68
|
export { default as WidgetPlaceholder } from "./@daf/core/components/Dashboard/Widget/WidgetPlaceholder/index.jsx";
|
|
68
69
|
export { default as Steps } from "./@daf/core/components/Dashboard/Steps/index.jsx";
|
|
69
70
|
export { default as DashboardLayout } from "./@daf/core/components/Dashboard/DashboardLayout/index.jsx";
|