datastake-daf 0.6.283 β 0.6.285
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 +333 -122
- package/dist/style/datastake/mapbox-gl.css +330 -0
- package/package.json +1 -1
- package/src/@daf/core/components/Dashboard/Globe/CSSInJSGlobe.jsx +415 -0
- package/src/@daf/core/components/Dashboard/Globe/IsolatedGlobe.jsx +345 -0
- package/src/@daf/core/components/Dashboard/Globe/NoConflictGlobe.jsx +488 -0
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobe.jsx +17 -111
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobe.stories.js +14 -13
- package/src/index.js +2 -1
- package/src/styles/datastake/mapbox-gl.css +330 -0
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobeStraatosDebug.jsx +0 -322
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobeStraatosDebug.standalone.jsx +0 -349
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobeTestDebug.jsx +0 -150
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobeTestDebug.standalone.jsx +0 -183
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import mapboxgl from 'mapbox-gl';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* NoConflictGlobe - Mapbox component with aggressive CSS isolation
|
|
6
|
+
* Uses unique CSS classes and inline styles to prevent any conflicts
|
|
7
|
+
*/
|
|
8
|
+
const NoConflictGlobe = ({
|
|
9
|
+
projects = [],
|
|
10
|
+
mapConfig = {},
|
|
11
|
+
onProjectClick = () => {},
|
|
12
|
+
type = "default",
|
|
13
|
+
color = "#00809E"
|
|
14
|
+
}) => {
|
|
15
|
+
const mapContainer = useRef(null);
|
|
16
|
+
const map = useRef(null);
|
|
17
|
+
const boundsRef = useRef(null);
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (map.current) return;
|
|
21
|
+
|
|
22
|
+
console.log('πΊοΈ [NO CONFLICT GLOBE] Creating map with aggressive isolation...');
|
|
23
|
+
|
|
24
|
+
// Set Mapbox access token
|
|
25
|
+
mapboxgl.accessToken = 'pk.eyJ1IjoicmVkaXM5OTkiLCJhIjoiY2x4YWV5MzA5MmtuZzJpcXM5Y201Z2E2YiJ9.m5bwPg-Tj4Akesl1yQUa3w';
|
|
26
|
+
|
|
27
|
+
// Create map
|
|
28
|
+
map.current = new mapboxgl.Map({
|
|
29
|
+
container: mapContainer.current,
|
|
30
|
+
style: 'mapbox://styles/mapbox/satellite-v9',
|
|
31
|
+
center: [0, 0],
|
|
32
|
+
zoom: mapConfig.maxZoom || 3,
|
|
33
|
+
projection: 'globe',
|
|
34
|
+
attributionControl: false
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Add markers when map loads
|
|
38
|
+
map.current.on('load', () => {
|
|
39
|
+
console.log('πΊοΈ [NO CONFLICT GLOBE] Map loaded, adding markers...');
|
|
40
|
+
|
|
41
|
+
// Inject aggressive CSS isolation
|
|
42
|
+
const styleId = 'no-conflict-globe-styles';
|
|
43
|
+
let existingStyle = document.getElementById(styleId);
|
|
44
|
+
if (!existingStyle) {
|
|
45
|
+
const style = document.createElement('style');
|
|
46
|
+
style.id = styleId;
|
|
47
|
+
style.textContent = `
|
|
48
|
+
/* NO CONFLICT GLOBE - Aggressive CSS Isolation */
|
|
49
|
+
.no-conflict-globe-container {
|
|
50
|
+
position: relative !important;
|
|
51
|
+
width: 100% !important;
|
|
52
|
+
height: 100% !important;
|
|
53
|
+
overflow: hidden !important;
|
|
54
|
+
font: 12px/20px Helvetica Neue, Arial, Helvetica, sans-serif !important;
|
|
55
|
+
-webkit-tap-highlight-color: rgb(0 0 0/0) !important;
|
|
56
|
+
isolation: isolate !important;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.no-conflict-globe-container .mapboxgl-canvas-container {
|
|
60
|
+
position: relative !important;
|
|
61
|
+
left: 0 !important;
|
|
62
|
+
top: 0 !important;
|
|
63
|
+
transform: none !important;
|
|
64
|
+
width: 100% !important;
|
|
65
|
+
height: 100% !important;
|
|
66
|
+
overflow: hidden !important;
|
|
67
|
+
isolation: isolate !important;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.no-conflict-globe-container .mapboxgl-canvas-container canvas {
|
|
71
|
+
position: absolute !important;
|
|
72
|
+
left: 0 !important;
|
|
73
|
+
top: 0 !important;
|
|
74
|
+
transform: none !important;
|
|
75
|
+
width: 100% !important;
|
|
76
|
+
height: 100% !important;
|
|
77
|
+
isolation: isolate !important;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* Override ALL possible Leaflet CSS interference */
|
|
81
|
+
.no-conflict-globe-container .mapboxgl-marker {
|
|
82
|
+
position: absolute !important;
|
|
83
|
+
left: auto !important;
|
|
84
|
+
top: auto !important;
|
|
85
|
+
transform: none !important;
|
|
86
|
+
pointer-events: auto !important;
|
|
87
|
+
z-index: 1000 !important;
|
|
88
|
+
isolation: isolate !important;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.no-conflict-globe-container .mapboxgl-marker .no-conflict-marker {
|
|
92
|
+
position: relative !important;
|
|
93
|
+
left: auto !important;
|
|
94
|
+
top: auto !important;
|
|
95
|
+
transform: none !important;
|
|
96
|
+
pointer-events: auto !important;
|
|
97
|
+
cursor: pointer !important;
|
|
98
|
+
display: flex !important;
|
|
99
|
+
align-items: center !important;
|
|
100
|
+
justify-content: center !important;
|
|
101
|
+
isolation: isolate !important;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Override Leaflet pane positioning */
|
|
105
|
+
.no-conflict-globe-container .mapboxgl-marker-pane {
|
|
106
|
+
position: absolute !important;
|
|
107
|
+
left: 0 !important;
|
|
108
|
+
top: 0 !important;
|
|
109
|
+
transform: none !important;
|
|
110
|
+
z-index: 600 !important;
|
|
111
|
+
isolation: isolate !important;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.no-conflict-globe-container .mapboxgl-tile-container {
|
|
115
|
+
position: absolute !important;
|
|
116
|
+
left: 0 !important;
|
|
117
|
+
top: 0 !important;
|
|
118
|
+
transform: none !important;
|
|
119
|
+
isolation: isolate !important;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.no-conflict-globe-container .mapboxgl-zoom-animated {
|
|
123
|
+
transform-origin: 0 0 !important;
|
|
124
|
+
isolation: isolate !important;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.no-conflict-globe-container .mapboxgl-marker.leaflet-interactive {
|
|
128
|
+
cursor: pointer !important;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/* Popup styles with isolation */
|
|
132
|
+
.no-conflict-globe-container .mapboxgl-popup {
|
|
133
|
+
position: absolute !important;
|
|
134
|
+
left: auto !important;
|
|
135
|
+
top: auto !important;
|
|
136
|
+
transform: none !important;
|
|
137
|
+
z-index: 700 !important;
|
|
138
|
+
text-align: center !important;
|
|
139
|
+
margin-bottom: 20px !important;
|
|
140
|
+
isolation: isolate !important;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.no-conflict-globe-container .mapboxgl-popup-content-wrapper {
|
|
144
|
+
padding: 1px !important;
|
|
145
|
+
text-align: left !important;
|
|
146
|
+
border-radius: 12px !important;
|
|
147
|
+
background: white !important;
|
|
148
|
+
color: #333 !important;
|
|
149
|
+
box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4) !important;
|
|
150
|
+
isolation: isolate !important;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.no-conflict-globe-container .mapboxgl-popup-content {
|
|
154
|
+
margin: 13px 24px 13px 20px !important;
|
|
155
|
+
line-height: 1.3 !important;
|
|
156
|
+
font-size: 13px !important;
|
|
157
|
+
min-height: 1px !important;
|
|
158
|
+
isolation: isolate !important;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.no-conflict-globe-container .mapboxgl-popup-content p {
|
|
162
|
+
margin: 17px 0 !important;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.no-conflict-globe-container .mapboxgl-popup-tip-container {
|
|
166
|
+
width: 40px !important;
|
|
167
|
+
height: 20px !important;
|
|
168
|
+
position: absolute !important;
|
|
169
|
+
left: 50% !important;
|
|
170
|
+
margin-top: -1px !important;
|
|
171
|
+
margin-left: -20px !important;
|
|
172
|
+
overflow: hidden !important;
|
|
173
|
+
pointer-events: none !important;
|
|
174
|
+
isolation: isolate !important;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.no-conflict-globe-container .mapboxgl-popup-tip {
|
|
178
|
+
width: 17px !important;
|
|
179
|
+
height: 17px !important;
|
|
180
|
+
padding: 1px !important;
|
|
181
|
+
margin: -10px auto 0 !important;
|
|
182
|
+
pointer-events: auto !important;
|
|
183
|
+
transform: rotate(45deg) !important;
|
|
184
|
+
background: white !important;
|
|
185
|
+
box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4) !important;
|
|
186
|
+
isolation: isolate !important;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.no-conflict-globe-container .mapboxgl-popup-close-button {
|
|
190
|
+
position: absolute !important;
|
|
191
|
+
top: 0 !important;
|
|
192
|
+
right: 0 !important;
|
|
193
|
+
border: none !important;
|
|
194
|
+
text-align: center !important;
|
|
195
|
+
width: 24px !important;
|
|
196
|
+
height: 24px !important;
|
|
197
|
+
font: 16px/24px Tahoma, Verdana, sans-serif !important;
|
|
198
|
+
color: #757575 !important;
|
|
199
|
+
text-decoration: none !important;
|
|
200
|
+
background: transparent !important;
|
|
201
|
+
cursor: pointer !important;
|
|
202
|
+
isolation: isolate !important;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.no-conflict-globe-container .mapboxgl-popup-close-button:hover {
|
|
206
|
+
color: #585858 !important;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/* Hide Mapbox attribution completely */
|
|
210
|
+
.no-conflict-globe-container .mapboxgl-ctrl-attribution {
|
|
211
|
+
display: none !important;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.no-conflict-globe-container .mapboxgl-ctrl-logo {
|
|
215
|
+
display: none !important;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/* Override any Leaflet pane positioning */
|
|
219
|
+
.no-conflict-globe-container .mapboxgl-overlay-pane {
|
|
220
|
+
position: absolute !important;
|
|
221
|
+
left: 0 !important;
|
|
222
|
+
top: 0 !important;
|
|
223
|
+
transform: none !important;
|
|
224
|
+
z-index: 400 !important;
|
|
225
|
+
isolation: isolate !important;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.no-conflict-globe-container .mapboxgl-shadow-pane {
|
|
229
|
+
position: absolute !important;
|
|
230
|
+
left: 0 !important;
|
|
231
|
+
top: 0 !important;
|
|
232
|
+
transform: none !important;
|
|
233
|
+
z-index: 500 !important;
|
|
234
|
+
isolation: isolate !important;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.no-conflict-globe-container .mapboxgl-tooltip-pane {
|
|
238
|
+
position: absolute !important;
|
|
239
|
+
left: 0 !important;
|
|
240
|
+
top: 0 !important;
|
|
241
|
+
transform: none !important;
|
|
242
|
+
z-index: 650 !important;
|
|
243
|
+
isolation: isolate !important;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.no-conflict-globe-container .mapboxgl-popup-pane {
|
|
247
|
+
position: absolute !important;
|
|
248
|
+
left: 0 !important;
|
|
249
|
+
top: 0 !important;
|
|
250
|
+
transform: none !important;
|
|
251
|
+
z-index: 700 !important;
|
|
252
|
+
isolation: isolate !important;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/* Override any Leaflet div icon styles */
|
|
256
|
+
.no-conflict-globe-container .mapboxgl-marker .leaflet-div-icon {
|
|
257
|
+
background: none !important;
|
|
258
|
+
border: none !important;
|
|
259
|
+
position: relative !important;
|
|
260
|
+
left: auto !important;
|
|
261
|
+
top: auto !important;
|
|
262
|
+
transform: none !important;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/* Override any Leaflet marker icon styles */
|
|
266
|
+
.no-conflict-globe-container .mapboxgl-marker .leaflet-marker-icon {
|
|
267
|
+
position: relative !important;
|
|
268
|
+
left: auto !important;
|
|
269
|
+
top: auto !important;
|
|
270
|
+
transform: none !important;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/* Override any Leaflet marker shadow styles */
|
|
274
|
+
.no-conflict-globe-container .mapboxgl-marker .leaflet-marker-shadow {
|
|
275
|
+
display: none !important;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/* Override any Leaflet interactive styles */
|
|
279
|
+
.no-conflict-globe-container .mapboxgl-marker.leaflet-interactive {
|
|
280
|
+
cursor: pointer !important;
|
|
281
|
+
pointer-events: auto !important;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/* Override any Leaflet zoom animations */
|
|
285
|
+
.no-conflict-globe-container .mapboxgl-zoom-animated {
|
|
286
|
+
transform-origin: 0 0 !important;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/* Override any Leaflet tile styles */
|
|
290
|
+
.no-conflict-globe-container .mapboxgl-tile {
|
|
291
|
+
position: absolute !important;
|
|
292
|
+
left: 0 !important;
|
|
293
|
+
top: 0 !important;
|
|
294
|
+
transform: none !important;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/* Override any Leaflet image layer styles */
|
|
298
|
+
.no-conflict-globe-container .mapboxgl-image-layer {
|
|
299
|
+
position: absolute !important;
|
|
300
|
+
left: 0 !important;
|
|
301
|
+
top: 0 !important;
|
|
302
|
+
transform: none !important;
|
|
303
|
+
}
|
|
304
|
+
`;
|
|
305
|
+
document.head.appendChild(style);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// Calculate bounds to fit all markers
|
|
309
|
+
const bounds = new mapboxgl.LngLatBounds();
|
|
310
|
+
let hasValidCoordinates = false;
|
|
311
|
+
|
|
312
|
+
projects.forEach((project, index) => {
|
|
313
|
+
console.log(`π [NO CONFLICT GLOBE] Adding marker ${index}:`, project);
|
|
314
|
+
|
|
315
|
+
// Create marker element with unique class
|
|
316
|
+
const el = document.createElement('div');
|
|
317
|
+
el.className = 'no-conflict-marker';
|
|
318
|
+
el.style.cursor = 'pointer';
|
|
319
|
+
el.style.boxShadow = '0px 3.45px 3.45px 0px #00000029';
|
|
320
|
+
el.style.display = 'flex';
|
|
321
|
+
el.style.alignItems = 'center';
|
|
322
|
+
el.style.justifyContent = 'center';
|
|
323
|
+
el.style.position = 'relative';
|
|
324
|
+
el.style.left = 'auto';
|
|
325
|
+
el.style.top = 'auto';
|
|
326
|
+
el.style.transform = 'none';
|
|
327
|
+
el.style.zIndex = '1000';
|
|
328
|
+
el.style.isolation = 'isolate';
|
|
329
|
+
|
|
330
|
+
if (type === "location") {
|
|
331
|
+
// Location marker - SVG map pin style
|
|
332
|
+
el.style.width = '28px';
|
|
333
|
+
el.style.height = '33px';
|
|
334
|
+
el.innerHTML = `
|
|
335
|
+
<svg
|
|
336
|
+
width="28"
|
|
337
|
+
height="33"
|
|
338
|
+
viewBox="0 0 28 33"
|
|
339
|
+
fill="none"
|
|
340
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
341
|
+
>
|
|
342
|
+
<path
|
|
343
|
+
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"
|
|
344
|
+
fill="${color}"
|
|
345
|
+
stroke="white"
|
|
346
|
+
/>
|
|
347
|
+
</svg>
|
|
348
|
+
`;
|
|
349
|
+
} else {
|
|
350
|
+
// Default circular marker style
|
|
351
|
+
el.style.width = '30px';
|
|
352
|
+
el.style.height = '30px';
|
|
353
|
+
el.style.backgroundColor = color;
|
|
354
|
+
el.style.borderRadius = '50%';
|
|
355
|
+
el.style.border = '2px solid white';
|
|
356
|
+
el.style.color = 'white';
|
|
357
|
+
el.style.fontWeight = 'bold';
|
|
358
|
+
el.style.fontSize = '14px';
|
|
359
|
+
el.style.textAlign = 'center';
|
|
360
|
+
el.style.lineHeight = '1';
|
|
361
|
+
el.innerHTML = `<span style="display: block; line-height: 1;">${project.percentageCompletion || 0}</span>`;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// Create popup content
|
|
365
|
+
const popupContent = `
|
|
366
|
+
<div style="padding: 12px; min-width: 200px;">
|
|
367
|
+
<h3 style="margin: 0 0 8px 0; font-size: 16px; color: #333;">${project.name}</h3>
|
|
368
|
+
<p style="margin: 0 0 4px 0; font-size: 12px; color: #666;">
|
|
369
|
+
<strong>Country:</strong> ${project.country || 'N/A'}
|
|
370
|
+
</p>
|
|
371
|
+
<p style="margin: 0 0 4px 0; font-size: 12px; color: #666;">
|
|
372
|
+
<strong>Sector:</strong> ${project.sectoralScope || 'Project'}
|
|
373
|
+
</p>
|
|
374
|
+
<p style="margin: 0 0 4px 0; font-size: 12px; color: #666;">
|
|
375
|
+
<strong>Completion:</strong> ${project.percentageCompletion || 0}%
|
|
376
|
+
</p>
|
|
377
|
+
<p style="margin: 4px 0 0 0; font-size: 12px; color: #666;">
|
|
378
|
+
<strong>Coordinates:</strong> ${Number(project.latitude).toFixed(4)}, ${Number(project.longitude).toFixed(4)}
|
|
379
|
+
</p>
|
|
380
|
+
</div>
|
|
381
|
+
`;
|
|
382
|
+
|
|
383
|
+
// Create popup
|
|
384
|
+
const popup = new mapboxgl.Popup({
|
|
385
|
+
offset: 25,
|
|
386
|
+
closeButton: true,
|
|
387
|
+
closeOnClick: false
|
|
388
|
+
}).setHTML(popupContent);
|
|
389
|
+
|
|
390
|
+
// Ensure coordinates are valid numbers
|
|
391
|
+
const lng = Number(project.longitude);
|
|
392
|
+
const lat = Number(project.latitude);
|
|
393
|
+
|
|
394
|
+
console.log(`π [NO CONFLICT GLOBE] Marker ${index} coordinates:`, {
|
|
395
|
+
original: { longitude: project.longitude, latitude: project.latitude },
|
|
396
|
+
processed: { lng, lat },
|
|
397
|
+
project: project.name
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
// Validate coordinates
|
|
401
|
+
if (isNaN(lng) || isNaN(lat) || lng < -180 || lng > 180 || lat < -90 || lat > 90) {
|
|
402
|
+
console.error(`β [NO CONFLICT GLOBE] Invalid coordinates for project ${index}:`, {
|
|
403
|
+
lng, lat,
|
|
404
|
+
original: { longitude: project.longitude, latitude: project.latitude },
|
|
405
|
+
project: project.name
|
|
406
|
+
});
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// Add coordinates to bounds
|
|
411
|
+
bounds.extend([lng, lat]);
|
|
412
|
+
hasValidCoordinates = true;
|
|
413
|
+
|
|
414
|
+
// Create marker with explicit positioning
|
|
415
|
+
const marker = new mapboxgl.Marker({
|
|
416
|
+
element: el,
|
|
417
|
+
anchor: 'center'
|
|
418
|
+
})
|
|
419
|
+
.setLngLat([lng, lat])
|
|
420
|
+
.setPopup(popup)
|
|
421
|
+
.addTo(map.current);
|
|
422
|
+
|
|
423
|
+
// Add click handler
|
|
424
|
+
el.addEventListener('click', () => {
|
|
425
|
+
console.log('π [NO CONFLICT GLOBE] Marker clicked:', project);
|
|
426
|
+
onProjectClick(project);
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
// Verify marker position after a short delay
|
|
430
|
+
setTimeout(() => {
|
|
431
|
+
const markerLngLat = marker.getLngLat();
|
|
432
|
+
console.log(`π [NO CONFLICT GLOBE] Marker ${index} position verification:`, {
|
|
433
|
+
expected: [lng, lat],
|
|
434
|
+
actual: [markerLngLat.lng, markerLngLat.lat],
|
|
435
|
+
project: project.name,
|
|
436
|
+
match: Math.abs(markerLngLat.lng - lng) < 0.0001 && Math.abs(markerLngLat.lat - lat) < 0.0001
|
|
437
|
+
});
|
|
438
|
+
}, 100);
|
|
439
|
+
|
|
440
|
+
console.log(`β
[NO CONFLICT GLOBE] Marker ${index} added at:`, [lng, lat]);
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
// Fit map to show all markers if we have valid coordinates
|
|
444
|
+
if (hasValidCoordinates && !bounds.isEmpty()) {
|
|
445
|
+
console.log('πΊοΈ [NO CONFLICT GLOBE] Fitting map to bounds:', bounds);
|
|
446
|
+
map.current.fitBounds(bounds, {
|
|
447
|
+
padding: { top: 20, bottom: 20, left: 20, right: 20 },
|
|
448
|
+
maxZoom: 6,
|
|
449
|
+
duration: 1000
|
|
450
|
+
});
|
|
451
|
+
boundsRef.current = bounds;
|
|
452
|
+
} else {
|
|
453
|
+
boundsRef.current = null;
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
return () => {
|
|
458
|
+
if (map.current) {
|
|
459
|
+
map.current.remove();
|
|
460
|
+
map.current = null;
|
|
461
|
+
}
|
|
462
|
+
};
|
|
463
|
+
}, [projects, onProjectClick, mapConfig]);
|
|
464
|
+
|
|
465
|
+
return (
|
|
466
|
+
<div
|
|
467
|
+
className="no-conflict-globe-container"
|
|
468
|
+
style={{
|
|
469
|
+
width: '100%',
|
|
470
|
+
height: '100%',
|
|
471
|
+
position: 'relative',
|
|
472
|
+
isolation: 'isolate'
|
|
473
|
+
}}
|
|
474
|
+
>
|
|
475
|
+
<div
|
|
476
|
+
ref={mapContainer}
|
|
477
|
+
style={{
|
|
478
|
+
width: '100%',
|
|
479
|
+
height: '100%',
|
|
480
|
+
position: 'relative',
|
|
481
|
+
isolation: 'isolate'
|
|
482
|
+
}}
|
|
483
|
+
/>
|
|
484
|
+
</div>
|
|
485
|
+
);
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
export default NoConflictGlobe;
|
|
@@ -47,29 +47,15 @@ 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
|
-
|
|
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
|
-
}
|
|
50
|
+
// Create map with custom Straatos style
|
|
51
|
+
map.current = new mapboxgl.Map({
|
|
52
|
+
container: mapContainer.current,
|
|
53
|
+
style: 'mapbox://styles/pietragottardo/cm9tt9zfi00d101pg1vdx26si',
|
|
54
|
+
center: [0, 0],
|
|
55
|
+
zoom: mapConfig.maxZoom || 3,
|
|
56
|
+
projection: 'globe',
|
|
57
|
+
attributionControl: false
|
|
58
|
+
});
|
|
73
59
|
|
|
74
60
|
// Add markers when map loads
|
|
75
61
|
map.current.on('load', () => {
|
|
@@ -91,13 +77,11 @@ const SimpleGlobe = ({
|
|
|
91
77
|
.mapboxgl-canvas {
|
|
92
78
|
overflow: hidden !important;
|
|
93
79
|
}
|
|
94
|
-
|
|
95
|
-
/* AGGRESSIVE CSS ISOLATION: Override ALL Leaflet CSS interference */
|
|
80
|
+
/* CRITICAL: Override Leaflet CSS interference with Mapbox */
|
|
96
81
|
.daf-simple-globe-container .mapboxgl-canvas-container {
|
|
97
82
|
position: relative !important;
|
|
98
83
|
left: auto !important;
|
|
99
84
|
top: auto !important;
|
|
100
|
-
transform: none !important;
|
|
101
85
|
}
|
|
102
86
|
.daf-simple-globe-container .mapboxgl-canvas-container canvas {
|
|
103
87
|
position: relative !important;
|
|
@@ -105,61 +89,11 @@ const SimpleGlobe = ({
|
|
|
105
89
|
top: auto !important;
|
|
106
90
|
transform: none !important;
|
|
107
91
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
.daf-simple-globe-container .mapboxgl-marker {
|
|
111
|
-
position: absolute !important;
|
|
112
|
-
left: auto !important;
|
|
113
|
-
top: auto !important;
|
|
114
|
-
transform: none !important;
|
|
115
|
-
pointer-events: auto !important;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/* Override Leaflet div icon styles */
|
|
119
|
-
.daf-simple-globe-container .mapboxgl-marker .daf-globe-marker {
|
|
92
|
+
/* Prevent Leaflet styles from affecting Mapbox markers */
|
|
93
|
+
.daf-simple-globe-container .daf-globe-marker {
|
|
120
94
|
position: relative !important;
|
|
121
95
|
left: auto !important;
|
|
122
96
|
top: auto !important;
|
|
123
|
-
transform: none !important;
|
|
124
|
-
width: auto !important;
|
|
125
|
-
height: auto !important;
|
|
126
|
-
background: none !important;
|
|
127
|
-
border: none !important;
|
|
128
|
-
pointer-events: auto !important;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/* Override any Leaflet pane positioning */
|
|
132
|
-
.daf-simple-globe-container .mapboxgl-marker-pane {
|
|
133
|
-
position: absolute !important;
|
|
134
|
-
left: 0 !important;
|
|
135
|
-
top: 0 !important;
|
|
136
|
-
transform: none !important;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/* Override Leaflet tile container interference */
|
|
140
|
-
.daf-simple-globe-container .mapboxgl-tile-container {
|
|
141
|
-
position: absolute !important;
|
|
142
|
-
left: 0 !important;
|
|
143
|
-
top: 0 !important;
|
|
144
|
-
transform: none !important;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/* Override any Leaflet zoom animations */
|
|
148
|
-
.daf-simple-globe-container .mapboxgl-zoom-animated {
|
|
149
|
-
transform-origin: 0 0 !important;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/* Override Leaflet interactive cursor styles */
|
|
153
|
-
.daf-simple-globe-container .mapboxgl-marker.leaflet-interactive {
|
|
154
|
-
cursor: pointer !important;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/* Override Leaflet popup positioning */
|
|
158
|
-
.daf-simple-globe-container .mapboxgl-popup {
|
|
159
|
-
position: absolute !important;
|
|
160
|
-
left: auto !important;
|
|
161
|
-
top: auto !important;
|
|
162
|
-
transform: none !important;
|
|
163
97
|
}
|
|
164
98
|
`;
|
|
165
99
|
document.head.appendChild(style);
|
|
@@ -205,12 +139,6 @@ const SimpleGlobe = ({
|
|
|
205
139
|
el.style.display = 'flex';
|
|
206
140
|
el.style.alignItems = 'center';
|
|
207
141
|
el.style.justifyContent = 'center';
|
|
208
|
-
// Ensure proper positioning and prevent CSS interference
|
|
209
|
-
el.style.position = 'relative';
|
|
210
|
-
el.style.left = 'auto';
|
|
211
|
-
el.style.top = 'auto';
|
|
212
|
-
el.style.transform = 'none';
|
|
213
|
-
el.style.zIndex = '1000';
|
|
214
142
|
|
|
215
143
|
if (type === "location") {
|
|
216
144
|
// Location marker - SVG map pin style
|
|
@@ -289,23 +217,15 @@ const SimpleGlobe = ({
|
|
|
289
217
|
closeOnClick: false
|
|
290
218
|
}).setHTML(popupContent);
|
|
291
219
|
|
|
292
|
-
// Ensure coordinates are valid numbers
|
|
220
|
+
// Ensure coordinates are valid numbers
|
|
293
221
|
const lng = Number(project.longitude);
|
|
294
222
|
const lat = Number(project.latitude);
|
|
295
223
|
|
|
296
|
-
console.log(`π [SIMPLE GLOBE] Marker ${index} coordinates:`, {
|
|
297
|
-
original: { longitude: project.longitude, latitude: project.latitude },
|
|
298
|
-
processed: { lng, lat },
|
|
299
|
-
project: project.name
|
|
300
|
-
});
|
|
224
|
+
console.log(`π [SIMPLE GLOBE] Marker ${index} coordinates:`, { lng, lat });
|
|
301
225
|
|
|
302
226
|
// Validate coordinates
|
|
303
227
|
if (isNaN(lng) || isNaN(lat) || lng < -180 || lng > 180 || lat < -90 || lat > 90) {
|
|
304
|
-
console.error(`β [SIMPLE GLOBE] Invalid coordinates for project ${index}:`, {
|
|
305
|
-
lng, lat,
|
|
306
|
-
original: { longitude: project.longitude, latitude: project.latitude },
|
|
307
|
-
project: project.name
|
|
308
|
-
});
|
|
228
|
+
console.error(`β [SIMPLE GLOBE] Invalid coordinates for project ${index}:`, { lng, lat });
|
|
309
229
|
return;
|
|
310
230
|
}
|
|
311
231
|
|
|
@@ -313,11 +233,8 @@ const SimpleGlobe = ({
|
|
|
313
233
|
bounds.extend([lng, lat]);
|
|
314
234
|
hasValidCoordinates = true;
|
|
315
235
|
|
|
316
|
-
//
|
|
317
|
-
const marker = new mapboxgl.Marker(
|
|
318
|
-
element: el,
|
|
319
|
-
anchor: 'center'
|
|
320
|
-
})
|
|
236
|
+
// Add marker to map with proper coordinate order [lng, lat]
|
|
237
|
+
const marker = new mapboxgl.Marker(el)
|
|
321
238
|
.setLngLat([lng, lat])
|
|
322
239
|
.setPopup(popup)
|
|
323
240
|
.addTo(map.current);
|
|
@@ -327,17 +244,6 @@ const SimpleGlobe = ({
|
|
|
327
244
|
console.log('π [SIMPLE GLOBE] Marker clicked:', project);
|
|
328
245
|
onProjectClick(project);
|
|
329
246
|
});
|
|
330
|
-
|
|
331
|
-
// Verify marker position after a short delay
|
|
332
|
-
setTimeout(() => {
|
|
333
|
-
const markerLngLat = marker.getLngLat();
|
|
334
|
-
console.log(`π [SIMPLE GLOBE] Marker ${index} position verification:`, {
|
|
335
|
-
expected: [lng, lat],
|
|
336
|
-
actual: [markerLngLat.lng, markerLngLat.lat],
|
|
337
|
-
project: project.name,
|
|
338
|
-
match: Math.abs(markerLngLat.lng - lng) < 0.0001 && Math.abs(markerLngLat.lat - lat) < 0.0001
|
|
339
|
-
});
|
|
340
|
-
}, 100);
|
|
341
247
|
|
|
342
248
|
console.log(`β
[SIMPLE GLOBE] Marker ${index} added at:`, [lng, lat]);
|
|
343
249
|
});
|