datastake-daf 0.6.281 β 0.6.282
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 +192 -15
- package/package.json +1 -1
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobe.jsx +56 -14
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobe.stories.js +17 -0
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobeTestDebug.jsx +150 -0
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobeTestDebug.standalone.jsx +183 -0
- package/src/index.js +1 -0
package/dist/components/index.js
CHANGED
|
@@ -20959,15 +20959,29 @@ const SimpleGlobe = _ref => {
|
|
|
20959
20959
|
// Set Mapbox access token
|
|
20960
20960
|
mapboxgl.accessToken = 'pk.eyJ1IjoicmVkaXM5OTkiLCJhIjoiY2x4YWV5MzA5MmtuZzJpcXM5Y201Z2E2YiJ9.m5bwPg-Tj4Akesl1yQUa3w';
|
|
20961
20961
|
|
|
20962
|
-
// Create map with custom Straatos style
|
|
20963
|
-
|
|
20964
|
-
|
|
20965
|
-
|
|
20966
|
-
|
|
20967
|
-
|
|
20968
|
-
|
|
20969
|
-
|
|
20970
|
-
|
|
20962
|
+
// Create map with custom Straatos style (with fallback)
|
|
20963
|
+
try {
|
|
20964
|
+
map.current = new mapboxgl.Map({
|
|
20965
|
+
container: mapContainer.current,
|
|
20966
|
+
style: 'mapbox://styles/pietragottardo/cm9tt9zfi00d101pg1vdx26si',
|
|
20967
|
+
center: [0, 0],
|
|
20968
|
+
zoom: mapConfig.maxZoom || 3,
|
|
20969
|
+
projection: 'globe',
|
|
20970
|
+
attributionControl: false
|
|
20971
|
+
});
|
|
20972
|
+
console.log('πΊοΈ [SIMPLE GLOBE] Custom style loaded successfully');
|
|
20973
|
+
} catch (error) {
|
|
20974
|
+
console.warn('β οΈ [SIMPLE GLOBE] Custom style failed, using fallback:', error);
|
|
20975
|
+
// Fallback to standard style
|
|
20976
|
+
map.current = new mapboxgl.Map({
|
|
20977
|
+
container: mapContainer.current,
|
|
20978
|
+
style: 'mapbox://styles/mapbox/satellite-v9',
|
|
20979
|
+
center: [0, 0],
|
|
20980
|
+
zoom: mapConfig.maxZoom || 3,
|
|
20981
|
+
projection: 'globe',
|
|
20982
|
+
attributionControl: false
|
|
20983
|
+
});
|
|
20984
|
+
}
|
|
20971
20985
|
|
|
20972
20986
|
// Add markers when map loads
|
|
20973
20987
|
map.current.on('load', () => {
|
|
@@ -21019,6 +21033,12 @@ const SimpleGlobe = _ref => {
|
|
|
21019
21033
|
el.style.display = 'flex';
|
|
21020
21034
|
el.style.alignItems = 'center';
|
|
21021
21035
|
el.style.justifyContent = 'center';
|
|
21036
|
+
// Ensure proper positioning and prevent CSS interference
|
|
21037
|
+
el.style.position = 'relative';
|
|
21038
|
+
el.style.left = 'auto';
|
|
21039
|
+
el.style.top = 'auto';
|
|
21040
|
+
el.style.transform = 'none';
|
|
21041
|
+
el.style.zIndex = '1000';
|
|
21022
21042
|
if (type === "location") {
|
|
21023
21043
|
// Location marker - SVG map pin style
|
|
21024
21044
|
el.style.width = '28px';
|
|
@@ -21074,19 +21094,31 @@ const SimpleGlobe = _ref => {
|
|
|
21074
21094
|
closeOnClick: false
|
|
21075
21095
|
}).setHTML(popupContent);
|
|
21076
21096
|
|
|
21077
|
-
// Ensure coordinates are valid numbers
|
|
21097
|
+
// Ensure coordinates are valid numbers and in correct order
|
|
21078
21098
|
const lng = Number(project.longitude);
|
|
21079
21099
|
const lat = Number(project.latitude);
|
|
21080
21100
|
console.log("\uD83D\uDCCD [SIMPLE GLOBE] Marker ".concat(index, " coordinates:"), {
|
|
21081
|
-
|
|
21082
|
-
|
|
21101
|
+
original: {
|
|
21102
|
+
longitude: project.longitude,
|
|
21103
|
+
latitude: project.latitude
|
|
21104
|
+
},
|
|
21105
|
+
processed: {
|
|
21106
|
+
lng,
|
|
21107
|
+
lat
|
|
21108
|
+
},
|
|
21109
|
+
project: project.name
|
|
21083
21110
|
});
|
|
21084
21111
|
|
|
21085
21112
|
// Validate coordinates
|
|
21086
21113
|
if (isNaN(lng) || isNaN(lat) || lng < -180 || lng > 180 || lat < -90 || lat > 90) {
|
|
21087
21114
|
console.error("\u274C [SIMPLE GLOBE] Invalid coordinates for project ".concat(index, ":"), {
|
|
21088
21115
|
lng,
|
|
21089
|
-
lat
|
|
21116
|
+
lat,
|
|
21117
|
+
original: {
|
|
21118
|
+
longitude: project.longitude,
|
|
21119
|
+
latitude: project.latitude
|
|
21120
|
+
},
|
|
21121
|
+
project: project.name
|
|
21090
21122
|
});
|
|
21091
21123
|
return;
|
|
21092
21124
|
}
|
|
@@ -21095,14 +21127,28 @@ const SimpleGlobe = _ref => {
|
|
|
21095
21127
|
bounds.extend([lng, lat]);
|
|
21096
21128
|
hasValidCoordinates = true;
|
|
21097
21129
|
|
|
21098
|
-
//
|
|
21099
|
-
new mapboxgl.Marker(
|
|
21130
|
+
// Create marker with explicit positioning
|
|
21131
|
+
const marker = new mapboxgl.Marker({
|
|
21132
|
+
element: el,
|
|
21133
|
+
anchor: 'center'
|
|
21134
|
+
}).setLngLat([lng, lat]).setPopup(popup).addTo(map.current);
|
|
21100
21135
|
|
|
21101
21136
|
// Add click handler
|
|
21102
21137
|
el.addEventListener('click', () => {
|
|
21103
21138
|
console.log('π [SIMPLE GLOBE] Marker clicked:', project);
|
|
21104
21139
|
onProjectClick(project);
|
|
21105
21140
|
});
|
|
21141
|
+
|
|
21142
|
+
// Verify marker position after a short delay
|
|
21143
|
+
setTimeout(() => {
|
|
21144
|
+
const markerLngLat = marker.getLngLat();
|
|
21145
|
+
console.log("\uD83D\uDD0D [SIMPLE GLOBE] Marker ".concat(index, " position verification:"), {
|
|
21146
|
+
expected: [lng, lat],
|
|
21147
|
+
actual: [markerLngLat.lng, markerLngLat.lat],
|
|
21148
|
+
project: project.name,
|
|
21149
|
+
match: Math.abs(markerLngLat.lng - lng) < 0.0001 && Math.abs(markerLngLat.lat - lat) < 0.0001
|
|
21150
|
+
});
|
|
21151
|
+
}, 100);
|
|
21106
21152
|
console.log("\u2705 [SIMPLE GLOBE] Marker ".concat(index, " added at:"), [lng, lat]);
|
|
21107
21153
|
});
|
|
21108
21154
|
|
|
@@ -21217,6 +21263,136 @@ const SimpleGlobe = _ref => {
|
|
|
21217
21263
|
});
|
|
21218
21264
|
};
|
|
21219
21265
|
|
|
21266
|
+
const SimpleGlobeTestDebug = _ref => {
|
|
21267
|
+
let {
|
|
21268
|
+
projects = []
|
|
21269
|
+
} = _ref;
|
|
21270
|
+
const mapContainer = React.useRef(null);
|
|
21271
|
+
const map = React.useRef(null);
|
|
21272
|
+
React.useEffect(() => {
|
|
21273
|
+
if (map.current) return;
|
|
21274
|
+
console.log('π§ͺ [DEBUG TEST] Creating minimal map...');
|
|
21275
|
+
|
|
21276
|
+
// Set Mapbox access token
|
|
21277
|
+
mapboxgl.accessToken = 'pk.eyJ1IjoicmVkaXM5OTkiLCJhIjoiY2x4YWV5MzA5MmtuZzJpcXM5Y201Z2E2YiJ9.m5bwPg-Tj4Akesl1yQUa3w';
|
|
21278
|
+
|
|
21279
|
+
// Create minimal map
|
|
21280
|
+
map.current = new mapboxgl.Map({
|
|
21281
|
+
container: mapContainer.current,
|
|
21282
|
+
style: 'mapbox://styles/mapbox/satellite-v9',
|
|
21283
|
+
center: [0, 0],
|
|
21284
|
+
zoom: 2,
|
|
21285
|
+
projection: 'globe'
|
|
21286
|
+
});
|
|
21287
|
+
|
|
21288
|
+
// Add markers when map loads
|
|
21289
|
+
map.current.on('load', () => {
|
|
21290
|
+
console.log('π§ͺ [DEBUG TEST] Map loaded, adding test markers...');
|
|
21291
|
+
projects.forEach((project, index) => {
|
|
21292
|
+
console.log("\uD83E\uDDEA [DEBUG TEST] Processing project ".concat(index, ":"), project);
|
|
21293
|
+
|
|
21294
|
+
// Create simple marker
|
|
21295
|
+
const el = document.createElement('div');
|
|
21296
|
+
el.style.width = '20px';
|
|
21297
|
+
el.style.height = '20px';
|
|
21298
|
+
el.style.backgroundColor = '#FF0000';
|
|
21299
|
+
el.style.borderRadius = '50%';
|
|
21300
|
+
el.style.border = '2px solid white';
|
|
21301
|
+
el.style.cursor = 'pointer';
|
|
21302
|
+
el.style.boxShadow = '0px 3px 6px rgba(0,0,0,0.3)';
|
|
21303
|
+
|
|
21304
|
+
// Get coordinates
|
|
21305
|
+
const lng = Number(project.longitude);
|
|
21306
|
+
const lat = Number(project.latitude);
|
|
21307
|
+
console.log("\uD83E\uDDEA [DEBUG TEST] Coordinates for ".concat(project.name, ":"), {
|
|
21308
|
+
original: {
|
|
21309
|
+
longitude: project.longitude,
|
|
21310
|
+
latitude: project.latitude
|
|
21311
|
+
},
|
|
21312
|
+
processed: {
|
|
21313
|
+
lng,
|
|
21314
|
+
lat
|
|
21315
|
+
},
|
|
21316
|
+
valid: !isNaN(lng) && !isNaN(lat) && lng >= -180 && lng <= 180 && lat >= -90 && lat <= 90
|
|
21317
|
+
});
|
|
21318
|
+
if (isNaN(lng) || isNaN(lat) || lng < -180 || lng > 180 || lat < -90 || lat > 90) {
|
|
21319
|
+
console.error("\u274C [DEBUG TEST] Invalid coordinates for ".concat(project.name, ":"), {
|
|
21320
|
+
lng,
|
|
21321
|
+
lat
|
|
21322
|
+
});
|
|
21323
|
+
return;
|
|
21324
|
+
}
|
|
21325
|
+
|
|
21326
|
+
// Create popup
|
|
21327
|
+
const popup = new mapboxgl.Popup({
|
|
21328
|
+
offset: 25
|
|
21329
|
+
}).setHTML("\n <div style=\"padding: 8px;\">\n <h3 style=\"margin: 0 0 8px 0; font-size: 14px;\">".concat(project.name, "</h3>\n <p style=\"margin: 0; font-size: 12px; color: #666;\">\n Lat: ").concat(lat.toFixed(4), ", Lng: ").concat(lng.toFixed(4), "\n </p>\n <p style=\"margin: 4px 0 0 0; font-size: 12px;\">\n ").concat(project.projectDescription || 'No description', "\n </p>\n </div>\n "));
|
|
21330
|
+
|
|
21331
|
+
// Add marker with explicit positioning
|
|
21332
|
+
const marker = new mapboxgl.Marker({
|
|
21333
|
+
element: el,
|
|
21334
|
+
anchor: 'center'
|
|
21335
|
+
}).setLngLat([lng, lat]).setPopup(popup).addTo(map.current);
|
|
21336
|
+
|
|
21337
|
+
// Verify position after a delay
|
|
21338
|
+
setTimeout(() => {
|
|
21339
|
+
const markerLngLat = marker.getLngLat();
|
|
21340
|
+
const positionMatch = Math.abs(markerLngLat.lng - lng) < 0.0001 && Math.abs(markerLngLat.lat - lat) < 0.0001;
|
|
21341
|
+
console.log("\uD83D\uDD0D [DEBUG TEST] Position verification for ".concat(project.name, ":"), {
|
|
21342
|
+
expected: [lng, lat],
|
|
21343
|
+
actual: [markerLngLat.lng, markerLngLat.lat],
|
|
21344
|
+
match: positionMatch,
|
|
21345
|
+
difference: {
|
|
21346
|
+
lng: Math.abs(markerLngLat.lng - lng),
|
|
21347
|
+
lat: Math.abs(markerLngLat.lat - lat)
|
|
21348
|
+
}
|
|
21349
|
+
});
|
|
21350
|
+
if (!positionMatch) {
|
|
21351
|
+
console.error("\u274C [DEBUG TEST] Position mismatch for ".concat(project.name, "!"));
|
|
21352
|
+
}
|
|
21353
|
+
}, 200);
|
|
21354
|
+
console.log("\u2705 [DEBUG TEST] Marker added for ".concat(project.name, " at:"), [lng, lat]);
|
|
21355
|
+
});
|
|
21356
|
+
});
|
|
21357
|
+
return () => {
|
|
21358
|
+
if (map.current) {
|
|
21359
|
+
map.current.remove();
|
|
21360
|
+
map.current = null;
|
|
21361
|
+
}
|
|
21362
|
+
};
|
|
21363
|
+
}, [projects]);
|
|
21364
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
21365
|
+
style: {
|
|
21366
|
+
width: '100%',
|
|
21367
|
+
height: '600px',
|
|
21368
|
+
border: '2px solid #ccc',
|
|
21369
|
+
position: 'relative'
|
|
21370
|
+
},
|
|
21371
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
21372
|
+
ref: mapContainer,
|
|
21373
|
+
style: {
|
|
21374
|
+
width: '100%',
|
|
21375
|
+
height: '100%',
|
|
21376
|
+
position: 'relative'
|
|
21377
|
+
}
|
|
21378
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
21379
|
+
style: {
|
|
21380
|
+
position: 'absolute',
|
|
21381
|
+
top: '10px',
|
|
21382
|
+
left: '10px',
|
|
21383
|
+
background: 'rgba(255,255,255,0.9)',
|
|
21384
|
+
padding: '8px',
|
|
21385
|
+
borderRadius: '4px',
|
|
21386
|
+
fontSize: '12px',
|
|
21387
|
+
zIndex: 1000
|
|
21388
|
+
},
|
|
21389
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("strong", {
|
|
21390
|
+
children: "Debug Test Map"
|
|
21391
|
+
}), /*#__PURE__*/jsxRuntime.jsx("br", {}), "Projects: ", projects.length, /*#__PURE__*/jsxRuntime.jsx("br", {}), "Check console for position verification"]
|
|
21392
|
+
})]
|
|
21393
|
+
});
|
|
21394
|
+
};
|
|
21395
|
+
|
|
21220
21396
|
function WidgetPlaceholder(_ref) {
|
|
21221
21397
|
let {
|
|
21222
21398
|
icon = "",
|
|
@@ -62040,6 +62216,7 @@ exports.SettingsPopover = SettingsPopover;
|
|
|
62040
62216
|
exports.Sidenav = Sidenav;
|
|
62041
62217
|
exports.SidenavMenu = SidenavMenu;
|
|
62042
62218
|
exports.SimpleGlobe = SimpleGlobe;
|
|
62219
|
+
exports.SimpleGlobeTestDebug = SimpleGlobeTestDebug;
|
|
62043
62220
|
exports.StackChart = StackChart;
|
|
62044
62221
|
exports.StakeholderMappings = index$1;
|
|
62045
62222
|
exports.Steps = DAFSteps;
|
package/package.json
CHANGED
|
@@ -47,15 +47,29 @@ const SimpleGlobe = ({
|
|
|
47
47
|
// Set Mapbox access token
|
|
48
48
|
mapboxgl.accessToken = 'pk.eyJ1IjoicmVkaXM5OTkiLCJhIjoiY2x4YWV5MzA5MmtuZzJpcXM5Y201Z2E2YiJ9.m5bwPg-Tj4Akesl1yQUa3w';
|
|
49
49
|
|
|
50
|
-
// Create map with custom Straatos style
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
// Create map with custom Straatos style (with fallback)
|
|
51
|
+
try {
|
|
52
|
+
map.current = new mapboxgl.Map({
|
|
53
|
+
container: mapContainer.current,
|
|
54
|
+
style: 'mapbox://styles/pietragottardo/cm9tt9zfi00d101pg1vdx26si',
|
|
55
|
+
center: [0, 0],
|
|
56
|
+
zoom: mapConfig.maxZoom || 3,
|
|
57
|
+
projection: 'globe',
|
|
58
|
+
attributionControl: false
|
|
59
|
+
});
|
|
60
|
+
console.log('πΊοΈ [SIMPLE GLOBE] Custom style loaded successfully');
|
|
61
|
+
} catch (error) {
|
|
62
|
+
console.warn('β οΈ [SIMPLE GLOBE] Custom style failed, using fallback:', error);
|
|
63
|
+
// Fallback to standard style
|
|
64
|
+
map.current = new mapboxgl.Map({
|
|
65
|
+
container: mapContainer.current,
|
|
66
|
+
style: 'mapbox://styles/mapbox/satellite-v9',
|
|
67
|
+
center: [0, 0],
|
|
68
|
+
zoom: mapConfig.maxZoom || 3,
|
|
69
|
+
projection: 'globe',
|
|
70
|
+
attributionControl: false
|
|
71
|
+
});
|
|
72
|
+
}
|
|
59
73
|
|
|
60
74
|
// Add markers when map loads
|
|
61
75
|
map.current.on('load', () => {
|
|
@@ -139,6 +153,12 @@ const SimpleGlobe = ({
|
|
|
139
153
|
el.style.display = 'flex';
|
|
140
154
|
el.style.alignItems = 'center';
|
|
141
155
|
el.style.justifyContent = 'center';
|
|
156
|
+
// Ensure proper positioning and prevent CSS interference
|
|
157
|
+
el.style.position = 'relative';
|
|
158
|
+
el.style.left = 'auto';
|
|
159
|
+
el.style.top = 'auto';
|
|
160
|
+
el.style.transform = 'none';
|
|
161
|
+
el.style.zIndex = '1000';
|
|
142
162
|
|
|
143
163
|
if (type === "location") {
|
|
144
164
|
// Location marker - SVG map pin style
|
|
@@ -217,15 +237,23 @@ const SimpleGlobe = ({
|
|
|
217
237
|
closeOnClick: false
|
|
218
238
|
}).setHTML(popupContent);
|
|
219
239
|
|
|
220
|
-
// Ensure coordinates are valid numbers
|
|
240
|
+
// Ensure coordinates are valid numbers and in correct order
|
|
221
241
|
const lng = Number(project.longitude);
|
|
222
242
|
const lat = Number(project.latitude);
|
|
223
243
|
|
|
224
|
-
console.log(`π [SIMPLE GLOBE] Marker ${index} coordinates:`, {
|
|
244
|
+
console.log(`π [SIMPLE GLOBE] Marker ${index} coordinates:`, {
|
|
245
|
+
original: { longitude: project.longitude, latitude: project.latitude },
|
|
246
|
+
processed: { lng, lat },
|
|
247
|
+
project: project.name
|
|
248
|
+
});
|
|
225
249
|
|
|
226
250
|
// Validate coordinates
|
|
227
251
|
if (isNaN(lng) || isNaN(lat) || lng < -180 || lng > 180 || lat < -90 || lat > 90) {
|
|
228
|
-
console.error(`β [SIMPLE GLOBE] Invalid coordinates for project ${index}:`, {
|
|
252
|
+
console.error(`β [SIMPLE GLOBE] Invalid coordinates for project ${index}:`, {
|
|
253
|
+
lng, lat,
|
|
254
|
+
original: { longitude: project.longitude, latitude: project.latitude },
|
|
255
|
+
project: project.name
|
|
256
|
+
});
|
|
229
257
|
return;
|
|
230
258
|
}
|
|
231
259
|
|
|
@@ -233,8 +261,11 @@ const SimpleGlobe = ({
|
|
|
233
261
|
bounds.extend([lng, lat]);
|
|
234
262
|
hasValidCoordinates = true;
|
|
235
263
|
|
|
236
|
-
//
|
|
237
|
-
const marker = new mapboxgl.Marker(
|
|
264
|
+
// Create marker with explicit positioning
|
|
265
|
+
const marker = new mapboxgl.Marker({
|
|
266
|
+
element: el,
|
|
267
|
+
anchor: 'center'
|
|
268
|
+
})
|
|
238
269
|
.setLngLat([lng, lat])
|
|
239
270
|
.setPopup(popup)
|
|
240
271
|
.addTo(map.current);
|
|
@@ -244,6 +275,17 @@ const SimpleGlobe = ({
|
|
|
244
275
|
console.log('π [SIMPLE GLOBE] Marker clicked:', project);
|
|
245
276
|
onProjectClick(project);
|
|
246
277
|
});
|
|
278
|
+
|
|
279
|
+
// Verify marker position after a short delay
|
|
280
|
+
setTimeout(() => {
|
|
281
|
+
const markerLngLat = marker.getLngLat();
|
|
282
|
+
console.log(`π [SIMPLE GLOBE] Marker ${index} position verification:`, {
|
|
283
|
+
expected: [lng, lat],
|
|
284
|
+
actual: [markerLngLat.lng, markerLngLat.lat],
|
|
285
|
+
project: project.name,
|
|
286
|
+
match: Math.abs(markerLngLat.lng - lng) < 0.0001 && Math.abs(markerLngLat.lat - lat) < 0.0001
|
|
287
|
+
});
|
|
288
|
+
}, 100);
|
|
247
289
|
|
|
248
290
|
console.log(`β
[SIMPLE GLOBE] Marker ${index} added at:`, [lng, lat]);
|
|
249
291
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import SimpleGlobe from "./SimpleGlobe";
|
|
2
2
|
import SimpleGlobeDebug from "./SimpleGlobeDebug";
|
|
3
|
+
import SimpleGlobeTestDebug from "./SimpleGlobeTestDebug";
|
|
3
4
|
import ThemeLayout from "../../ThemeLayout";
|
|
4
5
|
import Widget from "../Widget";
|
|
5
6
|
|
|
@@ -282,3 +283,19 @@ export const DebugVersion = {
|
|
|
282
283
|
</div>
|
|
283
284
|
)
|
|
284
285
|
};
|
|
286
|
+
|
|
287
|
+
export const TestDebugVersion = {
|
|
288
|
+
name: "Test Debug Version (Minimal Setup)",
|
|
289
|
+
render: () => (
|
|
290
|
+
<div style={{ margin: "3em" }}>
|
|
291
|
+
<ThemeLayout>
|
|
292
|
+
<Widget title="Test Debug Globe (Minimal Mapbox)" className="no-px no-pb-body">
|
|
293
|
+
<SimpleGlobeTestDebug projects={SAMPLE_PROJECTS} />
|
|
294
|
+
</Widget>
|
|
295
|
+
</ThemeLayout>
|
|
296
|
+
</div>
|
|
297
|
+
)
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
// Export the component for reuse in other projects
|
|
301
|
+
export { SimpleGlobeTestDebug };
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import mapboxgl from 'mapbox-gl';
|
|
3
|
+
import 'mapbox-gl/dist/mapbox-gl.css';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* SimpleGlobeTestDebug - A minimal test component to debug marker positioning issues
|
|
7
|
+
* This component uses the most basic Mapbox setup to isolate positioning problems
|
|
8
|
+
*/
|
|
9
|
+
const SimpleGlobeTestDebug = ({ projects = [] }) => {
|
|
10
|
+
const mapContainer = useRef(null);
|
|
11
|
+
const map = useRef(null);
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (map.current) return;
|
|
15
|
+
|
|
16
|
+
console.log('π§ͺ [DEBUG TEST] Creating minimal map...');
|
|
17
|
+
|
|
18
|
+
// Set Mapbox access token
|
|
19
|
+
mapboxgl.accessToken = 'pk.eyJ1IjoicmVkaXM5OTkiLCJhIjoiY2x4YWV5MzA5MmtuZzJpcXM5Y201Z2E2YiJ9.m5bwPg-Tj4Akesl1yQUa3w';
|
|
20
|
+
|
|
21
|
+
// Create minimal map
|
|
22
|
+
map.current = new mapboxgl.Map({
|
|
23
|
+
container: mapContainer.current,
|
|
24
|
+
style: 'mapbox://styles/mapbox/satellite-v9',
|
|
25
|
+
center: [0, 0],
|
|
26
|
+
zoom: 2,
|
|
27
|
+
projection: 'globe'
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Add markers when map loads
|
|
31
|
+
map.current.on('load', () => {
|
|
32
|
+
console.log('π§ͺ [DEBUG TEST] Map loaded, adding test markers...');
|
|
33
|
+
|
|
34
|
+
projects.forEach((project, index) => {
|
|
35
|
+
console.log(`π§ͺ [DEBUG TEST] Processing project ${index}:`, project);
|
|
36
|
+
|
|
37
|
+
// Create simple marker
|
|
38
|
+
const el = document.createElement('div');
|
|
39
|
+
el.style.width = '20px';
|
|
40
|
+
el.style.height = '20px';
|
|
41
|
+
el.style.backgroundColor = '#FF0000';
|
|
42
|
+
el.style.borderRadius = '50%';
|
|
43
|
+
el.style.border = '2px solid white';
|
|
44
|
+
el.style.cursor = 'pointer';
|
|
45
|
+
el.style.boxShadow = '0px 3px 6px rgba(0,0,0,0.3)';
|
|
46
|
+
|
|
47
|
+
// Get coordinates
|
|
48
|
+
const lng = Number(project.longitude);
|
|
49
|
+
const lat = Number(project.latitude);
|
|
50
|
+
|
|
51
|
+
console.log(`π§ͺ [DEBUG TEST] Coordinates for ${project.name}:`, {
|
|
52
|
+
original: { longitude: project.longitude, latitude: project.latitude },
|
|
53
|
+
processed: { lng, lat },
|
|
54
|
+
valid: !isNaN(lng) && !isNaN(lat) && lng >= -180 && lng <= 180 && lat >= -90 && lat <= 90
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
if (isNaN(lng) || isNaN(lat) || lng < -180 || lng > 180 || lat < -90 || lat > 90) {
|
|
58
|
+
console.error(`β [DEBUG TEST] Invalid coordinates for ${project.name}:`, { lng, lat });
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Create popup
|
|
63
|
+
const popup = new mapboxgl.Popup({ offset: 25 })
|
|
64
|
+
.setHTML(`
|
|
65
|
+
<div style="padding: 8px;">
|
|
66
|
+
<h3 style="margin: 0 0 8px 0; font-size: 14px;">${project.name}</h3>
|
|
67
|
+
<p style="margin: 0; font-size: 12px; color: #666;">
|
|
68
|
+
Lat: ${lat.toFixed(4)}, Lng: ${lng.toFixed(4)}
|
|
69
|
+
</p>
|
|
70
|
+
<p style="margin: 4px 0 0 0; font-size: 12px;">
|
|
71
|
+
${project.projectDescription || 'No description'}
|
|
72
|
+
</p>
|
|
73
|
+
</div>
|
|
74
|
+
`);
|
|
75
|
+
|
|
76
|
+
// Add marker with explicit positioning
|
|
77
|
+
const marker = new mapboxgl.Marker({
|
|
78
|
+
element: el,
|
|
79
|
+
anchor: 'center'
|
|
80
|
+
})
|
|
81
|
+
.setLngLat([lng, lat])
|
|
82
|
+
.setPopup(popup)
|
|
83
|
+
.addTo(map.current);
|
|
84
|
+
|
|
85
|
+
// Verify position after a delay
|
|
86
|
+
setTimeout(() => {
|
|
87
|
+
const markerLngLat = marker.getLngLat();
|
|
88
|
+
const positionMatch = Math.abs(markerLngLat.lng - lng) < 0.0001 && Math.abs(markerLngLat.lat - lat) < 0.0001;
|
|
89
|
+
|
|
90
|
+
console.log(`π [DEBUG TEST] Position verification for ${project.name}:`, {
|
|
91
|
+
expected: [lng, lat],
|
|
92
|
+
actual: [markerLngLat.lng, markerLngLat.lat],
|
|
93
|
+
match: positionMatch,
|
|
94
|
+
difference: {
|
|
95
|
+
lng: Math.abs(markerLngLat.lng - lng),
|
|
96
|
+
lat: Math.abs(markerLngLat.lat - lat)
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
if (!positionMatch) {
|
|
101
|
+
console.error(`β [DEBUG TEST] Position mismatch for ${project.name}!`);
|
|
102
|
+
}
|
|
103
|
+
}, 200);
|
|
104
|
+
|
|
105
|
+
console.log(`β
[DEBUG TEST] Marker added for ${project.name} at:`, [lng, lat]);
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
return () => {
|
|
110
|
+
if (map.current) {
|
|
111
|
+
map.current.remove();
|
|
112
|
+
map.current = null;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}, [projects]);
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<div style={{
|
|
119
|
+
width: '100%',
|
|
120
|
+
height: '600px',
|
|
121
|
+
border: '2px solid #ccc',
|
|
122
|
+
position: 'relative'
|
|
123
|
+
}}>
|
|
124
|
+
<div
|
|
125
|
+
ref={mapContainer}
|
|
126
|
+
style={{
|
|
127
|
+
width: '100%',
|
|
128
|
+
height: '100%',
|
|
129
|
+
position: 'relative'
|
|
130
|
+
}}
|
|
131
|
+
/>
|
|
132
|
+
<div style={{
|
|
133
|
+
position: 'absolute',
|
|
134
|
+
top: '10px',
|
|
135
|
+
left: '10px',
|
|
136
|
+
background: 'rgba(255,255,255,0.9)',
|
|
137
|
+
padding: '8px',
|
|
138
|
+
borderRadius: '4px',
|
|
139
|
+
fontSize: '12px',
|
|
140
|
+
zIndex: 1000
|
|
141
|
+
}}>
|
|
142
|
+
<strong>Debug Test Map</strong><br/>
|
|
143
|
+
Projects: {projects.length}<br/>
|
|
144
|
+
Check console for position verification
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
147
|
+
);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export default SimpleGlobeTestDebug;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import mapboxgl from 'mapbox-gl';
|
|
3
|
+
import 'mapbox-gl/dist/mapbox-gl.css';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* SimpleGlobeTestDebug - A minimal test component to debug marker positioning issues
|
|
7
|
+
* This component uses the most basic Mapbox setup to isolate positioning problems
|
|
8
|
+
*
|
|
9
|
+
* USAGE:
|
|
10
|
+
* 1. Copy this file to your straatos project
|
|
11
|
+
* 2. Install mapbox-gl: npm install mapbox-gl
|
|
12
|
+
* 3. Import and use: <SimpleGlobeTestDebug projects={yourProjects} />
|
|
13
|
+
*
|
|
14
|
+
* @param {Array} projects - Array of project objects with location data
|
|
15
|
+
* @param {string} projects[].name - Project name
|
|
16
|
+
* @param {number} projects[].latitude - Latitude coordinate
|
|
17
|
+
* @param {number} projects[].longitude - Longitude coordinate
|
|
18
|
+
* @param {string} projects[].projectDescription - Project description (optional)
|
|
19
|
+
*/
|
|
20
|
+
const SimpleGlobeTestDebug = ({ projects = [] }) => {
|
|
21
|
+
const mapContainer = useRef(null);
|
|
22
|
+
const map = useRef(null);
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (map.current) return;
|
|
26
|
+
|
|
27
|
+
console.log('π§ͺ [DEBUG TEST] Creating minimal map...');
|
|
28
|
+
|
|
29
|
+
// Set Mapbox access token - REPLACE WITH YOUR TOKEN
|
|
30
|
+
mapboxgl.accessToken = 'pk.eyJ1IjoicmVkaXM5OTkiLCJhIjoiY2x4YWV5MzA5MmtuZzJpcXM5Y201Z2E2YiJ9.m5bwPg-Tj4Akesl1yQUa3w';
|
|
31
|
+
|
|
32
|
+
// Create minimal map
|
|
33
|
+
map.current = new mapboxgl.Map({
|
|
34
|
+
container: mapContainer.current,
|
|
35
|
+
style: 'mapbox://styles/mapbox/satellite-v9',
|
|
36
|
+
center: [0, 0],
|
|
37
|
+
zoom: 2,
|
|
38
|
+
projection: 'globe'
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// Add markers when map loads
|
|
42
|
+
map.current.on('load', () => {
|
|
43
|
+
console.log('π§ͺ [DEBUG TEST] Map loaded, adding test markers...');
|
|
44
|
+
|
|
45
|
+
projects.forEach((project, index) => {
|
|
46
|
+
console.log(`π§ͺ [DEBUG TEST] Processing project ${index}:`, project);
|
|
47
|
+
|
|
48
|
+
// Create simple marker
|
|
49
|
+
const el = document.createElement('div');
|
|
50
|
+
el.style.width = '20px';
|
|
51
|
+
el.style.height = '20px';
|
|
52
|
+
el.style.backgroundColor = '#FF0000';
|
|
53
|
+
el.style.borderRadius = '50%';
|
|
54
|
+
el.style.border = '2px solid white';
|
|
55
|
+
el.style.cursor = 'pointer';
|
|
56
|
+
el.style.boxShadow = '0px 3px 6px rgba(0,0,0,0.3)';
|
|
57
|
+
|
|
58
|
+
// Get coordinates
|
|
59
|
+
const lng = Number(project.longitude);
|
|
60
|
+
const lat = Number(project.latitude);
|
|
61
|
+
|
|
62
|
+
console.log(`π§ͺ [DEBUG TEST] Coordinates for ${project.name}:`, {
|
|
63
|
+
original: { longitude: project.longitude, latitude: project.latitude },
|
|
64
|
+
processed: { lng, lat },
|
|
65
|
+
valid: !isNaN(lng) && !isNaN(lat) && lng >= -180 && lng <= 180 && lat >= -90 && lat <= 90
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
if (isNaN(lng) || isNaN(lat) || lng < -180 || lng > 180 || lat < -90 || lat > 90) {
|
|
69
|
+
console.error(`β [DEBUG TEST] Invalid coordinates for ${project.name}:`, { lng, lat });
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Create popup
|
|
74
|
+
const popup = new mapboxgl.Popup({ offset: 25 })
|
|
75
|
+
.setHTML(`
|
|
76
|
+
<div style="padding: 8px;">
|
|
77
|
+
<h3 style="margin: 0 0 8px 0; font-size: 14px;">${project.name}</h3>
|
|
78
|
+
<p style="margin: 0; font-size: 12px; color: #666;">
|
|
79
|
+
Lat: ${lat.toFixed(4)}, Lng: ${lng.toFixed(4)}
|
|
80
|
+
</p>
|
|
81
|
+
<p style="margin: 4px 0 0 0; font-size: 12px;">
|
|
82
|
+
${project.projectDescription || 'No description'}
|
|
83
|
+
</p>
|
|
84
|
+
</div>
|
|
85
|
+
`);
|
|
86
|
+
|
|
87
|
+
// Add marker with explicit positioning
|
|
88
|
+
const marker = new mapboxgl.Marker({
|
|
89
|
+
element: el,
|
|
90
|
+
anchor: 'center'
|
|
91
|
+
})
|
|
92
|
+
.setLngLat([lng, lat])
|
|
93
|
+
.setPopup(popup)
|
|
94
|
+
.addTo(map.current);
|
|
95
|
+
|
|
96
|
+
// Verify position after a delay
|
|
97
|
+
setTimeout(() => {
|
|
98
|
+
const markerLngLat = marker.getLngLat();
|
|
99
|
+
const positionMatch = Math.abs(markerLngLat.lng - lng) < 0.0001 && Math.abs(markerLngLat.lat - lat) < 0.0001;
|
|
100
|
+
|
|
101
|
+
console.log(`π [DEBUG TEST] Position verification for ${project.name}:`, {
|
|
102
|
+
expected: [lng, lat],
|
|
103
|
+
actual: [markerLngLat.lng, markerLngLat.lat],
|
|
104
|
+
match: positionMatch,
|
|
105
|
+
difference: {
|
|
106
|
+
lng: Math.abs(markerLngLat.lng - lng),
|
|
107
|
+
lat: Math.abs(markerLngLat.lat - lat)
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
if (!positionMatch) {
|
|
112
|
+
console.error(`β [DEBUG TEST] Position mismatch for ${project.name}!`);
|
|
113
|
+
}
|
|
114
|
+
}, 200);
|
|
115
|
+
|
|
116
|
+
console.log(`β
[DEBUG TEST] Marker added for ${project.name} at:`, [lng, lat]);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
return () => {
|
|
121
|
+
if (map.current) {
|
|
122
|
+
map.current.remove();
|
|
123
|
+
map.current = null;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
}, [projects]);
|
|
127
|
+
|
|
128
|
+
return (
|
|
129
|
+
<div style={{
|
|
130
|
+
width: '100%',
|
|
131
|
+
height: '600px',
|
|
132
|
+
border: '2px solid #ccc',
|
|
133
|
+
position: 'relative'
|
|
134
|
+
}}>
|
|
135
|
+
<div
|
|
136
|
+
ref={mapContainer}
|
|
137
|
+
style={{
|
|
138
|
+
width: '100%',
|
|
139
|
+
height: '100%',
|
|
140
|
+
position: 'relative'
|
|
141
|
+
}}
|
|
142
|
+
/>
|
|
143
|
+
<div style={{
|
|
144
|
+
position: 'absolute',
|
|
145
|
+
top: '10px',
|
|
146
|
+
left: '10px',
|
|
147
|
+
background: 'rgba(255,255,255,0.9)',
|
|
148
|
+
padding: '8px',
|
|
149
|
+
borderRadius: '4px',
|
|
150
|
+
fontSize: '12px',
|
|
151
|
+
zIndex: 1000
|
|
152
|
+
}}>
|
|
153
|
+
<strong>Debug Test Map</strong><br/>
|
|
154
|
+
Projects: {projects.length}<br/>
|
|
155
|
+
Check console for position verification
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
);
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export default SimpleGlobeTestDebug;
|
|
162
|
+
|
|
163
|
+
// Example usage:
|
|
164
|
+
/*
|
|
165
|
+
import SimpleGlobeTestDebug from './SimpleGlobeTestDebug';
|
|
166
|
+
|
|
167
|
+
const MyComponent = () => {
|
|
168
|
+
const projects = [
|
|
169
|
+
{
|
|
170
|
+
name: "Test Project",
|
|
171
|
+
latitude: 14.7167,
|
|
172
|
+
longitude: -17.4677,
|
|
173
|
+
projectDescription: "Test project in Dakar"
|
|
174
|
+
}
|
|
175
|
+
];
|
|
176
|
+
|
|
177
|
+
return (
|
|
178
|
+
<div style={{ width: '100%', height: '600px' }}>
|
|
179
|
+
<SimpleGlobeTestDebug projects={projects} />
|
|
180
|
+
</div>
|
|
181
|
+
);
|
|
182
|
+
};
|
|
183
|
+
*/
|
package/src/index.js
CHANGED
|
@@ -63,6 +63,7 @@ export { default as MineSiteMap } from "./@daf/core/components/Dashboard/Map/ind
|
|
|
63
63
|
export { default as InExpandableWidgetMap } from "./@daf/core/components/Dashboard/Map/InExpandableWidgetMap/index.jsx";
|
|
64
64
|
export { default as Globe } from "./@daf/core/components/Dashboard/Globe/index.jsx";
|
|
65
65
|
export { default as SimpleGlobe } from "./@daf/core/components/Dashboard/Globe/SimpleGlobe.jsx";
|
|
66
|
+
export { default as SimpleGlobeTestDebug } from "./@daf/core/components/Dashboard/Globe/SimpleGlobeTestDebug.jsx";
|
|
66
67
|
export { default as WidgetPlaceholder } from "./@daf/core/components/Dashboard/Widget/WidgetPlaceholder/index.jsx";
|
|
67
68
|
export { default as Steps } from "./@daf/core/components/Dashboard/Steps/index.jsx";
|
|
68
69
|
export { default as DashboardLayout } from "./@daf/core/components/Dashboard/DashboardLayout/index.jsx";
|