@eeacms/volto-marine-policy 2.0.31 → 2.0.33
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 +20 -0
- package/package.json +1 -1
- package/src/components/Blocks/DemoSitesExplorer/DemoSitesExplorerEdit.js +23 -1
- package/src/components/Blocks/DemoSitesExplorer/DemoSitesExplorerView.js +15 -5
- package/src/components/Blocks/DemoSitesExplorer/DemoSitesFilters.jsx +3 -15
- package/src/components/Blocks/DemoSitesExplorer/DemoSitesMap.jsx +43 -21
- package/src/components/Blocks/DemoSitesExplorer/schema.jsx +23 -0
- package/src/components/Blocks/DemoSitesExplorer/utils.js +15 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,26 @@ 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.33](https://github.com/eea/volto-marine-policy/compare/2.0.32...2.0.33) - 22 October 2025
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- update demo sites map marine protected areas [laszlocseh - [`20ff428`](https://github.com/eea/volto-marine-policy/commit/20ff4280bc26593126566718993d16a0c36574cc)]
|
|
12
|
+
### [2.0.32](https://github.com/eea/volto-marine-policy/compare/2.0.31...2.0.32) - 21 October 2025
|
|
13
|
+
|
|
14
|
+
#### :rocket: New Features
|
|
15
|
+
|
|
16
|
+
- feat: demo sites explorer marine protected areas [laszlocseh - [`2948712`](https://github.com/eea/volto-marine-policy/commit/29487121251c4281ba68fa3225746c0956eeb61f)]
|
|
17
|
+
- feat: demo sites explorer possibility to enable marine protected areas layer [laszlocseh - [`7eb5548`](https://github.com/eea/volto-marine-policy/commit/7eb5548f64ae9db459c8897cfff619a55c34a28d)]
|
|
18
|
+
|
|
19
|
+
#### :house: Internal changes
|
|
20
|
+
|
|
21
|
+
- style: Automated code fix [eea-jenkins - [`07e516a`](https://github.com/eea/volto-marine-policy/commit/07e516aa712789a54ad7c3554f8391710f3db26a)]
|
|
22
|
+
- style: Automated code fix [eea-jenkins - [`d7e18b9`](https://github.com/eea/volto-marine-policy/commit/d7e18b99b4e2babd5bc8fdf954f8537c4cbdde39)]
|
|
23
|
+
|
|
24
|
+
#### :hammer_and_wrench: Others
|
|
25
|
+
|
|
26
|
+
- fix eslint [laszlocseh - [`a2776d2`](https://github.com/eea/volto-marine-policy/commit/a2776d2e26ccf816334d6721bec15f5896cde579)]
|
|
7
27
|
### [2.0.31](https://github.com/eea/volto-marine-policy/compare/2.0.30...2.0.31) - 10 October 2025
|
|
8
28
|
|
|
9
29
|
#### :hammer_and_wrench: Others
|
package/package.json
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
import DemoSitesExplorerView from './DemoSitesExplorerView';
|
|
2
|
+
import { SidebarPortal, BlockDataForm } from '@plone/volto/components';
|
|
3
|
+
import schema from './schema';
|
|
2
4
|
|
|
3
5
|
export default function DemoSitesExplorerEdit(props) {
|
|
4
|
-
|
|
6
|
+
const { selected, onChangeBlock, data = {}, block } = props;
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<div>
|
|
10
|
+
<DemoSitesExplorerView {...props} mode="edit" />
|
|
11
|
+
|
|
12
|
+
<SidebarPortal selected={selected}>
|
|
13
|
+
<BlockDataForm
|
|
14
|
+
schema={schema}
|
|
15
|
+
title={schema.title}
|
|
16
|
+
onChangeField={(id, value) => {
|
|
17
|
+
onChangeBlock(block, {
|
|
18
|
+
...data,
|
|
19
|
+
[id]: value,
|
|
20
|
+
});
|
|
21
|
+
}}
|
|
22
|
+
formData={data}
|
|
23
|
+
/>
|
|
24
|
+
</SidebarPortal>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
5
27
|
}
|
|
@@ -19,8 +19,11 @@ export default function DemoSitesExplorerView(props) {
|
|
|
19
19
|
: '/marine/@@demo-sites-map.arcgis.json';
|
|
20
20
|
let cases = useCases(addAppURL(cases_url));
|
|
21
21
|
const [selectedCase, onSelectedCase] = React.useState(null);
|
|
22
|
-
|
|
22
|
+
const { enableMarineMO } = props.data;
|
|
23
|
+
// console.log('enableMarineMO', enableMarineMO);
|
|
23
24
|
const { properties } = props;
|
|
25
|
+
// if the map is rendered on the indicator page we hide the Target and
|
|
26
|
+
// the Indicator filters, and hide the chart on the right side
|
|
24
27
|
const hideFilters = properties['@type'] === 'indicator_mo' ? true : false;
|
|
25
28
|
const indicatorOnly = hideFilters ? properties['title'] : null;
|
|
26
29
|
|
|
@@ -36,7 +39,7 @@ export default function DemoSitesExplorerView(props) {
|
|
|
36
39
|
const [filters, setFilters] = React.useState([]);
|
|
37
40
|
const [map, setMap] = React.useState();
|
|
38
41
|
const [highlightedIndex, setHighlightedIndex] = React.useState(-1);
|
|
39
|
-
const columnsLength = hideFilters ? 12 : 8;
|
|
42
|
+
const columnsLength = hideFilters || enableMarineMO ? 12 : 8;
|
|
40
43
|
|
|
41
44
|
React.useEffect(() => {
|
|
42
45
|
const _filters = getFilters(activeItems, indicatorOnly);
|
|
@@ -53,10 +56,15 @@ export default function DemoSitesExplorerView(props) {
|
|
|
53
56
|
]);
|
|
54
57
|
|
|
55
58
|
React.useEffect(() => {
|
|
56
|
-
let activeItems = filterCases(
|
|
59
|
+
let activeItems = filterCases(
|
|
60
|
+
cases,
|
|
61
|
+
activeFilters,
|
|
62
|
+
indicatorOnly,
|
|
63
|
+
enableMarineMO,
|
|
64
|
+
);
|
|
57
65
|
|
|
58
66
|
setActiveItems(activeItems);
|
|
59
|
-
}, [activeFilters, cases, indicatorOnly]);
|
|
67
|
+
}, [activeFilters, cases, indicatorOnly, enableMarineMO]);
|
|
60
68
|
|
|
61
69
|
if (__SERVER__) return '';
|
|
62
70
|
|
|
@@ -78,6 +86,7 @@ export default function DemoSitesExplorerView(props) {
|
|
|
78
86
|
hideFilters={hideFilters}
|
|
79
87
|
setActiveFilters={setActiveFilters}
|
|
80
88
|
highlightedIndex={highlightedIndex}
|
|
89
|
+
enableMarineMO={enableMarineMO}
|
|
81
90
|
/>
|
|
82
91
|
</Grid.Row>
|
|
83
92
|
<Grid.Row>
|
|
@@ -99,9 +108,10 @@ export default function DemoSitesExplorerView(props) {
|
|
|
99
108
|
setMap={setMap}
|
|
100
109
|
highlightedIndex={highlightedIndex}
|
|
101
110
|
setHighlightedIndex={setHighlightedIndex}
|
|
111
|
+
enableMarineMO={enableMarineMO}
|
|
102
112
|
/>
|
|
103
113
|
</Grid.Column>
|
|
104
|
-
{!hideFilters ? (
|
|
114
|
+
{!(hideFilters || enableMarineMO) ? (
|
|
105
115
|
<Grid.Column
|
|
106
116
|
mobile={4}
|
|
107
117
|
tablet={4}
|
|
@@ -165,6 +165,7 @@ export function DemoSitesFilters(props) {
|
|
|
165
165
|
hideFilters,
|
|
166
166
|
setActiveFilters,
|
|
167
167
|
highlightedIndex,
|
|
168
|
+
enableMarineMO,
|
|
168
169
|
} = props;
|
|
169
170
|
|
|
170
171
|
React.useEffect(() => {
|
|
@@ -179,21 +180,8 @@ export function DemoSitesFilters(props) {
|
|
|
179
180
|
});
|
|
180
181
|
}, []);
|
|
181
182
|
|
|
182
|
-
return (
|
|
183
|
+
return !enableMarineMO ? (
|
|
183
184
|
<>
|
|
184
|
-
{/* {!hideFilters ? (
|
|
185
|
-
<DemoSitesFilter
|
|
186
|
-
filterTitle="Objective/Enabler"
|
|
187
|
-
filterName="objective_filter"
|
|
188
|
-
filters={filters}
|
|
189
|
-
activeFilters={activeFilters}
|
|
190
|
-
setActiveFilters={setActiveFilters}
|
|
191
|
-
map={map}
|
|
192
|
-
customOrder={objectivesCustomOrder}
|
|
193
|
-
/>
|
|
194
|
-
) : (
|
|
195
|
-
''
|
|
196
|
-
)} */}
|
|
197
185
|
{!hideFilters ? (
|
|
198
186
|
<DemoSitesFilter
|
|
199
187
|
filterTitle="Target"
|
|
@@ -235,7 +223,7 @@ export function DemoSitesFilters(props) {
|
|
|
235
223
|
highlightedIndex={highlightedIndex}
|
|
236
224
|
/>
|
|
237
225
|
</>
|
|
238
|
-
);
|
|
226
|
+
) : null;
|
|
239
227
|
}
|
|
240
228
|
|
|
241
229
|
export function SearchBox(props) {
|
|
@@ -42,12 +42,19 @@ function DemoSitesMap(props) {
|
|
|
42
42
|
setMap,
|
|
43
43
|
highlightedIndex,
|
|
44
44
|
setHighlightedIndex,
|
|
45
|
+
enableMarineMO,
|
|
45
46
|
ol,
|
|
46
47
|
} = props;
|
|
47
48
|
const features = getFeatures({ cases: items, ol });
|
|
48
49
|
const [resetMapButtonClass, setResetMapButtonClass] =
|
|
49
50
|
React.useState('inactive');
|
|
50
51
|
|
|
52
|
+
const arcgisSource = React.useMemo(() => {
|
|
53
|
+
return new ol.source.TileArcGISRest({
|
|
54
|
+
url: 'https://water.discomap.eea.europa.eu/arcgis/rest/services/Marine/MPA_networks_in_EEA_marine_assessment_areas_2021/MapServer',
|
|
55
|
+
});
|
|
56
|
+
}, [ol.source.TileArcGISRest]);
|
|
57
|
+
|
|
51
58
|
const [tileWMSSources] = React.useState([
|
|
52
59
|
new ol.source.TileWMS({
|
|
53
60
|
url: 'https://gisco-services.ec.europa.eu/maps/service',
|
|
@@ -55,6 +62,7 @@ function DemoSitesMap(props) {
|
|
|
55
62
|
// LAYERS: 'OSMBlossomComposite', OSMCartoComposite, OSMPositronComposite
|
|
56
63
|
LAYERS: 'OSMPositronComposite',
|
|
57
64
|
TILED: true,
|
|
65
|
+
DPI: 192,
|
|
58
66
|
},
|
|
59
67
|
serverType: 'geoserver',
|
|
60
68
|
transition: 0,
|
|
@@ -128,8 +136,8 @@ function DemoSitesMap(props) {
|
|
|
128
136
|
}, [map, selectedCase, resetMapButtonClass, setResetMapButtonClass, ol]);
|
|
129
137
|
|
|
130
138
|
const clusterStyle = React.useMemo(
|
|
131
|
-
() => selectedClusterStyle({ selectedCase, ol }),
|
|
132
|
-
[selectedCase, ol],
|
|
139
|
+
() => selectedClusterStyle({ selectedCase, ol, enableMarineMO }),
|
|
140
|
+
[selectedCase, ol, enableMarineMO],
|
|
133
141
|
);
|
|
134
142
|
|
|
135
143
|
const MapWithSelection = React.useMemo(() => Map, []);
|
|
@@ -143,7 +151,7 @@ function DemoSitesMap(props) {
|
|
|
143
151
|
showFullExtent: true,
|
|
144
152
|
zoom: 3.4,
|
|
145
153
|
}}
|
|
146
|
-
pixelRatio={1}
|
|
154
|
+
// pixelRatio={window.devicePixelRatio || 1}
|
|
147
155
|
// controls={ol.control.defaults({ attribution: false })}
|
|
148
156
|
>
|
|
149
157
|
<Controls attribution={false} />
|
|
@@ -188,6 +196,7 @@ function DemoSitesMap(props) {
|
|
|
188
196
|
// selectedCase={selectedCase}
|
|
189
197
|
/>
|
|
190
198
|
<Layer.Tile source={tileWMSSources[0]} zIndex={0} />
|
|
199
|
+
{enableMarineMO && <Layer.Tile source={arcgisSource} zIndex={0} />}
|
|
191
200
|
<Layer.Vector
|
|
192
201
|
style={clusterStyle}
|
|
193
202
|
source={clusterSource}
|
|
@@ -200,7 +209,7 @@ function DemoSitesMap(props) {
|
|
|
200
209
|
) : null;
|
|
201
210
|
}
|
|
202
211
|
|
|
203
|
-
const selectedClusterStyle = ({ selectedFeature, ol }) => {
|
|
212
|
+
const selectedClusterStyle = ({ selectedFeature, ol, enableMarineMO }) => {
|
|
204
213
|
function _clusterStyle(feature, selectedFeature) {
|
|
205
214
|
const size = feature.get('features').length;
|
|
206
215
|
let clusterStyle = styleCache[size];
|
|
@@ -228,25 +237,38 @@ const selectedClusterStyle = ({ selectedFeature, ol }) => {
|
|
|
228
237
|
}
|
|
229
238
|
// set size === 1 to enable clusterization
|
|
230
239
|
if (size) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
radius: radius,
|
|
241
|
-
fill: new ol.style.Fill({
|
|
242
|
-
color: '#fff',
|
|
240
|
+
if (enableMarineMO) {
|
|
241
|
+
return new ol.style.Style({
|
|
242
|
+
image: new ol.style.Icon({
|
|
243
|
+
anchor: [0.5, 1],
|
|
244
|
+
// size: [52, 52],
|
|
245
|
+
// offset: [52, 0],
|
|
246
|
+
// opacity: 1,
|
|
247
|
+
scale: 0.8,
|
|
248
|
+
src: '/marine/europe-seas/eu-mission-restore-our-oceans-and-water/icon-point.png/@@images/image/tiny',
|
|
243
249
|
}),
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
250
|
+
});
|
|
251
|
+
} else {
|
|
252
|
+
// let color = feature.values_.features[0].values_['color'];
|
|
253
|
+
let color = '#0179cf';
|
|
254
|
+
let width = feature.values_.features[0].values_['width'];
|
|
255
|
+
let radius = feature.values_.features[0].values_['radius'];
|
|
256
|
+
// console.log(color)
|
|
257
|
+
// let color = '#0083E0'; // #0083E0 #50B0A4
|
|
258
|
+
|
|
259
|
+
return new ol.style.Style({
|
|
260
|
+
image: new ol.style.Circle({
|
|
261
|
+
radius: radius,
|
|
262
|
+
fill: new ol.style.Fill({
|
|
263
|
+
color: '#fff',
|
|
264
|
+
}),
|
|
265
|
+
stroke: new ol.style.Stroke({
|
|
266
|
+
color: color,
|
|
267
|
+
width: width,
|
|
268
|
+
}),
|
|
247
269
|
}),
|
|
248
|
-
})
|
|
249
|
-
}
|
|
270
|
+
});
|
|
271
|
+
}
|
|
250
272
|
} else {
|
|
251
273
|
return clusterStyle;
|
|
252
274
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const DemoSitesExplorerSchema = {
|
|
2
|
+
title: 'Demo Sites Explorer',
|
|
3
|
+
fieldsets: [
|
|
4
|
+
{
|
|
5
|
+
id: 'default',
|
|
6
|
+
title: 'Default',
|
|
7
|
+
fields: ['enableMarineMO'],
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
|
|
11
|
+
properties: {
|
|
12
|
+
enableMarineMO: {
|
|
13
|
+
title: 'Enable Marine Protected Areas layer',
|
|
14
|
+
description:
|
|
15
|
+
'If enabled, the Marine Protected Areas layer will be displayed on the map, without the filters and the chart on the right side',
|
|
16
|
+
type: 'boolean',
|
|
17
|
+
default: false,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
required: ['enableMarineMO'],
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default DemoSitesExplorerSchema;
|
|
@@ -144,7 +144,12 @@ export function getFeatures({ cases, ol }) {
|
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
export function filterCases(
|
|
147
|
+
export function filterCases(
|
|
148
|
+
cases,
|
|
149
|
+
activeFilters,
|
|
150
|
+
indicatorOnly,
|
|
151
|
+
enableMarineMO,
|
|
152
|
+
) {
|
|
148
153
|
const data = cases.filter((_case) => {
|
|
149
154
|
let flag_objective = false;
|
|
150
155
|
let flag_target = false;
|
|
@@ -158,6 +163,15 @@ export function filterCases(cases, activeFilters, indicatorOnly) {
|
|
|
158
163
|
return item['title'].toString();
|
|
159
164
|
});
|
|
160
165
|
if (indicators?.includes(indicatorOnly)) flag_indicatorOnly = true;
|
|
166
|
+
} else if (enableMarineMO) {
|
|
167
|
+
let indicators = _case.properties.indicators?.map((item) => {
|
|
168
|
+
return item['title'].toString();
|
|
169
|
+
});
|
|
170
|
+
if (
|
|
171
|
+
indicators?.includes('Marine protected areas') ||
|
|
172
|
+
indicators?.includes('Marine strictly protected areas')
|
|
173
|
+
)
|
|
174
|
+
flag_indicatorOnly = true;
|
|
161
175
|
} else {
|
|
162
176
|
flag_indicatorOnly = true;
|
|
163
177
|
}
|