datastake-daf 0.6.262 β 0.6.264
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 +78 -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/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/.env +0 -8
- package/.vscode/settings.json +0 -13
package/dist/components/index.js
CHANGED
|
@@ -19919,14 +19919,26 @@ const useGlobe = ({
|
|
|
19919
19919
|
const addedSources = React.useRef(new Set());
|
|
19920
19920
|
const isMounted = React.useRef(true);
|
|
19921
19921
|
const addAllDataToMap = React.useCallback(() => {
|
|
19922
|
-
|
|
19922
|
+
console.log('π [GLOBE HOOK] addAllDataToMap called');
|
|
19923
|
+
console.log('π [GLOBE HOOK] data:', data);
|
|
19924
|
+
console.log('π [GLOBE HOOK] mapRef exists:', !!mapRef);
|
|
19925
|
+
console.log('π [GLOBE HOOK] style loaded:', mapRef?.isStyleLoaded());
|
|
19926
|
+
if (!data || !mapRef) {
|
|
19927
|
+
console.log('β [GLOBE HOOK] addAllDataToMap early return - missing data or mapRef');
|
|
19928
|
+
return;
|
|
19929
|
+
}
|
|
19930
|
+
if (!mapRef.isStyleLoaded()) {
|
|
19931
|
+
console.log('β³ [GLOBE HOOK] Style not loaded yet, retrying in 100ms...');
|
|
19932
|
+
setTimeout(() => {
|
|
19933
|
+
addAllDataToMap();
|
|
19934
|
+
}, 100);
|
|
19923
19935
|
return;
|
|
19924
19936
|
}
|
|
19925
|
-
|
|
19926
|
-
// Prevent multiple calls with empty data
|
|
19927
19937
|
if (data.length === 0) {
|
|
19938
|
+
console.log('β [GLOBE HOOK] addAllDataToMap early return - no data');
|
|
19928
19939
|
return;
|
|
19929
19940
|
}
|
|
19941
|
+
console.log('β
[GLOBE HOOK] Starting to add markers to map...');
|
|
19930
19942
|
|
|
19931
19943
|
// Clear existing markers using functional update to avoid dependency issues
|
|
19932
19944
|
setMapMarkers(currentMarkers => {
|
|
@@ -19978,8 +19990,13 @@ const useGlobe = ({
|
|
|
19978
19990
|
if (data && mapRef) {
|
|
19979
19991
|
const newMarkers = [];
|
|
19980
19992
|
const maxTotal = Math.max(...(data || []).map(d => d.total || 0));
|
|
19993
|
+
console.log('π― [GLOBE HOOK] Processing data items:', data.length);
|
|
19981
19994
|
data.forEach((d, i) => {
|
|
19995
|
+
console.log(`π― [GLOBE HOOK] Processing item ${i}:`, d);
|
|
19996
|
+
console.log(`π― [GLOBE HOOK] Item ${i} marker:`, d?.marker);
|
|
19997
|
+
console.log(`π― [GLOBE HOOK] Item ${i} lat/lng:`, d?.marker?.lat, d?.marker?.lng);
|
|
19982
19998
|
if (d?.marker?.lat && d?.marker?.lng) {
|
|
19999
|
+
console.log(`β
[GLOBE HOOK] Item ${i} has valid coordinates, creating marker...`);
|
|
19983
20000
|
let marker;
|
|
19984
20001
|
let iconClassName = "";
|
|
19985
20002
|
let iconSize = [25, 25];
|
|
@@ -20059,6 +20076,7 @@ const useGlobe = ({
|
|
|
20059
20076
|
el.style.fontWeight = 'bold';
|
|
20060
20077
|
el.innerHTML = `<span>${d.total || 0}</span>`;
|
|
20061
20078
|
marker = new mapboxgl.Marker(el).setLngLat([d.marker.lng, d.marker.lat]).setPopup(new mapboxgl.Popup().setDOMContent(div)).addTo(mapRef);
|
|
20079
|
+
console.log(`π [GLOBE HOOK] Marker ${i} added to map at:`, [d.marker.lng, d.marker.lat]);
|
|
20062
20080
|
} else if (type === "territory") {
|
|
20063
20081
|
// Handle territory polygons
|
|
20064
20082
|
if (d.area && Array.isArray(d.area)) {
|
|
@@ -20128,6 +20146,7 @@ const useGlobe = ({
|
|
|
20128
20146
|
}));
|
|
20129
20147
|
roots.current.push(root);
|
|
20130
20148
|
marker = new mapboxgl.Marker(el).setLngLat([d.marker.lng, d.marker.lat]).setPopup(new mapboxgl.Popup().setDOMContent(div)).addTo(mapRef);
|
|
20149
|
+
console.log(`π [GLOBE HOOK] Default marker ${i} added to map at:`, [d.marker.lng, d.marker.lat]);
|
|
20131
20150
|
}
|
|
20132
20151
|
|
|
20133
20152
|
// Add click handler
|
|
@@ -20161,6 +20180,7 @@ const useGlobe = ({
|
|
|
20161
20180
|
mapboxgl.accessToken = MAP_TOKEN;
|
|
20162
20181
|
|
|
20163
20182
|
// Create the map with Mapbox GL JS - 3D globe
|
|
20183
|
+
console.log('πΊοΈ [GLOBE HOOK] Creating map with style:', STYLE_URL);
|
|
20164
20184
|
const map = new mapboxgl.Map({
|
|
20165
20185
|
container: container.current,
|
|
20166
20186
|
style: STYLE_URL,
|
|
@@ -20179,8 +20199,13 @@ const useGlobe = ({
|
|
|
20179
20199
|
|
|
20180
20200
|
// Configure the map when style loads
|
|
20181
20201
|
map.on('style.load', () => {
|
|
20202
|
+
console.log('π¨ [GLOBE HOOK] Style loaded event triggered');
|
|
20203
|
+
console.log('π¨ [GLOBE HOOK] Map style loaded:', map.isStyleLoaded());
|
|
20204
|
+
|
|
20182
20205
|
// Wait a bit for the style to fully load
|
|
20183
20206
|
setTimeout(() => {
|
|
20207
|
+
console.log('π¨ [GLOBE HOOK] After timeout - Map style loaded:', map.isStyleLoaded());
|
|
20208
|
+
|
|
20184
20209
|
// Set fog for the space background effect with stars - simplified to avoid errors
|
|
20185
20210
|
try {
|
|
20186
20211
|
map.setFog({
|
|
@@ -20276,9 +20301,10 @@ const useGlobe = ({
|
|
|
20276
20301
|
|
|
20277
20302
|
// Add navigation controls
|
|
20278
20303
|
map.addControl(new mapboxgl.NavigationControl(), 'top-right');
|
|
20304
|
+
console.log('πΊοΈ [GLOBE HOOK] Map created successfully');
|
|
20279
20305
|
return map;
|
|
20280
20306
|
} catch (error) {
|
|
20281
|
-
console.error('Error creating Mapbox GL JS globe:', error);
|
|
20307
|
+
console.error('β [GLOBE HOOK] Error creating Mapbox GL JS globe:', error);
|
|
20282
20308
|
return null;
|
|
20283
20309
|
}
|
|
20284
20310
|
}, []);
|
|
@@ -20291,9 +20317,12 @@ const useGlobe = ({
|
|
|
20291
20317
|
// }, [initialMarkerSetIsDone]);
|
|
20292
20318
|
|
|
20293
20319
|
React.useEffect(() => {
|
|
20320
|
+
console.log('π [GLOBE HOOK] useEffect for map creation - mapRef:', !!mapRef);
|
|
20294
20321
|
if (!mapRef) {
|
|
20322
|
+
console.log('π [GLOBE HOOK] Creating map instance...');
|
|
20295
20323
|
const instance = createInstance();
|
|
20296
20324
|
if (instance) {
|
|
20325
|
+
console.log('π [GLOBE HOOK] Map instance created, setting mapRef');
|
|
20297
20326
|
setMapRef(instance);
|
|
20298
20327
|
|
|
20299
20328
|
// Add comprehensive resize detection for Mapbox GL JS responsiveness
|
|
@@ -20374,14 +20403,22 @@ const useGlobe = ({
|
|
|
20374
20403
|
}
|
|
20375
20404
|
}, [polygon, mapRef]);
|
|
20376
20405
|
React.useEffect(() => {
|
|
20406
|
+
console.log('π₯ [GLOBE HOOK] allData received:', allData);
|
|
20407
|
+
console.log('π₯ [GLOBE HOOK] allData length:', allData?.length);
|
|
20377
20408
|
if (allData) {
|
|
20378
20409
|
if (allData.length === 0) {
|
|
20410
|
+
console.log('β οΈ [GLOBE HOOK] Empty data array');
|
|
20379
20411
|
setEmptyStateIsVisible(true);
|
|
20380
20412
|
} else if (emptyStateIsVisible) {
|
|
20381
20413
|
setEmptyStateIsVisible(false);
|
|
20382
20414
|
}
|
|
20383
|
-
|
|
20415
|
+
console.log('π [GLOBE HOOK] Filtering data with filterValidGPS...');
|
|
20416
|
+
const filteredData = filterValidGPS(allData);
|
|
20417
|
+
console.log('π [GLOBE HOOK] filtered data result:', filteredData);
|
|
20418
|
+
console.log('π [GLOBE HOOK] filtered data length:', filteredData.length);
|
|
20419
|
+
setData(filteredData);
|
|
20384
20420
|
} else {
|
|
20421
|
+
console.log('β [GLOBE HOOK] No allData provided');
|
|
20385
20422
|
setData(null);
|
|
20386
20423
|
}
|
|
20387
20424
|
}, [allData, emptyStateIsVisible]);
|
|
@@ -20411,7 +20448,19 @@ const useGlobe = ({
|
|
|
20411
20448
|
}
|
|
20412
20449
|
}, [user, mapRef, allData]);
|
|
20413
20450
|
React.useEffect(() => {
|
|
20414
|
-
|
|
20451
|
+
console.log('π [GLOBE HOOK] useEffect triggered:', {
|
|
20452
|
+
mapRef: !!mapRef,
|
|
20453
|
+
data: !!data,
|
|
20454
|
+
dataLength: data?.length,
|
|
20455
|
+
initialMarkerSetIsDone,
|
|
20456
|
+
styleLoaded: mapRef?.isStyleLoaded()
|
|
20457
|
+
});
|
|
20458
|
+
if (mapRef && data && !initialMarkerSetIsDone) {
|
|
20459
|
+
console.log('π [GLOBE HOOK] Attempting to add markers...');
|
|
20460
|
+
console.log('π [GLOBE HOOK] Style loaded check:', mapRef.isStyleLoaded());
|
|
20461
|
+
|
|
20462
|
+
// Try to add markers immediately, and if style isn't loaded,
|
|
20463
|
+
// the addAllDataToMap function will handle it
|
|
20415
20464
|
setInitialMarkerSetIsDone(true);
|
|
20416
20465
|
addAllDataToMap();
|
|
20417
20466
|
}
|
|
@@ -20624,7 +20673,7 @@ function Globe(_ref) {
|
|
|
20624
20673
|
renderSider = null,
|
|
20625
20674
|
renderMarker = null,
|
|
20626
20675
|
type = "default",
|
|
20627
|
-
showSider =
|
|
20676
|
+
showSider = false,
|
|
20628
20677
|
filtersConfig,
|
|
20629
20678
|
onFilterChange = () => {},
|
|
20630
20679
|
isSatellite = false,
|
|
@@ -20634,15 +20683,29 @@ function Globe(_ref) {
|
|
|
20634
20683
|
onUnmount
|
|
20635
20684
|
} = _ref;
|
|
20636
20685
|
// Map data to include marker coordinates
|
|
20637
|
-
const mappedData = React.useMemo(() =>
|
|
20638
|
-
|
|
20639
|
-
|
|
20640
|
-
|
|
20641
|
-
|
|
20642
|
-
|
|
20643
|
-
|
|
20686
|
+
const mappedData = React.useMemo(() => {
|
|
20687
|
+
console.log('π [GLOBE COMPONENT] Original data received:', data);
|
|
20688
|
+
console.log('π [GLOBE COMPONENT] Data length:', data === null || data === void 0 ? void 0 : data.length);
|
|
20689
|
+
if (!data || data.length === 0) {
|
|
20690
|
+
console.log('β [GLOBE COMPONENT] No data to map');
|
|
20691
|
+
return [];
|
|
20692
|
+
}
|
|
20693
|
+
const mapped = data.map((d, i) => {
|
|
20694
|
+
var _d$gps, _d$gps2;
|
|
20695
|
+
console.log("\uD83D\uDCCA [GLOBE COMPONENT] Mapping item ".concat(i, ":"), d);
|
|
20696
|
+
console.log("\uD83D\uDCCA [GLOBE COMPONENT] Item ".concat(i, " GPS:"), d === null || d === void 0 ? void 0 : d.gps);
|
|
20697
|
+
const result = _objectSpread2(_objectSpread2({}, d), {}, {
|
|
20698
|
+
marker: {
|
|
20699
|
+
lat: d === null || d === void 0 || (_d$gps = d.gps) === null || _d$gps === void 0 ? void 0 : _d$gps.latitude,
|
|
20700
|
+
lng: d === null || d === void 0 || (_d$gps2 = d.gps) === null || _d$gps2 === void 0 ? void 0 : _d$gps2.longitude
|
|
20701
|
+
}
|
|
20702
|
+
});
|
|
20703
|
+
console.log("\uD83D\uDCCA [GLOBE COMPONENT] Item ".concat(i, " mapped result:"), result);
|
|
20704
|
+
return result;
|
|
20644
20705
|
});
|
|
20645
|
-
|
|
20706
|
+
console.log('π [GLOBE COMPONENT] Final mapped data:', mapped);
|
|
20707
|
+
return mapped;
|
|
20708
|
+
}, [data]);
|
|
20646
20709
|
|
|
20647
20710
|
// Get resize context for sidebar state changes
|
|
20648
20711
|
const {
|
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
|
+
|
|
@@ -48,15 +48,30 @@ export const useGlobe = ({
|
|
|
48
48
|
const isMounted = useRef(true);
|
|
49
49
|
|
|
50
50
|
const addAllDataToMap = useCallback(() => {
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
console.log('π [GLOBE HOOK] addAllDataToMap called');
|
|
52
|
+
console.log('π [GLOBE HOOK] data:', data);
|
|
53
|
+
console.log('π [GLOBE HOOK] mapRef exists:', !!mapRef);
|
|
54
|
+
console.log('π [GLOBE HOOK] style loaded:', mapRef?.isStyleLoaded());
|
|
55
|
+
|
|
56
|
+
if (!data || !mapRef) {
|
|
57
|
+
console.log('β [GLOBE HOOK] addAllDataToMap early return - missing data or mapRef');
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (!mapRef.isStyleLoaded()) {
|
|
62
|
+
console.log('β³ [GLOBE HOOK] Style not loaded yet, retrying in 100ms...');
|
|
63
|
+
setTimeout(() => {
|
|
64
|
+
addAllDataToMap();
|
|
65
|
+
}, 100);
|
|
53
66
|
return;
|
|
54
67
|
}
|
|
55
68
|
|
|
56
|
-
// Prevent multiple calls with empty data
|
|
57
69
|
if (data.length === 0) {
|
|
70
|
+
console.log('β [GLOBE HOOK] addAllDataToMap early return - no data');
|
|
58
71
|
return;
|
|
59
72
|
}
|
|
73
|
+
|
|
74
|
+
console.log('β
[GLOBE HOOK] Starting to add markers to map...');
|
|
60
75
|
|
|
61
76
|
// Clear existing markers using functional update to avoid dependency issues
|
|
62
77
|
setMapMarkers(currentMarkers => {
|
|
@@ -108,8 +123,14 @@ export const useGlobe = ({
|
|
|
108
123
|
const newMarkers = [];
|
|
109
124
|
const maxTotal = Math.max(...(data || []).map((d) => d.total || 0));
|
|
110
125
|
|
|
126
|
+
console.log('π― [GLOBE HOOK] Processing data items:', data.length);
|
|
111
127
|
data.forEach((d, i) => {
|
|
128
|
+
console.log(`π― [GLOBE HOOK] Processing item ${i}:`, d);
|
|
129
|
+
console.log(`π― [GLOBE HOOK] Item ${i} marker:`, d?.marker);
|
|
130
|
+
console.log(`π― [GLOBE HOOK] Item ${i} lat/lng:`, d?.marker?.lat, d?.marker?.lng);
|
|
131
|
+
|
|
112
132
|
if (d?.marker?.lat && d?.marker?.lng) {
|
|
133
|
+
console.log(`β
[GLOBE HOOK] Item ${i} has valid coordinates, creating marker...`);
|
|
113
134
|
let marker;
|
|
114
135
|
let iconClassName = "";
|
|
115
136
|
let innerHtml = "";
|
|
@@ -212,6 +233,8 @@ export const useGlobe = ({
|
|
|
212
233
|
.setLngLat([d.marker.lng, d.marker.lat])
|
|
213
234
|
.setPopup(new mapboxgl.Popup().setDOMContent(div))
|
|
214
235
|
.addTo(mapRef);
|
|
236
|
+
|
|
237
|
+
console.log(`π [GLOBE HOOK] Marker ${i} added to map at:`, [d.marker.lng, d.marker.lat]);
|
|
215
238
|
|
|
216
239
|
} else if (type === "territory") {
|
|
217
240
|
// Handle territory polygons
|
|
@@ -297,6 +320,8 @@ export const useGlobe = ({
|
|
|
297
320
|
.setLngLat([d.marker.lng, d.marker.lat])
|
|
298
321
|
.setPopup(new mapboxgl.Popup().setDOMContent(div))
|
|
299
322
|
.addTo(mapRef);
|
|
323
|
+
|
|
324
|
+
console.log(`π [GLOBE HOOK] Default marker ${i} added to map at:`, [d.marker.lng, d.marker.lat]);
|
|
300
325
|
}
|
|
301
326
|
|
|
302
327
|
// Add click handler
|
|
@@ -330,6 +355,7 @@ export const useGlobe = ({
|
|
|
330
355
|
mapboxgl.accessToken = MAP_TOKEN;
|
|
331
356
|
|
|
332
357
|
// Create the map with Mapbox GL JS - 3D globe
|
|
358
|
+
console.log('πΊοΈ [GLOBE HOOK] Creating map with style:', STYLE_URL);
|
|
333
359
|
const map = new mapboxgl.Map({
|
|
334
360
|
container: container.current,
|
|
335
361
|
style: STYLE_URL,
|
|
@@ -348,9 +374,13 @@ export const useGlobe = ({
|
|
|
348
374
|
|
|
349
375
|
// Configure the map when style loads
|
|
350
376
|
map.on('style.load', () => {
|
|
377
|
+
console.log('π¨ [GLOBE HOOK] Style loaded event triggered');
|
|
378
|
+
console.log('π¨ [GLOBE HOOK] Map style loaded:', map.isStyleLoaded());
|
|
351
379
|
|
|
352
380
|
// Wait a bit for the style to fully load
|
|
353
381
|
setTimeout(() => {
|
|
382
|
+
console.log('π¨ [GLOBE HOOK] After timeout - Map style loaded:', map.isStyleLoaded());
|
|
383
|
+
|
|
354
384
|
// Set fog for the space background effect with stars - simplified to avoid errors
|
|
355
385
|
try {
|
|
356
386
|
map.setFog({
|
|
@@ -445,9 +475,10 @@ export const useGlobe = ({
|
|
|
445
475
|
// Add navigation controls
|
|
446
476
|
map.addControl(new mapboxgl.NavigationControl(), 'top-right');
|
|
447
477
|
|
|
478
|
+
console.log('πΊοΈ [GLOBE HOOK] Map created successfully');
|
|
448
479
|
return map;
|
|
449
480
|
} catch (error) {
|
|
450
|
-
console.error('Error creating Mapbox GL JS globe:', error);
|
|
481
|
+
console.error('β [GLOBE HOOK] Error creating Mapbox GL JS globe:', error);
|
|
451
482
|
return null;
|
|
452
483
|
}
|
|
453
484
|
}, []);
|
|
@@ -460,10 +491,13 @@ export const useGlobe = ({
|
|
|
460
491
|
// }, [initialMarkerSetIsDone]);
|
|
461
492
|
|
|
462
493
|
useEffect(() => {
|
|
494
|
+
console.log('π [GLOBE HOOK] useEffect for map creation - mapRef:', !!mapRef);
|
|
463
495
|
|
|
464
496
|
if (!mapRef) {
|
|
497
|
+
console.log('π [GLOBE HOOK] Creating map instance...');
|
|
465
498
|
const instance = createInstance();
|
|
466
499
|
if (instance) {
|
|
500
|
+
console.log('π [GLOBE HOOK] Map instance created, setting mapRef');
|
|
467
501
|
setMapRef(instance);
|
|
468
502
|
|
|
469
503
|
// Add comprehensive resize detection for Mapbox GL JS responsiveness
|
|
@@ -552,15 +586,24 @@ export const useGlobe = ({
|
|
|
552
586
|
}, [polygon, mapRef]);
|
|
553
587
|
|
|
554
588
|
useEffect(() => {
|
|
555
|
-
|
|
589
|
+
console.log('π₯ [GLOBE HOOK] allData received:', allData);
|
|
590
|
+
console.log('π₯ [GLOBE HOOK] allData length:', allData?.length);
|
|
591
|
+
|
|
556
592
|
if (allData) {
|
|
557
593
|
if (allData.length === 0) {
|
|
594
|
+
console.log('β οΈ [GLOBE HOOK] Empty data array');
|
|
558
595
|
setEmptyStateIsVisible(true);
|
|
559
596
|
} else if (emptyStateIsVisible) {
|
|
560
597
|
setEmptyStateIsVisible(false);
|
|
561
598
|
}
|
|
562
|
-
|
|
599
|
+
|
|
600
|
+
console.log('π [GLOBE HOOK] Filtering data with filterValidGPS...');
|
|
601
|
+
const filteredData = filterValidGPS(allData);
|
|
602
|
+
console.log('π [GLOBE HOOK] filtered data result:', filteredData);
|
|
603
|
+
console.log('π [GLOBE HOOK] filtered data length:', filteredData.length);
|
|
604
|
+
setData(filteredData);
|
|
563
605
|
} else {
|
|
606
|
+
console.log('β [GLOBE HOOK] No allData provided');
|
|
564
607
|
setData(null);
|
|
565
608
|
}
|
|
566
609
|
}, [allData, emptyStateIsVisible]);
|
|
@@ -591,7 +634,20 @@ export const useGlobe = ({
|
|
|
591
634
|
}, [user, mapRef, allData]);
|
|
592
635
|
|
|
593
636
|
useEffect(() => {
|
|
594
|
-
|
|
637
|
+
console.log('π [GLOBE HOOK] useEffect triggered:', {
|
|
638
|
+
mapRef: !!mapRef,
|
|
639
|
+
data: !!data,
|
|
640
|
+
dataLength: data?.length,
|
|
641
|
+
initialMarkerSetIsDone,
|
|
642
|
+
styleLoaded: mapRef?.isStyleLoaded()
|
|
643
|
+
});
|
|
644
|
+
|
|
645
|
+
if (mapRef && data && !initialMarkerSetIsDone) {
|
|
646
|
+
console.log('π [GLOBE HOOK] Attempting to add markers...');
|
|
647
|
+
console.log('π [GLOBE HOOK] Style loaded check:', mapRef.isStyleLoaded());
|
|
648
|
+
|
|
649
|
+
// Try to add markers immediately, and if style isn't loaded,
|
|
650
|
+
// the addAllDataToMap function will handle it
|
|
595
651
|
setInitialMarkerSetIsDone(true);
|
|
596
652
|
addAllDataToMap();
|
|
597
653
|
}
|
|
@@ -111,7 +111,7 @@ function Globe({
|
|
|
111
111
|
renderSider = null,
|
|
112
112
|
renderMarker = null,
|
|
113
113
|
type = "default",
|
|
114
|
-
showSider =
|
|
114
|
+
showSider = false,
|
|
115
115
|
filtersConfig,
|
|
116
116
|
onFilterChange = () => { },
|
|
117
117
|
isSatellite = false,
|
|
@@ -122,11 +122,29 @@ function Globe({
|
|
|
122
122
|
}) {
|
|
123
123
|
// Map data to include marker coordinates
|
|
124
124
|
const mappedData = useMemo(
|
|
125
|
-
() =>
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
125
|
+
() => {
|
|
126
|
+
console.log('π [GLOBE COMPONENT] Original data received:', data);
|
|
127
|
+
console.log('π [GLOBE COMPONENT] Data length:', data?.length);
|
|
128
|
+
|
|
129
|
+
if (!data || data.length === 0) {
|
|
130
|
+
console.log('β [GLOBE COMPONENT] No data to map');
|
|
131
|
+
return [];
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const mapped = data.map((d, i) => {
|
|
135
|
+
console.log(`π [GLOBE COMPONENT] Mapping item ${i}:`, d);
|
|
136
|
+
console.log(`π [GLOBE COMPONENT] Item ${i} GPS:`, d?.gps);
|
|
137
|
+
const result = {
|
|
138
|
+
...d,
|
|
139
|
+
marker: { lat: d?.gps?.latitude, lng: d?.gps?.longitude },
|
|
140
|
+
};
|
|
141
|
+
console.log(`π [GLOBE COMPONENT] Item ${i} mapped result:`, result);
|
|
142
|
+
return result;
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
console.log('π [GLOBE COMPONENT] Final mapped data:', mapped);
|
|
146
|
+
return mapped;
|
|
147
|
+
},
|
|
130
148
|
[data],
|
|
131
149
|
);
|
|
132
150
|
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { storyConfig as EventConfig } from "./storyConfig1.js";
|
|
2
|
+
// Create default configs since the other files were deleted
|
|
3
|
+
const DefaultGlobeConfig = {
|
|
4
|
+
data: [
|
|
5
|
+
{
|
|
6
|
+
gps: { latitude: 40.7128, longitude: -74.0060 },
|
|
7
|
+
name: "New York City",
|
|
8
|
+
description: "Major metropolitan area in the United States",
|
|
9
|
+
total: 15,
|
|
10
|
+
sources: 3,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
gps: { latitude: 51.5074, longitude: -0.1278 },
|
|
14
|
+
name: "London",
|
|
15
|
+
description: "Capital of the United Kingdom",
|
|
16
|
+
total: 12,
|
|
17
|
+
sources: 2,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
gps: { latitude: 35.6762, longitude: 139.6503 },
|
|
21
|
+
name: "Tokyo",
|
|
22
|
+
description: "Capital of Japan",
|
|
23
|
+
total: 8,
|
|
24
|
+
sources: 1,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
gps: { latitude: -33.8688, longitude: 151.2093 },
|
|
28
|
+
name: "Sydney",
|
|
29
|
+
description: "Major city in Australia",
|
|
30
|
+
total: 6,
|
|
31
|
+
sources: 2,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
gps: { latitude: -22.9068, longitude: -43.1729 },
|
|
35
|
+
name: "Rio de Janeiro",
|
|
36
|
+
description: "Major city in Brazil",
|
|
37
|
+
total: 10,
|
|
38
|
+
sources: 1,
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
renderTooltip: (data) => [
|
|
42
|
+
{ label: "City", value: data.name || "-" },
|
|
43
|
+
{ label: "Total Events", value: data.total || 0 },
|
|
44
|
+
{ label: "Sources", value: data.sources || 0 },
|
|
45
|
+
{ label: "Description", value: data.description || "-" },
|
|
46
|
+
],
|
|
47
|
+
primaryLink: true,
|
|
48
|
+
showSider: false,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const TerritoryGlobeConfig = {
|
|
52
|
+
data: [
|
|
53
|
+
{
|
|
54
|
+
gps: { latitude: 39.9042, longitude: 116.4074 },
|
|
55
|
+
name: "Beijing Territory",
|
|
56
|
+
description: "Administrative region in China",
|
|
57
|
+
total: 25,
|
|
58
|
+
sources: 4,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
gps: { latitude: 55.7558, longitude: 37.6176 },
|
|
62
|
+
name: "Moscow Region",
|
|
63
|
+
description: "Federal subject of Russia",
|
|
64
|
+
total: 18,
|
|
65
|
+
sources: 3,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
gps: { latitude: -26.2041, longitude: 28.0473 },
|
|
69
|
+
name: "Gauteng Province",
|
|
70
|
+
description: "Province in South Africa",
|
|
71
|
+
total: 14,
|
|
72
|
+
sources: 2,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
gps: { latitude: 19.4326, longitude: -99.1332 },
|
|
76
|
+
name: "Mexico City Territory",
|
|
77
|
+
description: "Federal district in Mexico",
|
|
78
|
+
total: 20,
|
|
79
|
+
sources: 3,
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
renderTooltip: (data) => [
|
|
83
|
+
{ label: "Territory", value: data.name || "-" },
|
|
84
|
+
{ label: "Total Events", value: data.total || 0 },
|
|
85
|
+
{ label: "Sources", value: data.sources || 0 },
|
|
86
|
+
{ label: "Description", value: data.description || "-" },
|
|
87
|
+
],
|
|
88
|
+
primaryLink: true,
|
|
89
|
+
showSider: false,
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const StakeholderGlobeConfig = {
|
|
93
|
+
data: [
|
|
94
|
+
{
|
|
95
|
+
gps: { latitude: 48.8566, longitude: 2.3522 },
|
|
96
|
+
name: "Paris NGO",
|
|
97
|
+
description: "Environmental NGO in France",
|
|
98
|
+
total: 12,
|
|
99
|
+
sources: 2,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
gps: { latitude: 37.7749, longitude: -122.4194 },
|
|
103
|
+
name: "San Francisco Tech",
|
|
104
|
+
description: "Technology company in California",
|
|
105
|
+
total: 8,
|
|
106
|
+
sources: 1,
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
gps: { latitude: 1.3521, longitude: 103.8198 },
|
|
110
|
+
name: "Singapore Corp",
|
|
111
|
+
description: "Multinational corporation",
|
|
112
|
+
total: 15,
|
|
113
|
+
sources: 3,
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
gps: { latitude: 52.5200, longitude: 13.4050 },
|
|
117
|
+
name: "Berlin Institute",
|
|
118
|
+
description: "Research institute in Germany",
|
|
119
|
+
total: 9,
|
|
120
|
+
sources: 2,
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
gps: { latitude: -34.6037, longitude: -58.3816 },
|
|
124
|
+
name: "Buenos Aires Union",
|
|
125
|
+
description: "Labor union in Argentina",
|
|
126
|
+
total: 11,
|
|
127
|
+
sources: 1,
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
renderTooltip: (data) => [
|
|
131
|
+
{ label: "Stakeholder", value: data.name || "-" },
|
|
132
|
+
{ label: "Total Events", value: data.total || 0 },
|
|
133
|
+
{ label: "Sources", value: data.sources || 0 },
|
|
134
|
+
{ label: "Description", value: data.description || "-" },
|
|
135
|
+
],
|
|
136
|
+
primaryLink: true,
|
|
137
|
+
showSider: false,
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const ChainGlobeConfig = {
|
|
141
|
+
data: [
|
|
142
|
+
{
|
|
143
|
+
gps: { latitude: 23.1291, longitude: 113.2644 },
|
|
144
|
+
name: "Guangzhou Manufacturing",
|
|
145
|
+
description: "Electronics manufacturing hub in China",
|
|
146
|
+
total: 22,
|
|
147
|
+
sources: 4,
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
gps: { latitude: 12.9716, longitude: 77.5946 },
|
|
151
|
+
name: "Bangalore Tech Hub",
|
|
152
|
+
description: "Software development center in India",
|
|
153
|
+
total: 18,
|
|
154
|
+
sources: 3,
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
gps: { latitude: 41.8781, longitude: -87.6298 },
|
|
158
|
+
name: "Chicago Logistics",
|
|
159
|
+
description: "Transportation and logistics hub in USA",
|
|
160
|
+
total: 16,
|
|
161
|
+
sources: 2,
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
gps: { latitude: 25.2048, longitude: 55.2708 },
|
|
165
|
+
name: "Dubai Trade Center",
|
|
166
|
+
description: "International trade and commerce hub",
|
|
167
|
+
total: 14,
|
|
168
|
+
sources: 3,
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
gps: { latitude: -23.5505, longitude: -46.6333 },
|
|
172
|
+
name: "SΓ£o Paulo Distribution",
|
|
173
|
+
description: "Distribution center in Brazil",
|
|
174
|
+
total: 12,
|
|
175
|
+
sources: 2,
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
renderTooltip: (data) => [
|
|
179
|
+
{ label: "Supply Chain Node", value: data.name || "-" },
|
|
180
|
+
{ label: "Total Events", value: data.total || 0 },
|
|
181
|
+
{ label: "Sources", value: data.sources || 0 },
|
|
182
|
+
{ label: "Description", value: data.description || "-" },
|
|
183
|
+
],
|
|
184
|
+
primaryLink: true,
|
|
185
|
+
showSider: false,
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
const ProjectGlobeConfig = {
|
|
189
|
+
data: [
|
|
190
|
+
{
|
|
191
|
+
gps: { latitude: 6.5244, longitude: 3.3792 },
|
|
192
|
+
name: "Lagos Solar Project",
|
|
193
|
+
description: "Renewable energy project in Nigeria",
|
|
194
|
+
total: 8,
|
|
195
|
+
sources: 2,
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
gps: { latitude: -1.2921, longitude: 36.8219 },
|
|
199
|
+
name: "Nairobi Water Initiative",
|
|
200
|
+
description: "Water management project in Kenya",
|
|
201
|
+
total: 12,
|
|
202
|
+
sources: 3,
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
gps: { latitude: 13.7563, longitude: 100.5018 },
|
|
206
|
+
name: "Bangkok Green City",
|
|
207
|
+
description: "Urban sustainability project in Thailand",
|
|
208
|
+
total: 15,
|
|
209
|
+
sources: 4,
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
gps: { latitude: -12.0464, longitude: -77.0428 },
|
|
213
|
+
name: "Lima Education Hub",
|
|
214
|
+
description: "Educational development project in Peru",
|
|
215
|
+
total: 10,
|
|
216
|
+
sources: 2,
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
gps: { latitude: 30.0444, longitude: 31.2357 },
|
|
220
|
+
name: "Cairo Infrastructure",
|
|
221
|
+
description: "Infrastructure development project in Egypt",
|
|
222
|
+
total: 14,
|
|
223
|
+
sources: 3,
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
gps: { latitude: 55.7558, longitude: 37.6176 },
|
|
227
|
+
name: "Moscow Innovation Center",
|
|
228
|
+
description: "Technology innovation project in Russia",
|
|
229
|
+
total: 9,
|
|
230
|
+
sources: 2,
|
|
231
|
+
},
|
|
232
|
+
],
|
|
233
|
+
renderTooltip: (data) => [
|
|
234
|
+
{ label: "Project Name", value: data.name || "-" },
|
|
235
|
+
{ label: "Total Events", value: data.total || 0 },
|
|
236
|
+
{ label: "Sources", value: data.sources || 0 },
|
|
237
|
+
{ label: "Description", value: data.description || "-" },
|
|
238
|
+
],
|
|
239
|
+
primaryLink: true,
|
|
240
|
+
showSider: false,
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
export { DefaultGlobeConfig, TerritoryGlobeConfig, StakeholderGlobeConfig, EventConfig, ChainGlobeConfig, ProjectGlobeConfig };
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import CustomIcon from "../../Icon/CustomIcon";
|
|
2
|
+
import DAFTable from "../../Table";
|
|
3
|
+
import MoreTags from "../../Table/MoreTags";
|
|
4
|
+
|
|
5
|
+
const isMineSite = true;
|
|
6
|
+
|
|
7
|
+
export const storyConfig = {
|
|
8
|
+
data: [
|
|
9
|
+
{
|
|
10
|
+
gps: {
|
|
11
|
+
latitude: -1.5457261,
|
|
12
|
+
longitude: 28.8756306,
|
|
13
|
+
},
|
|
14
|
+
name: "Rubaya Mining Site",
|
|
15
|
+
datastakeId: "LOC-00000000241",
|
|
16
|
+
description: "A major mining site with multiple operational areas and significant mineral extraction activities. This location has experienced various incidents and events over time.",
|
|
17
|
+
data: [
|
|
18
|
+
{
|
|
19
|
+
_id: "68af116e2cb57a4e3dd2e056",
|
|
20
|
+
createdBy: "4274fdb4-2798-46ea-a0a6-b4af5d92566e",
|
|
21
|
+
form: "event",
|
|
22
|
+
id: "91c3176a-d312-4259-9ddf-9d286ff6df87",
|
|
23
|
+
datastakeId: "EV-000000000150",
|
|
24
|
+
name: "Mining Collapse Incident",
|
|
25
|
+
authorId: "7e17f076-09e7-4668-927c-11c12ccd1346",
|
|
26
|
+
collectId: "d78271301d04f76dfe0f70ce3c9e114ffe4dc4e0",
|
|
27
|
+
country: "CD",
|
|
28
|
+
date: "2025-08-25",
|
|
29
|
+
typeOfEvent: "incident",
|
|
30
|
+
implementers: [],
|
|
31
|
+
associatedSubjects: [],
|
|
32
|
+
testimonialsSource: [],
|
|
33
|
+
pictures: [],
|
|
34
|
+
documents: [],
|
|
35
|
+
channels: ["NAS-00000000105"],
|
|
36
|
+
published: true,
|
|
37
|
+
version: 1,
|
|
38
|
+
identifiedPerpetrators: [],
|
|
39
|
+
identifiedVictims: [],
|
|
40
|
+
assistedVictims: [],
|
|
41
|
+
mitigationMeasures: [],
|
|
42
|
+
createdAt: "2025-08-27T00:00:00.000Z",
|
|
43
|
+
updatedAt: "2025-08-27T14:12:21.395Z",
|
|
44
|
+
__v: 0,
|
|
45
|
+
percentageCompletion: 40,
|
|
46
|
+
eventCategory: "conflict",
|
|
47
|
+
incindentType: null,
|
|
48
|
+
initiative: null,
|
|
49
|
+
meta: null,
|
|
50
|
+
namespace: "incident",
|
|
51
|
+
primarySource: null,
|
|
52
|
+
severity: "moderate",
|
|
53
|
+
sources: ["7e17f076-09e7-4668-927c-11c12ccd1346"],
|
|
54
|
+
type: "minor_incident",
|
|
55
|
+
description: "A minor mining collapse incident that occurred during routine operations. No injuries were reported, but equipment was damaged.",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
_id: "68af1fb6b52f86d82f57e945",
|
|
59
|
+
createdBy: "b1e3f288-01a2-4cea-95d2-03f65dfede99",
|
|
60
|
+
form: "event",
|
|
61
|
+
id: "5bee0d0f-39da-4bd1-85a4-e66276c82303",
|
|
62
|
+
datastakeId: "EV-000000000153",
|
|
63
|
+
name: "Security Equipment Request",
|
|
64
|
+
authorId: "fc4ca5c6-f46d-424f-a948-d66b031a82c3",
|
|
65
|
+
collectId: "2142bd9f3306c9ec3c823f63bbbbb8fe3ebad7fa",
|
|
66
|
+
country: "CD",
|
|
67
|
+
date: "2025-08-11",
|
|
68
|
+
typeOfEvent: "testimonials",
|
|
69
|
+
implementers: [],
|
|
70
|
+
typeOfTestimonials: "request",
|
|
71
|
+
associatedSubjects: [],
|
|
72
|
+
testimonialsSource: [],
|
|
73
|
+
pictures: [],
|
|
74
|
+
documents: [],
|
|
75
|
+
channels: [],
|
|
76
|
+
published: true,
|
|
77
|
+
version: 1,
|
|
78
|
+
identifiedPerpetrators: [],
|
|
79
|
+
identifiedVictims: [],
|
|
80
|
+
assistedVictims: [],
|
|
81
|
+
mitigationMeasures: [],
|
|
82
|
+
createdAt: "2025-08-27T00:00:00.000Z",
|
|
83
|
+
updatedAt: "2025-08-27T15:10:00.619Z",
|
|
84
|
+
__v: 0,
|
|
85
|
+
percentageCompletion: 50,
|
|
86
|
+
meta: null,
|
|
87
|
+
namespace: "testimonials",
|
|
88
|
+
sources: ["fc4ca5c6-f46d-424f-a948-d66b031a82c3"],
|
|
89
|
+
type: "correctiveActions",
|
|
90
|
+
description: "A request for additional security equipment to improve safety measures at the mining site.",
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
_id: "68af5d45b52f86d82f580fc8",
|
|
94
|
+
createdBy: "fc4ca5c6-f46d-424f-a948-d66b031a82c3",
|
|
95
|
+
form: "event",
|
|
96
|
+
id: "97348b4c-f7cf-4124-9b70-0f6891a40a15",
|
|
97
|
+
datastakeId: "EV-000000000161",
|
|
98
|
+
name: "Major Safety Incident",
|
|
99
|
+
authorId: "fc4ca5c6-f46d-424f-a948-d66b031a82c3",
|
|
100
|
+
collectId: "33b9aea707761a7a735aee81ebd29d5656f049fa",
|
|
101
|
+
country: "CD",
|
|
102
|
+
date: "2025-08-11",
|
|
103
|
+
typeOfEvent: "incident",
|
|
104
|
+
implementers: [],
|
|
105
|
+
associatedSubjects: [],
|
|
106
|
+
testimonialsSource: [],
|
|
107
|
+
pictures: [],
|
|
108
|
+
documents: [],
|
|
109
|
+
channels: [],
|
|
110
|
+
published: false,
|
|
111
|
+
version: 1,
|
|
112
|
+
identifiedPerpetrators: [],
|
|
113
|
+
identifiedVictims: [],
|
|
114
|
+
assistedVictims: [],
|
|
115
|
+
mitigationMeasures: [],
|
|
116
|
+
createdAt: "2025-08-27T00:00:00.000Z",
|
|
117
|
+
updatedAt: "2025-08-27T00:00:00.000Z",
|
|
118
|
+
__v: 0,
|
|
119
|
+
percentageCompletion: 40,
|
|
120
|
+
eventCategory: null,
|
|
121
|
+
initiative: null,
|
|
122
|
+
meta: null,
|
|
123
|
+
namespace: "incident",
|
|
124
|
+
primarySource: null,
|
|
125
|
+
severity: "major",
|
|
126
|
+
sources: ["fc4ca5c6-f46d-424f-a948-d66b031a82c3"],
|
|
127
|
+
type: "major_incident",
|
|
128
|
+
description: "A major safety incident that required immediate attention and investigation. This event is currently under review.",
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
type: "Mine site",
|
|
132
|
+
total: 5,
|
|
133
|
+
sources: 2,
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
gps: {
|
|
137
|
+
latitude: -2.3456789,
|
|
138
|
+
longitude: 29.1234567,
|
|
139
|
+
},
|
|
140
|
+
name: "Kivu Processing Plant",
|
|
141
|
+
datastakeId: "LOC-00000000242",
|
|
142
|
+
description: "A mineral processing facility that handles various types of minerals extracted from nearby mining sites.",
|
|
143
|
+
data: [
|
|
144
|
+
{
|
|
145
|
+
_id: "68af116e2cb57a4e3dd2e057",
|
|
146
|
+
createdBy: "4274fdb4-2798-46ea-a0a6-b4af5d92566e",
|
|
147
|
+
form: "event",
|
|
148
|
+
id: "91c3176a-d312-4259-9ddf-9d286ff6df88",
|
|
149
|
+
datastakeId: "EV-000000000151",
|
|
150
|
+
name: "Processing Efficiency Improvement",
|
|
151
|
+
authorId: "7e17f076-09e7-4668-927c-11c12ccd1346",
|
|
152
|
+
collectId: "d78271301d04f76dfe0f70ce3c9e114ffe4dc4e0",
|
|
153
|
+
country: "CD",
|
|
154
|
+
date: "2025-08-20",
|
|
155
|
+
typeOfEvent: "initiative",
|
|
156
|
+
implementers: [],
|
|
157
|
+
associatedSubjects: [],
|
|
158
|
+
testimonialsSource: [],
|
|
159
|
+
pictures: [],
|
|
160
|
+
documents: [],
|
|
161
|
+
channels: ["NAS-00000000106"],
|
|
162
|
+
published: true,
|
|
163
|
+
version: 1,
|
|
164
|
+
identifiedPerpetrators: [],
|
|
165
|
+
identifiedVictims: [],
|
|
166
|
+
assistedVictims: [],
|
|
167
|
+
mitigationMeasures: [],
|
|
168
|
+
createdAt: "2025-08-20T00:00:00.000Z",
|
|
169
|
+
updatedAt: "2025-08-20T14:12:21.395Z",
|
|
170
|
+
__v: 0,
|
|
171
|
+
percentageCompletion: 75,
|
|
172
|
+
eventCategory: "improvement",
|
|
173
|
+
incindentType: null,
|
|
174
|
+
initiative: "efficiency",
|
|
175
|
+
meta: null,
|
|
176
|
+
namespace: "initiative",
|
|
177
|
+
primarySource: null,
|
|
178
|
+
severity: "low",
|
|
179
|
+
sources: ["7e17f076-09e7-4668-927c-11c12ccd1346"],
|
|
180
|
+
type: "improvement_initiative",
|
|
181
|
+
description: "An initiative to improve processing efficiency through new technology implementation.",
|
|
182
|
+
},
|
|
183
|
+
],
|
|
184
|
+
type: "Processing Plant",
|
|
185
|
+
total: 1,
|
|
186
|
+
sources: 1,
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
filtersConfig: [
|
|
190
|
+
{
|
|
191
|
+
label: "Event Type",
|
|
192
|
+
placeholder: "Select",
|
|
193
|
+
key: "type",
|
|
194
|
+
type: "select",
|
|
195
|
+
value: "A",
|
|
196
|
+
options: [
|
|
197
|
+
{ label: "All Events", value: "A" },
|
|
198
|
+
{ label: "Incidents", value: "incident" },
|
|
199
|
+
{ label: "Initiatives", value: "initiative" },
|
|
200
|
+
{ label: "Testimonials", value: "testimonials" },
|
|
201
|
+
],
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
label: "Severity",
|
|
205
|
+
placeholder: "Select",
|
|
206
|
+
key: "severity",
|
|
207
|
+
type: "select",
|
|
208
|
+
value: undefined,
|
|
209
|
+
options: [
|
|
210
|
+
{ label: "All", value: "all" },
|
|
211
|
+
{ label: "Low", value: "low" },
|
|
212
|
+
{ label: "Moderate", value: "moderate" },
|
|
213
|
+
{ label: "Major", value: "major" },
|
|
214
|
+
],
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
type: "slider",
|
|
218
|
+
label: "Completion Percentage",
|
|
219
|
+
key: "completion",
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
onFilterChange: (v) => {
|
|
223
|
+
console.log(v);
|
|
224
|
+
},
|
|
225
|
+
// tooltipAsText: true,
|
|
226
|
+
primaryLink: true,
|
|
227
|
+
renderSider: () =>
|
|
228
|
+
isMineSite ? (
|
|
229
|
+
<div className="body-list">
|
|
230
|
+
<div className="body-row">
|
|
231
|
+
<span className="label">Event Type</span>
|
|
232
|
+
<span>Mixed</span>
|
|
233
|
+
</div>
|
|
234
|
+
|
|
235
|
+
<div className="body-row">
|
|
236
|
+
<span className="label">Total Events</span>
|
|
237
|
+
<span>4</span>
|
|
238
|
+
</div>
|
|
239
|
+
|
|
240
|
+
<div className="body-row">
|
|
241
|
+
<span className="label">Severity</span>
|
|
242
|
+
<span>Mixed</span>
|
|
243
|
+
</div>
|
|
244
|
+
</div>
|
|
245
|
+
) : (
|
|
246
|
+
<div className="daf-table-wrapper extra-small">
|
|
247
|
+
<DAFTable
|
|
248
|
+
loading={false}
|
|
249
|
+
scroll={{ y: 300 }}
|
|
250
|
+
className="no-padding no-margin"
|
|
251
|
+
data={[
|
|
252
|
+
{ event: "Mining Collapse", type: "Incident", severity: "Moderate", key: 0 },
|
|
253
|
+
{ event: "Security Request", type: "Testimonial", severity: "Low", key: 1 },
|
|
254
|
+
{ event: "Safety Incident", type: "Incident", severity: "Major", key: 2 },
|
|
255
|
+
{ event: "Efficiency Improvement", type: "Initiative", severity: "Low", key: 3 },
|
|
256
|
+
]}
|
|
257
|
+
pagination={false}
|
|
258
|
+
columns={[
|
|
259
|
+
{
|
|
260
|
+
title: "Event",
|
|
261
|
+
dataIndex: "event",
|
|
262
|
+
key: "event",
|
|
263
|
+
ellipsis: true,
|
|
264
|
+
width: 120,
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
title: "Type",
|
|
268
|
+
dataIndex: "type",
|
|
269
|
+
key: "type",
|
|
270
|
+
width: 80,
|
|
271
|
+
render: (_, all) => {
|
|
272
|
+
return (
|
|
273
|
+
<MoreTags values={[{ label: all.type }]} maxTextCont={40} />
|
|
274
|
+
);
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
title: "Severity",
|
|
279
|
+
dataIndex: "severity",
|
|
280
|
+
key: "severity",
|
|
281
|
+
width: 80,
|
|
282
|
+
render: (_, all) => {
|
|
283
|
+
return (
|
|
284
|
+
<MoreTags values={[{ label: all.severity }]} maxTextCont={40} />
|
|
285
|
+
);
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
title: "",
|
|
290
|
+
dataIndex: "action",
|
|
291
|
+
key: "action",
|
|
292
|
+
width: 34,
|
|
293
|
+
render: (_, all) => {
|
|
294
|
+
return <CustomIcon name="LinkNewTab" width={12} height={12} />;
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
]}
|
|
298
|
+
rowKey="key"
|
|
299
|
+
/>
|
|
300
|
+
</div>
|
|
301
|
+
),
|
|
302
|
+
renderTooltip: (data) => {
|
|
303
|
+
const correctiveActionsCount = data?.data?.filter(
|
|
304
|
+
(d) => d.type === "correctiveActions",
|
|
305
|
+
).length;
|
|
306
|
+
|
|
307
|
+
const majorIncidents = data?.data?.filter(
|
|
308
|
+
(d) => d.type === "major_incident",
|
|
309
|
+
).length;
|
|
310
|
+
|
|
311
|
+
const minorIncidents = data?.data?.filter(
|
|
312
|
+
(d) => d.type === "minor_incident",
|
|
313
|
+
).length;
|
|
314
|
+
|
|
315
|
+
const moderateIncidents = data?.data?.filter(
|
|
316
|
+
(d) => d.type === "moderate_incident",
|
|
317
|
+
).length;
|
|
318
|
+
|
|
319
|
+
return [
|
|
320
|
+
{
|
|
321
|
+
label: "Major Incidents",
|
|
322
|
+
color: "#F04438",
|
|
323
|
+
value: majorIncidents || 0,
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
label: "Moderate Incidents",
|
|
327
|
+
color: "#FF7A45",
|
|
328
|
+
value: moderateIncidents || 0,
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
label: "Minor Incidents",
|
|
332
|
+
color: "#FFC069",
|
|
333
|
+
value: minorIncidents || 0,
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
label: "Corrective Actions",
|
|
337
|
+
color: "#12b76a",
|
|
338
|
+
value: correctiveActionsCount || 0,
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
label: "Total Events",
|
|
342
|
+
value: data?.total || 0,
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
label: "Sources",
|
|
346
|
+
value: data?.sources || 0,
|
|
347
|
+
},
|
|
348
|
+
];
|
|
349
|
+
},
|
|
350
|
+
link: true,
|
|
351
|
+
onClickLink: (data) => {
|
|
352
|
+
console.log(data);
|
|
353
|
+
},
|
|
354
|
+
};
|
package/.env
DELETED
package/.vscode/settings.json
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"cSpell.words": ["cukura"],
|
|
3
|
-
"files.autoSave": "afterDelay",
|
|
4
|
-
"editor.wordWrap": "on",
|
|
5
|
-
"editor.autoClosingBrackets": "always",
|
|
6
|
-
"editor.autoClosingComments": "always",
|
|
7
|
-
"editor.autoClosingQuotes": "always",
|
|
8
|
-
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
9
|
-
"editor.formatOnPaste": true,
|
|
10
|
-
"editor.formatOnSave": true,
|
|
11
|
-
"notebook.defaultFormatter": "esbenp.prettier-vscode",
|
|
12
|
-
"javascript.format.semicolons": "insert"
|
|
13
|
-
}
|