datastake-daf 0.6.272 β 0.6.273
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 +373 -317
- package/package.json +1 -1
- package/src/@daf/core/components/Dashboard/Globe/Globe.stories.js +30 -5
- package/src/@daf/core/components/Dashboard/Globe/README.md +106 -0
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobe.jsx +259 -0
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobe.stories.js +202 -0
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobeDebug.jsx +85 -0
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobeExample.jsx +75 -0
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobeTest.jsx +48 -0
- package/src/@daf/core/components/Dashboard/Globe/hook.js +63 -7
- package/src/@daf/core/components/Dashboard/Globe/index.jsx +24 -6
- package/src/@daf/core/components/Dashboard/Globe/storyConfig.js +243 -0
- package/src/@daf/core/components/Dashboard/Globe/storyConfig1.js +354 -0
- package/src/@daf/core/components/Dashboard/Globe/style.js +7 -23
- package/src/@daf/core/components/EditForm/EditForm.stories.js +0 -1
- package/src/@daf/core/components/EditForm/_index.scss +18 -64
- package/src/@daf/core/components/EditForm/form.jsx +2 -3
- package/src/@daf/core/components/ViewForm/ViewForm.stories.js +0 -1
- package/src/@daf/core/components/ViewForm/content.jsx +346 -386
- package/src/index.js +1 -0
- package/.env +0 -8
- package/.vscode/settings.json +0 -13
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
|
+
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# SimpleGlobe Component
|
|
2
|
+
|
|
3
|
+
A simplified wrapper for the Globe component that makes it easy to display project data as pins on a 3D globe.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- πΊοΈ **3D Globe Visualization**: Interactive 3D globe using Mapbox GL JS
|
|
8
|
+
- π **Pin-based Display**: Projects are displayed as clickable pins on the globe
|
|
9
|
+
- π― **Simple Integration**: Just pass your project data and it works
|
|
10
|
+
- π **Rich Tooltips**: Hover over pins to see project details
|
|
11
|
+
- π¨ **Customizable**: Support for custom map configurations
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```jsx
|
|
16
|
+
import SimpleGlobe from './SimpleGlobe';
|
|
17
|
+
|
|
18
|
+
const MyComponent = () => {
|
|
19
|
+
const projects = [
|
|
20
|
+
{
|
|
21
|
+
name: "Solar Project",
|
|
22
|
+
latitude: 14.7167,
|
|
23
|
+
longitude: -17.4677,
|
|
24
|
+
percentageCompletion: 75,
|
|
25
|
+
projectDescription: "Large-scale solar energy project"
|
|
26
|
+
}
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div style={{ width: '100%', height: '600px' }}>
|
|
31
|
+
<SimpleGlobe
|
|
32
|
+
projects={projects}
|
|
33
|
+
onProjectClick={(project) => console.log('Clicked:', project)}
|
|
34
|
+
/>
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Props
|
|
41
|
+
|
|
42
|
+
| Prop | Type | Default | Description |
|
|
43
|
+
|------|------|---------|-------------|
|
|
44
|
+
| `projects` | `Array` | `[]` | Array of project objects |
|
|
45
|
+
| `mapConfig` | `Object` | `{}` | Map configuration options |
|
|
46
|
+
| `showSider` | `boolean` | `false` | Whether to show the sidebar |
|
|
47
|
+
| `onProjectClick` | `Function` | `() => {}` | Callback when a project pin is clicked |
|
|
48
|
+
|
|
49
|
+
## Project Data Format
|
|
50
|
+
|
|
51
|
+
Your project objects should have the following structure:
|
|
52
|
+
|
|
53
|
+
```javascript
|
|
54
|
+
{
|
|
55
|
+
_id: "unique-id", // Optional: Unique identifier
|
|
56
|
+
name: "Project Name", // Required: Project name
|
|
57
|
+
latitude: 14.7167, // Required: Latitude coordinate
|
|
58
|
+
longitude: -17.4677, // Required: Longitude coordinate
|
|
59
|
+
projectDescription: "Description", // Optional: Project description
|
|
60
|
+
country: "SN", // Optional: Country code
|
|
61
|
+
sectoralScope: "energy", // Optional: Project sector
|
|
62
|
+
percentageCompletion: 75, // Optional: Completion percentage
|
|
63
|
+
author: { name: "Author Name" } // Optional: Author information
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Examples
|
|
68
|
+
|
|
69
|
+
### Basic Usage
|
|
70
|
+
```jsx
|
|
71
|
+
<SimpleGlobe projects={myProjects} />
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### With Sidebar
|
|
75
|
+
```jsx
|
|
76
|
+
<SimpleGlobe
|
|
77
|
+
projects={myProjects}
|
|
78
|
+
showSider={true}
|
|
79
|
+
/>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### With Custom Configuration
|
|
83
|
+
```jsx
|
|
84
|
+
<SimpleGlobe
|
|
85
|
+
projects={myProjects}
|
|
86
|
+
mapConfig={{
|
|
87
|
+
maxZoom: 8,
|
|
88
|
+
minZoom: 2
|
|
89
|
+
}}
|
|
90
|
+
onProjectClick={(project) => {
|
|
91
|
+
// Handle project click
|
|
92
|
+
console.log('Project clicked:', project);
|
|
93
|
+
}}
|
|
94
|
+
/>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Storybook
|
|
98
|
+
|
|
99
|
+
You can see all examples in Storybook under "Dashboard/Globe/SimpleGlobe".
|
|
100
|
+
|
|
101
|
+
## Notes
|
|
102
|
+
|
|
103
|
+
- The component automatically transforms your project data to the format expected by the underlying Globe component
|
|
104
|
+
- Pins are displayed as circular markers with project completion percentage
|
|
105
|
+
- Tooltips show project details when hovering over pins
|
|
106
|
+
- The globe is fully interactive - you can zoom, pan, and rotate
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import mapboxgl from 'mapbox-gl';
|
|
3
|
+
import 'mapbox-gl/dist/mapbox-gl.css';
|
|
4
|
+
import Style from './style';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* SimpleGlobe - A simplified wrapper for the Globe component
|
|
8
|
+
*
|
|
9
|
+
* This component makes it easy to display project data as pins on a 3D globe.
|
|
10
|
+
* Just pass your project data and it will automatically create pins at the specified locations.
|
|
11
|
+
*
|
|
12
|
+
* @param {Array} projects - Array of project objects with location data
|
|
13
|
+
* @param {string} projects[].name - Project name
|
|
14
|
+
* @param {number} projects[].latitude - Latitude coordinate
|
|
15
|
+
* @param {number} projects[].longitude - Longitude coordinate
|
|
16
|
+
* @param {string} projects[].description - Project description (optional)
|
|
17
|
+
* @param {string} projects[].country - Country code (optional)
|
|
18
|
+
* @param {string} projects[].sectoralScope - Project sector (optional)
|
|
19
|
+
* @param {number} projects[].percentageCompletion - Completion percentage (optional)
|
|
20
|
+
* @param {Object} projects[].author - Author information (optional)
|
|
21
|
+
* @param {Object} mapConfig - Map configuration options (optional)
|
|
22
|
+
* @param {boolean} showSider - Whether to show the sidebar (default: false)
|
|
23
|
+
* @param {Function} onProjectClick - Callback when a project pin is clicked
|
|
24
|
+
* @param {string} type - Marker type: "default" for circular markers, "location" for map pin markers
|
|
25
|
+
* @param {string} color - Marker color (default: "var(--color-primary-60)")
|
|
26
|
+
*/
|
|
27
|
+
const SimpleGlobe = ({
|
|
28
|
+
projects = [],
|
|
29
|
+
mapConfig = {},
|
|
30
|
+
showSider = false,
|
|
31
|
+
onProjectClick = () => {},
|
|
32
|
+
type = "default",
|
|
33
|
+
color = "var(--color-primary-60)"
|
|
34
|
+
}) => {
|
|
35
|
+
const mapContainer = useRef(null);
|
|
36
|
+
const map = useRef(null);
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (map.current) return; // Initialize map only once
|
|
40
|
+
|
|
41
|
+
console.log('πΊοΈ [SIMPLE GLOBE] Creating map...');
|
|
42
|
+
|
|
43
|
+
// Set Mapbox access token
|
|
44
|
+
mapboxgl.accessToken = 'pk.eyJ1IjoicmVkaXM5OTkiLCJhIjoiY2x4YWV5MzA5MmtuZzJpcXM5Y201Z2E2YiJ9.m5bwPg-Tj4Akesl1yQUa3w';
|
|
45
|
+
|
|
46
|
+
// Create map with custom Straatos style
|
|
47
|
+
map.current = new mapboxgl.Map({
|
|
48
|
+
container: mapContainer.current,
|
|
49
|
+
style: 'mapbox://styles/pietragottardo/cm9tt9zfi00d101pg1vdx26si',
|
|
50
|
+
center: [0, 0],
|
|
51
|
+
zoom: mapConfig.maxZoom || 3,
|
|
52
|
+
projection: 'globe',
|
|
53
|
+
attributionControl: false
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// Add markers when map loads
|
|
57
|
+
map.current.on('load', () => {
|
|
58
|
+
console.log('πΊοΈ [SIMPLE GLOBE] Map loaded, adding markers...');
|
|
59
|
+
|
|
60
|
+
// Hide Mapbox logo and attribution completely
|
|
61
|
+
const mapContainer = map.current.getContainer();
|
|
62
|
+
const style = document.createElement('style');
|
|
63
|
+
style.textContent = `
|
|
64
|
+
.mapboxgl-ctrl-logo,
|
|
65
|
+
.mapboxgl-ctrl-attrib,
|
|
66
|
+
.mapboxgl-ctrl-bottom-left,
|
|
67
|
+
.mapboxgl-ctrl-bottom-right {
|
|
68
|
+
display: none !important;
|
|
69
|
+
}
|
|
70
|
+
.mapboxgl-canvas-container {
|
|
71
|
+
overflow: hidden !important;
|
|
72
|
+
}
|
|
73
|
+
.mapboxgl-canvas {
|
|
74
|
+
overflow: hidden !important;
|
|
75
|
+
}
|
|
76
|
+
`;
|
|
77
|
+
document.head.appendChild(style);
|
|
78
|
+
|
|
79
|
+
// Set the space background with stars
|
|
80
|
+
try {
|
|
81
|
+
map.current.setFog({
|
|
82
|
+
'color': 'rgb(0, 0, 0)',
|
|
83
|
+
'high-color': 'rgb(0, 0, 0)',
|
|
84
|
+
'horizon-blend': 0.1,
|
|
85
|
+
'space-color': 'rgb(0, 0, 0)',
|
|
86
|
+
'star-intensity': 0.6
|
|
87
|
+
});
|
|
88
|
+
console.log('β¨ [SIMPLE GLOBE] Space background with stars set');
|
|
89
|
+
} catch (e) {
|
|
90
|
+
console.log('β οΈ [SIMPLE GLOBE] Could not set fog, trying alternative...');
|
|
91
|
+
// Fallback: try simpler fog configuration
|
|
92
|
+
try {
|
|
93
|
+
map.current.setFog({
|
|
94
|
+
'color': 'rgb(0, 0, 0)',
|
|
95
|
+
'high-color': 'rgb(0, 0, 0)',
|
|
96
|
+
'horizon-blend': 0.1
|
|
97
|
+
});
|
|
98
|
+
console.log('β¨ [SIMPLE GLOBE] Alternative space background set');
|
|
99
|
+
} catch (e2) {
|
|
100
|
+
console.log('β οΈ [SIMPLE GLOBE] Could not set any fog configuration');
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Calculate bounds to fit all markers
|
|
105
|
+
const bounds = new mapboxgl.LngLatBounds();
|
|
106
|
+
let hasValidCoordinates = false;
|
|
107
|
+
|
|
108
|
+
projects.forEach((project, index) => {
|
|
109
|
+
console.log(`π [SIMPLE GLOBE] Adding marker ${index}:`, project);
|
|
110
|
+
|
|
111
|
+
// Create marker element based on type
|
|
112
|
+
const el = document.createElement('div');
|
|
113
|
+
// Use a scoped class to avoid picking up broad styles like `.map-marker { width:100% }`
|
|
114
|
+
el.className = 'daf-globe-marker';
|
|
115
|
+
el.style.cursor = 'pointer';
|
|
116
|
+
el.style.boxShadow = '0px 3.45px 3.45px 0px #00000029';
|
|
117
|
+
el.style.display = 'flex';
|
|
118
|
+
el.style.alignItems = 'center';
|
|
119
|
+
el.style.justifyContent = 'center';
|
|
120
|
+
|
|
121
|
+
if (type === "location") {
|
|
122
|
+
// Location marker - SVG map pin style
|
|
123
|
+
el.style.width = '28px';
|
|
124
|
+
el.style.height = '33px';
|
|
125
|
+
el.innerHTML = `
|
|
126
|
+
<svg
|
|
127
|
+
width="28"
|
|
128
|
+
height="33"
|
|
129
|
+
viewBox="0 0 28 33"
|
|
130
|
+
fill="none"
|
|
131
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
132
|
+
>
|
|
133
|
+
<path
|
|
134
|
+
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"
|
|
135
|
+
fill="${color}"
|
|
136
|
+
stroke="white"
|
|
137
|
+
/>
|
|
138
|
+
</svg>
|
|
139
|
+
`;
|
|
140
|
+
} else {
|
|
141
|
+
// Default circular marker style
|
|
142
|
+
el.style.width = '30px';
|
|
143
|
+
el.style.height = '30px';
|
|
144
|
+
el.style.backgroundColor = color;
|
|
145
|
+
el.style.borderRadius = '50%';
|
|
146
|
+
el.style.border = '2px solid white';
|
|
147
|
+
el.style.color = 'white';
|
|
148
|
+
el.style.fontWeight = 'bold';
|
|
149
|
+
el.style.fontSize = '14px';
|
|
150
|
+
el.style.textAlign = 'center';
|
|
151
|
+
el.style.lineHeight = '1';
|
|
152
|
+
el.innerHTML = `<span style="display: block; line-height: 1;">${project.percentageCompletion || 0}</span>`;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Create popup content using the same structure as minesitemap
|
|
156
|
+
const popupContent = `
|
|
157
|
+
<div class="daf-tooltip-cont">
|
|
158
|
+
<div class="daf-tooltip-head">
|
|
159
|
+
<div class="daf-tooltip-title">
|
|
160
|
+
<div>
|
|
161
|
+
<h4>${project.name}</h4>
|
|
162
|
+
<h5>${project.sectoralScope || 'Project'}</h5>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
<div class="daf-tooltip-list">
|
|
167
|
+
<div class="daf-tooltip-list-item">
|
|
168
|
+
<span class="daf-tooltip-name">Country</span>
|
|
169
|
+
<span class="daf-tooltip-value">${project.country || 'N/A'}</span>
|
|
170
|
+
</div>
|
|
171
|
+
<div class="daf-tooltip-list-item">
|
|
172
|
+
<span class="daf-tooltip-name">Completion</span>
|
|
173
|
+
<span class="daf-tooltip-value">${project.percentageCompletion || 0}%</span>
|
|
174
|
+
</div>
|
|
175
|
+
<div class="daf-tooltip-list-item">
|
|
176
|
+
<span class="daf-tooltip-name">Author</span>
|
|
177
|
+
<span class="daf-tooltip-value">${project.author?.name || 'N/A'}</span>
|
|
178
|
+
</div>
|
|
179
|
+
<div class="daf-tooltip-list-item">
|
|
180
|
+
<span class="daf-tooltip-name">ID</span>
|
|
181
|
+
<span class="daf-tooltip-value">${project.datastakeId || 'N/A'}</span>
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
</div>
|
|
185
|
+
`;
|
|
186
|
+
|
|
187
|
+
// Create popup
|
|
188
|
+
const popup = new mapboxgl.Popup({
|
|
189
|
+
offset: 25,
|
|
190
|
+
closeButton: true,
|
|
191
|
+
closeOnClick: false
|
|
192
|
+
}).setHTML(popupContent);
|
|
193
|
+
|
|
194
|
+
// Ensure coordinates are valid numbers
|
|
195
|
+
const lng = Number(project.longitude);
|
|
196
|
+
const lat = Number(project.latitude);
|
|
197
|
+
|
|
198
|
+
console.log(`π [SIMPLE GLOBE] Marker ${index} coordinates:`, { lng, lat });
|
|
199
|
+
|
|
200
|
+
// Validate coordinates
|
|
201
|
+
if (isNaN(lng) || isNaN(lat) || lng < -180 || lng > 180 || lat < -90 || lat > 90) {
|
|
202
|
+
console.error(`β [SIMPLE GLOBE] Invalid coordinates for project ${index}:`, { lng, lat });
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Add coordinates to bounds
|
|
207
|
+
bounds.extend([lng, lat]);
|
|
208
|
+
hasValidCoordinates = true;
|
|
209
|
+
|
|
210
|
+
// Add marker to map with proper coordinate order [lng, lat]
|
|
211
|
+
const marker = new mapboxgl.Marker(el)
|
|
212
|
+
.setLngLat([lng, lat])
|
|
213
|
+
.setPopup(popup)
|
|
214
|
+
.addTo(map.current);
|
|
215
|
+
|
|
216
|
+
// Add click handler
|
|
217
|
+
el.addEventListener('click', () => {
|
|
218
|
+
console.log('π [SIMPLE GLOBE] Marker clicked:', project);
|
|
219
|
+
onProjectClick(project);
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
console.log(`β
[SIMPLE GLOBE] Marker ${index} added at:`, [lng, lat]);
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
// Fit map to show all markers if we have valid coordinates
|
|
226
|
+
if (hasValidCoordinates && !bounds.isEmpty()) {
|
|
227
|
+
console.log('πΊοΈ [SIMPLE GLOBE] Fitting map to bounds:', bounds);
|
|
228
|
+
map.current.fitBounds(bounds, {
|
|
229
|
+
padding: { top: 20, bottom: 20, left: 20, right: 20 },
|
|
230
|
+
maxZoom: 6,
|
|
231
|
+
duration: 1000
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
return () => {
|
|
237
|
+
if (map.current) {
|
|
238
|
+
map.current.remove();
|
|
239
|
+
map.current = null;
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
}, [projects, onProjectClick, mapConfig]);
|
|
243
|
+
|
|
244
|
+
return (
|
|
245
|
+
<Style>
|
|
246
|
+
<div
|
|
247
|
+
ref={mapContainer}
|
|
248
|
+
style={{
|
|
249
|
+
width: '100%',
|
|
250
|
+
height: '500px',
|
|
251
|
+
overflow: 'hidden',
|
|
252
|
+
position: 'relative'
|
|
253
|
+
}}
|
|
254
|
+
/>
|
|
255
|
+
</Style>
|
|
256
|
+
);
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
export default SimpleGlobe;
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import SimpleGlobe from "./SimpleGlobe";
|
|
2
|
+
import SimpleGlobeDebug from "./SimpleGlobeDebug";
|
|
3
|
+
import ThemeLayout from "../../ThemeLayout";
|
|
4
|
+
import Widget from "../Widget";
|
|
5
|
+
|
|
6
|
+
// Sample project data
|
|
7
|
+
const SAMPLE_PROJECTS = [
|
|
8
|
+
{
|
|
9
|
+
_id: "sample-1",
|
|
10
|
+
name: "Dakar Solar Initiative",
|
|
11
|
+
country: "SN",
|
|
12
|
+
datastakeId: "PRJ-SAMPLE-001",
|
|
13
|
+
sectoralScope: "energy",
|
|
14
|
+
percentageCompletion: 75,
|
|
15
|
+
projectDescription: "Large-scale solar energy project in Dakar region",
|
|
16
|
+
latitude: 14.7167,
|
|
17
|
+
longitude: -17.4677,
|
|
18
|
+
author: { name: "Dakar Energy Co." }
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
_id: "sample-2",
|
|
22
|
+
name: "Saint-Louis Wind Farm",
|
|
23
|
+
country: "SN",
|
|
24
|
+
datastakeId: "PRJ-SAMPLE-002",
|
|
25
|
+
sectoralScope: "energy",
|
|
26
|
+
percentageCompletion: 45,
|
|
27
|
+
projectDescription: "Wind energy project in Saint-Louis region",
|
|
28
|
+
latitude: 16.0167,
|
|
29
|
+
longitude: -16.4833,
|
|
30
|
+
author: { name: "Wind Power Solutions" }
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
_id: "sample-3",
|
|
34
|
+
name: "Casamance Reforestation",
|
|
35
|
+
country: "SN",
|
|
36
|
+
datastakeId: "PRJ-SAMPLE-003",
|
|
37
|
+
sectoralScope: "agricultureForestryAndOtherLandUse",
|
|
38
|
+
percentageCompletion: 60,
|
|
39
|
+
projectDescription: "Forest restoration project in Casamance region",
|
|
40
|
+
latitude: 12.5833,
|
|
41
|
+
longitude: -16.2667,
|
|
42
|
+
author: { name: "Green Casamance" }
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
_id: "sample-4",
|
|
46
|
+
name: "Lagos Tech Hub",
|
|
47
|
+
country: "NG",
|
|
48
|
+
datastakeId: "PRJ-SAMPLE-004",
|
|
49
|
+
sectoralScope: "technology",
|
|
50
|
+
percentageCompletion: 30,
|
|
51
|
+
projectDescription: "Technology innovation center in Lagos",
|
|
52
|
+
latitude: 6.5244,
|
|
53
|
+
longitude: 3.3792,
|
|
54
|
+
author: { name: "Lagos Tech Foundation" }
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
_id: "sample-5",
|
|
58
|
+
name: "Cairo Water Management",
|
|
59
|
+
country: "EG",
|
|
60
|
+
datastakeId: "PRJ-SAMPLE-005",
|
|
61
|
+
sectoralScope: "water",
|
|
62
|
+
percentageCompletion: 85,
|
|
63
|
+
projectDescription: "Water conservation project in Cairo",
|
|
64
|
+
latitude: 30.0444,
|
|
65
|
+
longitude: 31.2357,
|
|
66
|
+
author: { name: "Cairo Water Authority" }
|
|
67
|
+
}
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
export default {
|
|
71
|
+
title: "Dashboard/Globe/SimpleGlobe",
|
|
72
|
+
component: SimpleGlobe,
|
|
73
|
+
tags: ["autodocs"],
|
|
74
|
+
args: {
|
|
75
|
+
projects: SAMPLE_PROJECTS,
|
|
76
|
+
showSider: false,
|
|
77
|
+
onProjectClick: (project) => console.log('Project clicked:', project)
|
|
78
|
+
},
|
|
79
|
+
decorators: [
|
|
80
|
+
(Story) => (
|
|
81
|
+
|
|
82
|
+
<ThemeLayout>
|
|
83
|
+
<Widget title="Simple Globe with Project Pins" className="no-px no-pb-body">
|
|
84
|
+
{/* <div style={{ width: '100%', height: '600px' }}> */}
|
|
85
|
+
<Story />
|
|
86
|
+
{/* </div> */}
|
|
87
|
+
</Widget>
|
|
88
|
+
</ThemeLayout>
|
|
89
|
+
|
|
90
|
+
),
|
|
91
|
+
],
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const Default = {
|
|
95
|
+
name: "Default Project Globe",
|
|
96
|
+
args: {
|
|
97
|
+
projects: SAMPLE_PROJECTS,
|
|
98
|
+
showSider: false
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export const TestSimple = {
|
|
103
|
+
name: "Test Simple Data",
|
|
104
|
+
args: {
|
|
105
|
+
projects: [
|
|
106
|
+
{
|
|
107
|
+
name: "Test Project 1",
|
|
108
|
+
latitude: 14.7167,
|
|
109
|
+
longitude: -17.4677,
|
|
110
|
+
percentageCompletion: 75,
|
|
111
|
+
projectDescription: "Test project in Dakar"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: "Test Project 2",
|
|
115
|
+
latitude: 16.0167,
|
|
116
|
+
longitude: -16.4833,
|
|
117
|
+
percentageCompletion: 45,
|
|
118
|
+
projectDescription: "Test project in Saint-Louis"
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
showSider: true
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export const WithSidebar = {
|
|
126
|
+
name: "With Sidebar",
|
|
127
|
+
args: {
|
|
128
|
+
projects: SAMPLE_PROJECTS,
|
|
129
|
+
showSider: true
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export const CustomMapConfig = {
|
|
134
|
+
name: "Custom Map Configuration",
|
|
135
|
+
args: {
|
|
136
|
+
projects: SAMPLE_PROJECTS,
|
|
137
|
+
showSider: true,
|
|
138
|
+
mapConfig: {
|
|
139
|
+
maxZoom: 6,
|
|
140
|
+
minZoom: 2
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export const SingleProject = {
|
|
146
|
+
name: "Single Project",
|
|
147
|
+
args: {
|
|
148
|
+
projects: [SAMPLE_PROJECTS[0]],
|
|
149
|
+
showSider: true
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export const EmptyState = {
|
|
154
|
+
name: "Empty State",
|
|
155
|
+
args: {
|
|
156
|
+
projects: [],
|
|
157
|
+
showSider: false
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export const LocationMarkers = {
|
|
162
|
+
name: "Location Markers (Map Pin Style)",
|
|
163
|
+
args: {
|
|
164
|
+
projects: SAMPLE_PROJECTS,
|
|
165
|
+
showSider: true,
|
|
166
|
+
type: "location"
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export const CustomColorMarkers = {
|
|
171
|
+
name: "Custom Color Markers",
|
|
172
|
+
args: {
|
|
173
|
+
projects: SAMPLE_PROJECTS,
|
|
174
|
+
showSider: true,
|
|
175
|
+
color: "#FF6B6B"
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export const LocationCustomColor = {
|
|
180
|
+
name: "Location Markers with Custom Color",
|
|
181
|
+
args: {
|
|
182
|
+
projects: SAMPLE_PROJECTS,
|
|
183
|
+
showSider: true,
|
|
184
|
+
type: "location",
|
|
185
|
+
color: "#4ECDC4"
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export const DebugVersion = {
|
|
190
|
+
name: "Debug Version (Direct Mapbox)",
|
|
191
|
+
render: () => (
|
|
192
|
+
<div style={{ margin: "3em" }}>
|
|
193
|
+
<ThemeLayout>
|
|
194
|
+
<Widget title="Debug Globe (Direct Mapbox)" className="no-px no-pb-body">
|
|
195
|
+
<div style={{ width: '100%', height: '600px' }}>
|
|
196
|
+
<SimpleGlobeDebug projects={SAMPLE_PROJECTS} />
|
|
197
|
+
</div>
|
|
198
|
+
</Widget>
|
|
199
|
+
</ThemeLayout>
|
|
200
|
+
</div>
|
|
201
|
+
)
|
|
202
|
+
};
|