datastake-daf 0.6.276 → 0.6.277
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 +404 -15
- package/package.json +1 -1
- package/src/@daf/core/components/Dashboard/Globe/Globe.stories.js +30 -5
- package/src/@daf/core/components/Dashboard/Globe/README.md +106 -0
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobe.jsx +344 -0
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobe.stories.js +284 -0
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobeDebug.jsx +85 -0
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobeExample.jsx +75 -0
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobeTest.jsx +48 -0
- package/src/@daf/core/components/Dashboard/Globe/hook.js +63 -7
- package/src/@daf/core/components/Dashboard/Globe/index.jsx +24 -6
- package/src/@daf/core/components/Dashboard/Globe/storyConfig.js +243 -0
- package/src/@daf/core/components/Dashboard/Globe/storyConfig1.js +354 -0
- package/src/@daf/core/components/Dashboard/Globe/style.js +45 -0
- package/src/index.js +1 -0
package/dist/components/index.js
CHANGED
|
@@ -19310,6 +19310,50 @@ const Style$A = dt.div`
|
|
|
19310
19310
|
position: relative;
|
|
19311
19311
|
width: 100%;
|
|
19312
19312
|
height: 472px;
|
|
19313
|
+
|
|
19314
|
+
/* CRITICAL: Protect against Leaflet CSS interference */
|
|
19315
|
+
.daf-simple-globe-container {
|
|
19316
|
+
isolation: isolate;
|
|
19317
|
+
position: relative;
|
|
19318
|
+
width: 100%;
|
|
19319
|
+
height: 100%;
|
|
19320
|
+
|
|
19321
|
+
/* Override any Leaflet CSS that might interfere */
|
|
19322
|
+
.mapboxgl-canvas-container,
|
|
19323
|
+
.mapboxgl-canvas-container *,
|
|
19324
|
+
.mapboxgl-canvas,
|
|
19325
|
+
.mapboxgl-canvas * {
|
|
19326
|
+
position: relative !important;
|
|
19327
|
+
left: auto !important;
|
|
19328
|
+
top: auto !important;
|
|
19329
|
+
transform: none !important;
|
|
19330
|
+
}
|
|
19331
|
+
|
|
19332
|
+
/* Protect markers from Leaflet positioning */
|
|
19333
|
+
.daf-globe-marker {
|
|
19334
|
+
position: relative !important;
|
|
19335
|
+
left: auto !important;
|
|
19336
|
+
top: auto !important;
|
|
19337
|
+
}
|
|
19338
|
+
|
|
19339
|
+
/* Additional protection - reset any inherited Leaflet styles */
|
|
19340
|
+
* {
|
|
19341
|
+
position: relative !important;
|
|
19342
|
+
left: auto !important;
|
|
19343
|
+
top: auto !important;
|
|
19344
|
+
}
|
|
19345
|
+
|
|
19346
|
+
/* Specifically target Mapbox elements */
|
|
19347
|
+
.mapboxgl-map,
|
|
19348
|
+
.mapboxgl-map *,
|
|
19349
|
+
.mapboxgl-canvas-container,
|
|
19350
|
+
.mapboxgl-canvas-container * {
|
|
19351
|
+
position: relative !important;
|
|
19352
|
+
left: auto !important;
|
|
19353
|
+
top: auto !important;
|
|
19354
|
+
transform: none !important;
|
|
19355
|
+
}
|
|
19356
|
+
}
|
|
19313
19357
|
|
|
19314
19358
|
.filter-cont {
|
|
19315
19359
|
position: absolute;
|
|
@@ -19363,6 +19407,7 @@ const Style$A = dt.div`
|
|
|
19363
19407
|
height: 100%;
|
|
19364
19408
|
}
|
|
19365
19409
|
|
|
19410
|
+
/* Narrow marker styling used by legacy components; avoid width/height overrides for SimpleGlobe */
|
|
19366
19411
|
.map-marker {
|
|
19367
19412
|
text-align: center;
|
|
19368
19413
|
width 100%;
|
|
@@ -19928,14 +19973,26 @@ const useGlobe = ({
|
|
|
19928
19973
|
const addedSources = React.useRef(new Set());
|
|
19929
19974
|
const isMounted = React.useRef(true);
|
|
19930
19975
|
const addAllDataToMap = React.useCallback(() => {
|
|
19931
|
-
|
|
19976
|
+
console.log('🚀 [GLOBE HOOK] addAllDataToMap called');
|
|
19977
|
+
console.log('🚀 [GLOBE HOOK] data:', data);
|
|
19978
|
+
console.log('🚀 [GLOBE HOOK] mapRef exists:', !!mapRef);
|
|
19979
|
+
console.log('🚀 [GLOBE HOOK] style loaded:', mapRef?.isStyleLoaded());
|
|
19980
|
+
if (!data || !mapRef) {
|
|
19981
|
+
console.log('❌ [GLOBE HOOK] addAllDataToMap early return - missing data or mapRef');
|
|
19982
|
+
return;
|
|
19983
|
+
}
|
|
19984
|
+
if (!mapRef.isStyleLoaded()) {
|
|
19985
|
+
console.log('⏳ [GLOBE HOOK] Style not loaded yet, retrying in 100ms...');
|
|
19986
|
+
setTimeout(() => {
|
|
19987
|
+
addAllDataToMap();
|
|
19988
|
+
}, 100);
|
|
19932
19989
|
return;
|
|
19933
19990
|
}
|
|
19934
|
-
|
|
19935
|
-
// Prevent multiple calls with empty data
|
|
19936
19991
|
if (data.length === 0) {
|
|
19992
|
+
console.log('❌ [GLOBE HOOK] addAllDataToMap early return - no data');
|
|
19937
19993
|
return;
|
|
19938
19994
|
}
|
|
19995
|
+
console.log('✅ [GLOBE HOOK] Starting to add markers to map...');
|
|
19939
19996
|
|
|
19940
19997
|
// Clear existing markers using functional update to avoid dependency issues
|
|
19941
19998
|
setMapMarkers(currentMarkers => {
|
|
@@ -19987,8 +20044,13 @@ const useGlobe = ({
|
|
|
19987
20044
|
if (data && mapRef) {
|
|
19988
20045
|
const newMarkers = [];
|
|
19989
20046
|
const maxTotal = Math.max(...(data || []).map(d => d.total || 0));
|
|
20047
|
+
console.log('🎯 [GLOBE HOOK] Processing data items:', data.length);
|
|
19990
20048
|
data.forEach((d, i) => {
|
|
20049
|
+
console.log(`🎯 [GLOBE HOOK] Processing item ${i}:`, d);
|
|
20050
|
+
console.log(`🎯 [GLOBE HOOK] Item ${i} marker:`, d?.marker);
|
|
20051
|
+
console.log(`🎯 [GLOBE HOOK] Item ${i} lat/lng:`, d?.marker?.lat, d?.marker?.lng);
|
|
19991
20052
|
if (d?.marker?.lat && d?.marker?.lng) {
|
|
20053
|
+
console.log(`✅ [GLOBE HOOK] Item ${i} has valid coordinates, creating marker...`);
|
|
19992
20054
|
let marker;
|
|
19993
20055
|
let iconClassName = "";
|
|
19994
20056
|
let iconSize = [25, 25];
|
|
@@ -20068,6 +20130,7 @@ const useGlobe = ({
|
|
|
20068
20130
|
el.style.fontWeight = 'bold';
|
|
20069
20131
|
el.innerHTML = `<span>${d.total || 0}</span>`;
|
|
20070
20132
|
marker = new mapboxgl.Marker(el).setLngLat([d.marker.lng, d.marker.lat]).setPopup(new mapboxgl.Popup().setDOMContent(div)).addTo(mapRef);
|
|
20133
|
+
console.log(`🎉 [GLOBE HOOK] Marker ${i} added to map at:`, [d.marker.lng, d.marker.lat]);
|
|
20071
20134
|
} else if (type === "territory") {
|
|
20072
20135
|
// Handle territory polygons
|
|
20073
20136
|
if (d.area && Array.isArray(d.area)) {
|
|
@@ -20137,6 +20200,7 @@ const useGlobe = ({
|
|
|
20137
20200
|
}));
|
|
20138
20201
|
roots.current.push(root);
|
|
20139
20202
|
marker = new mapboxgl.Marker(el).setLngLat([d.marker.lng, d.marker.lat]).setPopup(new mapboxgl.Popup().setDOMContent(div)).addTo(mapRef);
|
|
20203
|
+
console.log(`🎉 [GLOBE HOOK] Default marker ${i} added to map at:`, [d.marker.lng, d.marker.lat]);
|
|
20140
20204
|
}
|
|
20141
20205
|
|
|
20142
20206
|
// Add click handler
|
|
@@ -20170,6 +20234,7 @@ const useGlobe = ({
|
|
|
20170
20234
|
mapboxgl.accessToken = MAP_TOKEN;
|
|
20171
20235
|
|
|
20172
20236
|
// Create the map with Mapbox GL JS - 3D globe
|
|
20237
|
+
console.log('🗺️ [GLOBE HOOK] Creating map with style:', STYLE_URL);
|
|
20173
20238
|
const map = new mapboxgl.Map({
|
|
20174
20239
|
container: container.current,
|
|
20175
20240
|
style: STYLE_URL,
|
|
@@ -20188,8 +20253,13 @@ const useGlobe = ({
|
|
|
20188
20253
|
|
|
20189
20254
|
// Configure the map when style loads
|
|
20190
20255
|
map.on('style.load', () => {
|
|
20256
|
+
console.log('🎨 [GLOBE HOOK] Style loaded event triggered');
|
|
20257
|
+
console.log('🎨 [GLOBE HOOK] Map style loaded:', map.isStyleLoaded());
|
|
20258
|
+
|
|
20191
20259
|
// Wait a bit for the style to fully load
|
|
20192
20260
|
setTimeout(() => {
|
|
20261
|
+
console.log('🎨 [GLOBE HOOK] After timeout - Map style loaded:', map.isStyleLoaded());
|
|
20262
|
+
|
|
20193
20263
|
// Set fog for the space background effect with stars - simplified to avoid errors
|
|
20194
20264
|
try {
|
|
20195
20265
|
map.setFog({
|
|
@@ -20285,9 +20355,10 @@ const useGlobe = ({
|
|
|
20285
20355
|
|
|
20286
20356
|
// Add navigation controls
|
|
20287
20357
|
map.addControl(new mapboxgl.NavigationControl(), 'top-right');
|
|
20358
|
+
console.log('🗺️ [GLOBE HOOK] Map created successfully');
|
|
20288
20359
|
return map;
|
|
20289
20360
|
} catch (error) {
|
|
20290
|
-
console.error('Error creating Mapbox GL JS globe:', error);
|
|
20361
|
+
console.error('❌ [GLOBE HOOK] Error creating Mapbox GL JS globe:', error);
|
|
20291
20362
|
return null;
|
|
20292
20363
|
}
|
|
20293
20364
|
}, []);
|
|
@@ -20300,9 +20371,12 @@ const useGlobe = ({
|
|
|
20300
20371
|
// }, [initialMarkerSetIsDone]);
|
|
20301
20372
|
|
|
20302
20373
|
React.useEffect(() => {
|
|
20374
|
+
console.log('🔄 [GLOBE HOOK] useEffect for map creation - mapRef:', !!mapRef);
|
|
20303
20375
|
if (!mapRef) {
|
|
20376
|
+
console.log('🔄 [GLOBE HOOK] Creating map instance...');
|
|
20304
20377
|
const instance = createInstance();
|
|
20305
20378
|
if (instance) {
|
|
20379
|
+
console.log('🔄 [GLOBE HOOK] Map instance created, setting mapRef');
|
|
20306
20380
|
setMapRef(instance);
|
|
20307
20381
|
|
|
20308
20382
|
// Add comprehensive resize detection for Mapbox GL JS responsiveness
|
|
@@ -20383,14 +20457,22 @@ const useGlobe = ({
|
|
|
20383
20457
|
}
|
|
20384
20458
|
}, [polygon, mapRef]);
|
|
20385
20459
|
React.useEffect(() => {
|
|
20460
|
+
console.log('📥 [GLOBE HOOK] allData received:', allData);
|
|
20461
|
+
console.log('📥 [GLOBE HOOK] allData length:', allData?.length);
|
|
20386
20462
|
if (allData) {
|
|
20387
20463
|
if (allData.length === 0) {
|
|
20464
|
+
console.log('⚠️ [GLOBE HOOK] Empty data array');
|
|
20388
20465
|
setEmptyStateIsVisible(true);
|
|
20389
20466
|
} else if (emptyStateIsVisible) {
|
|
20390
20467
|
setEmptyStateIsVisible(false);
|
|
20391
20468
|
}
|
|
20392
|
-
|
|
20469
|
+
console.log('🔍 [GLOBE HOOK] Filtering data with filterValidGPS...');
|
|
20470
|
+
const filteredData = filterValidGPS(allData);
|
|
20471
|
+
console.log('🔍 [GLOBE HOOK] filtered data result:', filteredData);
|
|
20472
|
+
console.log('🔍 [GLOBE HOOK] filtered data length:', filteredData.length);
|
|
20473
|
+
setData(filteredData);
|
|
20393
20474
|
} else {
|
|
20475
|
+
console.log('❌ [GLOBE HOOK] No allData provided');
|
|
20394
20476
|
setData(null);
|
|
20395
20477
|
}
|
|
20396
20478
|
}, [allData, emptyStateIsVisible]);
|
|
@@ -20420,7 +20502,19 @@ const useGlobe = ({
|
|
|
20420
20502
|
}
|
|
20421
20503
|
}, [user, mapRef, allData]);
|
|
20422
20504
|
React.useEffect(() => {
|
|
20423
|
-
|
|
20505
|
+
console.log('🔄 [GLOBE HOOK] useEffect triggered:', {
|
|
20506
|
+
mapRef: !!mapRef,
|
|
20507
|
+
data: !!data,
|
|
20508
|
+
dataLength: data?.length,
|
|
20509
|
+
initialMarkerSetIsDone,
|
|
20510
|
+
styleLoaded: mapRef?.isStyleLoaded()
|
|
20511
|
+
});
|
|
20512
|
+
if (mapRef && data && !initialMarkerSetIsDone) {
|
|
20513
|
+
console.log('🚀 [GLOBE HOOK] Attempting to add markers...');
|
|
20514
|
+
console.log('🚀 [GLOBE HOOK] Style loaded check:', mapRef.isStyleLoaded());
|
|
20515
|
+
|
|
20516
|
+
// Try to add markers immediately, and if style isn't loaded,
|
|
20517
|
+
// the addAllDataToMap function will handle it
|
|
20424
20518
|
setInitialMarkerSetIsDone(true);
|
|
20425
20519
|
addAllDataToMap();
|
|
20426
20520
|
}
|
|
@@ -20633,7 +20727,7 @@ function Globe(_ref) {
|
|
|
20633
20727
|
renderSider = null,
|
|
20634
20728
|
renderMarker = null,
|
|
20635
20729
|
type = "default",
|
|
20636
|
-
showSider =
|
|
20730
|
+
showSider = false,
|
|
20637
20731
|
filtersConfig,
|
|
20638
20732
|
onFilterChange = () => {},
|
|
20639
20733
|
isSatellite = false,
|
|
@@ -20643,15 +20737,29 @@ function Globe(_ref) {
|
|
|
20643
20737
|
onUnmount
|
|
20644
20738
|
} = _ref;
|
|
20645
20739
|
// Map data to include marker coordinates
|
|
20646
|
-
const mappedData = React.useMemo(() =>
|
|
20647
|
-
|
|
20648
|
-
|
|
20649
|
-
|
|
20650
|
-
|
|
20651
|
-
|
|
20652
|
-
|
|
20740
|
+
const mappedData = React.useMemo(() => {
|
|
20741
|
+
console.log('📊 [GLOBE COMPONENT] Original data received:', data);
|
|
20742
|
+
console.log('📊 [GLOBE COMPONENT] Data length:', data === null || data === void 0 ? void 0 : data.length);
|
|
20743
|
+
if (!data || data.length === 0) {
|
|
20744
|
+
console.log('❌ [GLOBE COMPONENT] No data to map');
|
|
20745
|
+
return [];
|
|
20746
|
+
}
|
|
20747
|
+
const mapped = data.map((d, i) => {
|
|
20748
|
+
var _d$gps, _d$gps2;
|
|
20749
|
+
console.log("\uD83D\uDCCA [GLOBE COMPONENT] Mapping item ".concat(i, ":"), d);
|
|
20750
|
+
console.log("\uD83D\uDCCA [GLOBE COMPONENT] Item ".concat(i, " GPS:"), d === null || d === void 0 ? void 0 : d.gps);
|
|
20751
|
+
const result = _objectSpread2(_objectSpread2({}, d), {}, {
|
|
20752
|
+
marker: {
|
|
20753
|
+
lat: d === null || d === void 0 || (_d$gps = d.gps) === null || _d$gps === void 0 ? void 0 : _d$gps.latitude,
|
|
20754
|
+
lng: d === null || d === void 0 || (_d$gps2 = d.gps) === null || _d$gps2 === void 0 ? void 0 : _d$gps2.longitude
|
|
20755
|
+
}
|
|
20756
|
+
});
|
|
20757
|
+
console.log("\uD83D\uDCCA [GLOBE COMPONENT] Item ".concat(i, " mapped result:"), result);
|
|
20758
|
+
return result;
|
|
20653
20759
|
});
|
|
20654
|
-
|
|
20760
|
+
console.log('📊 [GLOBE COMPONENT] Final mapped data:', mapped);
|
|
20761
|
+
return mapped;
|
|
20762
|
+
}, [data]);
|
|
20655
20763
|
|
|
20656
20764
|
// Get resize context for sidebar state changes
|
|
20657
20765
|
const {
|
|
@@ -20835,6 +20943,286 @@ Globe.propTypes = {
|
|
|
20835
20943
|
nameAsSiderTitle: PropTypes__default["default"].bool
|
|
20836
20944
|
};
|
|
20837
20945
|
|
|
20946
|
+
const SimpleGlobe = _ref => {
|
|
20947
|
+
let {
|
|
20948
|
+
projects = [],
|
|
20949
|
+
mapConfig = {},
|
|
20950
|
+
showSider = false,
|
|
20951
|
+
onProjectClick = () => {},
|
|
20952
|
+
type = "default",
|
|
20953
|
+
color = "var(--color-primary-60)",
|
|
20954
|
+
renderTooltip: renderTooltip$1 = null
|
|
20955
|
+
} = _ref;
|
|
20956
|
+
const mapContainer = React.useRef(null);
|
|
20957
|
+
const map = React.useRef(null);
|
|
20958
|
+
const boundsRef = React.useRef(null);
|
|
20959
|
+
React.useEffect(() => {
|
|
20960
|
+
if (map.current) return; // Initialize map only once
|
|
20961
|
+
|
|
20962
|
+
console.log('🗺️ [SIMPLE GLOBE] Creating map...');
|
|
20963
|
+
|
|
20964
|
+
// Set Mapbox access token
|
|
20965
|
+
mapboxgl.accessToken = 'pk.eyJ1IjoicmVkaXM5OTkiLCJhIjoiY2x4YWV5MzA5MmtuZzJpcXM5Y201Z2E2YiJ9.m5bwPg-Tj4Akesl1yQUa3w';
|
|
20966
|
+
|
|
20967
|
+
// Create map with custom Straatos style
|
|
20968
|
+
map.current = new mapboxgl.Map({
|
|
20969
|
+
container: mapContainer.current,
|
|
20970
|
+
style: 'mapbox://styles/pietragottardo/cm9tt9zfi00d101pg1vdx26si',
|
|
20971
|
+
center: [0, 0],
|
|
20972
|
+
zoom: mapConfig.maxZoom || 3,
|
|
20973
|
+
projection: 'globe',
|
|
20974
|
+
attributionControl: false
|
|
20975
|
+
});
|
|
20976
|
+
|
|
20977
|
+
// Add markers when map loads
|
|
20978
|
+
map.current.on('load', () => {
|
|
20979
|
+
console.log('🗺️ [SIMPLE GLOBE] Map loaded, adding markers...');
|
|
20980
|
+
|
|
20981
|
+
// Hide Mapbox logo and attribution completely
|
|
20982
|
+
map.current.getContainer();
|
|
20983
|
+
const style = document.createElement('style');
|
|
20984
|
+
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 canvas {\n position: relative !important;\n left: auto !important;\n top: auto !important;\n transform: none !important;\n }\n .daf-simple-globe-container .mapboxgl-canvas-container {\n position: relative !important;\n left: auto !important;\n top: auto !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 /* Additional protection against Leaflet CSS */\n .daf-simple-globe-container * {\n position: relative !important;\n left: auto !important;\n top: auto !important;\n }\n .daf-simple-globe-container .mapboxgl-canvas-container,\n .daf-simple-globe-container .mapboxgl-canvas-container * {\n position: relative !important;\n left: auto !important;\n top: auto !important;\n }\n ";
|
|
20985
|
+
document.head.appendChild(style);
|
|
20986
|
+
|
|
20987
|
+
// Set the space background with stars
|
|
20988
|
+
try {
|
|
20989
|
+
map.current.setFog({
|
|
20990
|
+
'color': 'rgb(0, 0, 0)',
|
|
20991
|
+
'high-color': 'rgb(0, 0, 0)',
|
|
20992
|
+
'horizon-blend': 0.1,
|
|
20993
|
+
'space-color': 'rgb(0, 0, 0)',
|
|
20994
|
+
'star-intensity': 0.6
|
|
20995
|
+
});
|
|
20996
|
+
console.log('✨ [SIMPLE GLOBE] Space background with stars set');
|
|
20997
|
+
} catch (e) {
|
|
20998
|
+
console.log('⚠️ [SIMPLE GLOBE] Could not set fog, trying alternative...');
|
|
20999
|
+
// Fallback: try simpler fog configuration
|
|
21000
|
+
try {
|
|
21001
|
+
map.current.setFog({
|
|
21002
|
+
'color': 'rgb(0, 0, 0)',
|
|
21003
|
+
'high-color': 'rgb(0, 0, 0)',
|
|
21004
|
+
'horizon-blend': 0.1
|
|
21005
|
+
});
|
|
21006
|
+
console.log('✨ [SIMPLE GLOBE] Alternative space background set');
|
|
21007
|
+
} catch (e2) {
|
|
21008
|
+
console.log('⚠️ [SIMPLE GLOBE] Could not set any fog configuration');
|
|
21009
|
+
}
|
|
21010
|
+
}
|
|
21011
|
+
|
|
21012
|
+
// Calculate bounds to fit all markers
|
|
21013
|
+
const bounds = new mapboxgl.LngLatBounds();
|
|
21014
|
+
let hasValidCoordinates = false;
|
|
21015
|
+
projects.forEach((project, index) => {
|
|
21016
|
+
console.log("\uD83D\uDCCD [SIMPLE GLOBE] Adding marker ".concat(index, ":"), project);
|
|
21017
|
+
|
|
21018
|
+
// Create marker element based on type
|
|
21019
|
+
const el = document.createElement('div');
|
|
21020
|
+
// Use a scoped class to avoid picking up broad styles like `.map-marker { width:100% }`
|
|
21021
|
+
el.className = 'daf-globe-marker';
|
|
21022
|
+
el.style.cursor = 'pointer';
|
|
21023
|
+
el.style.boxShadow = '0px 3.45px 3.45px 0px #00000029';
|
|
21024
|
+
el.style.display = 'flex';
|
|
21025
|
+
el.style.alignItems = 'center';
|
|
21026
|
+
el.style.justifyContent = 'center';
|
|
21027
|
+
if (type === "location") {
|
|
21028
|
+
// Location marker - SVG map pin style
|
|
21029
|
+
el.style.width = '28px';
|
|
21030
|
+
el.style.height = '33px';
|
|
21031
|
+
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 ");
|
|
21032
|
+
} else {
|
|
21033
|
+
// Default circular marker style
|
|
21034
|
+
el.style.width = '30px';
|
|
21035
|
+
el.style.height = '30px';
|
|
21036
|
+
el.style.backgroundColor = color;
|
|
21037
|
+
el.style.borderRadius = '50%';
|
|
21038
|
+
el.style.border = '2px solid white';
|
|
21039
|
+
el.style.color = 'white';
|
|
21040
|
+
el.style.fontWeight = 'bold';
|
|
21041
|
+
el.style.fontSize = '14px';
|
|
21042
|
+
el.style.textAlign = 'center';
|
|
21043
|
+
el.style.lineHeight = '1';
|
|
21044
|
+
el.innerHTML = "<span style=\"display: block; line-height: 1;\">".concat(project.percentageCompletion || 0, "</span>");
|
|
21045
|
+
}
|
|
21046
|
+
|
|
21047
|
+
// Create popup content using custom renderTooltip or default
|
|
21048
|
+
let popupContent;
|
|
21049
|
+
if (renderTooltip$1 && typeof renderTooltip$1 === 'function') {
|
|
21050
|
+
// Use custom renderTooltip function (same as MineSiteMap)
|
|
21051
|
+
const tooltipData = renderTooltip$1(project);
|
|
21052
|
+
popupContent = renderTooltip({
|
|
21053
|
+
title: project.name,
|
|
21054
|
+
subTitle: project.sectoralScope || 'Project',
|
|
21055
|
+
items: tooltipData,
|
|
21056
|
+
link: false
|
|
21057
|
+
});
|
|
21058
|
+
} else {
|
|
21059
|
+
// Use default tooltip structure
|
|
21060
|
+
const tooltipData = [{
|
|
21061
|
+
label: "Country",
|
|
21062
|
+
value: project.country || 'N/A'
|
|
21063
|
+
}, {
|
|
21064
|
+
label: "Sectoral Scope",
|
|
21065
|
+
value: project.sectoralScope || 'Project'
|
|
21066
|
+
}];
|
|
21067
|
+
popupContent = renderTooltip({
|
|
21068
|
+
title: project.name,
|
|
21069
|
+
subTitle: project.sectoralScope || 'Project',
|
|
21070
|
+
items: tooltipData,
|
|
21071
|
+
link: false
|
|
21072
|
+
});
|
|
21073
|
+
}
|
|
21074
|
+
|
|
21075
|
+
// Create popup
|
|
21076
|
+
const popup = new mapboxgl.Popup({
|
|
21077
|
+
offset: 25,
|
|
21078
|
+
closeButton: true,
|
|
21079
|
+
closeOnClick: false
|
|
21080
|
+
}).setHTML(popupContent);
|
|
21081
|
+
|
|
21082
|
+
// Ensure coordinates are valid numbers
|
|
21083
|
+
const lng = Number(project.longitude);
|
|
21084
|
+
const lat = Number(project.latitude);
|
|
21085
|
+
console.log("\uD83D\uDCCD [SIMPLE GLOBE] Marker ".concat(index, " coordinates:"), {
|
|
21086
|
+
lng,
|
|
21087
|
+
lat
|
|
21088
|
+
});
|
|
21089
|
+
|
|
21090
|
+
// Validate coordinates
|
|
21091
|
+
if (isNaN(lng) || isNaN(lat) || lng < -180 || lng > 180 || lat < -90 || lat > 90) {
|
|
21092
|
+
console.error("\u274C [SIMPLE GLOBE] Invalid coordinates for project ".concat(index, ":"), {
|
|
21093
|
+
lng,
|
|
21094
|
+
lat
|
|
21095
|
+
});
|
|
21096
|
+
return;
|
|
21097
|
+
}
|
|
21098
|
+
|
|
21099
|
+
// Add coordinates to bounds
|
|
21100
|
+
bounds.extend([lng, lat]);
|
|
21101
|
+
hasValidCoordinates = true;
|
|
21102
|
+
|
|
21103
|
+
// Add marker to map with proper coordinate order [lng, lat]
|
|
21104
|
+
new mapboxgl.Marker(el).setLngLat([lng, lat]).setPopup(popup).addTo(map.current);
|
|
21105
|
+
|
|
21106
|
+
// Add click handler
|
|
21107
|
+
el.addEventListener('click', () => {
|
|
21108
|
+
console.log('📍 [SIMPLE GLOBE] Marker clicked:', project);
|
|
21109
|
+
onProjectClick(project);
|
|
21110
|
+
});
|
|
21111
|
+
console.log("\u2705 [SIMPLE GLOBE] Marker ".concat(index, " added at:"), [lng, lat]);
|
|
21112
|
+
});
|
|
21113
|
+
|
|
21114
|
+
// Fit map to show all markers if we have valid coordinates
|
|
21115
|
+
if (hasValidCoordinates && !bounds.isEmpty()) {
|
|
21116
|
+
console.log('🗺️ [SIMPLE GLOBE] Fitting map to bounds:', bounds);
|
|
21117
|
+
map.current.fitBounds(bounds, {
|
|
21118
|
+
padding: {
|
|
21119
|
+
top: 20,
|
|
21120
|
+
bottom: 20,
|
|
21121
|
+
left: 20,
|
|
21122
|
+
right: 20
|
|
21123
|
+
},
|
|
21124
|
+
maxZoom: 6,
|
|
21125
|
+
duration: 1000
|
|
21126
|
+
});
|
|
21127
|
+
boundsRef.current = bounds;
|
|
21128
|
+
} else {
|
|
21129
|
+
boundsRef.current = null;
|
|
21130
|
+
}
|
|
21131
|
+
});
|
|
21132
|
+
return () => {
|
|
21133
|
+
if (map.current) {
|
|
21134
|
+
map.current.remove();
|
|
21135
|
+
map.current = null;
|
|
21136
|
+
}
|
|
21137
|
+
};
|
|
21138
|
+
}, [projects, onProjectClick, mapConfig]);
|
|
21139
|
+
const zoomIn = () => map.current && map.current.zoomIn();
|
|
21140
|
+
const zoomOut = () => map.current && map.current.zoomOut();
|
|
21141
|
+
const recenter = () => {
|
|
21142
|
+
if (!map.current) return;
|
|
21143
|
+
if (boundsRef.current && !boundsRef.current.isEmpty()) {
|
|
21144
|
+
map.current.fitBounds(boundsRef.current, {
|
|
21145
|
+
padding: {
|
|
21146
|
+
top: 20,
|
|
21147
|
+
bottom: 20,
|
|
21148
|
+
left: 20,
|
|
21149
|
+
right: 20
|
|
21150
|
+
},
|
|
21151
|
+
maxZoom: 6,
|
|
21152
|
+
duration: 800
|
|
21153
|
+
});
|
|
21154
|
+
return;
|
|
21155
|
+
}
|
|
21156
|
+
map.current.easeTo({
|
|
21157
|
+
center: [0, 0],
|
|
21158
|
+
zoom: 3,
|
|
21159
|
+
duration: 800
|
|
21160
|
+
});
|
|
21161
|
+
};
|
|
21162
|
+
const pitchUp = () => {
|
|
21163
|
+
var _map$current$getPitch, _map$current;
|
|
21164
|
+
if (!map.current) return;
|
|
21165
|
+
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);
|
|
21166
|
+
map.current.setPitch(next);
|
|
21167
|
+
};
|
|
21168
|
+
const pitchDown = () => {
|
|
21169
|
+
var _map$current$getPitch2, _map$current2;
|
|
21170
|
+
if (!map.current) return;
|
|
21171
|
+
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);
|
|
21172
|
+
map.current.setPitch(next);
|
|
21173
|
+
};
|
|
21174
|
+
return /*#__PURE__*/jsxRuntime.jsx(Style$A, {
|
|
21175
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
21176
|
+
className: "daf-simple-globe-container",
|
|
21177
|
+
style: {
|
|
21178
|
+
width: '100%',
|
|
21179
|
+
height: '100%',
|
|
21180
|
+
overflow: 'hidden',
|
|
21181
|
+
position: 'relative',
|
|
21182
|
+
isolation: 'isolate' // Create new stacking context to prevent CSS interference
|
|
21183
|
+
},
|
|
21184
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
21185
|
+
ref: mapContainer,
|
|
21186
|
+
className: "daf-globe-map-container",
|
|
21187
|
+
style: {
|
|
21188
|
+
width: '100%',
|
|
21189
|
+
height: '100%',
|
|
21190
|
+
overflow: 'hidden',
|
|
21191
|
+
position: 'relative'
|
|
21192
|
+
}
|
|
21193
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
21194
|
+
className: "map-control-buttons",
|
|
21195
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("button", {
|
|
21196
|
+
type: "button",
|
|
21197
|
+
"aria-label": "Zoom in",
|
|
21198
|
+
onClick: zoomIn,
|
|
21199
|
+
children: "+"
|
|
21200
|
+
}), /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
21201
|
+
type: "button",
|
|
21202
|
+
"aria-label": "Zoom out",
|
|
21203
|
+
onClick: zoomOut,
|
|
21204
|
+
children: "\u2212"
|
|
21205
|
+
}), /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
21206
|
+
type: "button",
|
|
21207
|
+
"aria-label": "Recenter",
|
|
21208
|
+
onClick: recenter,
|
|
21209
|
+
children: "\u25CE"
|
|
21210
|
+
}), /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
21211
|
+
type: "button",
|
|
21212
|
+
"aria-label": "Pitch up",
|
|
21213
|
+
onClick: pitchUp,
|
|
21214
|
+
children: "^"
|
|
21215
|
+
}), /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
21216
|
+
type: "button",
|
|
21217
|
+
"aria-label": "Pitch down",
|
|
21218
|
+
onClick: pitchDown,
|
|
21219
|
+
children: "\u02C5"
|
|
21220
|
+
})]
|
|
21221
|
+
})]
|
|
21222
|
+
})
|
|
21223
|
+
});
|
|
21224
|
+
};
|
|
21225
|
+
|
|
20838
21226
|
function WidgetPlaceholder(_ref) {
|
|
20839
21227
|
let {
|
|
20840
21228
|
icon = "",
|
|
@@ -61635,6 +62023,7 @@ exports.SelectFiltersTimeFrame = Timeframe;
|
|
|
61635
62023
|
exports.SettingsPopover = SettingsPopover;
|
|
61636
62024
|
exports.Sidenav = Sidenav;
|
|
61637
62025
|
exports.SidenavMenu = SidenavMenu;
|
|
62026
|
+
exports.SimpleGlobe = SimpleGlobe;
|
|
61638
62027
|
exports.StackChart = StackChart;
|
|
61639
62028
|
exports.StakeholderMappings = index$1;
|
|
61640
62029
|
exports.Steps = DAFSteps;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import Globe from "./index";
|
|
|
2
2
|
import ThemeLayout from "../../ThemeLayout";
|
|
3
3
|
import Widget from "../Widget";
|
|
4
4
|
|
|
5
|
-
import * as configs from "
|
|
5
|
+
import * as configs from "./storyConfig";
|
|
6
6
|
|
|
7
7
|
export default {
|
|
8
8
|
title: "Dashboard/Globe",
|
|
@@ -29,14 +29,14 @@ export default {
|
|
|
29
29
|
export const DefaultGlobe = {
|
|
30
30
|
name: "Default Globe",
|
|
31
31
|
args: {
|
|
32
|
-
...configs.
|
|
32
|
+
...configs.DefaultGlobeConfig,
|
|
33
33
|
},
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
export const SatelliteGlobe = {
|
|
37
37
|
name: "Satellite Globe",
|
|
38
38
|
args: {
|
|
39
|
-
...configs.
|
|
39
|
+
...configs.DefaultGlobeConfig,
|
|
40
40
|
isSatellite: true,
|
|
41
41
|
},
|
|
42
42
|
};
|
|
@@ -44,11 +44,19 @@ export const SatelliteGlobe = {
|
|
|
44
44
|
export const TerritoryGlobe = {
|
|
45
45
|
name: "Territory Globe",
|
|
46
46
|
args: {
|
|
47
|
-
...configs.
|
|
47
|
+
...configs.TerritoryGlobeConfig,
|
|
48
48
|
type: "territory",
|
|
49
49
|
},
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
+
export const StakeholderGlobe = {
|
|
53
|
+
name: "Stakeholder Globe",
|
|
54
|
+
args: {
|
|
55
|
+
...configs.StakeholderGlobeConfig,
|
|
56
|
+
type: "stakeholder",
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
52
60
|
export const EventGlobe = {
|
|
53
61
|
name: "Event Globe",
|
|
54
62
|
args: {
|
|
@@ -57,10 +65,27 @@ export const EventGlobe = {
|
|
|
57
65
|
},
|
|
58
66
|
};
|
|
59
67
|
|
|
68
|
+
export const ChainGlobe = {
|
|
69
|
+
name: "Supply Chain Globe",
|
|
70
|
+
args: {
|
|
71
|
+
...configs.ChainGlobeConfig,
|
|
72
|
+
type: "chain",
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
60
76
|
export const LocationGlobe = {
|
|
61
77
|
name: "Location Globe",
|
|
62
78
|
args: {
|
|
63
|
-
...configs.
|
|
79
|
+
...configs.DefaultGlobeConfig,
|
|
64
80
|
type: "location",
|
|
65
81
|
},
|
|
66
82
|
};
|
|
83
|
+
|
|
84
|
+
export const ProjectGlobe = {
|
|
85
|
+
name: "Project Globe",
|
|
86
|
+
args: {
|
|
87
|
+
...configs.ProjectGlobeConfig,
|
|
88
|
+
type: "project",
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
|