@eeacms/volto-marine-policy 2.0.9 → 2.0.11
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/CHANGELOG.md +30 -0
- package/package.json +2 -2
- package/src/components/Blocks/DemoSitesExplorer/DemoSitesExplorerView.js +9 -4
- package/src/components/Blocks/DemoSitesExplorer/DemoSitesFilters.jsx +29 -20
- package/src/components/Blocks/DemoSitesExplorer/DemoSitesListing.jsx +2 -2
- package/src/components/Blocks/DemoSitesExplorer/DemoSitesMap.jsx +17 -9
- package/src/components/Blocks/DemoSitesExplorer/FeatureDisplay.jsx +19 -10
- package/src/components/Blocks/DemoSitesExplorer/FeatureInteraction.jsx +2 -2
- package/src/components/Blocks/DemoSitesExplorer/ObjectivesChart.jsx +58 -18
- package/src/components/Blocks/DemoSitesExplorer/styles.less +32 -2
- package/src/components/Blocks/DemoSitesExplorer/utils.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,36 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
### [2.0.11](https://github.com/eea/volto-marine-policy/compare/2.0.10...2.0.11) - 12 May 2025
|
|
8
|
+
|
|
9
|
+
#### :house: Internal changes
|
|
10
|
+
|
|
11
|
+
- style: Automated code fix [eea-jenkins - [`a054cba`](https://github.com/eea/volto-marine-policy/commit/a054cba726d2d053b15b2eadd1ccd24ef9377b8a)]
|
|
12
|
+
|
|
13
|
+
#### :hammer_and_wrench: Others
|
|
14
|
+
|
|
15
|
+
- fixes eslint [laszlocseh - [`c663600`](https://github.com/eea/volto-marine-policy/commit/c6636007ac365ba98462dc57d040eb8fa3ff187f)]
|
|
16
|
+
- fixes to demo sites map viewer [laszlocseh - [`b82cd91`](https://github.com/eea/volto-marine-policy/commit/b82cd91670fca640e115a765626c81ba8019bff2)]
|
|
17
|
+
- Small improvements to demo sites map viewer [laszlocseh - [`e5c5e66`](https://github.com/eea/volto-marine-policy/commit/e5c5e66e2ef121f3812aa2dc53a9f9a35679f667)]
|
|
18
|
+
### [2.0.10](https://github.com/eea/volto-marine-policy/compare/2.0.9...2.0.10) - 9 May 2025
|
|
19
|
+
|
|
20
|
+
#### :rocket: Dependency updates
|
|
21
|
+
|
|
22
|
+
- Release @eeacms/volto-globalsearch@2.1.0 [EEA Jenkins - [`3b20bc2`](https://github.com/eea/volto-marine-policy/commit/3b20bc292d04ab81385732840ffe2c469f83fbd6)]
|
|
23
|
+
|
|
24
|
+
#### :house: Internal changes
|
|
25
|
+
|
|
26
|
+
- style: Automated code fix [eea-jenkins - [`69cc9c8`](https://github.com/eea/volto-marine-policy/commit/69cc9c86e32d35cce4f979b36bc7d20cc4b01e8f)]
|
|
27
|
+
- style: Automated code fix [eea-jenkins - [`d1a8da0`](https://github.com/eea/volto-marine-policy/commit/d1a8da01dfc0ddcc24058ba5aafb5d76be0d2ffc)]
|
|
28
|
+
|
|
29
|
+
#### :hammer_and_wrench: Others
|
|
30
|
+
|
|
31
|
+
- eslint [laszlocseh - [`8c27f84`](https://github.com/eea/volto-marine-policy/commit/8c27f84fcdc8adf9b12746b585c66f34b9e785a4)]
|
|
32
|
+
- further improvements to demo sites map [laszlocseh - [`b15e205`](https://github.com/eea/volto-marine-policy/commit/b15e2053256552c30f26fdab581330cba420b412)]
|
|
33
|
+
- eslint [laszlocseh - [`4514ee0`](https://github.com/eea/volto-marine-policy/commit/4514ee0a409e8dfe0d6975da989228f39033b343)]
|
|
34
|
+
- no results message [laszlocseh - [`06b7ae6`](https://github.com/eea/volto-marine-policy/commit/06b7ae62eb7b27a2ec9e2d3f9ec62aed42a85045)]
|
|
35
|
+
- fix eslint [laszlocseh - [`2a4605a`](https://github.com/eea/volto-marine-policy/commit/2a4605ac45b141d5e3f2b737a24c6afca0b5d884)]
|
|
36
|
+
- optimize demo sites map rendering [laszlocseh - [`2345b60`](https://github.com/eea/volto-marine-policy/commit/2345b609a95a00a53c46ce9b92686eeb598a14a6)]
|
|
7
37
|
### [2.0.9](https://github.com/eea/volto-marine-policy/compare/2.0.8...2.0.9) - 7 May 2025
|
|
8
38
|
|
|
9
39
|
#### :rocket: Dependency updates
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-marine-policy",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.11",
|
|
4
4
|
"description": "@eeacms/volto-marine-policy: Volto add-on",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@eeacms/volto-eea-design-system": "*",
|
|
35
35
|
"@eeacms/volto-eea-website-theme": "*",
|
|
36
36
|
"@eeacms/volto-embed": "*",
|
|
37
|
-
"@eeacms/volto-globalsearch": "2.0
|
|
37
|
+
"@eeacms/volto-globalsearch": "2.1.0",
|
|
38
38
|
"@eeacms/volto-openlayers-map": "0.3.2",
|
|
39
39
|
"@eeacms/volto-searchlib": "2.0.16",
|
|
40
40
|
"@eeacms/volto-tabs-block": "*",
|
|
@@ -13,6 +13,7 @@ import { useCases } from './hooks';
|
|
|
13
13
|
import './styles.less';
|
|
14
14
|
|
|
15
15
|
export default function DemoSitesExplorerView(props) {
|
|
16
|
+
const [initialized, setInitialized] = React.useState(false); // set to true after the chart animation is finished
|
|
16
17
|
const cases_url = config.settings.prefixPath
|
|
17
18
|
? '/@@demo-sites-map.arcgis.json'
|
|
18
19
|
: '/marine/@@demo-sites-map.arcgis.json';
|
|
@@ -65,6 +66,8 @@ export default function DemoSitesExplorerView(props) {
|
|
|
65
66
|
filters={filters}
|
|
66
67
|
activeFilters={activeFilters}
|
|
67
68
|
setActiveFilters={setActiveFilters}
|
|
69
|
+
setHighlightedIndex={setHighlightedIndex}
|
|
70
|
+
initialized={initialized}
|
|
68
71
|
/>
|
|
69
72
|
</Grid.Row>
|
|
70
73
|
<Grid.Row stretched={true} id="cse-filter">
|
|
@@ -104,14 +107,16 @@ export default function DemoSitesExplorerView(props) {
|
|
|
104
107
|
<VisibilitySensor>
|
|
105
108
|
<ObjectivesChart
|
|
106
109
|
items={cases}
|
|
107
|
-
activeItems={activeItems}
|
|
108
|
-
filters={filters}
|
|
110
|
+
// activeItems={activeItems}
|
|
111
|
+
// filters={filters}
|
|
109
112
|
activeFilters={activeFilters}
|
|
110
|
-
hideFilters={hideFilters}
|
|
111
113
|
setActiveFilters={setActiveFilters}
|
|
112
|
-
|
|
114
|
+
// hideFilters={hideFilters}
|
|
115
|
+
// map={map}
|
|
113
116
|
highlightedIndex={highlightedIndex}
|
|
114
117
|
setHighlightedIndex={setHighlightedIndex}
|
|
118
|
+
initialized={initialized}
|
|
119
|
+
setInitialized={setInitialized}
|
|
115
120
|
/>
|
|
116
121
|
</VisibilitySensor>
|
|
117
122
|
) : (
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { clearFilters } from './utils';
|
|
4
4
|
|
|
5
5
|
const normalizeSearchInput = (searchInput) => {
|
|
6
6
|
let normInput = searchInput
|
|
@@ -20,7 +20,7 @@ export function DemoSitesFilter(props) {
|
|
|
20
20
|
activeFilters,
|
|
21
21
|
setActiveFilters,
|
|
22
22
|
filterName,
|
|
23
|
-
map,
|
|
23
|
+
// map,
|
|
24
24
|
} = props;
|
|
25
25
|
|
|
26
26
|
const customOrder = props?.customOrder || [];
|
|
@@ -103,7 +103,7 @@ export function DemoSitesFilter(props) {
|
|
|
103
103
|
}
|
|
104
104
|
setActiveFilters(temp);
|
|
105
105
|
// scrollToElement('search-input');
|
|
106
|
-
centerAndResetMapZoom(map);
|
|
106
|
+
// centerAndResetMapZoom(map);
|
|
107
107
|
}}
|
|
108
108
|
/>
|
|
109
109
|
<span>{label}</span>
|
|
@@ -190,7 +190,7 @@ export function DemoSitesFilters(props) {
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
export function SearchBox(props) {
|
|
193
|
-
const { setSearchInput,
|
|
193
|
+
const { setSearchInput, onSelectedCase } = props;
|
|
194
194
|
const [showClearButton, setShowClearButton] = React.useState(false);
|
|
195
195
|
|
|
196
196
|
return (
|
|
@@ -215,7 +215,7 @@ export function SearchBox(props) {
|
|
|
215
215
|
// popupOverlay.style.visibility = 'hidden';
|
|
216
216
|
setSearchInput(searchInput);
|
|
217
217
|
// scrollToElement('search-input');
|
|
218
|
-
centerAndResetMapZoom(map);
|
|
218
|
+
// centerAndResetMapZoom(map);
|
|
219
219
|
}}
|
|
220
220
|
></input>
|
|
221
221
|
<div className="terms-box-left">
|
|
@@ -233,7 +233,7 @@ export function SearchBox(props) {
|
|
|
233
233
|
setSearchInput('');
|
|
234
234
|
setShowClearButton(false);
|
|
235
235
|
// scrollToElement('search-input');
|
|
236
|
-
centerAndResetMapZoom(map);
|
|
236
|
+
// centerAndResetMapZoom(map);
|
|
237
237
|
}}
|
|
238
238
|
></i>
|
|
239
239
|
</div>
|
|
@@ -253,7 +253,7 @@ export function SearchBox(props) {
|
|
|
253
253
|
|
|
254
254
|
setSearchInput(searchInputVal);
|
|
255
255
|
// scrollToElement('search-input');
|
|
256
|
-
centerAndResetMapZoom(map);
|
|
256
|
+
// centerAndResetMapZoom(map);
|
|
257
257
|
}}
|
|
258
258
|
onKeyDown={() => {}}
|
|
259
259
|
tabIndex="0"
|
|
@@ -271,17 +271,22 @@ export function SearchBox(props) {
|
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
export function ActiveFilters(props) {
|
|
274
|
-
const {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
//
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
274
|
+
const {
|
|
275
|
+
filters,
|
|
276
|
+
activeFilters,
|
|
277
|
+
setActiveFilters,
|
|
278
|
+
setHighlightedIndex,
|
|
279
|
+
initialized,
|
|
280
|
+
} = props;
|
|
281
|
+
// const hasActiveFilters = false;
|
|
282
|
+
const hasActiveFilters = Object.entries(activeFilters).some(
|
|
283
|
+
([filterName, filterList]) => {
|
|
284
|
+
if (filterList.length > 0) {
|
|
285
|
+
return true;
|
|
286
|
+
}
|
|
287
|
+
return false;
|
|
288
|
+
},
|
|
289
|
+
);
|
|
285
290
|
|
|
286
291
|
const removeFilter = (filterName, filterCode) => {
|
|
287
292
|
const temp = JSON.parse(JSON.stringify(activeFilters));
|
|
@@ -303,12 +308,15 @@ export function ActiveFilters(props) {
|
|
|
303
308
|
setActiveFilters(temp);
|
|
304
309
|
};
|
|
305
310
|
|
|
306
|
-
return hasActiveFilters ? (
|
|
311
|
+
return hasActiveFilters && initialized ? (
|
|
307
312
|
<div className="ui segment active-filter-list">
|
|
308
313
|
<div className="filter-list-header">
|
|
309
314
|
<h4 className="filter-list-title">Active filters</h4>
|
|
310
315
|
<button
|
|
311
|
-
onClick={() =>
|
|
316
|
+
onClick={() => {
|
|
317
|
+
setHighlightedIndex(5);
|
|
318
|
+
clearFilters(setActiveFilters);
|
|
319
|
+
}}
|
|
312
320
|
className="ui mini basic compact button clear-btn"
|
|
313
321
|
>
|
|
314
322
|
clear all
|
|
@@ -328,6 +336,7 @@ export function ActiveFilters(props) {
|
|
|
328
336
|
tabIndex="0"
|
|
329
337
|
onKeyPress={() => {}}
|
|
330
338
|
onClick={() => {
|
|
339
|
+
setHighlightedIndex(5);
|
|
331
340
|
removeFilter('objective_filter', filterCode);
|
|
332
341
|
// scrollToElement('search-input');
|
|
333
342
|
}}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { centerAndResetMapZoom,
|
|
2
|
+
import { centerAndResetMapZoom, isValidURL } from './utils';
|
|
3
3
|
|
|
4
4
|
const showPageNr = (pageNr, currentPage, numberOfPages) => {
|
|
5
5
|
// show first 5 pages
|
|
@@ -271,7 +271,7 @@ export default function DemoSitesList(props) {
|
|
|
271
271
|
// scroll to the map
|
|
272
272
|
// scrollToElement('ol-map-container');
|
|
273
273
|
|
|
274
|
-
zoomMapToFeatures(map, [item], 5000);
|
|
274
|
+
// zoomMapToFeatures(map, [item], 5000);
|
|
275
275
|
onSelectedCase(item.values_);
|
|
276
276
|
|
|
277
277
|
const popupOverlay =
|
|
@@ -10,10 +10,10 @@ import FeatureInteraction from './FeatureInteraction';
|
|
|
10
10
|
import { useMapContext } from '@eeacms/volto-openlayers-map/api';
|
|
11
11
|
|
|
12
12
|
import {
|
|
13
|
-
|
|
13
|
+
centerAndResetMapZoom,
|
|
14
14
|
clearFilters,
|
|
15
15
|
getFeatures,
|
|
16
|
-
zoomMapToFeatures,
|
|
16
|
+
// zoomMapToFeatures,
|
|
17
17
|
} from './utils';
|
|
18
18
|
|
|
19
19
|
const styleCache = {};
|
|
@@ -35,6 +35,7 @@ export default function DemoSitesMap(props) {
|
|
|
35
35
|
onSelectedCase,
|
|
36
36
|
map,
|
|
37
37
|
setMap,
|
|
38
|
+
highlightedIndex,
|
|
38
39
|
setHighlightedIndex,
|
|
39
40
|
} = props;
|
|
40
41
|
const features = getFeatures(items);
|
|
@@ -73,7 +74,7 @@ export default function DemoSitesMap(props) {
|
|
|
73
74
|
pointsSource.clear();
|
|
74
75
|
pointsSource.addFeatures(getFeatures(activeItems));
|
|
75
76
|
// hideFilters && zoomMapToFeatures(map, getFeatures(activeItems));
|
|
76
|
-
zoomMapToFeatures(map, getFeatures(activeItems));
|
|
77
|
+
// zoomMapToFeatures(map, getFeatures(activeItems));
|
|
77
78
|
}
|
|
78
79
|
}, [map, activeItems, pointsSource, hideFilters]);
|
|
79
80
|
|
|
@@ -130,13 +131,18 @@ export default function DemoSitesMap(props) {
|
|
|
130
131
|
view={{
|
|
131
132
|
center: ol.proj.fromLonLat([10, 54]),
|
|
132
133
|
showFullExtent: true,
|
|
133
|
-
zoom: 3,
|
|
134
|
+
zoom: 3.4,
|
|
134
135
|
}}
|
|
135
136
|
pixelRatio={1}
|
|
136
137
|
// controls={ol.control.defaults({ attribution: false })}
|
|
137
138
|
>
|
|
138
139
|
<Controls attribution={false} />
|
|
139
140
|
<Layers>
|
|
141
|
+
{highlightedIndex > 0 && !activeItems.length && (
|
|
142
|
+
<div className="no-results-message">
|
|
143
|
+
No results found. Please refine your filters.
|
|
144
|
+
</div>
|
|
145
|
+
)}
|
|
140
146
|
<button
|
|
141
147
|
className={cx(
|
|
142
148
|
'reset-map-button ui button secondary',
|
|
@@ -148,15 +154,16 @@ export default function DemoSitesMap(props) {
|
|
|
148
154
|
clearFilters(setActiveFilters);
|
|
149
155
|
setHighlightedIndex(5);
|
|
150
156
|
if (hideFilters) {
|
|
151
|
-
zoomMapToFeatures(map, getFeatures(activeItems));
|
|
157
|
+
// zoomMapToFeatures(map, getFeatures(activeItems));
|
|
158
|
+
centerAndResetMapZoom(map);
|
|
152
159
|
} else {
|
|
153
|
-
|
|
154
|
-
zoomMapToFeatures(map, getFeatures(activeItems));
|
|
160
|
+
centerAndResetMapZoom(map);
|
|
161
|
+
// zoomMapToFeatures(map, getFeatures(activeItems));
|
|
155
162
|
}
|
|
156
163
|
map.getInteractions().array_[9].getFeatures().clear();
|
|
157
164
|
}}
|
|
158
165
|
>
|
|
159
|
-
<span className="result-info-title">Reset
|
|
166
|
+
<span className="result-info-title">Reset map</span>
|
|
160
167
|
<i className="icon ri-map-2-line"></i>
|
|
161
168
|
</button>
|
|
162
169
|
<InfoOverlay
|
|
@@ -211,7 +218,8 @@ const selectedClusterStyle = (selectedFeature) => {
|
|
|
211
218
|
}
|
|
212
219
|
// set size === 1 to enable clusterization
|
|
213
220
|
if (size) {
|
|
214
|
-
let color = feature.values_.features[0].values_['color'];
|
|
221
|
+
// let color = feature.values_.features[0].values_['color'];
|
|
222
|
+
let color = '#0179cf';
|
|
215
223
|
let width = feature.values_.features[0].values_['width'];
|
|
216
224
|
let radius = feature.values_.features[0].values_['radius'];
|
|
217
225
|
// console.log(color)
|
|
@@ -6,9 +6,13 @@ export default function FeatureDisplay({ feature }) {
|
|
|
6
6
|
<div id="csepopup">
|
|
7
7
|
<h3>
|
|
8
8
|
<strong>
|
|
9
|
-
<
|
|
9
|
+
<span
|
|
10
|
+
// target="_blank"
|
|
11
|
+
// rel="noopener noreferrer"
|
|
12
|
+
// href={feature.path}
|
|
13
|
+
>
|
|
10
14
|
{truncateText(feature.title)}
|
|
11
|
-
</
|
|
15
|
+
</span>
|
|
12
16
|
</strong>
|
|
13
17
|
</h3>
|
|
14
18
|
{feature.info ? (
|
|
@@ -57,6 +61,19 @@ export default function FeatureDisplay({ feature }) {
|
|
|
57
61
|
''
|
|
58
62
|
)}
|
|
59
63
|
|
|
64
|
+
{feature.objective.length > 0 ? (
|
|
65
|
+
<div>
|
|
66
|
+
<span className="popup-title blue">Objective/Enabler</span>
|
|
67
|
+
<ul>
|
|
68
|
+
{feature.objective.map((item, index) => {
|
|
69
|
+
return <li key={index}>{item}</li>;
|
|
70
|
+
})}
|
|
71
|
+
</ul>
|
|
72
|
+
</div>
|
|
73
|
+
) : (
|
|
74
|
+
''
|
|
75
|
+
)}
|
|
76
|
+
|
|
60
77
|
{/* {feature.project_link ? (
|
|
61
78
|
<div>
|
|
62
79
|
<span className="popup-title blue">Project link: </span>
|
|
@@ -100,14 +117,6 @@ export default function FeatureDisplay({ feature }) {
|
|
|
100
117
|
) : (
|
|
101
118
|
''
|
|
102
119
|
)}
|
|
103
|
-
{/* <div>
|
|
104
|
-
<h4>Indicators</h4>
|
|
105
|
-
<ul>
|
|
106
|
-
{feature.sectors.map((item, index) => {
|
|
107
|
-
return <li key={index}>{item}</li>;
|
|
108
|
-
})}
|
|
109
|
-
</ul>
|
|
110
|
-
</div> */}
|
|
111
120
|
</div>
|
|
112
121
|
) : null;
|
|
113
122
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { openlayers as ol } from '@eeacms/volto-openlayers-map';
|
|
3
3
|
import { useMapContext } from '@eeacms/volto-openlayers-map/api';
|
|
4
|
-
import { zoomMapToFeatures } from './utils';
|
|
4
|
+
// import { zoomMapToFeatures } from './utils';
|
|
5
5
|
|
|
6
6
|
export const useStyles = () => {
|
|
7
7
|
const selected = React.useMemo(
|
|
@@ -67,7 +67,7 @@ export default function FeatureInteraction({ onFeatureSelect }) {
|
|
|
67
67
|
// });
|
|
68
68
|
} else {
|
|
69
69
|
onFeatureSelect(null);
|
|
70
|
-
zoomMapToFeatures(map, subfeatures);
|
|
70
|
+
// zoomMapToFeatures(map, subfeatures);
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
73
|
|
|
@@ -17,8 +17,9 @@ const ObjectivesChart = ({
|
|
|
17
17
|
// map,
|
|
18
18
|
highlightedIndex,
|
|
19
19
|
setHighlightedIndex,
|
|
20
|
+
initialized,
|
|
21
|
+
setInitialized,
|
|
20
22
|
}) => {
|
|
21
|
-
const initialized = useRef(false);
|
|
22
23
|
const chartRef = useRef(null);
|
|
23
24
|
const objectiveCounts = {};
|
|
24
25
|
|
|
@@ -38,13 +39,13 @@ const ObjectivesChart = ({
|
|
|
38
39
|
React.useEffect(() => {
|
|
39
40
|
// set the objectives and the count
|
|
40
41
|
if (!items) return;
|
|
41
|
-
if (initialized
|
|
42
|
+
if (initialized) return;
|
|
42
43
|
|
|
43
44
|
const interval = setInterval(() => {
|
|
44
45
|
setHighlightedIndex((prevIndex) => {
|
|
45
46
|
if (prevIndex + 1 >= objectivesLength + 1) {
|
|
46
47
|
clearInterval(interval); // Stop after last item
|
|
47
|
-
|
|
48
|
+
setInitialized(true);
|
|
48
49
|
return prevIndex;
|
|
49
50
|
}
|
|
50
51
|
return prevIndex + 1;
|
|
@@ -52,23 +53,40 @@ const ObjectivesChart = ({
|
|
|
52
53
|
}, 2000);
|
|
53
54
|
// console.log('init');
|
|
54
55
|
return () => clearInterval(interval); // Cleanup on unmount
|
|
55
|
-
}, [
|
|
56
|
+
}, [
|
|
57
|
+
items,
|
|
58
|
+
objectivesLength,
|
|
59
|
+
highlightedIndex,
|
|
60
|
+
setHighlightedIndex,
|
|
61
|
+
initialized,
|
|
62
|
+
setInitialized,
|
|
63
|
+
]);
|
|
56
64
|
|
|
57
65
|
React.useEffect(() => {
|
|
58
66
|
// if (!objectives) return;
|
|
67
|
+
const filterKey = 'objective_filter';
|
|
68
|
+
|
|
59
69
|
if (highlightedIndex === -1) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
70
|
+
const newValue = [undefined];
|
|
71
|
+
|
|
72
|
+
setActiveFilters((prev) => {
|
|
73
|
+
const currentValues = prev[filterKey];
|
|
74
|
+
// Don't update if no change
|
|
75
|
+
const isSame =
|
|
76
|
+
currentValues.length === newValue.length &&
|
|
77
|
+
currentValues.every((v, i) => v === newValue[i]);
|
|
78
|
+
|
|
79
|
+
if (isSame) return prev;
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
...prev,
|
|
83
|
+
[filterKey]: newValue,
|
|
84
|
+
};
|
|
66
85
|
});
|
|
67
86
|
return;
|
|
68
87
|
}
|
|
69
88
|
|
|
70
89
|
const currentObjective = Object.keys(objectives)[highlightedIndex];
|
|
71
|
-
const filterKey = 'objective_filter';
|
|
72
90
|
const newValue = currentObjective ? [currentObjective] : [];
|
|
73
91
|
|
|
74
92
|
setActiveFilters((prev) => {
|
|
@@ -89,9 +107,15 @@ const ObjectivesChart = ({
|
|
|
89
107
|
}, [objectives, activeFilters, setActiveFilters, highlightedIndex]);
|
|
90
108
|
|
|
91
109
|
const handleClick = (event) => {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
110
|
+
let label = '';
|
|
111
|
+
|
|
112
|
+
if (event.points) {
|
|
113
|
+
const point = event.points[0];
|
|
114
|
+
label = point.label;
|
|
115
|
+
// const value = point.value;
|
|
116
|
+
} else {
|
|
117
|
+
label = event.target.textContent;
|
|
118
|
+
}
|
|
95
119
|
|
|
96
120
|
const tempFilters = JSON.parse(JSON.stringify(activeFilters));
|
|
97
121
|
if (tempFilters['objective_filter'].includes(label)) {
|
|
@@ -129,6 +153,9 @@ const ObjectivesChart = ({
|
|
|
129
153
|
i === highlightedIndex ? customColors[i % customColors.length] : grayColor,
|
|
130
154
|
);
|
|
131
155
|
|
|
156
|
+
// console.log(highlightedIndex);
|
|
157
|
+
// console.log(initialized);
|
|
158
|
+
|
|
132
159
|
return highlightedIndex >= -1 ? (
|
|
133
160
|
<div className="objectives-chart fade-in">
|
|
134
161
|
<Grid.Row className="chart-title">
|
|
@@ -152,14 +179,18 @@ const ObjectivesChart = ({
|
|
|
152
179
|
marker: {
|
|
153
180
|
colors:
|
|
154
181
|
highlightedIndex === 5 ? customColors : inactiveColors, // Apply custom colors here
|
|
182
|
+
line: {
|
|
183
|
+
color: '#e0e0e0', // light gray
|
|
184
|
+
width: 1, // thin border
|
|
185
|
+
},
|
|
155
186
|
},
|
|
156
187
|
direction: 'clockwise',
|
|
157
188
|
// pull,
|
|
158
189
|
},
|
|
159
190
|
]}
|
|
160
191
|
layout={{
|
|
161
|
-
width:
|
|
162
|
-
height:
|
|
192
|
+
width: 300,
|
|
193
|
+
height: 300,
|
|
163
194
|
// title: 'Objectives Distribution',
|
|
164
195
|
showlegend: false,
|
|
165
196
|
margin: {
|
|
@@ -175,6 +206,8 @@ const ObjectivesChart = ({
|
|
|
175
206
|
? `${totalCount}`
|
|
176
207
|
: values[highlightedIndex] || '', // Display total count in the center
|
|
177
208
|
font: {
|
|
209
|
+
family:
|
|
210
|
+
"'Roboto', 'Helvetica Neue', Arial, Helvetica, sans-serif",
|
|
178
211
|
size: 24, // Adjust font size as needed
|
|
179
212
|
weight: 'bold',
|
|
180
213
|
},
|
|
@@ -204,13 +237,20 @@ const ObjectivesChart = ({
|
|
|
204
237
|
<ul>
|
|
205
238
|
{Object.entries(objectives).map(([item, count], index) => (
|
|
206
239
|
<li
|
|
207
|
-
key={item}
|
|
208
240
|
className={cx(
|
|
209
241
|
index === highlightedIndex ? 'active' : '',
|
|
210
242
|
customColors[index].replace('#', 'C'),
|
|
211
243
|
)}
|
|
212
244
|
>
|
|
213
|
-
|
|
245
|
+
<div
|
|
246
|
+
onClick={handleClick}
|
|
247
|
+
onKeyDown={() => {}}
|
|
248
|
+
tabIndex={index}
|
|
249
|
+
role="button"
|
|
250
|
+
key={item}
|
|
251
|
+
>
|
|
252
|
+
{item}
|
|
253
|
+
</div>
|
|
214
254
|
</li>
|
|
215
255
|
))}
|
|
216
256
|
</ul>
|
|
@@ -12,6 +12,23 @@
|
|
|
12
12
|
.ol-map {
|
|
13
13
|
height: 600px;
|
|
14
14
|
min-height: 600px;
|
|
15
|
+
font-family: 'Roboto', 'Helvetica Neue', Arial, Helvetica, sans-serif !important;
|
|
16
|
+
|
|
17
|
+
.no-results-message {
|
|
18
|
+
position: absolute;
|
|
19
|
+
z-index: 9;
|
|
20
|
+
top: 46%;
|
|
21
|
+
right: 28%;
|
|
22
|
+
bottom: 47%;
|
|
23
|
+
left: 27%;
|
|
24
|
+
padding: 0.5em 1em;
|
|
25
|
+
border: 4px solid #dfdfdf;
|
|
26
|
+
border-radius: 2px;
|
|
27
|
+
background-color: #0088e9;
|
|
28
|
+
color: #ffffff;
|
|
29
|
+
opacity: 0.6;
|
|
30
|
+
text-shadow: none;
|
|
31
|
+
}
|
|
15
32
|
}
|
|
16
33
|
|
|
17
34
|
#csepopup {
|
|
@@ -29,6 +46,7 @@
|
|
|
29
46
|
}
|
|
30
47
|
|
|
31
48
|
h3 {
|
|
49
|
+
color: #069;
|
|
32
50
|
font-size: 1.4rem;
|
|
33
51
|
}
|
|
34
52
|
|
|
@@ -411,9 +429,9 @@
|
|
|
411
429
|
width: 22px;
|
|
412
430
|
min-width: 22px;
|
|
413
431
|
height: 22px;
|
|
414
|
-
/* dark green shade */
|
|
415
432
|
border-radius: 50%;
|
|
416
|
-
background-color: #007265;
|
|
433
|
+
// background-color: #007265;
|
|
434
|
+
background-color: #0179cf;
|
|
417
435
|
gap: 0.5em;
|
|
418
436
|
}
|
|
419
437
|
|
|
@@ -448,6 +466,13 @@
|
|
|
448
466
|
}
|
|
449
467
|
|
|
450
468
|
.objectives-chart {
|
|
469
|
+
font-family: 'Roboto', 'Helvetica Neue', Arial, Helvetica, sans-serif !important;
|
|
470
|
+
|
|
471
|
+
.js-plotly-plot .plotly,
|
|
472
|
+
.js-plotly-plot .plotly div {
|
|
473
|
+
font-family: 'Roboto', 'Helvetica Neue', Arial, Helvetica, sans-serif !important;
|
|
474
|
+
}
|
|
475
|
+
|
|
451
476
|
&.fade-in {
|
|
452
477
|
animation: fadeIn 1s ease-in forwards;
|
|
453
478
|
opacity: 0;
|
|
@@ -493,6 +518,11 @@
|
|
|
493
518
|
font-size: 0.8em;
|
|
494
519
|
line-height: 1.5em;
|
|
495
520
|
|
|
521
|
+
&:hover {
|
|
522
|
+
cursor: pointer;
|
|
523
|
+
font-weight: 500;
|
|
524
|
+
}
|
|
525
|
+
|
|
496
526
|
&.C007b6c::before {
|
|
497
527
|
background-color: #007b6c;
|
|
498
528
|
}
|