datastake-daf 0.6.279 → 0.6.281
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 +396 -41
- package/dist/utils/index.js +1 -1
- 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 +331 -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 +29 -0
- package/src/@daf/core/components/EditForm/helper.js +4 -34
- package/src/@daf/core/components/Icon/configs/MagicWant.js +1 -1
- package/src/index.js +1 -0
- package/.env +0 -8
- package/.vscode/settings.json +0 -13
package/dist/components/index.js
CHANGED
|
@@ -3006,7 +3006,7 @@ const config$4 = {
|
|
|
3006
3006
|
viewBox: "0 0 15 15",
|
|
3007
3007
|
children: /*#__PURE__*/jsxRuntime.jsx("path", {
|
|
3008
3008
|
d: "M7.66657 9.33337L5.66657 7.33337M9.0068 2.33337V1.33337M11.633 3.37381L12.3401 2.66671M11.633 8.66671L12.3401 9.37381M6.34013 3.37381L5.63303 2.66671M12.6735 6.00004H13.6735M3.08748 13.9125L9.24565 7.75429C9.50966 7.49028 9.64167 7.35827 9.69113 7.20605C9.73463 7.07216 9.73463 6.92792 9.69113 6.79403C9.64167 6.64181 9.50966 6.5098 9.24565 6.24579L8.75415 5.75429C8.49013 5.49028 8.35813 5.35827 8.20591 5.30881C8.07201 5.26531 7.92778 5.26531 7.79389 5.30881C7.64167 5.35827 7.50966 5.49028 7.24565 5.75429L1.08748 11.9125C0.823469 12.1765 0.691463 12.3085 0.642004 12.4607C0.598499 12.5946 0.598499 12.7388 0.642004 12.8727C0.691463 13.0249 0.823469 13.1569 1.08748 13.421L1.57899 13.9125C1.843 14.1765 1.975 14.3085 2.12722 14.3579C2.26112 14.4014 2.40535 14.4014 2.53924 14.3579C2.69146 14.3085 2.82347 14.1765 3.08748 13.9125Z",
|
|
3009
|
-
stroke: "
|
|
3009
|
+
stroke: "currentColor",
|
|
3010
3010
|
strokeLinecap: "round",
|
|
3011
3011
|
strokeLinejoin: "round"
|
|
3012
3012
|
})
|
|
@@ -14093,8 +14093,9 @@ const determineHasChildren = ({
|
|
|
14093
14093
|
|
|
14094
14094
|
const sortByPosition = (items, getConfig) => {
|
|
14095
14095
|
return items.sort((a, b) => {
|
|
14096
|
-
|
|
14097
|
-
const
|
|
14096
|
+
var _getConfig, _getConfig2;
|
|
14097
|
+
const positionA = ((_getConfig = getConfig(a)) === null || _getConfig === void 0 ? void 0 : _getConfig.position) || 0;
|
|
14098
|
+
const positionB = ((_getConfig2 = getConfig(b)) === null || _getConfig2 === void 0 ? void 0 : _getConfig2.position) || 0;
|
|
14098
14099
|
return positionA - positionB;
|
|
14099
14100
|
});
|
|
14100
14101
|
};
|
|
@@ -14111,7 +14112,7 @@ const resolveDynamicLabel = (labelConfig, item, defaultLabel) => {
|
|
|
14111
14112
|
const parts = labelKey.split(' is ');
|
|
14112
14113
|
if (parts.length === 2) {
|
|
14113
14114
|
const [conditionKey, conditionValue] = parts;
|
|
14114
|
-
if (item
|
|
14115
|
+
if ((item === null || item === void 0 ? void 0 : item[conditionKey]) === conditionValue) {
|
|
14115
14116
|
return labelConfig[labelKey];
|
|
14116
14117
|
}
|
|
14117
14118
|
}
|
|
@@ -19320,6 +19321,34 @@ const Style$A = dt.div`
|
|
|
19320
19321
|
position: relative;
|
|
19321
19322
|
width: 100%;
|
|
19322
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
|
+
}
|
|
19323
19352
|
|
|
19324
19353
|
.filter-cont {
|
|
19325
19354
|
position: absolute;
|
|
@@ -19373,6 +19402,7 @@ const Style$A = dt.div`
|
|
|
19373
19402
|
height: 100%;
|
|
19374
19403
|
}
|
|
19375
19404
|
|
|
19405
|
+
/* Narrow marker styling used by legacy components; avoid width/height overrides for SimpleGlobe */
|
|
19376
19406
|
.map-marker {
|
|
19377
19407
|
text-align: center;
|
|
19378
19408
|
width 100%;
|
|
@@ -19938,14 +19968,26 @@ const useGlobe = ({
|
|
|
19938
19968
|
const addedSources = React.useRef(new Set());
|
|
19939
19969
|
const isMounted = React.useRef(true);
|
|
19940
19970
|
const addAllDataToMap = React.useCallback(() => {
|
|
19941
|
-
|
|
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);
|
|
19942
19984
|
return;
|
|
19943
19985
|
}
|
|
19944
|
-
|
|
19945
|
-
// Prevent multiple calls with empty data
|
|
19946
19986
|
if (data.length === 0) {
|
|
19987
|
+
console.log('❌ [GLOBE HOOK] addAllDataToMap early return - no data');
|
|
19947
19988
|
return;
|
|
19948
19989
|
}
|
|
19990
|
+
console.log('✅ [GLOBE HOOK] Starting to add markers to map...');
|
|
19949
19991
|
|
|
19950
19992
|
// Clear existing markers using functional update to avoid dependency issues
|
|
19951
19993
|
setMapMarkers(currentMarkers => {
|
|
@@ -19997,8 +20039,13 @@ const useGlobe = ({
|
|
|
19997
20039
|
if (data && mapRef) {
|
|
19998
20040
|
const newMarkers = [];
|
|
19999
20041
|
const maxTotal = Math.max(...(data || []).map(d => d.total || 0));
|
|
20042
|
+
console.log('🎯 [GLOBE HOOK] Processing data items:', data.length);
|
|
20000
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);
|
|
20001
20047
|
if (d?.marker?.lat && d?.marker?.lng) {
|
|
20048
|
+
console.log(`✅ [GLOBE HOOK] Item ${i} has valid coordinates, creating marker...`);
|
|
20002
20049
|
let marker;
|
|
20003
20050
|
let iconClassName = "";
|
|
20004
20051
|
let iconSize = [25, 25];
|
|
@@ -20078,6 +20125,7 @@ const useGlobe = ({
|
|
|
20078
20125
|
el.style.fontWeight = 'bold';
|
|
20079
20126
|
el.innerHTML = `<span>${d.total || 0}</span>`;
|
|
20080
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]);
|
|
20081
20129
|
} else if (type === "territory") {
|
|
20082
20130
|
// Handle territory polygons
|
|
20083
20131
|
if (d.area && Array.isArray(d.area)) {
|
|
@@ -20147,6 +20195,7 @@ const useGlobe = ({
|
|
|
20147
20195
|
}));
|
|
20148
20196
|
roots.current.push(root);
|
|
20149
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]);
|
|
20150
20199
|
}
|
|
20151
20200
|
|
|
20152
20201
|
// Add click handler
|
|
@@ -20180,6 +20229,7 @@ const useGlobe = ({
|
|
|
20180
20229
|
mapboxgl.accessToken = MAP_TOKEN;
|
|
20181
20230
|
|
|
20182
20231
|
// Create the map with Mapbox GL JS - 3D globe
|
|
20232
|
+
console.log('🗺️ [GLOBE HOOK] Creating map with style:', STYLE_URL);
|
|
20183
20233
|
const map = new mapboxgl.Map({
|
|
20184
20234
|
container: container.current,
|
|
20185
20235
|
style: STYLE_URL,
|
|
@@ -20198,8 +20248,13 @@ const useGlobe = ({
|
|
|
20198
20248
|
|
|
20199
20249
|
// Configure the map when style loads
|
|
20200
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
|
+
|
|
20201
20254
|
// Wait a bit for the style to fully load
|
|
20202
20255
|
setTimeout(() => {
|
|
20256
|
+
console.log('🎨 [GLOBE HOOK] After timeout - Map style loaded:', map.isStyleLoaded());
|
|
20257
|
+
|
|
20203
20258
|
// Set fog for the space background effect with stars - simplified to avoid errors
|
|
20204
20259
|
try {
|
|
20205
20260
|
map.setFog({
|
|
@@ -20295,9 +20350,10 @@ const useGlobe = ({
|
|
|
20295
20350
|
|
|
20296
20351
|
// Add navigation controls
|
|
20297
20352
|
map.addControl(new mapboxgl.NavigationControl(), 'top-right');
|
|
20353
|
+
console.log('🗺️ [GLOBE HOOK] Map created successfully');
|
|
20298
20354
|
return map;
|
|
20299
20355
|
} catch (error) {
|
|
20300
|
-
console.error('Error creating Mapbox GL JS globe:', error);
|
|
20356
|
+
console.error('❌ [GLOBE HOOK] Error creating Mapbox GL JS globe:', error);
|
|
20301
20357
|
return null;
|
|
20302
20358
|
}
|
|
20303
20359
|
}, []);
|
|
@@ -20310,9 +20366,12 @@ const useGlobe = ({
|
|
|
20310
20366
|
// }, [initialMarkerSetIsDone]);
|
|
20311
20367
|
|
|
20312
20368
|
React.useEffect(() => {
|
|
20369
|
+
console.log('🔄 [GLOBE HOOK] useEffect for map creation - mapRef:', !!mapRef);
|
|
20313
20370
|
if (!mapRef) {
|
|
20371
|
+
console.log('🔄 [GLOBE HOOK] Creating map instance...');
|
|
20314
20372
|
const instance = createInstance();
|
|
20315
20373
|
if (instance) {
|
|
20374
|
+
console.log('🔄 [GLOBE HOOK] Map instance created, setting mapRef');
|
|
20316
20375
|
setMapRef(instance);
|
|
20317
20376
|
|
|
20318
20377
|
// Add comprehensive resize detection for Mapbox GL JS responsiveness
|
|
@@ -20393,14 +20452,22 @@ const useGlobe = ({
|
|
|
20393
20452
|
}
|
|
20394
20453
|
}, [polygon, mapRef]);
|
|
20395
20454
|
React.useEffect(() => {
|
|
20455
|
+
console.log('📥 [GLOBE HOOK] allData received:', allData);
|
|
20456
|
+
console.log('📥 [GLOBE HOOK] allData length:', allData?.length);
|
|
20396
20457
|
if (allData) {
|
|
20397
20458
|
if (allData.length === 0) {
|
|
20459
|
+
console.log('⚠️ [GLOBE HOOK] Empty data array');
|
|
20398
20460
|
setEmptyStateIsVisible(true);
|
|
20399
20461
|
} else if (emptyStateIsVisible) {
|
|
20400
20462
|
setEmptyStateIsVisible(false);
|
|
20401
20463
|
}
|
|
20402
|
-
|
|
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);
|
|
20403
20469
|
} else {
|
|
20470
|
+
console.log('❌ [GLOBE HOOK] No allData provided');
|
|
20404
20471
|
setData(null);
|
|
20405
20472
|
}
|
|
20406
20473
|
}, [allData, emptyStateIsVisible]);
|
|
@@ -20430,7 +20497,19 @@ const useGlobe = ({
|
|
|
20430
20497
|
}
|
|
20431
20498
|
}, [user, mapRef, allData]);
|
|
20432
20499
|
React.useEffect(() => {
|
|
20433
|
-
|
|
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
|
|
20434
20513
|
setInitialMarkerSetIsDone(true);
|
|
20435
20514
|
addAllDataToMap();
|
|
20436
20515
|
}
|
|
@@ -20643,7 +20722,7 @@ function Globe(_ref) {
|
|
|
20643
20722
|
renderSider = null,
|
|
20644
20723
|
renderMarker = null,
|
|
20645
20724
|
type = "default",
|
|
20646
|
-
showSider =
|
|
20725
|
+
showSider = false,
|
|
20647
20726
|
filtersConfig,
|
|
20648
20727
|
onFilterChange = () => {},
|
|
20649
20728
|
isSatellite = false,
|
|
@@ -20653,15 +20732,29 @@ function Globe(_ref) {
|
|
|
20653
20732
|
onUnmount
|
|
20654
20733
|
} = _ref;
|
|
20655
20734
|
// Map data to include marker coordinates
|
|
20656
|
-
const mappedData = React.useMemo(() =>
|
|
20657
|
-
|
|
20658
|
-
|
|
20659
|
-
|
|
20660
|
-
|
|
20661
|
-
|
|
20662
|
-
|
|
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;
|
|
20663
20754
|
});
|
|
20664
|
-
|
|
20755
|
+
console.log('📊 [GLOBE COMPONENT] Final mapped data:', mapped);
|
|
20756
|
+
return mapped;
|
|
20757
|
+
}, [data]);
|
|
20665
20758
|
|
|
20666
20759
|
// Get resize context for sidebar state changes
|
|
20667
20760
|
const {
|
|
@@ -20845,6 +20938,285 @@ Globe.propTypes = {
|
|
|
20845
20938
|
nameAsSiderTitle: PropTypes__default["default"].bool
|
|
20846
20939
|
};
|
|
20847
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
|
|
20963
|
+
map.current = new mapboxgl.Map({
|
|
20964
|
+
container: mapContainer.current,
|
|
20965
|
+
style: 'mapbox://styles/pietragottardo/cm9tt9zfi00d101pg1vdx26si',
|
|
20966
|
+
center: [0, 0],
|
|
20967
|
+
zoom: mapConfig.maxZoom || 3,
|
|
20968
|
+
projection: 'globe',
|
|
20969
|
+
attributionControl: false
|
|
20970
|
+
});
|
|
20971
|
+
|
|
20972
|
+
// Add markers when map loads
|
|
20973
|
+
map.current.on('load', () => {
|
|
20974
|
+
console.log('🗺️ [SIMPLE GLOBE] Map loaded, adding markers...');
|
|
20975
|
+
|
|
20976
|
+
// Hide Mapbox logo and attribution completely
|
|
20977
|
+
map.current.getContainer();
|
|
20978
|
+
const style = document.createElement('style');
|
|
20979
|
+
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 ";
|
|
20980
|
+
document.head.appendChild(style);
|
|
20981
|
+
|
|
20982
|
+
// Set the space background with stars
|
|
20983
|
+
try {
|
|
20984
|
+
map.current.setFog({
|
|
20985
|
+
'color': 'rgb(0, 0, 0)',
|
|
20986
|
+
'high-color': 'rgb(0, 0, 0)',
|
|
20987
|
+
'horizon-blend': 0.1,
|
|
20988
|
+
'space-color': 'rgb(0, 0, 0)',
|
|
20989
|
+
'star-intensity': 0.6
|
|
20990
|
+
});
|
|
20991
|
+
console.log('✨ [SIMPLE GLOBE] Space background with stars set');
|
|
20992
|
+
} catch (e) {
|
|
20993
|
+
console.log('⚠️ [SIMPLE GLOBE] Could not set fog, trying alternative...');
|
|
20994
|
+
// Fallback: try simpler fog configuration
|
|
20995
|
+
try {
|
|
20996
|
+
map.current.setFog({
|
|
20997
|
+
'color': 'rgb(0, 0, 0)',
|
|
20998
|
+
'high-color': 'rgb(0, 0, 0)',
|
|
20999
|
+
'horizon-blend': 0.1
|
|
21000
|
+
});
|
|
21001
|
+
console.log('✨ [SIMPLE GLOBE] Alternative space background set');
|
|
21002
|
+
} catch (e2) {
|
|
21003
|
+
console.log('⚠️ [SIMPLE GLOBE] Could not set any fog configuration');
|
|
21004
|
+
}
|
|
21005
|
+
}
|
|
21006
|
+
|
|
21007
|
+
// Calculate bounds to fit all markers
|
|
21008
|
+
const bounds = new mapboxgl.LngLatBounds();
|
|
21009
|
+
let hasValidCoordinates = false;
|
|
21010
|
+
projects.forEach((project, index) => {
|
|
21011
|
+
console.log("\uD83D\uDCCD [SIMPLE GLOBE] Adding marker ".concat(index, ":"), project);
|
|
21012
|
+
|
|
21013
|
+
// Create marker element based on type
|
|
21014
|
+
const el = document.createElement('div');
|
|
21015
|
+
// Use a scoped class to avoid picking up broad styles like `.map-marker { width:100% }`
|
|
21016
|
+
el.className = 'daf-globe-marker';
|
|
21017
|
+
el.style.cursor = 'pointer';
|
|
21018
|
+
el.style.boxShadow = '0px 3.45px 3.45px 0px #00000029';
|
|
21019
|
+
el.style.display = 'flex';
|
|
21020
|
+
el.style.alignItems = 'center';
|
|
21021
|
+
el.style.justifyContent = 'center';
|
|
21022
|
+
if (type === "location") {
|
|
21023
|
+
// Location marker - SVG map pin style
|
|
21024
|
+
el.style.width = '28px';
|
|
21025
|
+
el.style.height = '33px';
|
|
21026
|
+
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 ");
|
|
21027
|
+
} else {
|
|
21028
|
+
// Default circular marker style
|
|
21029
|
+
el.style.width = '30px';
|
|
21030
|
+
el.style.height = '30px';
|
|
21031
|
+
el.style.backgroundColor = color;
|
|
21032
|
+
el.style.borderRadius = '50%';
|
|
21033
|
+
el.style.border = '2px solid white';
|
|
21034
|
+
el.style.color = 'white';
|
|
21035
|
+
el.style.fontWeight = 'bold';
|
|
21036
|
+
el.style.fontSize = '14px';
|
|
21037
|
+
el.style.textAlign = 'center';
|
|
21038
|
+
el.style.lineHeight = '1';
|
|
21039
|
+
el.innerHTML = "<span style=\"display: block; line-height: 1;\">".concat(project.percentageCompletion || 0, "</span>");
|
|
21040
|
+
}
|
|
21041
|
+
|
|
21042
|
+
// Create popup content using custom renderTooltip or default
|
|
21043
|
+
let popupContent;
|
|
21044
|
+
if (renderTooltip$1 && typeof renderTooltip$1 === 'function') {
|
|
21045
|
+
// Use custom renderTooltip function (same as MineSiteMap)
|
|
21046
|
+
const tooltipData = renderTooltip$1(project);
|
|
21047
|
+
popupContent = renderTooltip({
|
|
21048
|
+
title: project.name,
|
|
21049
|
+
subTitle: project.sectoralScope || 'Project',
|
|
21050
|
+
items: tooltipData,
|
|
21051
|
+
link: false
|
|
21052
|
+
});
|
|
21053
|
+
} else {
|
|
21054
|
+
// Use default tooltip structure
|
|
21055
|
+
const tooltipData = [{
|
|
21056
|
+
label: "Country",
|
|
21057
|
+
value: project.country || 'N/A'
|
|
21058
|
+
}, {
|
|
21059
|
+
label: "Sectoral Scope",
|
|
21060
|
+
value: project.sectoralScope || 'Project'
|
|
21061
|
+
}];
|
|
21062
|
+
popupContent = renderTooltip({
|
|
21063
|
+
title: project.name,
|
|
21064
|
+
subTitle: project.sectoralScope || 'Project',
|
|
21065
|
+
items: tooltipData,
|
|
21066
|
+
link: false
|
|
21067
|
+
});
|
|
21068
|
+
}
|
|
21069
|
+
|
|
21070
|
+
// Create popup
|
|
21071
|
+
const popup = new mapboxgl.Popup({
|
|
21072
|
+
offset: 25,
|
|
21073
|
+
closeButton: true,
|
|
21074
|
+
closeOnClick: false
|
|
21075
|
+
}).setHTML(popupContent);
|
|
21076
|
+
|
|
21077
|
+
// Ensure coordinates are valid numbers
|
|
21078
|
+
const lng = Number(project.longitude);
|
|
21079
|
+
const lat = Number(project.latitude);
|
|
21080
|
+
console.log("\uD83D\uDCCD [SIMPLE GLOBE] Marker ".concat(index, " coordinates:"), {
|
|
21081
|
+
lng,
|
|
21082
|
+
lat
|
|
21083
|
+
});
|
|
21084
|
+
|
|
21085
|
+
// Validate coordinates
|
|
21086
|
+
if (isNaN(lng) || isNaN(lat) || lng < -180 || lng > 180 || lat < -90 || lat > 90) {
|
|
21087
|
+
console.error("\u274C [SIMPLE GLOBE] Invalid coordinates for project ".concat(index, ":"), {
|
|
21088
|
+
lng,
|
|
21089
|
+
lat
|
|
21090
|
+
});
|
|
21091
|
+
return;
|
|
21092
|
+
}
|
|
21093
|
+
|
|
21094
|
+
// Add coordinates to bounds
|
|
21095
|
+
bounds.extend([lng, lat]);
|
|
21096
|
+
hasValidCoordinates = true;
|
|
21097
|
+
|
|
21098
|
+
// Add marker to map with proper coordinate order [lng, lat]
|
|
21099
|
+
new mapboxgl.Marker(el).setLngLat([lng, lat]).setPopup(popup).addTo(map.current);
|
|
21100
|
+
|
|
21101
|
+
// Add click handler
|
|
21102
|
+
el.addEventListener('click', () => {
|
|
21103
|
+
console.log('📍 [SIMPLE GLOBE] Marker clicked:', project);
|
|
21104
|
+
onProjectClick(project);
|
|
21105
|
+
});
|
|
21106
|
+
console.log("\u2705 [SIMPLE GLOBE] Marker ".concat(index, " added at:"), [lng, lat]);
|
|
21107
|
+
});
|
|
21108
|
+
|
|
21109
|
+
// Fit map to show all markers if we have valid coordinates
|
|
21110
|
+
if (hasValidCoordinates && !bounds.isEmpty()) {
|
|
21111
|
+
console.log('🗺️ [SIMPLE GLOBE] Fitting map to bounds:', bounds);
|
|
21112
|
+
map.current.fitBounds(bounds, {
|
|
21113
|
+
padding: {
|
|
21114
|
+
top: 20,
|
|
21115
|
+
bottom: 20,
|
|
21116
|
+
left: 20,
|
|
21117
|
+
right: 20
|
|
21118
|
+
},
|
|
21119
|
+
maxZoom: 6,
|
|
21120
|
+
duration: 1000
|
|
21121
|
+
});
|
|
21122
|
+
boundsRef.current = bounds;
|
|
21123
|
+
} else {
|
|
21124
|
+
boundsRef.current = null;
|
|
21125
|
+
}
|
|
21126
|
+
});
|
|
21127
|
+
return () => {
|
|
21128
|
+
if (map.current) {
|
|
21129
|
+
map.current.remove();
|
|
21130
|
+
map.current = null;
|
|
21131
|
+
}
|
|
21132
|
+
};
|
|
21133
|
+
}, [projects, onProjectClick, mapConfig]);
|
|
21134
|
+
const zoomIn = () => map.current && map.current.zoomIn();
|
|
21135
|
+
const zoomOut = () => map.current && map.current.zoomOut();
|
|
21136
|
+
const recenter = () => {
|
|
21137
|
+
if (!map.current) return;
|
|
21138
|
+
if (boundsRef.current && !boundsRef.current.isEmpty()) {
|
|
21139
|
+
map.current.fitBounds(boundsRef.current, {
|
|
21140
|
+
padding: {
|
|
21141
|
+
top: 20,
|
|
21142
|
+
bottom: 20,
|
|
21143
|
+
left: 20,
|
|
21144
|
+
right: 20
|
|
21145
|
+
},
|
|
21146
|
+
maxZoom: 6,
|
|
21147
|
+
duration: 800
|
|
21148
|
+
});
|
|
21149
|
+
return;
|
|
21150
|
+
}
|
|
21151
|
+
map.current.easeTo({
|
|
21152
|
+
center: [0, 0],
|
|
21153
|
+
zoom: 3,
|
|
21154
|
+
duration: 800
|
|
21155
|
+
});
|
|
21156
|
+
};
|
|
21157
|
+
const pitchUp = () => {
|
|
21158
|
+
var _map$current$getPitch, _map$current;
|
|
21159
|
+
if (!map.current) return;
|
|
21160
|
+
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);
|
|
21161
|
+
map.current.setPitch(next);
|
|
21162
|
+
};
|
|
21163
|
+
const pitchDown = () => {
|
|
21164
|
+
var _map$current$getPitch2, _map$current2;
|
|
21165
|
+
if (!map.current) return;
|
|
21166
|
+
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);
|
|
21167
|
+
map.current.setPitch(next);
|
|
21168
|
+
};
|
|
21169
|
+
return /*#__PURE__*/jsxRuntime.jsx(Style$A, {
|
|
21170
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
21171
|
+
className: "daf-simple-globe-container",
|
|
21172
|
+
style: {
|
|
21173
|
+
width: '100%',
|
|
21174
|
+
height: '100%',
|
|
21175
|
+
overflow: 'hidden',
|
|
21176
|
+
position: 'relative'
|
|
21177
|
+
},
|
|
21178
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
21179
|
+
ref: mapContainer,
|
|
21180
|
+
className: "daf-globe-map-container",
|
|
21181
|
+
style: {
|
|
21182
|
+
width: '100%',
|
|
21183
|
+
height: '100%',
|
|
21184
|
+
overflow: 'hidden',
|
|
21185
|
+
position: 'relative'
|
|
21186
|
+
}
|
|
21187
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
21188
|
+
className: "map-control-buttons",
|
|
21189
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("button", {
|
|
21190
|
+
type: "button",
|
|
21191
|
+
"aria-label": "Zoom in",
|
|
21192
|
+
onClick: zoomIn,
|
|
21193
|
+
children: "+"
|
|
21194
|
+
}), /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
21195
|
+
type: "button",
|
|
21196
|
+
"aria-label": "Zoom out",
|
|
21197
|
+
onClick: zoomOut,
|
|
21198
|
+
children: "\u2212"
|
|
21199
|
+
}), /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
21200
|
+
type: "button",
|
|
21201
|
+
"aria-label": "Recenter",
|
|
21202
|
+
onClick: recenter,
|
|
21203
|
+
children: "\u25CE"
|
|
21204
|
+
}), /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
21205
|
+
type: "button",
|
|
21206
|
+
"aria-label": "Pitch up",
|
|
21207
|
+
onClick: pitchUp,
|
|
21208
|
+
children: "^"
|
|
21209
|
+
}), /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
21210
|
+
type: "button",
|
|
21211
|
+
"aria-label": "Pitch down",
|
|
21212
|
+
onClick: pitchDown,
|
|
21213
|
+
children: "\u02C5"
|
|
21214
|
+
})]
|
|
21215
|
+
})]
|
|
21216
|
+
})
|
|
21217
|
+
});
|
|
21218
|
+
};
|
|
21219
|
+
|
|
20848
21220
|
function WidgetPlaceholder(_ref) {
|
|
20849
21221
|
let {
|
|
20850
21222
|
icon = "",
|
|
@@ -40281,33 +40653,15 @@ const GetFormItem$1 = ({
|
|
|
40281
40653
|
})
|
|
40282
40654
|
})
|
|
40283
40655
|
}) : /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
40284
|
-
title: t("
|
|
40656
|
+
title: t("Project Readiness"),
|
|
40285
40657
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
40286
40658
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
40287
40659
|
type: "link",
|
|
40288
|
-
|
|
40289
|
-
...(!isShown ? {
|
|
40290
|
-
className: "default p-0"
|
|
40291
|
-
} : {
|
|
40292
|
-
className: "p-0 primary"
|
|
40293
|
-
}),
|
|
40294
|
-
onClick: () => {
|
|
40295
|
-
if (inputMeta.comment !== undefined && inputMeta.comment !== null) {
|
|
40296
|
-
return;
|
|
40297
|
-
}
|
|
40298
|
-
setIsShown(true);
|
|
40299
|
-
changeInputMeta({
|
|
40300
|
-
key: inputKey,
|
|
40301
|
-
type: input.type,
|
|
40302
|
-
value: {
|
|
40303
|
-
comment: ""
|
|
40304
|
-
}
|
|
40305
|
-
});
|
|
40306
|
-
},
|
|
40660
|
+
className: "default p-0",
|
|
40307
40661
|
children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
40308
40662
|
name: "MagicWand",
|
|
40309
|
-
width:
|
|
40310
|
-
height:
|
|
40663
|
+
width: 16,
|
|
40664
|
+
height: 16
|
|
40311
40665
|
})
|
|
40312
40666
|
})
|
|
40313
40667
|
})
|
|
@@ -61685,6 +62039,7 @@ exports.SelectFiltersTimeFrame = Timeframe;
|
|
|
61685
62039
|
exports.SettingsPopover = SettingsPopover;
|
|
61686
62040
|
exports.Sidenav = Sidenav;
|
|
61687
62041
|
exports.SidenavMenu = SidenavMenu;
|
|
62042
|
+
exports.SimpleGlobe = SimpleGlobe;
|
|
61688
62043
|
exports.StackChart = StackChart;
|
|
61689
62044
|
exports.StakeholderMappings = index$1;
|
|
61690
62045
|
exports.Steps = DAFSteps;
|
package/dist/utils/index.js
CHANGED
|
@@ -3108,7 +3108,7 @@ const config$2 = {
|
|
|
3108
3108
|
viewBox: "0 0 15 15",
|
|
3109
3109
|
children: /*#__PURE__*/jsxRuntime.jsx("path", {
|
|
3110
3110
|
d: "M7.66657 9.33337L5.66657 7.33337M9.0068 2.33337V1.33337M11.633 3.37381L12.3401 2.66671M11.633 8.66671L12.3401 9.37381M6.34013 3.37381L5.63303 2.66671M12.6735 6.00004H13.6735M3.08748 13.9125L9.24565 7.75429C9.50966 7.49028 9.64167 7.35827 9.69113 7.20605C9.73463 7.07216 9.73463 6.92792 9.69113 6.79403C9.64167 6.64181 9.50966 6.5098 9.24565 6.24579L8.75415 5.75429C8.49013 5.49028 8.35813 5.35827 8.20591 5.30881C8.07201 5.26531 7.92778 5.26531 7.79389 5.30881C7.64167 5.35827 7.50966 5.49028 7.24565 5.75429L1.08748 11.9125C0.823469 12.1765 0.691463 12.3085 0.642004 12.4607C0.598499 12.5946 0.598499 12.7388 0.642004 12.8727C0.691463 13.0249 0.823469 13.1569 1.08748 13.421L1.57899 13.9125C1.843 14.1765 1.975 14.3085 2.12722 14.3579C2.26112 14.4014 2.40535 14.4014 2.53924 14.3579C2.69146 14.3085 2.82347 14.1765 3.08748 13.9125Z",
|
|
3111
|
-
stroke: "
|
|
3111
|
+
stroke: "currentColor",
|
|
3112
3112
|
strokeLinecap: "round",
|
|
3113
3113
|
strokeLinejoin: "round"
|
|
3114
3114
|
})
|