@eeacms/volto-marine-policy 2.0.13 → 2.0.14

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,24 @@ 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.14](https://github.com/eea/volto-marine-policy/compare/2.0.13...2.0.14) - 15 May 2025
8
+
9
+ #### :rocket: Dependency updates
10
+
11
+ - Release @eeacms/volto-globalsearch@2.1.2 [EEA Jenkins - [`4781112`](https://github.com/eea/volto-marine-policy/commit/47811128d3fd2711efaafe426d32e28d87296222)]
12
+ - Release @eeacms/volto-globalsearch@2.1.1 [EEA Jenkins - [`91c4b2b`](https://github.com/eea/volto-marine-policy/commit/91c4b2ba5b743911f6898d2ad74230f3b87154b3)]
13
+
14
+ #### :house: Internal changes
15
+
16
+ - style: Automated code fix [eea-jenkins - [`ebda5f4`](https://github.com/eea/volto-marine-policy/commit/ebda5f4f834a8851ccaabb27b1a75caa13a5989c)]
17
+ - style: Automated code fix [eea-jenkins - [`f3118b8`](https://github.com/eea/volto-marine-policy/commit/f3118b86f9324b186eacbf9f5cfcf716d72213f0)]
18
+
19
+ #### :hammer_and_wrench: Others
20
+
21
+ - update jest-addon.config.js [laszlocseh - [`f63cc32`](https://github.com/eea/volto-marine-policy/commit/f63cc327fdc89ed930f03ae4c16baaf80a8e6fc0)]
22
+ - fix eslint [laszlocseh - [`4490f3f`](https://github.com/eea/volto-marine-policy/commit/4490f3f48a8256713760bc5193588cad9cb1ce6b)]
23
+ - remove console.log [laszlocseh - [`c2adb4a`](https://github.com/eea/volto-marine-policy/commit/c2adb4afc1c98315b36e55e94011212eec6b3927)]
24
+ - make filters auto update based on selection [laszlocseh - [`1a11f9a`](https://github.com/eea/volto-marine-policy/commit/1a11f9a2a0f65a2b03778c306052086068c5c323)]
7
25
  ### [2.0.13](https://github.com/eea/volto-marine-policy/compare/2.0.12...2.0.13) - 13 May 2025
8
26
 
9
27
  #### :house: Internal changes
@@ -41,10 +41,10 @@ module.exports = {
41
41
  },
42
42
  coverageThreshold: {
43
43
  global: {
44
- branches: 3,
45
- functions: 3,
46
- lines: 3,
47
- statements: 3,
44
+ branches: 2,
45
+ functions: 2,
46
+ lines: 2,
47
+ statements: 2,
48
48
  },
49
49
  },
50
50
  ...(process.env.JEST_USE_SETUP === 'ON' && {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-marine-policy",
3
- "version": "2.0.13",
3
+ "version": "2.0.14",
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.1.0",
37
+ "@eeacms/volto-globalsearch": "2.1.2",
38
38
  "@eeacms/volto-openlayers-map": "0.3.2",
39
39
  "@eeacms/volto-searchlib": "2.0.16",
40
40
  "@eeacms/volto-tabs-block": "*",
@@ -38,10 +38,10 @@ export default function DemoSitesExplorerView(props) {
38
38
  const [highlightedIndex, setHighlightedIndex] = React.useState(-1);
39
39
 
40
40
  React.useEffect(() => {
41
- const _filters = getFilters(cases, indicatorOnly);
41
+ const _filters = getFilters(activeItems, indicatorOnly);
42
42
  setFilters(_filters);
43
43
  }, [
44
- cases,
44
+ activeItems,
45
45
  activeFilters.objective_filter,
46
46
  activeFilters.target_filter,
47
47
  activeFilters.indicator_filter,
@@ -107,7 +107,7 @@ export default function DemoSitesExplorerView(props) {
107
107
  <VisibilitySensor>
108
108
  <ObjectivesChart
109
109
  items={cases}
110
- // activeItems={activeItems}
110
+ activeItems={activeItems}
111
111
  // filters={filters}
112
112
  activeFilters={activeFilters}
113
113
  setActiveFilters={setActiveFilters}
@@ -82,15 +82,11 @@ export function DemoSitesFilter(props) {
82
82
  {Object.entries(filters?.[filterName] || {})
83
83
  // .sort((item1, item2) => item1[1].localeCompare(item2[1]))
84
84
  .map(([value, label], index) => (
85
- <label
86
- htmlFor={label + index}
87
- className="filter-input"
88
- key={index}
89
- >
85
+ <label htmlFor={label} className="filter-input" key={label}>
90
86
  <input
91
87
  value={value}
92
88
  type="checkbox"
93
- id={label + index}
89
+ id={label}
94
90
  onChange={(e) => {
95
91
  const temp = JSON.parse(JSON.stringify(activeFilters));
96
92
  if (e.target.checked) {
@@ -91,10 +91,14 @@ export default function DemoSitesMap(props) {
91
91
  const coords = selectedCase.geometry.flatCoordinates;
92
92
  const pixel = map.getPixelFromCoordinate(coords);
93
93
  map.getInteractions().array_[9].getFeatures().clear();
94
- map
95
- .getInteractions()
96
- .array_[9].getFeatures()
97
- .push(map.getFeaturesAtPixel(pixel)[0]);
94
+ try {
95
+ map
96
+ .getInteractions()
97
+ .array_[9].getFeatures()
98
+ .push(map.getFeaturesAtPixel(pixel)[0]);
99
+ } catch (e) {
100
+ // console.error(e);
101
+ }
98
102
  } else {
99
103
  map.getInteractions().array_[9].getFeatures().clear();
100
104
  }
@@ -9,7 +9,7 @@ const Plot = loadable(() => import('react-plotly.js'));
9
9
 
10
10
  const ObjectivesChart = ({
11
11
  items,
12
- // activeItems,
12
+ activeItems,
13
13
  // filters,
14
14
  activeFilters,
15
15
  setActiveFilters,
@@ -21,9 +21,29 @@ const ObjectivesChart = ({
21
21
  setInitialized,
22
22
  }) => {
23
23
  const chartRef = useRef(null);
24
- const objectiveCounts = {};
24
+ let objectiveCounts = {};
25
25
 
26
- for (const item of items) {
26
+ // if (!items) return;
27
+
28
+ items.forEach((item) => {
29
+ const _obj = item.properties.objective;
30
+
31
+ _obj.forEach((_o) => {
32
+ if (!(_o in objectiveCounts)) {
33
+ objectiveCounts[_o] = 0;
34
+ }
35
+ });
36
+ });
37
+
38
+ let itemsUsedForChart = [];
39
+
40
+ if (initialized) {
41
+ itemsUsedForChart = activeItems;
42
+ } else {
43
+ itemsUsedForChart = items;
44
+ }
45
+
46
+ for (const item of itemsUsedForChart) {
27
47
  item.properties.objective.map((obj) => {
28
48
  objectiveCounts[obj] = (objectiveCounts[obj] || 0) + 1;
29
49
  return [];
@@ -43,9 +63,9 @@ const ObjectivesChart = ({
43
63
 
44
64
  const interval = setInterval(() => {
45
65
  setHighlightedIndex((prevIndex) => {
66
+ if (prevIndex + 1 >= objectivesLength) setInitialized(true);
46
67
  if (prevIndex + 1 >= objectivesLength + 1) {
47
68
  clearInterval(interval); // Stop after last item
48
- setInitialized(true);
49
69
  return prevIndex;
50
70
  }
51
71
  return prevIndex + 1;
@@ -63,6 +83,7 @@ const ObjectivesChart = ({
63
83
  ]);
64
84
 
65
85
  React.useEffect(() => {
86
+ // set the objectives filter based on chartclick or list selection
66
87
  // if (!objectives) return;
67
88
  const filterKey = 'objective_filter';
68
89
 
@@ -172,6 +193,7 @@ const ObjectivesChart = ({
172
193
  labels: labels,
173
194
  values: values,
174
195
  textinfo: 'none',
196
+ sort: false,
175
197
  // textinfo: highlightedIndex === 5 ? 'value' : 'none',
176
198
  hole: 0.4,
177
199
  insidetextorientation: 'radial',
@@ -240,6 +262,7 @@ const ObjectivesChart = ({
240
262
  className={cx(
241
263
  index === highlightedIndex ? 'active' : '',
242
264
  customColors[index].replace('#', 'C'),
265
+ count === 0 ? 'disabled' : '',
243
266
  )}
244
267
  >
245
268
  <div
@@ -565,5 +565,11 @@
565
565
  height: 1em;
566
566
  }
567
567
  }
568
+
569
+ &.disabled {
570
+ cursor: not-allowed;
571
+ opacity: 0.5;
572
+ pointer-events: none;
573
+ }
568
574
  }
569
575
  }