@eeacms/volto-marine-policy 2.0.31 → 2.0.32

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,21 @@ 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.32](https://github.com/eea/volto-marine-policy/compare/2.0.31...2.0.32) - 21 October 2025
8
+
9
+ #### :rocket: New Features
10
+
11
+ - feat: demo sites explorer marine protected areas [laszlocseh - [`2948712`](https://github.com/eea/volto-marine-policy/commit/29487121251c4281ba68fa3225746c0956eeb61f)]
12
+ - feat: demo sites explorer possibility to enable marine protected areas layer [laszlocseh - [`7eb5548`](https://github.com/eea/volto-marine-policy/commit/7eb5548f64ae9db459c8897cfff619a55c34a28d)]
13
+
14
+ #### :house: Internal changes
15
+
16
+ - style: Automated code fix [eea-jenkins - [`07e516a`](https://github.com/eea/volto-marine-policy/commit/07e516aa712789a54ad7c3554f8391710f3db26a)]
17
+ - style: Automated code fix [eea-jenkins - [`d7e18b9`](https://github.com/eea/volto-marine-policy/commit/d7e18b99b4e2babd5bc8fdf954f8537c4cbdde39)]
18
+
19
+ #### :hammer_and_wrench: Others
20
+
21
+ - fix eslint [laszlocseh - [`a2776d2`](https://github.com/eea/volto-marine-policy/commit/a2776d2e26ccf816334d6721bec15f5896cde579)]
7
22
  ### [2.0.31](https://github.com/eea/volto-marine-policy/compare/2.0.30...2.0.31) - 10 October 2025
8
23
 
9
24
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-marine-policy",
3
- "version": "2.0.31",
3
+ "version": "2.0.32",
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",
@@ -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
- return <DemoSitesExplorerView {...props} mode="edit" />;
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(cases, activeFilters, indicatorOnly);
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,
@@ -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}
@@ -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(cases, activeFilters, indicatorOnly) {
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
  }