datastake-daf 0.6.276 β 0.6.278
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 +387 -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 +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/index.js +1 -0
package/dist/components/index.js
CHANGED
|
@@ -19310,6 +19310,34 @@ 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
|
+
position: relative;
|
|
19317
|
+
width: 100%;
|
|
19318
|
+
height: 100%;
|
|
19319
|
+
|
|
19320
|
+
/* Override Leaflet CSS that interferes with Mapbox */
|
|
19321
|
+
.mapboxgl-canvas-container {
|
|
19322
|
+
position: relative !important;
|
|
19323
|
+
left: auto !important;
|
|
19324
|
+
top: auto !important;
|
|
19325
|
+
}
|
|
19326
|
+
|
|
19327
|
+
.mapboxgl-canvas-container canvas {
|
|
19328
|
+
position: relative !important;
|
|
19329
|
+
left: auto !important;
|
|
19330
|
+
top: auto !important;
|
|
19331
|
+
transform: none !important;
|
|
19332
|
+
}
|
|
19333
|
+
|
|
19334
|
+
/* Protect markers from Leaflet positioning */
|
|
19335
|
+
.daf-globe-marker {
|
|
19336
|
+
position: relative !important;
|
|
19337
|
+
left: auto !important;
|
|
19338
|
+
top: auto !important;
|
|
19339
|
+
}
|
|
19340
|
+
}
|
|
19313
19341
|
|
|
19314
19342
|
.filter-cont {
|
|
19315
19343
|
position: absolute;
|
|
@@ -19363,6 +19391,7 @@ const Style$A = dt.div`
|
|
|
19363
19391
|
height: 100%;
|
|
19364
19392
|
}
|
|
19365
19393
|
|
|
19394
|
+
/* Narrow marker styling used by legacy components; avoid width/height overrides for SimpleGlobe */
|
|
19366
19395
|
.map-marker {
|
|
19367
19396
|
text-align: center;
|
|
19368
19397
|
width 100%;
|
|
@@ -19928,14 +19957,26 @@ const useGlobe = ({
|
|
|
19928
19957
|
const addedSources = React.useRef(new Set());
|
|
19929
19958
|
const isMounted = React.useRef(true);
|
|
19930
19959
|
const addAllDataToMap = React.useCallback(() => {
|
|
19931
|
-
|
|
19960
|
+
console.log('π [GLOBE HOOK] addAllDataToMap called');
|
|
19961
|
+
console.log('π [GLOBE HOOK] data:', data);
|
|
19962
|
+
console.log('π [GLOBE HOOK] mapRef exists:', !!mapRef);
|
|
19963
|
+
console.log('π [GLOBE HOOK] style loaded:', mapRef?.isStyleLoaded());
|
|
19964
|
+
if (!data || !mapRef) {
|
|
19965
|
+
console.log('β [GLOBE HOOK] addAllDataToMap early return - missing data or mapRef');
|
|
19966
|
+
return;
|
|
19967
|
+
}
|
|
19968
|
+
if (!mapRef.isStyleLoaded()) {
|
|
19969
|
+
console.log('β³ [GLOBE HOOK] Style not loaded yet, retrying in 100ms...');
|
|
19970
|
+
setTimeout(() => {
|
|
19971
|
+
addAllDataToMap();
|
|
19972
|
+
}, 100);
|
|
19932
19973
|
return;
|
|
19933
19974
|
}
|
|
19934
|
-
|
|
19935
|
-
// Prevent multiple calls with empty data
|
|
19936
19975
|
if (data.length === 0) {
|
|
19976
|
+
console.log('β [GLOBE HOOK] addAllDataToMap early return - no data');
|
|
19937
19977
|
return;
|
|
19938
19978
|
}
|
|
19979
|
+
console.log('β
[GLOBE HOOK] Starting to add markers to map...');
|
|
19939
19980
|
|
|
19940
19981
|
// Clear existing markers using functional update to avoid dependency issues
|
|
19941
19982
|
setMapMarkers(currentMarkers => {
|
|
@@ -19987,8 +20028,13 @@ const useGlobe = ({
|
|
|
19987
20028
|
if (data && mapRef) {
|
|
19988
20029
|
const newMarkers = [];
|
|
19989
20030
|
const maxTotal = Math.max(...(data || []).map(d => d.total || 0));
|
|
20031
|
+
console.log('π― [GLOBE HOOK] Processing data items:', data.length);
|
|
19990
20032
|
data.forEach((d, i) => {
|
|
20033
|
+
console.log(`π― [GLOBE HOOK] Processing item ${i}:`, d);
|
|
20034
|
+
console.log(`π― [GLOBE HOOK] Item ${i} marker:`, d?.marker);
|
|
20035
|
+
console.log(`π― [GLOBE HOOK] Item ${i} lat/lng:`, d?.marker?.lat, d?.marker?.lng);
|
|
19991
20036
|
if (d?.marker?.lat && d?.marker?.lng) {
|
|
20037
|
+
console.log(`β
[GLOBE HOOK] Item ${i} has valid coordinates, creating marker...`);
|
|
19992
20038
|
let marker;
|
|
19993
20039
|
let iconClassName = "";
|
|
19994
20040
|
let iconSize = [25, 25];
|
|
@@ -20068,6 +20114,7 @@ const useGlobe = ({
|
|
|
20068
20114
|
el.style.fontWeight = 'bold';
|
|
20069
20115
|
el.innerHTML = `<span>${d.total || 0}</span>`;
|
|
20070
20116
|
marker = new mapboxgl.Marker(el).setLngLat([d.marker.lng, d.marker.lat]).setPopup(new mapboxgl.Popup().setDOMContent(div)).addTo(mapRef);
|
|
20117
|
+
console.log(`π [GLOBE HOOK] Marker ${i} added to map at:`, [d.marker.lng, d.marker.lat]);
|
|
20071
20118
|
} else if (type === "territory") {
|
|
20072
20119
|
// Handle territory polygons
|
|
20073
20120
|
if (d.area && Array.isArray(d.area)) {
|
|
@@ -20137,6 +20184,7 @@ const useGlobe = ({
|
|
|
20137
20184
|
}));
|
|
20138
20185
|
roots.current.push(root);
|
|
20139
20186
|
marker = new mapboxgl.Marker(el).setLngLat([d.marker.lng, d.marker.lat]).setPopup(new mapboxgl.Popup().setDOMContent(div)).addTo(mapRef);
|
|
20187
|
+
console.log(`π [GLOBE HOOK] Default marker ${i} added to map at:`, [d.marker.lng, d.marker.lat]);
|
|
20140
20188
|
}
|
|
20141
20189
|
|
|
20142
20190
|
// Add click handler
|
|
@@ -20170,6 +20218,7 @@ const useGlobe = ({
|
|
|
20170
20218
|
mapboxgl.accessToken = MAP_TOKEN;
|
|
20171
20219
|
|
|
20172
20220
|
// Create the map with Mapbox GL JS - 3D globe
|
|
20221
|
+
console.log('πΊοΈ [GLOBE HOOK] Creating map with style:', STYLE_URL);
|
|
20173
20222
|
const map = new mapboxgl.Map({
|
|
20174
20223
|
container: container.current,
|
|
20175
20224
|
style: STYLE_URL,
|
|
@@ -20188,8 +20237,13 @@ const useGlobe = ({
|
|
|
20188
20237
|
|
|
20189
20238
|
// Configure the map when style loads
|
|
20190
20239
|
map.on('style.load', () => {
|
|
20240
|
+
console.log('π¨ [GLOBE HOOK] Style loaded event triggered');
|
|
20241
|
+
console.log('π¨ [GLOBE HOOK] Map style loaded:', map.isStyleLoaded());
|
|
20242
|
+
|
|
20191
20243
|
// Wait a bit for the style to fully load
|
|
20192
20244
|
setTimeout(() => {
|
|
20245
|
+
console.log('π¨ [GLOBE HOOK] After timeout - Map style loaded:', map.isStyleLoaded());
|
|
20246
|
+
|
|
20193
20247
|
// Set fog for the space background effect with stars - simplified to avoid errors
|
|
20194
20248
|
try {
|
|
20195
20249
|
map.setFog({
|
|
@@ -20285,9 +20339,10 @@ const useGlobe = ({
|
|
|
20285
20339
|
|
|
20286
20340
|
// Add navigation controls
|
|
20287
20341
|
map.addControl(new mapboxgl.NavigationControl(), 'top-right');
|
|
20342
|
+
console.log('πΊοΈ [GLOBE HOOK] Map created successfully');
|
|
20288
20343
|
return map;
|
|
20289
20344
|
} catch (error) {
|
|
20290
|
-
console.error('Error creating Mapbox GL JS globe:', error);
|
|
20345
|
+
console.error('β [GLOBE HOOK] Error creating Mapbox GL JS globe:', error);
|
|
20291
20346
|
return null;
|
|
20292
20347
|
}
|
|
20293
20348
|
}, []);
|
|
@@ -20300,9 +20355,12 @@ const useGlobe = ({
|
|
|
20300
20355
|
// }, [initialMarkerSetIsDone]);
|
|
20301
20356
|
|
|
20302
20357
|
React.useEffect(() => {
|
|
20358
|
+
console.log('π [GLOBE HOOK] useEffect for map creation - mapRef:', !!mapRef);
|
|
20303
20359
|
if (!mapRef) {
|
|
20360
|
+
console.log('π [GLOBE HOOK] Creating map instance...');
|
|
20304
20361
|
const instance = createInstance();
|
|
20305
20362
|
if (instance) {
|
|
20363
|
+
console.log('π [GLOBE HOOK] Map instance created, setting mapRef');
|
|
20306
20364
|
setMapRef(instance);
|
|
20307
20365
|
|
|
20308
20366
|
// Add comprehensive resize detection for Mapbox GL JS responsiveness
|
|
@@ -20383,14 +20441,22 @@ const useGlobe = ({
|
|
|
20383
20441
|
}
|
|
20384
20442
|
}, [polygon, mapRef]);
|
|
20385
20443
|
React.useEffect(() => {
|
|
20444
|
+
console.log('π₯ [GLOBE HOOK] allData received:', allData);
|
|
20445
|
+
console.log('π₯ [GLOBE HOOK] allData length:', allData?.length);
|
|
20386
20446
|
if (allData) {
|
|
20387
20447
|
if (allData.length === 0) {
|
|
20448
|
+
console.log('β οΈ [GLOBE HOOK] Empty data array');
|
|
20388
20449
|
setEmptyStateIsVisible(true);
|
|
20389
20450
|
} else if (emptyStateIsVisible) {
|
|
20390
20451
|
setEmptyStateIsVisible(false);
|
|
20391
20452
|
}
|
|
20392
|
-
|
|
20453
|
+
console.log('π [GLOBE HOOK] Filtering data with filterValidGPS...');
|
|
20454
|
+
const filteredData = filterValidGPS(allData);
|
|
20455
|
+
console.log('π [GLOBE HOOK] filtered data result:', filteredData);
|
|
20456
|
+
console.log('π [GLOBE HOOK] filtered data length:', filteredData.length);
|
|
20457
|
+
setData(filteredData);
|
|
20393
20458
|
} else {
|
|
20459
|
+
console.log('β [GLOBE HOOK] No allData provided');
|
|
20394
20460
|
setData(null);
|
|
20395
20461
|
}
|
|
20396
20462
|
}, [allData, emptyStateIsVisible]);
|
|
@@ -20420,7 +20486,19 @@ const useGlobe = ({
|
|
|
20420
20486
|
}
|
|
20421
20487
|
}, [user, mapRef, allData]);
|
|
20422
20488
|
React.useEffect(() => {
|
|
20423
|
-
|
|
20489
|
+
console.log('π [GLOBE HOOK] useEffect triggered:', {
|
|
20490
|
+
mapRef: !!mapRef,
|
|
20491
|
+
data: !!data,
|
|
20492
|
+
dataLength: data?.length,
|
|
20493
|
+
initialMarkerSetIsDone,
|
|
20494
|
+
styleLoaded: mapRef?.isStyleLoaded()
|
|
20495
|
+
});
|
|
20496
|
+
if (mapRef && data && !initialMarkerSetIsDone) {
|
|
20497
|
+
console.log('π [GLOBE HOOK] Attempting to add markers...');
|
|
20498
|
+
console.log('π [GLOBE HOOK] Style loaded check:', mapRef.isStyleLoaded());
|
|
20499
|
+
|
|
20500
|
+
// Try to add markers immediately, and if style isn't loaded,
|
|
20501
|
+
// the addAllDataToMap function will handle it
|
|
20424
20502
|
setInitialMarkerSetIsDone(true);
|
|
20425
20503
|
addAllDataToMap();
|
|
20426
20504
|
}
|
|
@@ -20633,7 +20711,7 @@ function Globe(_ref) {
|
|
|
20633
20711
|
renderSider = null,
|
|
20634
20712
|
renderMarker = null,
|
|
20635
20713
|
type = "default",
|
|
20636
|
-
showSider =
|
|
20714
|
+
showSider = false,
|
|
20637
20715
|
filtersConfig,
|
|
20638
20716
|
onFilterChange = () => {},
|
|
20639
20717
|
isSatellite = false,
|
|
@@ -20643,15 +20721,29 @@ function Globe(_ref) {
|
|
|
20643
20721
|
onUnmount
|
|
20644
20722
|
} = _ref;
|
|
20645
20723
|
// Map data to include marker coordinates
|
|
20646
|
-
const mappedData = React.useMemo(() =>
|
|
20647
|
-
|
|
20648
|
-
|
|
20649
|
-
|
|
20650
|
-
|
|
20651
|
-
|
|
20652
|
-
|
|
20724
|
+
const mappedData = React.useMemo(() => {
|
|
20725
|
+
console.log('π [GLOBE COMPONENT] Original data received:', data);
|
|
20726
|
+
console.log('π [GLOBE COMPONENT] Data length:', data === null || data === void 0 ? void 0 : data.length);
|
|
20727
|
+
if (!data || data.length === 0) {
|
|
20728
|
+
console.log('β [GLOBE COMPONENT] No data to map');
|
|
20729
|
+
return [];
|
|
20730
|
+
}
|
|
20731
|
+
const mapped = data.map((d, i) => {
|
|
20732
|
+
var _d$gps, _d$gps2;
|
|
20733
|
+
console.log("\uD83D\uDCCA [GLOBE COMPONENT] Mapping item ".concat(i, ":"), d);
|
|
20734
|
+
console.log("\uD83D\uDCCA [GLOBE COMPONENT] Item ".concat(i, " GPS:"), d === null || d === void 0 ? void 0 : d.gps);
|
|
20735
|
+
const result = _objectSpread2(_objectSpread2({}, d), {}, {
|
|
20736
|
+
marker: {
|
|
20737
|
+
lat: d === null || d === void 0 || (_d$gps = d.gps) === null || _d$gps === void 0 ? void 0 : _d$gps.latitude,
|
|
20738
|
+
lng: d === null || d === void 0 || (_d$gps2 = d.gps) === null || _d$gps2 === void 0 ? void 0 : _d$gps2.longitude
|
|
20739
|
+
}
|
|
20740
|
+
});
|
|
20741
|
+
console.log("\uD83D\uDCCA [GLOBE COMPONENT] Item ".concat(i, " mapped result:"), result);
|
|
20742
|
+
return result;
|
|
20653
20743
|
});
|
|
20654
|
-
|
|
20744
|
+
console.log('π [GLOBE COMPONENT] Final mapped data:', mapped);
|
|
20745
|
+
return mapped;
|
|
20746
|
+
}, [data]);
|
|
20655
20747
|
|
|
20656
20748
|
// Get resize context for sidebar state changes
|
|
20657
20749
|
const {
|
|
@@ -20835,6 +20927,285 @@ Globe.propTypes = {
|
|
|
20835
20927
|
nameAsSiderTitle: PropTypes__default["default"].bool
|
|
20836
20928
|
};
|
|
20837
20929
|
|
|
20930
|
+
const SimpleGlobe = _ref => {
|
|
20931
|
+
let {
|
|
20932
|
+
projects = [],
|
|
20933
|
+
mapConfig = {},
|
|
20934
|
+
showSider = false,
|
|
20935
|
+
onProjectClick = () => {},
|
|
20936
|
+
type = "default",
|
|
20937
|
+
color = "var(--color-primary-60)",
|
|
20938
|
+
renderTooltip: renderTooltip$1 = null
|
|
20939
|
+
} = _ref;
|
|
20940
|
+
const mapContainer = React.useRef(null);
|
|
20941
|
+
const map = React.useRef(null);
|
|
20942
|
+
const boundsRef = React.useRef(null);
|
|
20943
|
+
React.useEffect(() => {
|
|
20944
|
+
if (map.current) return; // Initialize map only once
|
|
20945
|
+
|
|
20946
|
+
console.log('πΊοΈ [SIMPLE GLOBE] Creating map...');
|
|
20947
|
+
|
|
20948
|
+
// Set Mapbox access token
|
|
20949
|
+
mapboxgl.accessToken = 'pk.eyJ1IjoicmVkaXM5OTkiLCJhIjoiY2x4YWV5MzA5MmtuZzJpcXM5Y201Z2E2YiJ9.m5bwPg-Tj4Akesl1yQUa3w';
|
|
20950
|
+
|
|
20951
|
+
// Create map with custom Straatos style
|
|
20952
|
+
map.current = new mapboxgl.Map({
|
|
20953
|
+
container: mapContainer.current,
|
|
20954
|
+
style: 'mapbox://styles/pietragottardo/cm9tt9zfi00d101pg1vdx26si',
|
|
20955
|
+
center: [0, 0],
|
|
20956
|
+
zoom: mapConfig.maxZoom || 3,
|
|
20957
|
+
projection: 'globe',
|
|
20958
|
+
attributionControl: false
|
|
20959
|
+
});
|
|
20960
|
+
|
|
20961
|
+
// Add markers when map loads
|
|
20962
|
+
map.current.on('load', () => {
|
|
20963
|
+
console.log('πΊοΈ [SIMPLE GLOBE] Map loaded, adding markers...');
|
|
20964
|
+
|
|
20965
|
+
// Hide Mapbox logo and attribution completely
|
|
20966
|
+
map.current.getContainer();
|
|
20967
|
+
const style = document.createElement('style');
|
|
20968
|
+
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 ";
|
|
20969
|
+
document.head.appendChild(style);
|
|
20970
|
+
|
|
20971
|
+
// Set the space background with stars
|
|
20972
|
+
try {
|
|
20973
|
+
map.current.setFog({
|
|
20974
|
+
'color': 'rgb(0, 0, 0)',
|
|
20975
|
+
'high-color': 'rgb(0, 0, 0)',
|
|
20976
|
+
'horizon-blend': 0.1,
|
|
20977
|
+
'space-color': 'rgb(0, 0, 0)',
|
|
20978
|
+
'star-intensity': 0.6
|
|
20979
|
+
});
|
|
20980
|
+
console.log('β¨ [SIMPLE GLOBE] Space background with stars set');
|
|
20981
|
+
} catch (e) {
|
|
20982
|
+
console.log('β οΈ [SIMPLE GLOBE] Could not set fog, trying alternative...');
|
|
20983
|
+
// Fallback: try simpler fog configuration
|
|
20984
|
+
try {
|
|
20985
|
+
map.current.setFog({
|
|
20986
|
+
'color': 'rgb(0, 0, 0)',
|
|
20987
|
+
'high-color': 'rgb(0, 0, 0)',
|
|
20988
|
+
'horizon-blend': 0.1
|
|
20989
|
+
});
|
|
20990
|
+
console.log('β¨ [SIMPLE GLOBE] Alternative space background set');
|
|
20991
|
+
} catch (e2) {
|
|
20992
|
+
console.log('β οΈ [SIMPLE GLOBE] Could not set any fog configuration');
|
|
20993
|
+
}
|
|
20994
|
+
}
|
|
20995
|
+
|
|
20996
|
+
// Calculate bounds to fit all markers
|
|
20997
|
+
const bounds = new mapboxgl.LngLatBounds();
|
|
20998
|
+
let hasValidCoordinates = false;
|
|
20999
|
+
projects.forEach((project, index) => {
|
|
21000
|
+
console.log("\uD83D\uDCCD [SIMPLE GLOBE] Adding marker ".concat(index, ":"), project);
|
|
21001
|
+
|
|
21002
|
+
// Create marker element based on type
|
|
21003
|
+
const el = document.createElement('div');
|
|
21004
|
+
// Use a scoped class to avoid picking up broad styles like `.map-marker { width:100% }`
|
|
21005
|
+
el.className = 'daf-globe-marker';
|
|
21006
|
+
el.style.cursor = 'pointer';
|
|
21007
|
+
el.style.boxShadow = '0px 3.45px 3.45px 0px #00000029';
|
|
21008
|
+
el.style.display = 'flex';
|
|
21009
|
+
el.style.alignItems = 'center';
|
|
21010
|
+
el.style.justifyContent = 'center';
|
|
21011
|
+
if (type === "location") {
|
|
21012
|
+
// Location marker - SVG map pin style
|
|
21013
|
+
el.style.width = '28px';
|
|
21014
|
+
el.style.height = '33px';
|
|
21015
|
+
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 ");
|
|
21016
|
+
} else {
|
|
21017
|
+
// Default circular marker style
|
|
21018
|
+
el.style.width = '30px';
|
|
21019
|
+
el.style.height = '30px';
|
|
21020
|
+
el.style.backgroundColor = color;
|
|
21021
|
+
el.style.borderRadius = '50%';
|
|
21022
|
+
el.style.border = '2px solid white';
|
|
21023
|
+
el.style.color = 'white';
|
|
21024
|
+
el.style.fontWeight = 'bold';
|
|
21025
|
+
el.style.fontSize = '14px';
|
|
21026
|
+
el.style.textAlign = 'center';
|
|
21027
|
+
el.style.lineHeight = '1';
|
|
21028
|
+
el.innerHTML = "<span style=\"display: block; line-height: 1;\">".concat(project.percentageCompletion || 0, "</span>");
|
|
21029
|
+
}
|
|
21030
|
+
|
|
21031
|
+
// Create popup content using custom renderTooltip or default
|
|
21032
|
+
let popupContent;
|
|
21033
|
+
if (renderTooltip$1 && typeof renderTooltip$1 === 'function') {
|
|
21034
|
+
// Use custom renderTooltip function (same as MineSiteMap)
|
|
21035
|
+
const tooltipData = renderTooltip$1(project);
|
|
21036
|
+
popupContent = renderTooltip({
|
|
21037
|
+
title: project.name,
|
|
21038
|
+
subTitle: project.sectoralScope || 'Project',
|
|
21039
|
+
items: tooltipData,
|
|
21040
|
+
link: false
|
|
21041
|
+
});
|
|
21042
|
+
} else {
|
|
21043
|
+
// Use default tooltip structure
|
|
21044
|
+
const tooltipData = [{
|
|
21045
|
+
label: "Country",
|
|
21046
|
+
value: project.country || 'N/A'
|
|
21047
|
+
}, {
|
|
21048
|
+
label: "Sectoral Scope",
|
|
21049
|
+
value: project.sectoralScope || 'Project'
|
|
21050
|
+
}];
|
|
21051
|
+
popupContent = renderTooltip({
|
|
21052
|
+
title: project.name,
|
|
21053
|
+
subTitle: project.sectoralScope || 'Project',
|
|
21054
|
+
items: tooltipData,
|
|
21055
|
+
link: false
|
|
21056
|
+
});
|
|
21057
|
+
}
|
|
21058
|
+
|
|
21059
|
+
// Create popup
|
|
21060
|
+
const popup = new mapboxgl.Popup({
|
|
21061
|
+
offset: 25,
|
|
21062
|
+
closeButton: true,
|
|
21063
|
+
closeOnClick: false
|
|
21064
|
+
}).setHTML(popupContent);
|
|
21065
|
+
|
|
21066
|
+
// Ensure coordinates are valid numbers
|
|
21067
|
+
const lng = Number(project.longitude);
|
|
21068
|
+
const lat = Number(project.latitude);
|
|
21069
|
+
console.log("\uD83D\uDCCD [SIMPLE GLOBE] Marker ".concat(index, " coordinates:"), {
|
|
21070
|
+
lng,
|
|
21071
|
+
lat
|
|
21072
|
+
});
|
|
21073
|
+
|
|
21074
|
+
// Validate coordinates
|
|
21075
|
+
if (isNaN(lng) || isNaN(lat) || lng < -180 || lng > 180 || lat < -90 || lat > 90) {
|
|
21076
|
+
console.error("\u274C [SIMPLE GLOBE] Invalid coordinates for project ".concat(index, ":"), {
|
|
21077
|
+
lng,
|
|
21078
|
+
lat
|
|
21079
|
+
});
|
|
21080
|
+
return;
|
|
21081
|
+
}
|
|
21082
|
+
|
|
21083
|
+
// Add coordinates to bounds
|
|
21084
|
+
bounds.extend([lng, lat]);
|
|
21085
|
+
hasValidCoordinates = true;
|
|
21086
|
+
|
|
21087
|
+
// Add marker to map with proper coordinate order [lng, lat]
|
|
21088
|
+
new mapboxgl.Marker(el).setLngLat([lng, lat]).setPopup(popup).addTo(map.current);
|
|
21089
|
+
|
|
21090
|
+
// Add click handler
|
|
21091
|
+
el.addEventListener('click', () => {
|
|
21092
|
+
console.log('π [SIMPLE GLOBE] Marker clicked:', project);
|
|
21093
|
+
onProjectClick(project);
|
|
21094
|
+
});
|
|
21095
|
+
console.log("\u2705 [SIMPLE GLOBE] Marker ".concat(index, " added at:"), [lng, lat]);
|
|
21096
|
+
});
|
|
21097
|
+
|
|
21098
|
+
// Fit map to show all markers if we have valid coordinates
|
|
21099
|
+
if (hasValidCoordinates && !bounds.isEmpty()) {
|
|
21100
|
+
console.log('πΊοΈ [SIMPLE GLOBE] Fitting map to bounds:', bounds);
|
|
21101
|
+
map.current.fitBounds(bounds, {
|
|
21102
|
+
padding: {
|
|
21103
|
+
top: 20,
|
|
21104
|
+
bottom: 20,
|
|
21105
|
+
left: 20,
|
|
21106
|
+
right: 20
|
|
21107
|
+
},
|
|
21108
|
+
maxZoom: 6,
|
|
21109
|
+
duration: 1000
|
|
21110
|
+
});
|
|
21111
|
+
boundsRef.current = bounds;
|
|
21112
|
+
} else {
|
|
21113
|
+
boundsRef.current = null;
|
|
21114
|
+
}
|
|
21115
|
+
});
|
|
21116
|
+
return () => {
|
|
21117
|
+
if (map.current) {
|
|
21118
|
+
map.current.remove();
|
|
21119
|
+
map.current = null;
|
|
21120
|
+
}
|
|
21121
|
+
};
|
|
21122
|
+
}, [projects, onProjectClick, mapConfig]);
|
|
21123
|
+
const zoomIn = () => map.current && map.current.zoomIn();
|
|
21124
|
+
const zoomOut = () => map.current && map.current.zoomOut();
|
|
21125
|
+
const recenter = () => {
|
|
21126
|
+
if (!map.current) return;
|
|
21127
|
+
if (boundsRef.current && !boundsRef.current.isEmpty()) {
|
|
21128
|
+
map.current.fitBounds(boundsRef.current, {
|
|
21129
|
+
padding: {
|
|
21130
|
+
top: 20,
|
|
21131
|
+
bottom: 20,
|
|
21132
|
+
left: 20,
|
|
21133
|
+
right: 20
|
|
21134
|
+
},
|
|
21135
|
+
maxZoom: 6,
|
|
21136
|
+
duration: 800
|
|
21137
|
+
});
|
|
21138
|
+
return;
|
|
21139
|
+
}
|
|
21140
|
+
map.current.easeTo({
|
|
21141
|
+
center: [0, 0],
|
|
21142
|
+
zoom: 3,
|
|
21143
|
+
duration: 800
|
|
21144
|
+
});
|
|
21145
|
+
};
|
|
21146
|
+
const pitchUp = () => {
|
|
21147
|
+
var _map$current$getPitch, _map$current;
|
|
21148
|
+
if (!map.current) return;
|
|
21149
|
+
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);
|
|
21150
|
+
map.current.setPitch(next);
|
|
21151
|
+
};
|
|
21152
|
+
const pitchDown = () => {
|
|
21153
|
+
var _map$current$getPitch2, _map$current2;
|
|
21154
|
+
if (!map.current) return;
|
|
21155
|
+
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);
|
|
21156
|
+
map.current.setPitch(next);
|
|
21157
|
+
};
|
|
21158
|
+
return /*#__PURE__*/jsxRuntime.jsx(Style$A, {
|
|
21159
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
21160
|
+
className: "daf-simple-globe-container",
|
|
21161
|
+
style: {
|
|
21162
|
+
width: '100%',
|
|
21163
|
+
height: '100%',
|
|
21164
|
+
overflow: 'hidden',
|
|
21165
|
+
position: 'relative'
|
|
21166
|
+
},
|
|
21167
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
21168
|
+
ref: mapContainer,
|
|
21169
|
+
className: "daf-globe-map-container",
|
|
21170
|
+
style: {
|
|
21171
|
+
width: '100%',
|
|
21172
|
+
height: '100%',
|
|
21173
|
+
overflow: 'hidden',
|
|
21174
|
+
position: 'relative'
|
|
21175
|
+
}
|
|
21176
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
21177
|
+
className: "map-control-buttons",
|
|
21178
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("button", {
|
|
21179
|
+
type: "button",
|
|
21180
|
+
"aria-label": "Zoom in",
|
|
21181
|
+
onClick: zoomIn,
|
|
21182
|
+
children: "+"
|
|
21183
|
+
}), /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
21184
|
+
type: "button",
|
|
21185
|
+
"aria-label": "Zoom out",
|
|
21186
|
+
onClick: zoomOut,
|
|
21187
|
+
children: "\u2212"
|
|
21188
|
+
}), /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
21189
|
+
type: "button",
|
|
21190
|
+
"aria-label": "Recenter",
|
|
21191
|
+
onClick: recenter,
|
|
21192
|
+
children: "\u25CE"
|
|
21193
|
+
}), /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
21194
|
+
type: "button",
|
|
21195
|
+
"aria-label": "Pitch up",
|
|
21196
|
+
onClick: pitchUp,
|
|
21197
|
+
children: "^"
|
|
21198
|
+
}), /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
21199
|
+
type: "button",
|
|
21200
|
+
"aria-label": "Pitch down",
|
|
21201
|
+
onClick: pitchDown,
|
|
21202
|
+
children: "\u02C5"
|
|
21203
|
+
})]
|
|
21204
|
+
})]
|
|
21205
|
+
})
|
|
21206
|
+
});
|
|
21207
|
+
};
|
|
21208
|
+
|
|
20838
21209
|
function WidgetPlaceholder(_ref) {
|
|
20839
21210
|
let {
|
|
20840
21211
|
icon = "",
|
|
@@ -61635,6 +62006,7 @@ exports.SelectFiltersTimeFrame = Timeframe;
|
|
|
61635
62006
|
exports.SettingsPopover = SettingsPopover;
|
|
61636
62007
|
exports.Sidenav = Sidenav;
|
|
61637
62008
|
exports.SidenavMenu = SidenavMenu;
|
|
62009
|
+
exports.SimpleGlobe = SimpleGlobe;
|
|
61638
62010
|
exports.StackChart = StackChart;
|
|
61639
62011
|
exports.StakeholderMappings = index$1;
|
|
61640
62012
|
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
|
+
|