@eeacms/volto-marine-policy 2.0.26 → 2.0.27
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
CHANGED
|
@@ -4,6 +4,12 @@ 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.27](https://github.com/eea/volto-marine-policy/compare/2.0.26...2.0.27) - 5 September 2025
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- fix eslint [laszlocseh - [`3f90c17`](https://github.com/eea/volto-marine-policy/commit/3f90c17f976fdf48a2e967d2997487ba87a3535d)]
|
|
12
|
+
- Demo Sites Explorer filter Targets facet options by selected objective [laszlocseh - [`3b975ad`](https://github.com/eea/volto-marine-policy/commit/3b975ad4380196cfd71c8fd2919fc717f98528a5)]
|
|
7
13
|
### [2.0.26](https://github.com/eea/volto-marine-policy/compare/2.0.25...2.0.26) - 29 August 2025
|
|
8
14
|
|
|
9
15
|
#### :rocket: Dependency updates
|
package/package.json
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { clearFilters } from './utils';
|
|
4
|
+
import { objectivesCustomOrder } from './utils';
|
|
5
|
+
|
|
6
|
+
const objectivesTargets = {
|
|
7
|
+
'Objective 1: Protect and restore marine and freshwater ecosystems and biodiversity':
|
|
8
|
+
[
|
|
9
|
+
'Contribute to relevant marine nature restoration targets including degraded seabed habitats and coastal ecosystems',
|
|
10
|
+
"Protect at least 30% of the EU's seas and integrate ecological corridors, as part of a true Trans-European Nature Network",
|
|
11
|
+
"Strictly protect at least 10% of the EU's seas",
|
|
12
|
+
'Restore at least 25,000 km of free/flowing rivers',
|
|
13
|
+
],
|
|
14
|
+
'Objective 2: Prevent and eliminate pollution of our oceans, seas and waters':
|
|
15
|
+
[
|
|
16
|
+
'Reduce nutrient losses by 50%',
|
|
17
|
+
'Reduce the use and risk of chemical pesticides by 50%',
|
|
18
|
+
'Reduce plastic litter at sea by 50%',
|
|
19
|
+
'Reduce by 30% microplastics released into the environment',
|
|
20
|
+
],
|
|
21
|
+
'Objective 3: Make the sustainable blue economy carbon-neutral and circular':
|
|
22
|
+
[
|
|
23
|
+
'Achieve net zero maritime emissions',
|
|
24
|
+
'Promote circular, low-carbon multi-purpose use of marine and water space',
|
|
25
|
+
'Develop zero-carbon and low-impact aquaculture',
|
|
26
|
+
],
|
|
27
|
+
};
|
|
4
28
|
|
|
5
29
|
const normalizeSearchInput = (searchInput) => {
|
|
6
30
|
let normInput = searchInput
|
|
@@ -13,6 +37,25 @@ const normalizeSearchInput = (searchInput) => {
|
|
|
13
37
|
return '\\b' + normInput + '\\b';
|
|
14
38
|
};
|
|
15
39
|
|
|
40
|
+
const filterTargetsByObjective = (filters, filterName, highlightedIndex) => {
|
|
41
|
+
if (filterName !== 'target_filter') return filters;
|
|
42
|
+
if (highlightedIndex < 0 || highlightedIndex > 2) return filters;
|
|
43
|
+
|
|
44
|
+
let selectedObjective = objectivesCustomOrder[highlightedIndex];
|
|
45
|
+
let allowedTargets = objectivesTargets[selectedObjective] || [];
|
|
46
|
+
|
|
47
|
+
// Filter the targets based on the allowed ones
|
|
48
|
+
if (filters['target_filter']) {
|
|
49
|
+
filters['target_filter'] = Object.fromEntries(
|
|
50
|
+
Object.entries(filters['target_filter']).filter(([key]) =>
|
|
51
|
+
allowedTargets.includes(key),
|
|
52
|
+
),
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return filters;
|
|
57
|
+
};
|
|
58
|
+
|
|
16
59
|
export function DemoSitesFilter(props) {
|
|
17
60
|
const {
|
|
18
61
|
filterTitle,
|
|
@@ -20,11 +63,15 @@ export function DemoSitesFilter(props) {
|
|
|
20
63
|
activeFilters,
|
|
21
64
|
setActiveFilters,
|
|
22
65
|
filterName,
|
|
23
|
-
|
|
66
|
+
highlightedIndex,
|
|
24
67
|
} = props;
|
|
25
68
|
|
|
26
69
|
const customOrder = props?.customOrder || [];
|
|
27
|
-
const entries = Object.entries(
|
|
70
|
+
const entries = Object.entries(
|
|
71
|
+
filterTargetsByObjective(filters, filterName, highlightedIndex)?.[
|
|
72
|
+
filterName
|
|
73
|
+
] || {},
|
|
74
|
+
);
|
|
28
75
|
let sortedEntries = [];
|
|
29
76
|
|
|
30
77
|
if (customOrder.length > 0) {
|
|
@@ -112,7 +159,13 @@ export function DemoSitesFilter(props) {
|
|
|
112
159
|
}
|
|
113
160
|
|
|
114
161
|
export function DemoSitesFilters(props) {
|
|
115
|
-
const {
|
|
162
|
+
const {
|
|
163
|
+
filters,
|
|
164
|
+
activeFilters,
|
|
165
|
+
hideFilters,
|
|
166
|
+
setActiveFilters,
|
|
167
|
+
highlightedIndex,
|
|
168
|
+
} = props;
|
|
116
169
|
|
|
117
170
|
React.useEffect(() => {
|
|
118
171
|
window.addEventListener('click', (event) => {
|
|
@@ -148,7 +201,7 @@ export function DemoSitesFilters(props) {
|
|
|
148
201
|
filters={filters}
|
|
149
202
|
activeFilters={activeFilters}
|
|
150
203
|
setActiveFilters={setActiveFilters}
|
|
151
|
-
|
|
204
|
+
highlightedIndex={highlightedIndex}
|
|
152
205
|
/>
|
|
153
206
|
) : (
|
|
154
207
|
''
|
|
@@ -160,7 +213,7 @@ export function DemoSitesFilters(props) {
|
|
|
160
213
|
filters={filters}
|
|
161
214
|
activeFilters={activeFilters}
|
|
162
215
|
setActiveFilters={setActiveFilters}
|
|
163
|
-
|
|
216
|
+
highlightedIndex={highlightedIndex}
|
|
164
217
|
/>
|
|
165
218
|
) : (
|
|
166
219
|
''
|
|
@@ -171,7 +224,7 @@ export function DemoSitesFilters(props) {
|
|
|
171
224
|
filters={filters}
|
|
172
225
|
activeFilters={activeFilters}
|
|
173
226
|
setActiveFilters={setActiveFilters}
|
|
174
|
-
|
|
227
|
+
highlightedIndex={highlightedIndex}
|
|
175
228
|
/>
|
|
176
229
|
<DemoSitesFilter
|
|
177
230
|
filterTitle="Country"
|
|
@@ -179,7 +232,7 @@ export function DemoSitesFilters(props) {
|
|
|
179
232
|
filters={filters}
|
|
180
233
|
activeFilters={activeFilters}
|
|
181
234
|
setActiveFilters={setActiveFilters}
|
|
182
|
-
|
|
235
|
+
highlightedIndex={highlightedIndex}
|
|
183
236
|
/>
|
|
184
237
|
</>
|
|
185
238
|
);
|