@eeacms/volto-cca-policy 0.3.43 → 0.3.44

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,22 @@ 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
+ ### [0.3.44](https://github.com/eea/volto-cca-policy/compare/0.3.43...0.3.44) - 16 May 2025
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix(mission): fix actions fallback [kreafox - [`4868c71`](https://github.com/eea/volto-cca-policy/commit/4868c71eb3658b0eaac7946274fb8b4d5cd3c698)]
12
+ - fix(mission): default result to empty object [kreafox - [`1a4adbd`](https://github.com/eea/volto-cca-policy/commit/1a4adbd8203c36fb51be6060403e5ae683f1a47c)]
13
+
14
+ #### :nail_care: Enhancements
15
+
16
+ - change(mission): small update [kreafox - [`8314492`](https://github.com/eea/volto-cca-policy/commit/8314492b334a1ab523b1bd10497da1806460282d)]
17
+ - change(mission): update data for Assessment section - refs #286757 [kreafox - [`eeede94`](https://github.com/eea/volto-cca-policy/commit/eeede943d1f87e66d8688acabb4be051e37cea10)]
18
+ - change(mission): add fallback when results are empty [kreafox - [`4316e12`](https://github.com/eea/volto-cca-policy/commit/4316e122fb1f89582a70e8c5f33b57583d275001)]
19
+
20
+ #### :hammer_and_wrench: Others
21
+
22
+ - Show different message [Tiberiu Ichim - [`714bda0`](https://github.com/eea/volto-cca-policy/commit/714bda05dc7e8b5738a6bbd4a9b493e637e8b142)]
7
23
  ### [0.3.43](https://github.com/eea/volto-cca-policy/compare/0.3.42...0.3.43) - 16 May 2025
8
24
 
9
25
  #### :bug: Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-cca-policy",
3
- "version": "0.3.43",
3
+ "version": "0.3.44",
4
4
  "description": "@eeacms/volto-cca-policy: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -73,7 +73,7 @@ export default function CaseStudyExplorerView(props) {
73
73
  }, [activeFilters, cases]);
74
74
 
75
75
  if (__SERVER__)
76
- return <div className="casestudy-explorer-map">CaseStudyExplorer</div>;
76
+ return <div className="casestudy-explorer-map">Loading...</div>;
77
77
 
78
78
  return (
79
79
  <div className="casestudy-explorer-map">
@@ -4,6 +4,8 @@ import { HTMLField } from '@eeacms/volto-cca-policy/helpers';
4
4
  import { formatTextToHTML } from '@eeacms/volto-cca-policy/utils';
5
5
  import AccordionList from '../AccordionList';
6
6
 
7
+ const isEmpty = (arr) => !Array.isArray(arr) || arr.length === 0;
8
+
7
9
  const ActionsTabContent = ({ action }) => {
8
10
  const hasHazards = action?.Climate_Hazards?.length > 0;
9
11
  const hasSectors = action?.Sectors.length > 0;
@@ -69,15 +71,15 @@ const ActionPagesTab = ({ result, general_text }) => {
69
71
  const { action_text, actions } = result || {};
70
72
  const { No_Data_Reported_Label } = general_text || {};
71
73
  const { Title, Abstract, Abstract_Line } = action_text?.[0] || {};
72
- const hasNoActions = !(actions?.length > 0);
73
- const hasNoText = !(action_text?.length > 0);
74
74
 
75
75
  const sortedActions = [...(actions || [])].sort((a, b) => a.Order - b.Order);
76
76
 
77
- if (hasNoActions && hasNoText) {
77
+ const NoResults = isEmpty(action_text) && isEmpty(actions);
78
+
79
+ if (NoResults) {
78
80
  return (
79
81
  <Tab.Pane>
80
- <h5>{No_Data_Reported_Label}</h5>
82
+ <p>{No_Data_Reported_Label}</p>
81
83
  </Tab.Pane>
82
84
  );
83
85
  }
@@ -6,6 +6,8 @@ import AccordionList from '../AccordionList';
6
6
 
7
7
  import image from '@eeacms/volto-cca-policy/../theme//assets/images/image-narrow.svg';
8
8
 
9
+ const isEmpty = (arr) => !Array.isArray(arr) || arr.length === 0;
10
+
9
11
  const ItemsSection = ({ items }) => {
10
12
  if (!items?.length) return null;
11
13
 
@@ -45,7 +47,7 @@ const AssessmentAccordionContent = ({ result }) => {
45
47
  );
46
48
  };
47
49
 
48
- const AssessmentTab = ({ result }) => {
50
+ const AssessmentTab = ({ result, general_text }) => {
49
51
  const {
50
52
  Title,
51
53
  Subheading,
@@ -55,12 +57,26 @@ const AssessmentTab = ({ result }) => {
55
57
  Attachments,
56
58
  Hazards_Title,
57
59
  Hazards_Abstract,
58
- } = result.assessment_text?.[0] || [];
60
+ } = result.assessment_text?.[0] || {};
59
61
  const assessment_risks = result.assessment_risks || [];
60
- const assessment_sectors = result.assessment_sectors || [];
61
-
62
+ const assessment_hazards_sectors = result.assessment_hazards_sectors || [];
63
+ const { No_Data_Reported_Label } = general_text || {};
62
64
  // const [activeIndex, setActiveIndex] = React.useState(0);
63
65
 
66
+ const NoResults =
67
+ isEmpty(result.assessment_text) &&
68
+ isEmpty(result.assessment_factors) &&
69
+ isEmpty(result.assessment_risks) &&
70
+ isEmpty(result.assessment_hazards_sectors);
71
+
72
+ if (NoResults) {
73
+ return (
74
+ <Tab.Pane>
75
+ <p>{No_Data_Reported_Label}</p>
76
+ </Tab.Pane>
77
+ );
78
+ }
79
+
64
80
  return (
65
81
  <Tab.Pane>
66
82
  {Title && <h2>{Title}</h2>}
@@ -110,10 +126,10 @@ const AssessmentTab = ({ result }) => {
110
126
 
111
127
  <br />
112
128
 
113
- {assessment_sectors && (
129
+ {assessment_hazards_sectors && (
114
130
  <AccordionList
115
- accordions={assessment_sectors.map((category) => ({
116
- title: category.Category_Name,
131
+ accordions={assessment_hazards_sectors.map((category) => ({
132
+ title: category.Hazard,
117
133
  content: (
118
134
  <ul>
119
135
  {category.Sectors.map((sector, idx) => (
@@ -5,7 +5,7 @@ import { formatTextToHTML } from '@eeacms/volto-cca-policy/utils';
5
5
  import AccordionList from '../AccordionList';
6
6
  import StatisticSection from '../StatisticSection';
7
7
 
8
- const GovernanceTab = ({ result }) => {
8
+ const GovernanceTab = ({ result, general_text }) => {
9
9
  const {
10
10
  Title,
11
11
  Introduction,
@@ -21,7 +21,8 @@ const GovernanceTab = ({ result }) => {
21
21
  Statistic_Population_Size_Label,
22
22
  Statistic_Population_Year,
23
23
  Statistic_Population_Year_Label,
24
- } = result;
24
+ } = result || {};
25
+ const { No_Data_Reported_Label } = general_text || {};
25
26
 
26
27
  const statisticData = [
27
28
  {
@@ -42,6 +43,14 @@ const GovernanceTab = ({ result }) => {
42
43
  },
43
44
  ].filter((stat) => stat.value && stat.label);
44
45
 
46
+ if (!result) {
47
+ return (
48
+ <Tab.Pane>
49
+ <p>{No_Data_Reported_Label}</p>
50
+ </Tab.Pane>
51
+ );
52
+ }
53
+
45
54
  return (
46
55
  <Tab.Pane>
47
56
  {Title && <h2>{Title}</h2>}
@@ -9,6 +9,8 @@ import {
9
9
  import AccordionList from '../AccordionList';
10
10
  import image from '@eeacms/volto-cca-policy/../theme/assets/images/image-narrow.svg';
11
11
 
12
+ const isEmpty = (arr) => !Array.isArray(arr) || arr.length === 0;
13
+
12
14
  const ItemsSection = ({ items }) => {
13
15
  if (!items?.length) return null;
14
16
 
@@ -69,12 +71,13 @@ const PlanningGoalContent = ({ goal }) => {
69
71
  );
70
72
  };
71
73
 
72
- const PlanningTab = ({ result }) => {
74
+ const PlanningTab = ({ result, general_text }) => {
73
75
  const {
74
76
  planning_goals = [],
75
77
  planning_titles = [],
76
78
  planning_climate_action = [],
77
79
  } = result || {};
80
+ const { No_Data_Reported_Label } = general_text || {};
78
81
 
79
82
  const titleData = planning_titles?.[0];
80
83
  const goalData = planning_goals?.[0];
@@ -85,6 +88,19 @@ const PlanningTab = ({ result }) => {
85
88
  return aNum - bNum;
86
89
  });
87
90
 
91
+ const NoResults =
92
+ isEmpty(planning_goals) &&
93
+ isEmpty(planning_titles) &&
94
+ isEmpty(planning_climate_action);
95
+
96
+ if (NoResults) {
97
+ return (
98
+ <Tab.Pane>
99
+ <p>{No_Data_Reported_Label}</p>
100
+ </Tab.Pane>
101
+ );
102
+ }
103
+
88
104
  return (
89
105
  <Tab.Pane>
90
106
  {titleData?.Title && <h2>{titleData.Title}</h2>}