datastake-daf 0.6.280 β 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 +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/.env +0 -8
- package/.vscode/settings.json +0 -13
package/dist/components/index.js
CHANGED
|
@@ -19321,6 +19321,34 @@ const Style$A = dt.div`
|
|
|
19321
19321
|
position: relative;
|
|
19322
19322
|
width: 100%;
|
|
19323
19323
|
height: 472px;
|
|
19324
|
+
|
|
19325
|
+
/* CRITICAL: Protect against Leaflet CSS interference */
|
|
19326
|
+
.daf-simple-globe-container {
|
|
19327
|
+
position: relative;
|
|
19328
|
+
width: 100%;
|
|
19329
|
+
height: 100%;
|
|
19330
|
+
|
|
19331
|
+
/* Override Leaflet CSS that interferes with Mapbox */
|
|
19332
|
+
.mapboxgl-canvas-container {
|
|
19333
|
+
position: relative !important;
|
|
19334
|
+
left: auto !important;
|
|
19335
|
+
top: auto !important;
|
|
19336
|
+
}
|
|
19337
|
+
|
|
19338
|
+
.mapboxgl-canvas-container canvas {
|
|
19339
|
+
position: relative !important;
|
|
19340
|
+
left: auto !important;
|
|
19341
|
+
top: auto !important;
|
|
19342
|
+
transform: none !important;
|
|
19343
|
+
}
|
|
19344
|
+
|
|
19345
|
+
/* Protect markers from Leaflet positioning */
|
|
19346
|
+
.daf-globe-marker {
|
|
19347
|
+
position: relative !important;
|
|
19348
|
+
left: auto !important;
|
|
19349
|
+
top: auto !important;
|
|
19350
|
+
}
|
|
19351
|
+
}
|
|
19324
19352
|
|
|
19325
19353
|
.filter-cont {
|
|
19326
19354
|
position: absolute;
|
|
@@ -19374,6 +19402,7 @@ const Style$A = dt.div`
|
|
|
19374
19402
|
height: 100%;
|
|
19375
19403
|
}
|
|
19376
19404
|
|
|
19405
|
+
/* Narrow marker styling used by legacy components; avoid width/height overrides for SimpleGlobe */
|
|
19377
19406
|
.map-marker {
|
|
19378
19407
|
text-align: center;
|
|
19379
19408
|
width 100%;
|
|
@@ -19939,14 +19968,26 @@ const useGlobe = ({
|
|
|
19939
19968
|
const addedSources = React.useRef(new Set());
|
|
19940
19969
|
const isMounted = React.useRef(true);
|
|
19941
19970
|
const addAllDataToMap = React.useCallback(() => {
|
|
19942
|
-
|
|
19971
|
+
console.log('π [GLOBE HOOK] addAllDataToMap called');
|
|
19972
|
+
console.log('π [GLOBE HOOK] data:', data);
|
|
19973
|
+
console.log('π [GLOBE HOOK] mapRef exists:', !!mapRef);
|
|
19974
|
+
console.log('π [GLOBE HOOK] style loaded:', mapRef?.isStyleLoaded());
|
|
19975
|
+
if (!data || !mapRef) {
|
|
19976
|
+
console.log('β [GLOBE HOOK] addAllDataToMap early return - missing data or mapRef');
|
|
19977
|
+
return;
|
|
19978
|
+
}
|
|
19979
|
+
if (!mapRef.isStyleLoaded()) {
|
|
19980
|
+
console.log('β³ [GLOBE HOOK] Style not loaded yet, retrying in 100ms...');
|
|
19981
|
+
setTimeout(() => {
|
|
19982
|
+
addAllDataToMap();
|
|
19983
|
+
}, 100);
|
|
19943
19984
|
return;
|
|
19944
19985
|
}
|
|
19945
|
-
|
|
19946
|
-
// Prevent multiple calls with empty data
|
|
19947
19986
|
if (data.length === 0) {
|
|
19987
|
+
console.log('β [GLOBE HOOK] addAllDataToMap early return - no data');
|
|
19948
19988
|
return;
|
|
19949
19989
|
}
|
|
19990
|
+
console.log('β
[GLOBE HOOK] Starting to add markers to map...');
|
|
19950
19991
|
|
|
19951
19992
|
// Clear existing markers using functional update to avoid dependency issues
|
|
19952
19993
|
setMapMarkers(currentMarkers => {
|
|
@@ -19998,8 +20039,13 @@ const useGlobe = ({
|
|
|
19998
20039
|
if (data && mapRef) {
|
|
19999
20040
|
const newMarkers = [];
|
|
20000
20041
|
const maxTotal = Math.max(...(data || []).map(d => d.total || 0));
|
|
20042
|
+
console.log('π― [GLOBE HOOK] Processing data items:', data.length);
|
|
20001
20043
|
data.forEach((d, i) => {
|
|
20044
|
+
console.log(`π― [GLOBE HOOK] Processing item ${i}:`, d);
|
|
20045
|
+
console.log(`π― [GLOBE HOOK] Item ${i} marker:`, d?.marker);
|
|
20046
|
+
console.log(`π― [GLOBE HOOK] Item ${i} lat/lng:`, d?.marker?.lat, d?.marker?.lng);
|
|
20002
20047
|
if (d?.marker?.lat && d?.marker?.lng) {
|
|
20048
|
+
console.log(`β
[GLOBE HOOK] Item ${i} has valid coordinates, creating marker...`);
|
|
20003
20049
|
let marker;
|
|
20004
20050
|
let iconClassName = "";
|
|
20005
20051
|
let iconSize = [25, 25];
|
|
@@ -20079,6 +20125,7 @@ const useGlobe = ({
|
|
|
20079
20125
|
el.style.fontWeight = 'bold';
|
|
20080
20126
|
el.innerHTML = `<span>${d.total || 0}</span>`;
|
|
20081
20127
|
marker = new mapboxgl.Marker(el).setLngLat([d.marker.lng, d.marker.lat]).setPopup(new mapboxgl.Popup().setDOMContent(div)).addTo(mapRef);
|
|
20128
|
+
console.log(`π [GLOBE HOOK] Marker ${i} added to map at:`, [d.marker.lng, d.marker.lat]);
|
|
20082
20129
|
} else if (type === "territory") {
|
|
20083
20130
|
// Handle territory polygons
|
|
20084
20131
|
if (d.area && Array.isArray(d.area)) {
|
|
@@ -20148,6 +20195,7 @@ const useGlobe = ({
|
|
|
20148
20195
|
}));
|
|
20149
20196
|
roots.current.push(root);
|
|
20150
20197
|
marker = new mapboxgl.Marker(el).setLngLat([d.marker.lng, d.marker.lat]).setPopup(new mapboxgl.Popup().setDOMContent(div)).addTo(mapRef);
|
|
20198
|
+
console.log(`π [GLOBE HOOK] Default marker ${i} added to map at:`, [d.marker.lng, d.marker.lat]);
|
|
20151
20199
|
}
|
|
20152
20200
|
|
|
20153
20201
|
// Add click handler
|
|
@@ -20181,6 +20229,7 @@ const useGlobe = ({
|
|
|
20181
20229
|
mapboxgl.accessToken = MAP_TOKEN;
|
|
20182
20230
|
|
|
20183
20231
|
// Create the map with Mapbox GL JS - 3D globe
|
|
20232
|
+
console.log('πΊοΈ [GLOBE HOOK] Creating map with style:', STYLE_URL);
|
|
20184
20233
|
const map = new mapboxgl.Map({
|
|
20185
20234
|
container: container.current,
|
|
20186
20235
|
style: STYLE_URL,
|
|
@@ -20199,8 +20248,13 @@ const useGlobe = ({
|
|
|
20199
20248
|
|
|
20200
20249
|
// Configure the map when style loads
|
|
20201
20250
|
map.on('style.load', () => {
|
|
20251
|
+
console.log('π¨ [GLOBE HOOK] Style loaded event triggered');
|
|
20252
|
+
console.log('π¨ [GLOBE HOOK] Map style loaded:', map.isStyleLoaded());
|
|
20253
|
+
|
|
20202
20254
|
// Wait a bit for the style to fully load
|
|
20203
20255
|
setTimeout(() => {
|
|
20256
|
+
console.log('π¨ [GLOBE HOOK] After timeout - Map style loaded:', map.isStyleLoaded());
|
|
20257
|
+
|
|
20204
20258
|
// Set fog for the space background effect with stars - simplified to avoid errors
|
|
20205
20259
|
try {
|
|
20206
20260
|
map.setFog({
|
|
@@ -20296,9 +20350,10 @@ const useGlobe = ({
|
|
|
20296
20350
|
|
|
20297
20351
|
// Add navigation controls
|
|
20298
20352
|
map.addControl(new mapboxgl.NavigationControl(), 'top-right');
|
|
20353
|
+
console.log('πΊοΈ [GLOBE HOOK] Map created successfully');
|
|
20299
20354
|
return map;
|
|
20300
20355
|
} catch (error) {
|
|
20301
|
-
console.error('Error creating Mapbox GL JS globe:', error);
|
|
20356
|
+
console.error('β [GLOBE HOOK] Error creating Mapbox GL JS globe:', error);
|
|
20302
20357
|
return null;
|
|
20303
20358
|
}
|
|
20304
20359
|
}, []);
|
|
@@ -20311,9 +20366,12 @@ const useGlobe = ({
|
|
|
20311
20366
|
// }, [initialMarkerSetIsDone]);
|
|
20312
20367
|
|
|
20313
20368
|
React.useEffect(() => {
|
|
20369
|
+
console.log('π [GLOBE HOOK] useEffect for map creation - mapRef:', !!mapRef);
|
|
20314
20370
|
if (!mapRef) {
|
|
20371
|
+
console.log('π [GLOBE HOOK] Creating map instance...');
|
|
20315
20372
|
const instance = createInstance();
|
|
20316
20373
|
if (instance) {
|
|
20374
|
+
console.log('π [GLOBE HOOK] Map instance created, setting mapRef');
|
|
20317
20375
|
setMapRef(instance);
|
|
20318
20376
|
|
|
20319
20377
|
// Add comprehensive resize detection for Mapbox GL JS responsiveness
|
|
@@ -20394,14 +20452,22 @@ const useGlobe = ({
|
|
|
20394
20452
|
}
|
|
20395
20453
|
}, [polygon, mapRef]);
|
|
20396
20454
|
React.useEffect(() => {
|
|
20455
|
+
console.log('π₯ [GLOBE HOOK] allData received:', allData);
|
|
20456
|
+
console.log('π₯ [GLOBE HOOK] allData length:', allData?.length);
|
|
20397
20457
|
if (allData) {
|
|
20398
20458
|
if (allData.length === 0) {
|
|
20459
|
+
console.log('β οΈ [GLOBE HOOK] Empty data array');
|
|
20399
20460
|
setEmptyStateIsVisible(true);
|
|
20400
20461
|
} else if (emptyStateIsVisible) {
|
|
20401
20462
|
setEmptyStateIsVisible(false);
|
|
20402
20463
|
}
|
|
20403
|
-
|
|
20464
|
+
console.log('π [GLOBE HOOK] Filtering data with filterValidGPS...');
|
|
20465
|
+
const filteredData = filterValidGPS(allData);
|
|
20466
|
+
console.log('π [GLOBE HOOK] filtered data result:', filteredData);
|
|
20467
|
+
console.log('π [GLOBE HOOK] filtered data length:', filteredData.length);
|
|
20468
|
+
setData(filteredData);
|
|
20404
20469
|
} else {
|
|
20470
|
+
console.log('β [GLOBE HOOK] No allData provided');
|
|
20405
20471
|
setData(null);
|
|
20406
20472
|
}
|
|
20407
20473
|
}, [allData, emptyStateIsVisible]);
|
|
@@ -20431,7 +20497,19 @@ const useGlobe = ({
|
|
|
20431
20497
|
}
|
|
20432
20498
|
}, [user, mapRef, allData]);
|
|
20433
20499
|
React.useEffect(() => {
|
|
20434
|
-
|
|
20500
|
+
console.log('π [GLOBE HOOK] useEffect triggered:', {
|
|
20501
|
+
mapRef: !!mapRef,
|
|
20502
|
+
data: !!data,
|
|
20503
|
+
dataLength: data?.length,
|
|
20504
|
+
initialMarkerSetIsDone,
|
|
20505
|
+
styleLoaded: mapRef?.isStyleLoaded()
|
|
20506
|
+
});
|
|
20507
|
+
if (mapRef && data && !initialMarkerSetIsDone) {
|
|
20508
|
+
console.log('π [GLOBE HOOK] Attempting to add markers...');
|
|
20509
|
+
console.log('π [GLOBE HOOK] Style loaded check:', mapRef.isStyleLoaded());
|
|
20510
|
+
|
|
20511
|
+
// Try to add markers immediately, and if style isn't loaded,
|
|
20512
|
+
// the addAllDataToMap function will handle it
|
|
20435
20513
|
setInitialMarkerSetIsDone(true);
|
|
20436
20514
|
addAllDataToMap();
|
|
20437
20515
|
}
|
|
@@ -20644,7 +20722,7 @@ function Globe(_ref) {
|
|
|
20644
20722
|
renderSider = null,
|
|
20645
20723
|
renderMarker = null,
|
|
20646
20724
|
type = "default",
|
|
20647
|
-
showSider =
|
|
20725
|
+
showSider = false,
|
|
20648
20726
|
filtersConfig,
|
|
20649
20727
|
onFilterChange = () => {},
|
|
20650
20728
|
isSatellite = false,
|
|
@@ -20654,15 +20732,29 @@ function Globe(_ref) {
|
|
|
20654
20732
|
onUnmount
|
|
20655
20733
|
} = _ref;
|
|
20656
20734
|
// Map data to include marker coordinates
|
|
20657
|
-
const mappedData = React.useMemo(() =>
|
|
20658
|
-
|
|
20659
|
-
|
|
20660
|
-
|
|
20661
|
-
|
|
20662
|
-
|
|
20663
|
-
|
|
20735
|
+
const mappedData = React.useMemo(() => {
|
|
20736
|
+
console.log('π [GLOBE COMPONENT] Original data received:', data);
|
|
20737
|
+
console.log('π [GLOBE COMPONENT] Data length:', data === null || data === void 0 ? void 0 : data.length);
|
|
20738
|
+
if (!data || data.length === 0) {
|
|
20739
|
+
console.log('β [GLOBE COMPONENT] No data to map');
|
|
20740
|
+
return [];
|
|
20741
|
+
}
|
|
20742
|
+
const mapped = data.map((d, i) => {
|
|
20743
|
+
var _d$gps, _d$gps2;
|
|
20744
|
+
console.log("\uD83D\uDCCA [GLOBE COMPONENT] Mapping item ".concat(i, ":"), d);
|
|
20745
|
+
console.log("\uD83D\uDCCA [GLOBE COMPONENT] Item ".concat(i, " GPS:"), d === null || d === void 0 ? void 0 : d.gps);
|
|
20746
|
+
const result = _objectSpread2(_objectSpread2({}, d), {}, {
|
|
20747
|
+
marker: {
|
|
20748
|
+
lat: d === null || d === void 0 || (_d$gps = d.gps) === null || _d$gps === void 0 ? void 0 : _d$gps.latitude,
|
|
20749
|
+
lng: d === null || d === void 0 || (_d$gps2 = d.gps) === null || _d$gps2 === void 0 ? void 0 : _d$gps2.longitude
|
|
20750
|
+
}
|
|
20751
|
+
});
|
|
20752
|
+
console.log("\uD83D\uDCCA [GLOBE COMPONENT] Item ".concat(i, " mapped result:"), result);
|
|
20753
|
+
return result;
|
|
20664
20754
|
});
|
|
20665
|
-
|
|
20755
|
+
console.log('π [GLOBE COMPONENT] Final mapped data:', mapped);
|
|
20756
|
+
return mapped;
|
|
20757
|
+
}, [data]);
|
|
20666
20758
|
|
|
20667
20759
|
// Get resize context for sidebar state changes
|
|
20668
20760
|
const {
|
|
@@ -20846,6 +20938,285 @@ Globe.propTypes = {
|
|
|
20846
20938
|
nameAsSiderTitle: PropTypes__default["default"].bool
|
|
20847
20939
|
};
|
|
20848
20940
|
|
|
20941
|
+
const SimpleGlobe = _ref => {
|
|
20942
|
+
let {
|
|
20943
|
+
projects = [],
|
|
20944
|
+
mapConfig = {},
|
|
20945
|
+
showSider = false,
|
|
20946
|
+
onProjectClick = () => {},
|
|
20947
|
+
type = "default",
|
|
20948
|
+
color = "var(--color-primary-60)",
|
|
20949
|
+
renderTooltip: renderTooltip$1 = null
|
|
20950
|
+
} = _ref;
|
|
20951
|
+
const mapContainer = React.useRef(null);
|
|
20952
|
+
const map = React.useRef(null);
|
|
20953
|
+
const boundsRef = React.useRef(null);
|
|
20954
|
+
React.useEffect(() => {
|
|
20955
|
+
if (map.current) return; // Initialize map only once
|
|
20956
|
+
|
|
20957
|
+
console.log('πΊοΈ [SIMPLE GLOBE] Creating map...');
|
|
20958
|
+
|
|
20959
|
+
// Set Mapbox access token
|
|
20960
|
+
mapboxgl.accessToken = 'pk.eyJ1IjoicmVkaXM5OTkiLCJhIjoiY2x4YWV5MzA5MmtuZzJpcXM5Y201Z2E2YiJ9.m5bwPg-Tj4Akesl1yQUa3w';
|
|
20961
|
+
|
|
20962
|
+
// Create map with custom Straatos style
|
|
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
|
+
|
|
20849
21220
|
function WidgetPlaceholder(_ref) {
|
|
20850
21221
|
let {
|
|
20851
21222
|
icon = "",
|
|
@@ -61668,6 +62039,7 @@ exports.SelectFiltersTimeFrame = Timeframe;
|
|
|
61668
62039
|
exports.SettingsPopover = SettingsPopover;
|
|
61669
62040
|
exports.Sidenav = Sidenav;
|
|
61670
62041
|
exports.SidenavMenu = SidenavMenu;
|
|
62042
|
+
exports.SimpleGlobe = SimpleGlobe;
|
|
61671
62043
|
exports.StackChart = StackChart;
|
|
61672
62044
|
exports.StakeholderMappings = index$1;
|
|
61673
62045
|
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
|
+
|