@eeacms/volto-cca-policy 0.3.84 → 0.3.85

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,7 +4,7 @@ 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.84](https://github.com/eea/volto-cca-policy/compare/1.0.0-alpha.1...0.3.84) - 7 October 2025
7
+ ### [0.3.85](https://github.com/eea/volto-cca-policy/compare/1.0.0-alpha.1...0.3.85) - 14 October 2025
8
8
 
9
9
  #### :rocket: Dependency updates
10
10
 
@@ -14,12 +14,15 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
14
14
 
15
15
  #### :bug: Bug Fixes
16
16
 
17
+ - fix(mission): fix assessment risk numbering to match sorted order [kreafox - [`9ecea88`](https://github.com/eea/volto-cca-policy/commit/9ecea885394f1ae6ad63ffb03d8a10cd706caffb)]
17
18
  - fix: duplicated code - make ItemsSection reusable [kreafox - [`52e2625`](https://github.com/eea/volto-cca-policy/commit/52e2625914f699c194f75d561f97959ab6c21fbf)]
18
19
  - fix: add missing props for title block [kreafox - [`1d8efa0`](https://github.com/eea/volto-cca-policy/commit/1d8efa0136960261196e7585f89f4ff7db75ae17)]
19
20
  - fix: trailing space issue in HtmlSlateWidget - refs #290137 [kreafox - [`34c1ff6`](https://github.com/eea/volto-cca-policy/commit/34c1ff6896a0fe3fae40527f31ea34220e945163)]
20
21
 
21
22
  #### :nail_care: Enhancements
22
23
 
24
+ - change(mission): improve AccordionList [kreafox - [`cf1497f`](https://github.com/eea/volto-cca-policy/commit/cf1497ff50ff45cdb0bb8e995683969bb3e3c065)]
25
+ - refactor(mission): remove unnecessary line breaks and simplify message rendering - refs #291190 [kreafox - [`430a123`](https://github.com/eea/volto-cca-policy/commit/430a12371b6e1c6a77ea65b6a434eda883568c64)]
23
26
  - refactor(mission): use ItemsSection in PlanningTab - refs #291190 [kreafox - [`9e96aaa`](https://github.com/eea/volto-cca-policy/commit/9e96aaac0686f6688b3406aca578b598882a9c29)]
24
27
  - change: update sectors with icons for Planning tab - refs #291190 [kreafox - [`8b82168`](https://github.com/eea/volto-cca-policy/commit/8b821686fc6b9d98c542d9f0315734b446070a17)]
25
28
  - change: update factors with icons for Assessment tab - refs #291189 [kreafox - [`d8b7afc`](https://github.com/eea/volto-cca-policy/commit/d8b7afc36b2129b60ef81d9a057c4c9be35cbb03)]
@@ -37,6 +40,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
37
40
 
38
41
  #### :hammer_and_wrench: Others
39
42
 
43
+ - test(mission): add unit tests for NoDataReported and StatisticSection components [kreafox - [`36c6e36`](https://github.com/eea/volto-cca-policy/commit/36c6e36278124759240c896786f2ac0c20674730)]
40
44
  - test: resolve Jest errors in component tests [kreafox - [`6dbb735`](https://github.com/eea/volto-cca-policy/commit/6dbb73540e8301fcb42a4d52db7004f5a42db4d8)]
41
45
  - test: fix PlanningTab mock data to match component structure [kreafox - [`48e76e1`](https://github.com/eea/volto-cca-policy/commit/48e76e1e50e0c6d8a6a500fec3d1831419faeee9)]
42
46
  - test: resolve Jest errors in component tests [kreafox - [`f309b96`](https://github.com/eea/volto-cca-policy/commit/f309b96b0767358530d969e21102887a9db76b5a)]
@@ -125,8 +129,33 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
125
129
  - Add some loadable for components [Tiberiu Ichim - [`1793962`](https://github.com/eea/volto-cca-policy/commit/179396211c66a6a2465b2d1b6c0f2afc40fc7189)]
126
130
  - Refs #284961 - test [Tripon Eugen - [`c989f1f`](https://github.com/eea/volto-cca-policy/commit/c989f1f8638c0c5233c5c49f8673c9a2cdc7937e)]
127
131
  - Refs #284961 - add translations [Tripon Eugen - [`04ee988`](https://github.com/eea/volto-cca-policy/commit/04ee988c086d393b9b37ce1ea8d24f5e84f266aa)]
128
- ### [1.0.0-alpha.0](https://github.com/eea/volto-cca-policy/compare/0.3.83...1.0.0-alpha.0) - 15 July 2025
132
+ ### [1.0.0-alpha.0](https://github.com/eea/volto-cca-policy/compare/0.3.84...1.0.0-alpha.0) - 15 July 2025
129
133
 
134
+ ### [0.3.84](https://github.com/eea/volto-cca-policy/compare/0.3.83...0.3.84) - 7 October 2025
135
+
136
+ #### :bug: Bug Fixes
137
+
138
+ - fix: duplicated code - make ItemsSection reusable [kreafox - [`52e2625`](https://github.com/eea/volto-cca-policy/commit/52e2625914f699c194f75d561f97959ab6c21fbf)]
139
+
140
+ #### :nail_care: Enhancements
141
+
142
+ - refactor(mission): use ItemsSection in PlanningTab - refs #291190 [kreafox - [`9e96aaa`](https://github.com/eea/volto-cca-policy/commit/9e96aaac0686f6688b3406aca578b598882a9c29)]
143
+ - change: update sectors with icons for Planning tab - refs #291190 [kreafox - [`8b82168`](https://github.com/eea/volto-cca-policy/commit/8b821686fc6b9d98c542d9f0315734b446070a17)]
144
+ - change: update factors with icons for Assessment tab - refs #291189 [kreafox - [`d8b7afc`](https://github.com/eea/volto-cca-policy/commit/d8b7afc36b2129b60ef81d9a057c4c9be35cbb03)]
145
+ - change: update sectors with icons for Action tab - refs #291188 [kreafox - [`a9f15c7`](https://github.com/eea/volto-cca-policy/commit/a9f15c70fa261c9da5b0f01d0bf07ede0136085f)]
146
+ - change(mission): use result_beta in sandbox for signatory reporting - refs #292508 [kreafox - [`b425801`](https://github.com/eea/volto-cca-policy/commit/b42580100bdd2b4d79be53bbfa05098856deb4be)]
147
+ - change: update signatory profile action tab with icons [kreafox - [`0e72902`](https://github.com/eea/volto-cca-policy/commit/0e7290259b966ff72d2a4d77efca8fbeec8655f8)]
148
+
149
+ #### :house: Internal changes
150
+
151
+ - style(mission): mobile fixes on signatory reporting pages [kreafox - [`cbeb584`](https://github.com/eea/volto-cca-policy/commit/cbeb5846c8047c164c29635bd30491b4f810246a)]
152
+ - chore: better component naming [kreafox - [`d61e462`](https://github.com/eea/volto-cca-policy/commit/d61e4629da184ec14d6ad0d056ac29751223e2f9)]
153
+
154
+ #### :hammer_and_wrench: Others
155
+
156
+ - test: resolve Jest errors in component tests [kreafox - [`6dbb735`](https://github.com/eea/volto-cca-policy/commit/6dbb73540e8301fcb42a4d52db7004f5a42db4d8)]
157
+ - test: fix PlanningTab mock data to match component structure [kreafox - [`48e76e1`](https://github.com/eea/volto-cca-policy/commit/48e76e1e50e0c6d8a6a500fec3d1831419faeee9)]
158
+ - test: resolve Jest errors in component tests [kreafox - [`f309b96`](https://github.com/eea/volto-cca-policy/commit/f309b96b0767358530d969e21102887a9db76b5a)]
130
159
  ### [0.3.83](https://github.com/eea/volto-cca-policy/compare/0.3.82...0.3.83) - 10 September 2025
131
160
 
132
161
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-cca-policy",
3
- "version": "0.3.84",
3
+ "version": "0.3.85",
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",
@@ -6,34 +6,44 @@ import {
6
6
  AccordionContent,
7
7
  } from 'semantic-ui-react';
8
8
 
9
- const AccordionList = ({ accordions, variation }) => {
10
- const [activeIndex, setActiveIndex] = useState(-1);
9
+ const AccordionList = ({ accordions, variation, multiple = false }) => {
10
+ const [activeIndexes, setActiveIndexes] = useState([]);
11
+
11
12
  const handleAccordionClick = (index) => {
12
- setActiveIndex(activeIndex === index ? -1 : index);
13
+ if (multiple) {
14
+ setActiveIndexes((prev) =>
15
+ prev.includes(index)
16
+ ? prev.filter((i) => i !== index)
17
+ : [...prev, index],
18
+ );
19
+ } else {
20
+ setActiveIndexes((prev) => (prev.includes(index) ? [] : [index]));
21
+ }
13
22
  };
14
23
 
15
24
  return (
16
25
  <Accordion className={variation}>
17
- {accordions.map((accordion, index) => (
18
- <React.Fragment key={index}>
19
- <AccordionTitle
20
- active={activeIndex === index}
21
- onClick={() => handleAccordionClick(index)}
22
- >
23
- <Icon
24
- className={
25
- activeIndex === index
26
- ? 'ri-arrow-up-s-line'
27
- : 'ri-arrow-down-s-line'
28
- }
29
- />
30
- {accordion.title}
31
- </AccordionTitle>
32
- <AccordionContent active={activeIndex === index}>
33
- {accordion.content}
34
- </AccordionContent>
35
- </React.Fragment>
36
- ))}
26
+ {accordions.map((accordion, index) => {
27
+ const isActive = activeIndexes.includes(index);
28
+ return (
29
+ <React.Fragment key={index}>
30
+ <AccordionTitle
31
+ active={isActive}
32
+ onClick={() => handleAccordionClick(index)}
33
+ >
34
+ <Icon
35
+ className={
36
+ isActive ? 'ri-arrow-up-s-line' : 'ri-arrow-down-s-line'
37
+ }
38
+ />
39
+ {accordion.title}
40
+ </AccordionTitle>
41
+ <AccordionContent active={isActive}>
42
+ {accordion.content}
43
+ </AccordionContent>
44
+ </React.Fragment>
45
+ );
46
+ })}
37
47
  </Accordion>
38
48
  );
39
49
  };
@@ -0,0 +1,12 @@
1
+ import '@testing-library/jest-dom';
2
+ import { render } from '@testing-library/react';
3
+ import NoDataReported from './NoDataReported';
4
+
5
+ describe('NoDataReported', () => {
6
+ it('renders the provided label inside Tab.Pane', () => {
7
+ const testLabel = 'No data available';
8
+ const { getByText } = render(<NoDataReported label={testLabel} />);
9
+
10
+ expect(getByText(testLabel)).toBeInTheDocument();
11
+ });
12
+ });
@@ -0,0 +1,22 @@
1
+ import '@testing-library/jest-dom';
2
+ import { render } from '@testing-library/react';
3
+ import StatisticSection from './StatisticSection';
4
+
5
+ describe('StatisticSection', () => {
6
+ const mockStatistics = [
7
+ { label: 'Population year', value: 2023 },
8
+ { label: 'Population size', value: 362.133 },
9
+ ];
10
+
11
+ it('renders all statistic values and labels', () => {
12
+ const { getByText } = render(
13
+ <StatisticSection statistic={mockStatistics} />,
14
+ );
15
+
16
+ expect(getByText('2023')).toBeInTheDocument();
17
+ expect(getByText('362.133')).toBeInTheDocument();
18
+
19
+ expect(getByText('Population year')).toBeInTheDocument();
20
+ expect(getByText('Population size')).toBeInTheDocument();
21
+ });
22
+ });
@@ -10,8 +10,8 @@ import ItemsSection from '../ItemsSection';
10
10
  const ActionTabContent = ({ action }) => {
11
11
  const location = useLocation();
12
12
  const hasHazards = action?.Climate_Hazards?.length > 0;
13
- const hasSectors = action?.Sectors.length > 0;
14
- const hasBenefits = action?.Co_Benefits.length > 0;
13
+ const hasSectors = action?.Sectors?.length > 0;
14
+ const hasBenefits = action?.Co_Benefits?.length > 0;
15
15
 
16
16
  const isSandbox = location.pathname.includes(
17
17
  '/mission/sandbox/eea-sandbox/signatory-reporting',
@@ -65,17 +65,14 @@ const ActionTabContent = ({ action }) => {
65
65
  )}
66
66
  </Grid>
67
67
  {action.Funding_Sources && (
68
- <>
69
- <br />
70
- <div className="funding-sources">
71
- <span>{action.Funding_Sources_Label} </span>
72
- <strong>
73
- <HTMLField
74
- value={{ data: formatTextToHTML(action.Funding_Sources) }}
75
- />
76
- </strong>
77
- </div>
78
- </>
68
+ <div className="funding-sources">
69
+ <span>{action.Funding_Sources_Label} </span>
70
+ <strong>
71
+ <HTMLField
72
+ value={{ data: formatTextToHTML(action.Funding_Sources) }}
73
+ />
74
+ </strong>
75
+ </div>
79
76
  )}
80
77
  </>
81
78
  );
@@ -41,8 +41,9 @@ const AssessmentTab = ({ result, general_text }) => {
41
41
  Hazards_Title,
42
42
  Hazards_Abstract,
43
43
  } = result.assessment_text?.[0] || {};
44
- const assessment_risks = result.assessment_risks || [];
45
- const assessment_hazards_sectors = result.assessment_hazards_sectors || [];
44
+
45
+ const assessment_risks = result?.assessment_risks || [];
46
+ const assessment_hazards_sectors = result?.assessment_hazards_sectors || [];
46
47
  const { No_Data_Reported_Label } = general_text || {};
47
48
 
48
49
  const NoResults =
@@ -58,6 +59,7 @@ const AssessmentTab = ({ result, general_text }) => {
58
59
  return (
59
60
  <Tab.Pane className="assessment-tab">
60
61
  {Title && <h2>{Title}</h2>}
62
+
61
63
  {Subheading && (
62
64
  <Callout>
63
65
  <HTMLField value={{ data: formatTextToHTML(Subheading) }} />
@@ -69,7 +71,7 @@ const AssessmentTab = ({ result, general_text }) => {
69
71
  <div className="tab-section-wrapper assessment">
70
72
  {Cra_Title && <h3>{Cra_Title}</h3>}
71
73
 
72
- {result.assessment_factors.length > 0 && (
74
+ {result.assessment_factors?.length > 0 && (
73
75
  <>
74
76
  {Cra_Abstract && <h5>{Cra_Abstract}</h5>}
75
77
  <ItemsSection
@@ -83,26 +85,19 @@ const AssessmentTab = ({ result, general_text }) => {
83
85
  {assessment_risks.length > 0 && (
84
86
  <>
85
87
  {Attachments && <h4>{Attachments}</h4>}
86
- {assessment_risks.map((risk, index) => {
87
- const title = risk?.Attachment_Title
88
- ? `${risk.Assessment_Id}. ${risk.Attachment_Title} - ${
89
- risk.Year_Of_Publication || ''
90
- }`
91
- : null;
92
- return (
93
- <div key={index}>
94
- <AccordionList
95
- variation="tertiary"
96
- accordions={[
97
- {
98
- title: title,
99
- content: <AssessmentAccordionContent result={risk} />,
100
- },
101
- ]}
102
- />
103
- </div>
104
- );
105
- })}
88
+
89
+ <AccordionList
90
+ variation="tertiary"
91
+ multiple={false}
92
+ accordions={assessment_risks.map((risk, index) => ({
93
+ title: risk?.Attachment_Title
94
+ ? `${index + 1}. ${risk.Attachment_Title} - ${
95
+ risk.Year_Of_Publication || ''
96
+ }`
97
+ : `Risk ${index + 1}`,
98
+ content: <AssessmentAccordionContent result={risk} />,
99
+ }))}
100
+ />
106
101
  </>
107
102
  )}
108
103
  </div>
@@ -115,7 +110,7 @@ const AssessmentTab = ({ result, general_text }) => {
115
110
 
116
111
  <br />
117
112
 
118
- {assessment_hazards_sectors && (
113
+ {assessment_hazards_sectors.length > 0 && (
119
114
  <AccordionList
120
115
  accordions={assessment_hazards_sectors.map((category) => ({
121
116
  title: category.Hazard,
@@ -63,19 +63,19 @@ const GovernanceTab = ({ result, general_text }) => {
63
63
 
64
64
  {Describe && <HTMLField value={{ data: formatTextToHTML(Describe) }} />}
65
65
 
66
- <br />
67
-
68
66
  {Provide && (
69
- <AccordionList
70
- accordions={[
71
- {
72
- title: Provide_Title,
73
- content: (
74
- <HTMLField value={{ data: formatTextToHTML(Provide) }} />
75
- ),
76
- },
77
- ]}
78
- />
67
+ <div className="provide-section">
68
+ <AccordionList
69
+ accordions={[
70
+ {
71
+ title: Provide_Title,
72
+ content: (
73
+ <HTMLField value={{ data: formatTextToHTML(Provide) }} />
74
+ ),
75
+ },
76
+ ]}
77
+ />
78
+ </div>
79
79
  )}
80
80
  </Tab.Pane>
81
81
  );
@@ -127,9 +127,8 @@ const PlanningTab = ({ result, general_text }) => {
127
127
 
128
128
  {planning_climate_action.map((action, index) => (
129
129
  <React.Fragment key={index}>
130
- <br />
131
130
  {action?.Sectors_Introduction && (
132
- <Message>
131
+ <Message className="sectors-introduction">
133
132
  <HTMLField
134
133
  value={{
135
134
  data: formatTextToHTML(action.Sectors_Introduction),
@@ -173,12 +172,7 @@ const PlanningTab = ({ result, general_text }) => {
173
172
  {name && ` [${name}]`}
174
173
  </strong>
175
174
  </a>
176
- ) : (
177
- <strong>
178
- {action.Further_Information_Link_Text}
179
- {name && ` [${name}]`}
180
- </strong>
181
- );
175
+ ) : null;
182
176
  })()}
183
177
  </p>
184
178
  )}
@@ -112,6 +112,15 @@ body.subsite-mkh {
112
112
  margin: 2em 0;
113
113
  }
114
114
 
115
+ .sectors-introduction {
116
+ margin-top: 3em;
117
+ }
118
+
119
+ .funding-sources,
120
+ .provide-section {
121
+ margin-top: 1em;
122
+ }
123
+
115
124
  .action-tab {
116
125
  .ui.items.items-group {
117
126
  margin: 1em 0;