@eeacms/volto-marine-policy 2.0.9 → 2.0.10

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,25 @@ 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.10](https://github.com/eea/volto-marine-policy/compare/2.0.9...2.0.10) - 9 May 2025
8
+
9
+ #### :rocket: Dependency updates
10
+
11
+ - Release @eeacms/volto-globalsearch@2.1.0 [EEA Jenkins - [`3b20bc2`](https://github.com/eea/volto-marine-policy/commit/3b20bc292d04ab81385732840ffe2c469f83fbd6)]
12
+
13
+ #### :house: Internal changes
14
+
15
+ - style: Automated code fix [eea-jenkins - [`69cc9c8`](https://github.com/eea/volto-marine-policy/commit/69cc9c86e32d35cce4f979b36bc7d20cc4b01e8f)]
16
+ - style: Automated code fix [eea-jenkins - [`d1a8da0`](https://github.com/eea/volto-marine-policy/commit/d1a8da01dfc0ddcc24058ba5aafb5d76be0d2ffc)]
17
+
18
+ #### :hammer_and_wrench: Others
19
+
20
+ - eslint [laszlocseh - [`8c27f84`](https://github.com/eea/volto-marine-policy/commit/8c27f84fcdc8adf9b12746b585c66f34b9e785a4)]
21
+ - further improvements to demo sites map [laszlocseh - [`b15e205`](https://github.com/eea/volto-marine-policy/commit/b15e2053256552c30f26fdab581330cba420b412)]
22
+ - eslint [laszlocseh - [`4514ee0`](https://github.com/eea/volto-marine-policy/commit/4514ee0a409e8dfe0d6975da989228f39033b343)]
23
+ - no results message [laszlocseh - [`06b7ae6`](https://github.com/eea/volto-marine-policy/commit/06b7ae62eb7b27a2ec9e2d3f9ec62aed42a85045)]
24
+ - fix eslint [laszlocseh - [`2a4605a`](https://github.com/eea/volto-marine-policy/commit/2a4605ac45b141d5e3f2b737a24c6afca0b5d884)]
25
+ - optimize demo sites map rendering [laszlocseh - [`2345b60`](https://github.com/eea/volto-marine-policy/commit/2345b609a95a00a53c46ce9b92686eeb598a14a6)]
7
26
  ### [2.0.9](https://github.com/eea/volto-marine-policy/compare/2.0.8...2.0.9) - 7 May 2025
8
27
 
9
28
  #### :rocket: Dependency updates
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-marine-policy",
3
- "version": "2.0.9",
3
+ "version": "2.0.10",
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.0.11",
37
+ "@eeacms/volto-globalsearch": "2.1.0",
38
38
  "@eeacms/volto-openlayers-map": "0.3.2",
39
39
  "@eeacms/volto-searchlib": "2.0.16",
40
40
  "@eeacms/volto-tabs-block": "*",
@@ -104,12 +104,12 @@ export default function DemoSitesExplorerView(props) {
104
104
  <VisibilitySensor>
105
105
  <ObjectivesChart
106
106
  items={cases}
107
- activeItems={activeItems}
108
- filters={filters}
107
+ // activeItems={activeItems}
108
+ // filters={filters}
109
109
  activeFilters={activeFilters}
110
- hideFilters={hideFilters}
111
110
  setActiveFilters={setActiveFilters}
112
- map={map}
111
+ // hideFilters={hideFilters}
112
+ // map={map}
113
113
  highlightedIndex={highlightedIndex}
114
114
  setHighlightedIndex={setHighlightedIndex}
115
115
  />
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- import { centerAndResetMapZoom, clearFilters } from './utils';
3
+ import { clearFilters } from './utils';
4
4
 
5
5
  const normalizeSearchInput = (searchInput) => {
6
6
  let normInput = searchInput
@@ -20,7 +20,7 @@ export function DemoSitesFilter(props) {
20
20
  activeFilters,
21
21
  setActiveFilters,
22
22
  filterName,
23
- map,
23
+ // map,
24
24
  } = props;
25
25
 
26
26
  const customOrder = props?.customOrder || [];
@@ -103,7 +103,7 @@ export function DemoSitesFilter(props) {
103
103
  }
104
104
  setActiveFilters(temp);
105
105
  // scrollToElement('search-input');
106
- centerAndResetMapZoom(map);
106
+ // centerAndResetMapZoom(map);
107
107
  }}
108
108
  />
109
109
  <span>{label}</span>
@@ -190,7 +190,7 @@ export function DemoSitesFilters(props) {
190
190
  }
191
191
 
192
192
  export function SearchBox(props) {
193
- const { setSearchInput, map, onSelectedCase } = props;
193
+ const { setSearchInput, onSelectedCase } = props;
194
194
  const [showClearButton, setShowClearButton] = React.useState(false);
195
195
 
196
196
  return (
@@ -215,7 +215,7 @@ export function SearchBox(props) {
215
215
  // popupOverlay.style.visibility = 'hidden';
216
216
  setSearchInput(searchInput);
217
217
  // scrollToElement('search-input');
218
- centerAndResetMapZoom(map);
218
+ // centerAndResetMapZoom(map);
219
219
  }}
220
220
  ></input>
221
221
  <div className="terms-box-left">
@@ -233,7 +233,7 @@ export function SearchBox(props) {
233
233
  setSearchInput('');
234
234
  setShowClearButton(false);
235
235
  // scrollToElement('search-input');
236
- centerAndResetMapZoom(map);
236
+ // centerAndResetMapZoom(map);
237
237
  }}
238
238
  ></i>
239
239
  </div>
@@ -253,7 +253,7 @@ export function SearchBox(props) {
253
253
 
254
254
  setSearchInput(searchInputVal);
255
255
  // scrollToElement('search-input');
256
- centerAndResetMapZoom(map);
256
+ // centerAndResetMapZoom(map);
257
257
  }}
258
258
  onKeyDown={() => {}}
259
259
  tabIndex="0"
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { centerAndResetMapZoom, zoomMapToFeatures, isValidURL } from './utils';
2
+ import { centerAndResetMapZoom, isValidURL } from './utils';
3
3
 
4
4
  const showPageNr = (pageNr, currentPage, numberOfPages) => {
5
5
  // show first 5 pages
@@ -271,7 +271,7 @@ export default function DemoSitesList(props) {
271
271
  // scroll to the map
272
272
  // scrollToElement('ol-map-container');
273
273
 
274
- zoomMapToFeatures(map, [item], 5000);
274
+ // zoomMapToFeatures(map, [item], 5000);
275
275
  onSelectedCase(item.values_);
276
276
 
277
277
  const popupOverlay =
@@ -10,10 +10,10 @@ import FeatureInteraction from './FeatureInteraction';
10
10
  import { useMapContext } from '@eeacms/volto-openlayers-map/api';
11
11
 
12
12
  import {
13
- // centerAndResetMapZoom,
13
+ centerAndResetMapZoom,
14
14
  clearFilters,
15
15
  getFeatures,
16
- zoomMapToFeatures,
16
+ // zoomMapToFeatures,
17
17
  } from './utils';
18
18
 
19
19
  const styleCache = {};
@@ -35,6 +35,7 @@ export default function DemoSitesMap(props) {
35
35
  onSelectedCase,
36
36
  map,
37
37
  setMap,
38
+ highlightedIndex,
38
39
  setHighlightedIndex,
39
40
  } = props;
40
41
  const features = getFeatures(items);
@@ -73,7 +74,7 @@ export default function DemoSitesMap(props) {
73
74
  pointsSource.clear();
74
75
  pointsSource.addFeatures(getFeatures(activeItems));
75
76
  // hideFilters && zoomMapToFeatures(map, getFeatures(activeItems));
76
- zoomMapToFeatures(map, getFeatures(activeItems));
77
+ // zoomMapToFeatures(map, getFeatures(activeItems));
77
78
  }
78
79
  }, [map, activeItems, pointsSource, hideFilters]);
79
80
 
@@ -130,13 +131,18 @@ export default function DemoSitesMap(props) {
130
131
  view={{
131
132
  center: ol.proj.fromLonLat([10, 54]),
132
133
  showFullExtent: true,
133
- zoom: 3,
134
+ zoom: 3.4,
134
135
  }}
135
136
  pixelRatio={1}
136
137
  // controls={ol.control.defaults({ attribution: false })}
137
138
  >
138
139
  <Controls attribution={false} />
139
140
  <Layers>
141
+ {highlightedIndex > 0 && !activeItems.length && (
142
+ <div className="no-results-message">
143
+ No results found. Please refine your filters.
144
+ </div>
145
+ )}
140
146
  <button
141
147
  className={cx(
142
148
  'reset-map-button ui button secondary',
@@ -148,10 +154,11 @@ export default function DemoSitesMap(props) {
148
154
  clearFilters(setActiveFilters);
149
155
  setHighlightedIndex(5);
150
156
  if (hideFilters) {
151
- zoomMapToFeatures(map, getFeatures(activeItems));
157
+ // zoomMapToFeatures(map, getFeatures(activeItems));
158
+ centerAndResetMapZoom(map);
152
159
  } else {
153
- // centerAndResetMapZoom(map);
154
- zoomMapToFeatures(map, getFeatures(activeItems));
160
+ centerAndResetMapZoom(map);
161
+ // zoomMapToFeatures(map, getFeatures(activeItems));
155
162
  }
156
163
  map.getInteractions().array_[9].getFeatures().clear();
157
164
  }}
@@ -211,7 +218,8 @@ const selectedClusterStyle = (selectedFeature) => {
211
218
  }
212
219
  // set size === 1 to enable clusterization
213
220
  if (size) {
214
- let color = feature.values_.features[0].values_['color'];
221
+ // let color = feature.values_.features[0].values_['color'];
222
+ let color = '#0179cf';
215
223
  let width = feature.values_.features[0].values_['width'];
216
224
  let radius = feature.values_.features[0].values_['radius'];
217
225
  // console.log(color)
@@ -6,9 +6,13 @@ export default function FeatureDisplay({ feature }) {
6
6
  <div id="csepopup">
7
7
  <h3>
8
8
  <strong>
9
- <a target="_blank" rel="noopener noreferrer" href={feature.path}>
9
+ <span
10
+ // target="_blank"
11
+ // rel="noopener noreferrer"
12
+ // href={feature.path}
13
+ >
10
14
  {truncateText(feature.title)}
11
- </a>
15
+ </span>
12
16
  </strong>
13
17
  </h3>
14
18
  {feature.info ? (
@@ -57,6 +61,19 @@ export default function FeatureDisplay({ feature }) {
57
61
  ''
58
62
  )}
59
63
 
64
+ {feature.objective.length > 0 ? (
65
+ <div>
66
+ <span className="popup-title blue">Objective/Enabler</span>
67
+ <ul>
68
+ {feature.objective.map((item, index) => {
69
+ return <li key={index}>{item}</li>;
70
+ })}
71
+ </ul>
72
+ </div>
73
+ ) : (
74
+ ''
75
+ )}
76
+
60
77
  {/* {feature.project_link ? (
61
78
  <div>
62
79
  <span className="popup-title blue">Project link: </span>
@@ -100,14 +117,6 @@ export default function FeatureDisplay({ feature }) {
100
117
  ) : (
101
118
  ''
102
119
  )}
103
- {/* <div>
104
- <h4>Indicators</h4>
105
- <ul>
106
- {feature.sectors.map((item, index) => {
107
- return <li key={index}>{item}</li>;
108
- })}
109
- </ul>
110
- </div> */}
111
120
  </div>
112
121
  ) : null;
113
122
  }
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { openlayers as ol } from '@eeacms/volto-openlayers-map';
3
3
  import { useMapContext } from '@eeacms/volto-openlayers-map/api';
4
- import { zoomMapToFeatures } from './utils';
4
+ // import { zoomMapToFeatures } from './utils';
5
5
 
6
6
  export const useStyles = () => {
7
7
  const selected = React.useMemo(
@@ -67,7 +67,7 @@ export default function FeatureInteraction({ onFeatureSelect }) {
67
67
  // });
68
68
  } else {
69
69
  onFeatureSelect(null);
70
- zoomMapToFeatures(map, subfeatures);
70
+ // zoomMapToFeatures(map, subfeatures);
71
71
  }
72
72
  });
73
73
 
@@ -56,19 +56,29 @@ const ObjectivesChart = ({
56
56
 
57
57
  React.useEffect(() => {
58
58
  // if (!objectives) return;
59
+ const filterKey = 'objective_filter';
60
+
59
61
  if (highlightedIndex === -1) {
60
- setActiveFilters({
61
- objective_filter: [undefined],
62
- target_filter: [],
63
- indicator_filter: [],
64
- project_filter: [],
65
- country_filter: [],
62
+ const newValue = [undefined];
63
+
64
+ setActiveFilters((prev) => {
65
+ const currentValues = prev[filterKey];
66
+ // Don't update if no change
67
+ const isSame =
68
+ currentValues.length === newValue.length &&
69
+ currentValues.every((v, i) => v === newValue[i]);
70
+
71
+ if (isSame) return prev;
72
+
73
+ return {
74
+ ...prev,
75
+ [filterKey]: newValue,
76
+ };
66
77
  });
67
78
  return;
68
79
  }
69
80
 
70
81
  const currentObjective = Object.keys(objectives)[highlightedIndex];
71
- const filterKey = 'objective_filter';
72
82
  const newValue = currentObjective ? [currentObjective] : [];
73
83
 
74
84
  setActiveFilters((prev) => {
@@ -89,9 +99,15 @@ const ObjectivesChart = ({
89
99
  }, [objectives, activeFilters, setActiveFilters, highlightedIndex]);
90
100
 
91
101
  const handleClick = (event) => {
92
- const point = event.points[0];
93
- const label = point.label;
94
- // const value = point.value;
102
+ let label = '';
103
+
104
+ if (event.points) {
105
+ const point = event.points[0];
106
+ label = point.label;
107
+ // const value = point.value;
108
+ } else {
109
+ label = event.target.textContent;
110
+ }
95
111
 
96
112
  const tempFilters = JSON.parse(JSON.stringify(activeFilters));
97
113
  if (tempFilters['objective_filter'].includes(label)) {
@@ -129,6 +145,8 @@ const ObjectivesChart = ({
129
145
  i === highlightedIndex ? customColors[i % customColors.length] : grayColor,
130
146
  );
131
147
 
148
+ // console.log(highlightedIndex);
149
+
132
150
  return highlightedIndex >= -1 ? (
133
151
  <div className="objectives-chart fade-in">
134
152
  <Grid.Row className="chart-title">
@@ -152,14 +170,18 @@ const ObjectivesChart = ({
152
170
  marker: {
153
171
  colors:
154
172
  highlightedIndex === 5 ? customColors : inactiveColors, // Apply custom colors here
173
+ line: {
174
+ color: '#e0e0e0', // light gray
175
+ width: 1, // thin border
176
+ },
155
177
  },
156
178
  direction: 'clockwise',
157
179
  // pull,
158
180
  },
159
181
  ]}
160
182
  layout={{
161
- width: 250,
162
- height: 250,
183
+ width: 300,
184
+ height: 300,
163
185
  // title: 'Objectives Distribution',
164
186
  showlegend: false,
165
187
  margin: {
@@ -175,6 +197,8 @@ const ObjectivesChart = ({
175
197
  ? `${totalCount}`
176
198
  : values[highlightedIndex] || '', // Display total count in the center
177
199
  font: {
200
+ family:
201
+ "'Roboto', 'Helvetica Neue', Arial, Helvetica, sans-serif",
178
202
  size: 24, // Adjust font size as needed
179
203
  weight: 'bold',
180
204
  },
@@ -204,13 +228,20 @@ const ObjectivesChart = ({
204
228
  <ul>
205
229
  {Object.entries(objectives).map(([item, count], index) => (
206
230
  <li
207
- key={item}
208
231
  className={cx(
209
232
  index === highlightedIndex ? 'active' : '',
210
233
  customColors[index].replace('#', 'C'),
211
234
  )}
212
235
  >
213
- {item}
236
+ <div
237
+ onClick={handleClick}
238
+ onKeyDown={() => {}}
239
+ tabIndex={index}
240
+ role="button"
241
+ key={item}
242
+ >
243
+ {item}
244
+ </div>
214
245
  </li>
215
246
  ))}
216
247
  </ul>
@@ -12,6 +12,23 @@
12
12
  .ol-map {
13
13
  height: 600px;
14
14
  min-height: 600px;
15
+ font-family: 'Roboto', 'Helvetica Neue', Arial, Helvetica, sans-serif !important;
16
+
17
+ .no-results-message {
18
+ position: absolute;
19
+ z-index: 9;
20
+ top: 46%;
21
+ right: 28%;
22
+ bottom: 47%;
23
+ left: 27%;
24
+ padding: 0.5em 1em;
25
+ border: 4px solid #dfdfdf;
26
+ border-radius: 2px;
27
+ background-color: #0088e9;
28
+ color: #ffffff;
29
+ opacity: 0.6;
30
+ text-shadow: none;
31
+ }
15
32
  }
16
33
 
17
34
  #csepopup {
@@ -29,6 +46,7 @@
29
46
  }
30
47
 
31
48
  h3 {
49
+ color: #069;
32
50
  font-size: 1.4rem;
33
51
  }
34
52
 
@@ -411,9 +429,9 @@
411
429
  width: 22px;
412
430
  min-width: 22px;
413
431
  height: 22px;
414
- /* dark green shade */
415
432
  border-radius: 50%;
416
- background-color: #007265;
433
+ // background-color: #007265;
434
+ background-color: #0179cf;
417
435
  gap: 0.5em;
418
436
  }
419
437
 
@@ -448,6 +466,13 @@
448
466
  }
449
467
 
450
468
  .objectives-chart {
469
+ font-family: 'Roboto', 'Helvetica Neue', Arial, Helvetica, sans-serif !important;
470
+
471
+ .js-plotly-plot .plotly,
472
+ .js-plotly-plot .plotly div {
473
+ font-family: 'Roboto', 'Helvetica Neue', Arial, Helvetica, sans-serif !important;
474
+ }
475
+
451
476
  &.fade-in {
452
477
  animation: fadeIn 1s ease-in forwards;
453
478
  opacity: 0;
@@ -493,6 +518,11 @@
493
518
  font-size: 0.8em;
494
519
  line-height: 1.5em;
495
520
 
521
+ &:hover {
522
+ cursor: pointer;
523
+ font-weight: 500;
524
+ }
525
+
496
526
  &.C007b6c::before {
497
527
  background-color: #007b6c;
498
528
  }
@@ -43,7 +43,7 @@ export function isValidURL(string) {
43
43
 
44
44
  export function centerAndResetMapZoom(map) {
45
45
  map.getView().animate({
46
- zoom: 2.5,
46
+ zoom: 3.4,
47
47
  duration: 1000,
48
48
  center: ol.proj.transform([10, 54], 'EPSG:4326', 'EPSG:3857'),
49
49
  });