@eeacms/volto-marine-policy 2.0.13 → 2.0.15
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 +27 -0
- package/jest-addon.config.js +4 -4
- package/package.json +2 -2
- package/src/components/Blocks/DemoSitesExplorer/DemoSitesExplorerView.js +57 -31
- package/src/components/Blocks/DemoSitesExplorer/DemoSitesFilters.jsx +2 -6
- package/src/components/Blocks/DemoSitesExplorer/DemoSitesMap.jsx +8 -4
- package/src/components/Blocks/DemoSitesExplorer/ObjectivesChart.jsx +27 -4
- package/src/components/Blocks/DemoSitesExplorer/styles.less +12 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,33 @@ 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.15](https://github.com/eea/volto-marine-policy/compare/2.0.14...2.0.15) - 16 June 2025
|
|
8
|
+
|
|
9
|
+
#### :house: Internal changes
|
|
10
|
+
|
|
11
|
+
- style: Automated code fix [eea-jenkins - [`5b37969`](https://github.com/eea/volto-marine-policy/commit/5b3796962e97e62cde61dfe0e78e85e340eefc0c)]
|
|
12
|
+
|
|
13
|
+
#### :hammer_and_wrench: Others
|
|
14
|
+
|
|
15
|
+
- small change to demo sites map viewer legend position [laszlocseh - [`0891fdf`](https://github.com/eea/volto-marine-policy/commit/0891fdf38b439804c27c3442a731637ed415ea2b)]
|
|
16
|
+
### [2.0.14](https://github.com/eea/volto-marine-policy/compare/2.0.13...2.0.14) - 15 May 2025
|
|
17
|
+
|
|
18
|
+
#### :rocket: Dependency updates
|
|
19
|
+
|
|
20
|
+
- Release @eeacms/volto-globalsearch@2.1.2 [EEA Jenkins - [`4781112`](https://github.com/eea/volto-marine-policy/commit/47811128d3fd2711efaafe426d32e28d87296222)]
|
|
21
|
+
- Release @eeacms/volto-globalsearch@2.1.1 [EEA Jenkins - [`91c4b2b`](https://github.com/eea/volto-marine-policy/commit/91c4b2ba5b743911f6898d2ad74230f3b87154b3)]
|
|
22
|
+
|
|
23
|
+
#### :house: Internal changes
|
|
24
|
+
|
|
25
|
+
- style: Automated code fix [eea-jenkins - [`ebda5f4`](https://github.com/eea/volto-marine-policy/commit/ebda5f4f834a8851ccaabb27b1a75caa13a5989c)]
|
|
26
|
+
- style: Automated code fix [eea-jenkins - [`f3118b8`](https://github.com/eea/volto-marine-policy/commit/f3118b86f9324b186eacbf9f5cfcf716d72213f0)]
|
|
27
|
+
|
|
28
|
+
#### :hammer_and_wrench: Others
|
|
29
|
+
|
|
30
|
+
- update jest-addon.config.js [laszlocseh - [`f63cc32`](https://github.com/eea/volto-marine-policy/commit/f63cc327fdc89ed930f03ae4c16baaf80a8e6fc0)]
|
|
31
|
+
- fix eslint [laszlocseh - [`4490f3f`](https://github.com/eea/volto-marine-policy/commit/4490f3f48a8256713760bc5193588cad9cb1ce6b)]
|
|
32
|
+
- remove console.log [laszlocseh - [`c2adb4a`](https://github.com/eea/volto-marine-policy/commit/c2adb4afc1c98315b36e55e94011212eec6b3927)]
|
|
33
|
+
- make filters auto update based on selection [laszlocseh - [`1a11f9a`](https://github.com/eea/volto-marine-policy/commit/1a11f9a2a0f65a2b03778c306052086068c5c323)]
|
|
7
34
|
### [2.0.13](https://github.com/eea/volto-marine-policy/compare/2.0.12...2.0.13) - 13 May 2025
|
|
8
35
|
|
|
9
36
|
#### :house: Internal changes
|
package/jest-addon.config.js
CHANGED
|
@@ -41,10 +41,10 @@ module.exports = {
|
|
|
41
41
|
},
|
|
42
42
|
coverageThreshold: {
|
|
43
43
|
global: {
|
|
44
|
-
branches:
|
|
45
|
-
functions:
|
|
46
|
-
lines:
|
|
47
|
-
statements:
|
|
44
|
+
branches: 2,
|
|
45
|
+
functions: 2,
|
|
46
|
+
lines: 2,
|
|
47
|
+
statements: 2,
|
|
48
48
|
},
|
|
49
49
|
},
|
|
50
50
|
...(process.env.JEST_USE_SETUP === 'ON' && {
|
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.15",
|
|
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.1.
|
|
37
|
+
"@eeacms/volto-globalsearch": "2.1.2",
|
|
38
38
|
"@eeacms/volto-openlayers-map": "0.3.2",
|
|
39
39
|
"@eeacms/volto-searchlib": "2.0.16",
|
|
40
40
|
"@eeacms/volto-tabs-block": "*",
|
|
@@ -36,12 +36,13 @@ export default function DemoSitesExplorerView(props) {
|
|
|
36
36
|
const [filters, setFilters] = React.useState([]);
|
|
37
37
|
const [map, setMap] = React.useState();
|
|
38
38
|
const [highlightedIndex, setHighlightedIndex] = React.useState(-1);
|
|
39
|
+
const columnsLength = hideFilters ? 12 : 8;
|
|
39
40
|
|
|
40
41
|
React.useEffect(() => {
|
|
41
|
-
const _filters = getFilters(
|
|
42
|
+
const _filters = getFilters(activeItems, indicatorOnly);
|
|
42
43
|
setFilters(_filters);
|
|
43
44
|
}, [
|
|
44
|
-
|
|
45
|
+
activeItems,
|
|
45
46
|
activeFilters.objective_filter,
|
|
46
47
|
activeFilters.target_filter,
|
|
47
48
|
activeFilters.indicator_filter,
|
|
@@ -82,7 +83,11 @@ export default function DemoSitesExplorerView(props) {
|
|
|
82
83
|
<Grid.Row>
|
|
83
84
|
{cases.length ? (
|
|
84
85
|
<Grid columns={12}>
|
|
85
|
-
<Grid.Column
|
|
86
|
+
<Grid.Column
|
|
87
|
+
mobile={columnsLength}
|
|
88
|
+
tablet={columnsLength}
|
|
89
|
+
computer={columnsLength}
|
|
90
|
+
>
|
|
86
91
|
<DemoSitesMap
|
|
87
92
|
items={cases}
|
|
88
93
|
activeItems={activeItems}
|
|
@@ -96,18 +101,18 @@ export default function DemoSitesExplorerView(props) {
|
|
|
96
101
|
setHighlightedIndex={setHighlightedIndex}
|
|
97
102
|
/>
|
|
98
103
|
</Grid.Column>
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
{!hideFilters ? (
|
|
105
|
+
<Grid.Column
|
|
106
|
+
mobile={4}
|
|
107
|
+
tablet={4}
|
|
108
|
+
computer={4}
|
|
109
|
+
className="right-side-filters"
|
|
110
|
+
>
|
|
111
|
+
<Grid.Row>
|
|
107
112
|
<VisibilitySensor>
|
|
108
113
|
<ObjectivesChart
|
|
109
114
|
items={cases}
|
|
110
|
-
|
|
115
|
+
activeItems={activeItems}
|
|
111
116
|
// filters={filters}
|
|
112
117
|
activeFilters={activeFilters}
|
|
113
118
|
setActiveFilters={setActiveFilters}
|
|
@@ -119,31 +124,52 @@ export default function DemoSitesExplorerView(props) {
|
|
|
119
124
|
setInitialized={setInitialized}
|
|
120
125
|
/>
|
|
121
126
|
</VisibilitySensor>
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
<div className="dot-demosite"></div>
|
|
127
|
+
</Grid.Row>
|
|
128
|
+
<Grid.Row>
|
|
129
|
+
<div className="legend">
|
|
130
|
+
{/* <div className="legend-row legend-subtitle">Legend</div> */}
|
|
131
|
+
<div className="legend-row">
|
|
132
|
+
<div className="circle">
|
|
133
|
+
<div className="dot-demosite"></div>
|
|
134
|
+
</div>
|
|
135
|
+
<div>Demo site</div>
|
|
132
136
|
</div>
|
|
133
|
-
<div
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
<div
|
|
137
|
+
<div className="legend-row">
|
|
138
|
+
<div className="circle">
|
|
139
|
+
<div className="dot-region"></div>
|
|
140
|
+
</div>
|
|
141
|
+
<div>Associated region</div>
|
|
138
142
|
</div>
|
|
139
|
-
<div>Associated region</div>
|
|
140
143
|
</div>
|
|
141
|
-
</
|
|
142
|
-
</Grid.
|
|
143
|
-
|
|
144
|
+
</Grid.Row>
|
|
145
|
+
</Grid.Column>
|
|
146
|
+
) : (
|
|
147
|
+
''
|
|
148
|
+
)}
|
|
144
149
|
</Grid>
|
|
145
150
|
) : null}
|
|
146
151
|
</Grid.Row>
|
|
152
|
+
{hideFilters ? (
|
|
153
|
+
<Grid.Row stretched={true}>
|
|
154
|
+
<div className="legend position-bottom">
|
|
155
|
+
{/* <div className="legend-row legend-subtitle">Legend</div> */}
|
|
156
|
+
<div className="legend-row">
|
|
157
|
+
<div className="circle">
|
|
158
|
+
<div className="dot-demosite"></div>
|
|
159
|
+
</div>
|
|
160
|
+
<div>Demo site</div>
|
|
161
|
+
</div>
|
|
162
|
+
<div className="legend-row">
|
|
163
|
+
<div className="circle">
|
|
164
|
+
<div className="dot-region"></div>
|
|
165
|
+
</div>
|
|
166
|
+
<div>Associated region</div>
|
|
167
|
+
</div>
|
|
168
|
+
</div>
|
|
169
|
+
</Grid.Row>
|
|
170
|
+
) : (
|
|
171
|
+
''
|
|
172
|
+
)}
|
|
147
173
|
</div>
|
|
148
174
|
);
|
|
149
175
|
}
|
|
@@ -82,15 +82,11 @@ export function DemoSitesFilter(props) {
|
|
|
82
82
|
{Object.entries(filters?.[filterName] || {})
|
|
83
83
|
// .sort((item1, item2) => item1[1].localeCompare(item2[1]))
|
|
84
84
|
.map(([value, label], index) => (
|
|
85
|
-
<label
|
|
86
|
-
htmlFor={label + index}
|
|
87
|
-
className="filter-input"
|
|
88
|
-
key={index}
|
|
89
|
-
>
|
|
85
|
+
<label htmlFor={label} className="filter-input" key={label}>
|
|
90
86
|
<input
|
|
91
87
|
value={value}
|
|
92
88
|
type="checkbox"
|
|
93
|
-
id={label
|
|
89
|
+
id={label}
|
|
94
90
|
onChange={(e) => {
|
|
95
91
|
const temp = JSON.parse(JSON.stringify(activeFilters));
|
|
96
92
|
if (e.target.checked) {
|
|
@@ -91,10 +91,14 @@ export default function DemoSitesMap(props) {
|
|
|
91
91
|
const coords = selectedCase.geometry.flatCoordinates;
|
|
92
92
|
const pixel = map.getPixelFromCoordinate(coords);
|
|
93
93
|
map.getInteractions().array_[9].getFeatures().clear();
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
try {
|
|
95
|
+
map
|
|
96
|
+
.getInteractions()
|
|
97
|
+
.array_[9].getFeatures()
|
|
98
|
+
.push(map.getFeaturesAtPixel(pixel)[0]);
|
|
99
|
+
} catch (e) {
|
|
100
|
+
// console.error(e);
|
|
101
|
+
}
|
|
98
102
|
} else {
|
|
99
103
|
map.getInteractions().array_[9].getFeatures().clear();
|
|
100
104
|
}
|
|
@@ -9,7 +9,7 @@ const Plot = loadable(() => import('react-plotly.js'));
|
|
|
9
9
|
|
|
10
10
|
const ObjectivesChart = ({
|
|
11
11
|
items,
|
|
12
|
-
|
|
12
|
+
activeItems,
|
|
13
13
|
// filters,
|
|
14
14
|
activeFilters,
|
|
15
15
|
setActiveFilters,
|
|
@@ -21,9 +21,29 @@ const ObjectivesChart = ({
|
|
|
21
21
|
setInitialized,
|
|
22
22
|
}) => {
|
|
23
23
|
const chartRef = useRef(null);
|
|
24
|
-
|
|
24
|
+
let objectiveCounts = {};
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
// if (!items) return;
|
|
27
|
+
|
|
28
|
+
items.forEach((item) => {
|
|
29
|
+
const _obj = item.properties.objective;
|
|
30
|
+
|
|
31
|
+
_obj.forEach((_o) => {
|
|
32
|
+
if (!(_o in objectiveCounts)) {
|
|
33
|
+
objectiveCounts[_o] = 0;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
let itemsUsedForChart = [];
|
|
39
|
+
|
|
40
|
+
if (initialized) {
|
|
41
|
+
itemsUsedForChart = activeItems;
|
|
42
|
+
} else {
|
|
43
|
+
itemsUsedForChart = items;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
for (const item of itemsUsedForChart) {
|
|
27
47
|
item.properties.objective.map((obj) => {
|
|
28
48
|
objectiveCounts[obj] = (objectiveCounts[obj] || 0) + 1;
|
|
29
49
|
return [];
|
|
@@ -43,9 +63,9 @@ const ObjectivesChart = ({
|
|
|
43
63
|
|
|
44
64
|
const interval = setInterval(() => {
|
|
45
65
|
setHighlightedIndex((prevIndex) => {
|
|
66
|
+
if (prevIndex + 1 >= objectivesLength) setInitialized(true);
|
|
46
67
|
if (prevIndex + 1 >= objectivesLength + 1) {
|
|
47
68
|
clearInterval(interval); // Stop after last item
|
|
48
|
-
setInitialized(true);
|
|
49
69
|
return prevIndex;
|
|
50
70
|
}
|
|
51
71
|
return prevIndex + 1;
|
|
@@ -63,6 +83,7 @@ const ObjectivesChart = ({
|
|
|
63
83
|
]);
|
|
64
84
|
|
|
65
85
|
React.useEffect(() => {
|
|
86
|
+
// set the objectives filter based on chartclick or list selection
|
|
66
87
|
// if (!objectives) return;
|
|
67
88
|
const filterKey = 'objective_filter';
|
|
68
89
|
|
|
@@ -172,6 +193,7 @@ const ObjectivesChart = ({
|
|
|
172
193
|
labels: labels,
|
|
173
194
|
values: values,
|
|
174
195
|
textinfo: 'none',
|
|
196
|
+
sort: false,
|
|
175
197
|
// textinfo: highlightedIndex === 5 ? 'value' : 'none',
|
|
176
198
|
hole: 0.4,
|
|
177
199
|
insidetextorientation: 'radial',
|
|
@@ -240,6 +262,7 @@ const ObjectivesChart = ({
|
|
|
240
262
|
className={cx(
|
|
241
263
|
index === highlightedIndex ? 'active' : '',
|
|
242
264
|
customColors[index].replace('#', 'C'),
|
|
265
|
+
count === 0 ? 'disabled' : '',
|
|
243
266
|
)}
|
|
244
267
|
>
|
|
245
268
|
<div
|
|
@@ -409,12 +409,17 @@
|
|
|
409
409
|
|
|
410
410
|
.legend {
|
|
411
411
|
// position: absolute;
|
|
412
|
-
bottom: 2em;
|
|
412
|
+
// bottom: 2em;
|
|
413
413
|
display: flex;
|
|
414
414
|
flex-direction: row;
|
|
415
415
|
align-items: flex-start;
|
|
416
|
+
justify-content: center;
|
|
416
417
|
gap: 1em;
|
|
417
418
|
|
|
419
|
+
&.position-bottom {
|
|
420
|
+
margin-top: 1em;
|
|
421
|
+
}
|
|
422
|
+
|
|
418
423
|
.legend-row {
|
|
419
424
|
display: flex;
|
|
420
425
|
align-items: center;
|
|
@@ -565,5 +570,11 @@
|
|
|
565
570
|
height: 1em;
|
|
566
571
|
}
|
|
567
572
|
}
|
|
573
|
+
|
|
574
|
+
&.disabled {
|
|
575
|
+
cursor: not-allowed;
|
|
576
|
+
opacity: 0.5;
|
|
577
|
+
pointer-events: none;
|
|
578
|
+
}
|
|
568
579
|
}
|
|
569
580
|
}
|