@eeacms/volto-marine-policy 2.0.24 → 2.0.25

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,17 @@ 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.25](https://github.com/eea/volto-marine-policy/compare/2.0.24...2.0.25) - 27 August 2025
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - pin volto-openlayers-map to 1.0.0 [Nilesh - [`49c4af6`](https://github.com/eea/volto-marine-policy/commit/49c4af6c0edd7473d753a193f8c98c1789818e0f)]
12
+ - fix volto-openlayers-map module resolving [nileshgulia1 - [`c27cfa7`](https://github.com/eea/volto-marine-policy/commit/c27cfa7a067b7c42fdc85a3b847001cd8e3db088)]
13
+ - eslint [nileshgulia1 - [`2c5300e`](https://github.com/eea/volto-marine-policy/commit/2c5300eba990cc4a3d4c3e87d69faa00d93e756c)]
14
+ - eslint . [nileshgulia1 - [`87664a3`](https://github.com/eea/volto-marine-policy/commit/87664a3f5252c4f41ca1a1b069fc3073627e2dcc)]
15
+ - fix imports [nileshgulia1 - [`9baee98`](https://github.com/eea/volto-marine-policy/commit/9baee9884012a41db83c178f3e3e1058ff6ae4ee)]
16
+ - update [nileshgulia1 - [`0d4694c`](https://github.com/eea/volto-marine-policy/commit/0d4694cc75d8c37e1d49fe4808b21e5de9dae9d3)]
17
+ - update open layers map config in simple data block refs#288034 [nileshgulia1 - [`cc14bb7`](https://github.com/eea/volto-marine-policy/commit/cc14bb7e178d111dc0e560d97c83b1f503b607bf)]
7
18
  ### [2.0.24](https://github.com/eea/volto-marine-policy/compare/2.0.23...2.0.24) - 27 August 2025
8
19
 
9
20
  #### :rocket: New Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-marine-policy",
3
- "version": "2.0.24",
3
+ "version": "2.0.25",
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,6 @@
1
1
  import React from 'react';
2
2
  import { centerAndResetMapZoom, isValidURL } from './utils';
3
+ import { withOpenLayers } from '@eeacms/volto-openlayers-map';
3
4
 
4
5
  const showPageNr = (pageNr, currentPage, numberOfPages) => {
5
6
  // show first 5 pages
@@ -24,8 +25,8 @@ const showPageNr = (pageNr, currentPage, numberOfPages) => {
24
25
  return false;
25
26
  };
26
27
 
27
- export default function DemoSitesList(props) {
28
- const { selectedCase, onSelectedCase, pointsSource, map } = props;
28
+ function DemoSitesList(props) {
29
+ const { selectedCase, onSelectedCase, pointsSource, map, ol } = props;
29
30
  // const reSearch = new RegExp(`\\b(${searchInput})\\b`, 'gi');
30
31
  const [currentPage, setCurrentPage] = React.useState(1);
31
32
 
@@ -155,7 +156,7 @@ export default function DemoSitesList(props) {
155
156
  // scrollToElement('search-input');
156
157
  // reset map zoom
157
158
  onSelectedCase(null);
158
- centerAndResetMapZoom(map);
159
+ centerAndResetMapZoom({ map, ol });
159
160
  map.getInteractions().array_[9].getFeatures().clear();
160
161
  }}
161
162
  >
@@ -376,3 +377,5 @@ export default function DemoSitesList(props) {
376
377
  </>
377
378
  );
378
379
  }
380
+
381
+ export default withOpenLayers(DemoSitesList);
@@ -2,12 +2,17 @@ import React from 'react';
2
2
 
3
3
  import cx from 'classnames';
4
4
 
5
- import { Map, Layer, Layers, Controls } from '@eeacms/volto-openlayers-map/api';
6
- import { openlayers as ol } from '@eeacms/volto-openlayers-map';
5
+ import {
6
+ Map,
7
+ Layer,
8
+ Layers,
9
+ Controls,
10
+ useMapContext,
11
+ } from '@eeacms/volto-openlayers-map/api';
12
+ import { withOpenLayers } from '@eeacms/volto-openlayers-map';
7
13
 
8
14
  import InfoOverlay from './InfoOverlay';
9
15
  import FeatureInteraction from './FeatureInteraction';
10
- import { useMapContext } from '@eeacms/volto-openlayers-map/api';
11
16
 
12
17
  import {
13
18
  centerAndResetMapZoom,
@@ -25,7 +30,7 @@ const MapContextGateway = ({ setMap }) => {
25
30
  return null;
26
31
  };
27
32
 
28
- export default function DemoSitesMap(props) {
33
+ function DemoSitesMap(props) {
29
34
  const {
30
35
  items,
31
36
  activeItems,
@@ -37,8 +42,9 @@ export default function DemoSitesMap(props) {
37
42
  setMap,
38
43
  highlightedIndex,
39
44
  setHighlightedIndex,
45
+ ol,
40
46
  } = props;
41
- const features = getFeatures(items);
47
+ const features = getFeatures({ cases: items, ol });
42
48
  const [resetMapButtonClass, setResetMapButtonClass] =
43
49
  React.useState('inactive');
44
50
 
@@ -72,11 +78,11 @@ export default function DemoSitesMap(props) {
72
78
 
73
79
  if (activeItems) {
74
80
  pointsSource.clear();
75
- pointsSource.addFeatures(getFeatures(activeItems));
81
+ pointsSource.addFeatures(getFeatures({ cases: activeItems, ol }));
76
82
  // hideFilters && zoomMapToFeatures(map, getFeatures(activeItems));
77
83
  // zoomMapToFeatures(map, getFeatures(activeItems));
78
84
  }
79
- }, [map, activeItems, pointsSource, hideFilters]);
85
+ }, [map, activeItems, pointsSource, hideFilters, ol]);
80
86
 
81
87
  React.useEffect(() => {
82
88
  if (!map) return null;
@@ -119,11 +125,11 @@ export default function DemoSitesMap(props) {
119
125
  return () => {
120
126
  map.un('moveend', moveendListener);
121
127
  };
122
- }, [map, selectedCase, resetMapButtonClass, setResetMapButtonClass]);
128
+ }, [map, selectedCase, resetMapButtonClass, setResetMapButtonClass, ol]);
123
129
 
124
130
  const clusterStyle = React.useMemo(
125
- () => selectedClusterStyle(selectedCase),
126
- [selectedCase],
131
+ () => selectedClusterStyle({ selectedCase, ol }),
132
+ [selectedCase, ol],
127
133
  );
128
134
 
129
135
  const MapWithSelection = React.useMemo(() => Map, []);
@@ -159,9 +165,9 @@ export default function DemoSitesMap(props) {
159
165
  setHighlightedIndex(5);
160
166
  if (hideFilters) {
161
167
  // zoomMapToFeatures(map, getFeatures(activeItems));
162
- centerAndResetMapZoom(map);
168
+ centerAndResetMapZoom({ map, ol });
163
169
  } else {
164
- centerAndResetMapZoom(map);
170
+ centerAndResetMapZoom({ map, ol });
165
171
  // zoomMapToFeatures(map, getFeatures(activeItems));
166
172
  }
167
173
  map.getInteractions().array_[9].getFeatures().clear();
@@ -194,7 +200,7 @@ export default function DemoSitesMap(props) {
194
200
  ) : null;
195
201
  }
196
202
 
197
- const selectedClusterStyle = (selectedFeature) => {
203
+ const selectedClusterStyle = ({ selectedFeature, ol }) => {
198
204
  function _clusterStyle(feature, selectedFeature) {
199
205
  const size = feature.get('features').length;
200
206
  let clusterStyle = styleCache[size];
@@ -247,3 +253,5 @@ const selectedClusterStyle = (selectedFeature) => {
247
253
  }
248
254
  return _clusterStyle;
249
255
  };
256
+
257
+ export default withOpenLayers(DemoSitesMap);
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
- import { openlayers as ol } from '@eeacms/volto-openlayers-map';
2
+ import { withOpenLayers } from '@eeacms/volto-openlayers-map';
3
3
  import { useMapContext } from '@eeacms/volto-openlayers-map/api';
4
4
  // import { zoomMapToFeatures } from './utils';
5
5
 
6
- export const useStyles = () => {
6
+ export const useStyles = ({ ol }) => {
7
7
  const selected = React.useMemo(
8
8
  () =>
9
9
  new ol.style.Style({
@@ -18,7 +18,7 @@ export const useStyles = () => {
18
18
  }),
19
19
  }),
20
20
  }),
21
- [],
21
+ [ol],
22
22
  );
23
23
 
24
24
  const selectStyle = React.useCallback(
@@ -35,10 +35,10 @@ export const useStyles = () => {
35
35
  return { selected, selectStyle };
36
36
  };
37
37
 
38
- export default function FeatureInteraction({ onFeatureSelect }) {
38
+ function FeatureInteraction({ onFeatureSelect, ol }) {
39
39
  // console.log('featureinteraction', selectedCase);
40
40
  const { map } = useMapContext();
41
- const { selectStyle } = useStyles();
41
+ const { selectStyle } = useStyles({ ol });
42
42
 
43
43
  const select = new ol.interaction.Select({
44
44
  condition: ol.condition.click,
@@ -88,3 +88,5 @@ export default function FeatureInteraction({ onFeatureSelect }) {
88
88
 
89
89
  return null;
90
90
  }
91
+
92
+ export default withOpenLayers(FeatureInteraction);
@@ -1,14 +1,15 @@
1
1
  import React from 'react';
2
2
  import { useMapContext } from '@eeacms/volto-openlayers-map/api';
3
- import { openlayers as ol } from '@eeacms/volto-openlayers-map';
3
+ import { withOpenLayers } from '@eeacms/volto-openlayers-map';
4
4
  import FeatureDisplay from './FeatureDisplay';
5
5
  import { usePrevious } from '@plone/volto/helpers/Utils/usePrevious';
6
6
 
7
- export default function InfoOverlay({
7
+ function InfoOverlay({
8
8
  selectedFeature,
9
9
  onFeatureSelect,
10
10
  layerId,
11
11
  // hideFilters,
12
+ ol,
12
13
  }) {
13
14
  const { map } = useMapContext();
14
15
  const [tooltip, setTooltipRef] = React.useState();
@@ -63,7 +64,7 @@ export default function InfoOverlay({
63
64
  map.un('click', handler);
64
65
  map.removeOverlay(overlay);
65
66
  };
66
- }, [map, tooltip, onFeatureSelect]); //
67
+ }, [map, tooltip, onFeatureSelect, ol]); //
67
68
 
68
69
  const [isClient, setIsClient] = React.useState(false);
69
70
  React.useEffect(() => setIsClient(true), []);
@@ -82,3 +83,5 @@ export default function InfoOverlay({
82
83
  </div>
83
84
  ) : null;
84
85
  }
86
+
87
+ export default withOpenLayers(InfoOverlay);
@@ -1,5 +1,3 @@
1
- import { openlayers as ol } from '@eeacms/volto-openlayers-map';
2
-
3
1
  export const objectivesCustomOrder = [
4
2
  'Objective 1: Protect and restore marine and freshwater ecosystems and biodiversity',
5
3
  'Objective 2: Prevent and eliminate pollution of our oceans, seas and waters',
@@ -41,7 +39,7 @@ export function isValidURL(string) {
41
39
  }
42
40
  }
43
41
 
44
- export function centerAndResetMapZoom(map) {
42
+ export function centerAndResetMapZoom({ map, ol }) {
45
43
  map.getView().animate({
46
44
  zoom: 3.4,
47
45
  duration: 1000,
@@ -56,14 +54,14 @@ export function scrollToElement(elementId) {
56
54
  });
57
55
  }
58
56
 
59
- export function getExtentOfFeatures(features) {
57
+ export function getExtentOfFeatures({ features, ol }) {
60
58
  const points = features.map((f) => f.getGeometry().flatCoordinates);
61
59
  const point = new ol.geom.MultiPoint(points);
62
60
  return point.getExtent();
63
61
  }
64
62
 
65
- export function zoomMapToFeatures(map, features, threshold = 500) {
66
- const extent = getExtentOfFeatures(features);
63
+ export function zoomMapToFeatures({ map, features, ol, threshold = 500 }) {
64
+ const extent = getExtentOfFeatures({ map, features, ol });
67
65
 
68
66
  // let extentBuffer = (extent[3] - extent[1] + extent[2] - extent[0]) / 4;
69
67
  // extentBuffer = extentBuffer < threshold ? threshold : extentBuffer;
@@ -89,8 +87,8 @@ export function zoomMapToFeatures(map, features, threshold = 500) {
89
87
  }
90
88
  }
91
89
 
92
- export function getFeatures(cases) {
93
- const Feature = ol.ol.Feature;
90
+ export function getFeatures({ cases, ol }) {
91
+ const Feature = ol.Feature;
94
92
  const colors = {
95
93
  'Objective 1: Protect and restore marine and freshwater ecosystems and biodiversity':
96
94
  '#007b6c',