@eeacms/volto-marine-policy 2.0.10 → 2.0.11

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.11](https://github.com/eea/volto-marine-policy/compare/2.0.10...2.0.11) - 12 May 2025
8
+
9
+ #### :house: Internal changes
10
+
11
+ - style: Automated code fix [eea-jenkins - [`a054cba`](https://github.com/eea/volto-marine-policy/commit/a054cba726d2d053b15b2eadd1ccd24ef9377b8a)]
12
+
13
+ #### :hammer_and_wrench: Others
14
+
15
+ - fixes eslint [laszlocseh - [`c663600`](https://github.com/eea/volto-marine-policy/commit/c6636007ac365ba98462dc57d040eb8fa3ff187f)]
16
+ - fixes to demo sites map viewer [laszlocseh - [`b82cd91`](https://github.com/eea/volto-marine-policy/commit/b82cd91670fca640e115a765626c81ba8019bff2)]
17
+ - Small improvements to demo sites map viewer [laszlocseh - [`e5c5e66`](https://github.com/eea/volto-marine-policy/commit/e5c5e66e2ef121f3812aa2dc53a9f9a35679f667)]
7
18
  ### [2.0.10](https://github.com/eea/volto-marine-policy/compare/2.0.9...2.0.10) - 9 May 2025
8
19
 
9
20
  #### :rocket: Dependency updates
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-marine-policy",
3
- "version": "2.0.10",
3
+ "version": "2.0.11",
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",
@@ -13,6 +13,7 @@ import { useCases } from './hooks';
13
13
  import './styles.less';
14
14
 
15
15
  export default function DemoSitesExplorerView(props) {
16
+ const [initialized, setInitialized] = React.useState(false); // set to true after the chart animation is finished
16
17
  const cases_url = config.settings.prefixPath
17
18
  ? '/@@demo-sites-map.arcgis.json'
18
19
  : '/marine/@@demo-sites-map.arcgis.json';
@@ -65,6 +66,8 @@ export default function DemoSitesExplorerView(props) {
65
66
  filters={filters}
66
67
  activeFilters={activeFilters}
67
68
  setActiveFilters={setActiveFilters}
69
+ setHighlightedIndex={setHighlightedIndex}
70
+ initialized={initialized}
68
71
  />
69
72
  </Grid.Row>
70
73
  <Grid.Row stretched={true} id="cse-filter">
@@ -112,6 +115,8 @@ export default function DemoSitesExplorerView(props) {
112
115
  // map={map}
113
116
  highlightedIndex={highlightedIndex}
114
117
  setHighlightedIndex={setHighlightedIndex}
118
+ initialized={initialized}
119
+ setInitialized={setInitialized}
115
120
  />
116
121
  </VisibilitySensor>
117
122
  ) : (
@@ -271,17 +271,22 @@ export function SearchBox(props) {
271
271
  }
272
272
 
273
273
  export function ActiveFilters(props) {
274
- const { filters, activeFilters, setActiveFilters } = props;
275
- const hasActiveFilters = false;
276
- // const hasActiveFilters = Object.entries(activeFilters).some(
277
- // ([filterName, filterList]) => {
278
- // return false;
279
- // if (filterList.length > 0) {
280
- // return true;
281
- // }
282
- // return false;
283
- // },
284
- // );
274
+ const {
275
+ filters,
276
+ activeFilters,
277
+ setActiveFilters,
278
+ setHighlightedIndex,
279
+ initialized,
280
+ } = props;
281
+ // const hasActiveFilters = false;
282
+ const hasActiveFilters = Object.entries(activeFilters).some(
283
+ ([filterName, filterList]) => {
284
+ if (filterList.length > 0) {
285
+ return true;
286
+ }
287
+ return false;
288
+ },
289
+ );
285
290
 
286
291
  const removeFilter = (filterName, filterCode) => {
287
292
  const temp = JSON.parse(JSON.stringify(activeFilters));
@@ -303,12 +308,15 @@ export function ActiveFilters(props) {
303
308
  setActiveFilters(temp);
304
309
  };
305
310
 
306
- return hasActiveFilters ? (
311
+ return hasActiveFilters && initialized ? (
307
312
  <div className="ui segment active-filter-list">
308
313
  <div className="filter-list-header">
309
314
  <h4 className="filter-list-title">Active filters</h4>
310
315
  <button
311
- onClick={() => clearFilters(setActiveFilters)}
316
+ onClick={() => {
317
+ setHighlightedIndex(5);
318
+ clearFilters(setActiveFilters);
319
+ }}
312
320
  className="ui mini basic compact button clear-btn"
313
321
  >
314
322
  clear all
@@ -328,6 +336,7 @@ export function ActiveFilters(props) {
328
336
  tabIndex="0"
329
337
  onKeyPress={() => {}}
330
338
  onClick={() => {
339
+ setHighlightedIndex(5);
331
340
  removeFilter('objective_filter', filterCode);
332
341
  // scrollToElement('search-input');
333
342
  }}
@@ -163,7 +163,7 @@ export default function DemoSitesMap(props) {
163
163
  map.getInteractions().array_[9].getFeatures().clear();
164
164
  }}
165
165
  >
166
- <span className="result-info-title">Reset filters</span>
166
+ <span className="result-info-title">Reset map</span>
167
167
  <i className="icon ri-map-2-line"></i>
168
168
  </button>
169
169
  <InfoOverlay
@@ -17,8 +17,9 @@ const ObjectivesChart = ({
17
17
  // map,
18
18
  highlightedIndex,
19
19
  setHighlightedIndex,
20
+ initialized,
21
+ setInitialized,
20
22
  }) => {
21
- const initialized = useRef(false);
22
23
  const chartRef = useRef(null);
23
24
  const objectiveCounts = {};
24
25
 
@@ -38,13 +39,13 @@ const ObjectivesChart = ({
38
39
  React.useEffect(() => {
39
40
  // set the objectives and the count
40
41
  if (!items) return;
41
- if (initialized.current) return;
42
+ if (initialized) return;
42
43
 
43
44
  const interval = setInterval(() => {
44
45
  setHighlightedIndex((prevIndex) => {
45
46
  if (prevIndex + 1 >= objectivesLength + 1) {
46
47
  clearInterval(interval); // Stop after last item
47
- initialized.current = true;
48
+ setInitialized(true);
48
49
  return prevIndex;
49
50
  }
50
51
  return prevIndex + 1;
@@ -52,7 +53,14 @@ const ObjectivesChart = ({
52
53
  }, 2000);
53
54
  // console.log('init');
54
55
  return () => clearInterval(interval); // Cleanup on unmount
55
- }, [items, objectivesLength, highlightedIndex, setHighlightedIndex]);
56
+ }, [
57
+ items,
58
+ objectivesLength,
59
+ highlightedIndex,
60
+ setHighlightedIndex,
61
+ initialized,
62
+ setInitialized,
63
+ ]);
56
64
 
57
65
  React.useEffect(() => {
58
66
  // if (!objectives) return;
@@ -146,6 +154,7 @@ const ObjectivesChart = ({
146
154
  );
147
155
 
148
156
  // console.log(highlightedIndex);
157
+ // console.log(initialized);
149
158
 
150
159
  return highlightedIndex >= -1 ? (
151
160
  <div className="objectives-chart fade-in">