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.
@@ -1,150 +0,0 @@
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;
@@ -1,183 +0,0 @@
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
- */