@eeacms/volto-cca-policy 0.3.28 → 0.3.29

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +28 -8
  2. package/locales/bg/LC_MESSAGES/volto.po +53 -6
  3. package/locales/cs/LC_MESSAGES/volto.po +53 -6
  4. package/locales/da/LC_MESSAGES/volto.po +53 -6
  5. package/locales/de/LC_MESSAGES/volto.po +53 -5
  6. package/locales/eea.cca.pot +27 -0
  7. package/locales/el/LC_MESSAGES/volto.po +53 -6
  8. package/locales/en/LC_MESSAGES/volto.po +63 -5
  9. package/locales/es/LC_MESSAGES/volto.po +53 -5
  10. package/locales/et/LC_MESSAGES/volto.po +53 -6
  11. package/locales/fi/LC_MESSAGES/volto.po +53 -6
  12. package/locales/fr/LC_MESSAGES/volto.po +53 -6
  13. package/locales/ga/LC_MESSAGES/volto.po +53 -6
  14. package/locales/hr/LC_MESSAGES/volto.po +53 -6
  15. package/locales/hu/LC_MESSAGES/volto.po +53 -6
  16. package/locales/is/LC_MESSAGES/volto.po +53 -6
  17. package/locales/it/LC_MESSAGES/volto.po +53 -6
  18. package/locales/lt/LC_MESSAGES/volto.po +53 -6
  19. package/locales/lv/LC_MESSAGES/volto.po +53 -6
  20. package/locales/mt/LC_MESSAGES/volto.po +53 -6
  21. package/locales/nl/LC_MESSAGES/volto.po +53 -6
  22. package/locales/nn/LC_MESSAGES/volto.po +53 -6
  23. package/locales/pl/LC_MESSAGES/volto.po +53 -6
  24. package/locales/pt/LC_MESSAGES/volto.po +53 -6
  25. package/locales/ro/LC_MESSAGES/volto.po +53 -6
  26. package/locales/sk/LC_MESSAGES/volto.po +53 -6
  27. package/locales/sl/LC_MESSAGES/volto.po +53 -6
  28. package/locales/sv/LC_MESSAGES/volto.po +53 -6
  29. package/locales/volto.pot +9 -1
  30. package/package.json +1 -1
  31. package/src/components/manage/Blocks/CollectionStatistics/CollectionStatsView.jsx +5 -1
  32. package/src/components/manage/Blocks/CollectionStatistics/styles.less +8 -0
  33. package/src/components/manage/Blocks/MissionSignatoriesProfile/MissionSignatoriesProfileView.js +2 -1
  34. package/src/components/manage/Blocks/MissionSignatoriesProfile/TabSections/ActionPagesTab.jsx +94 -17
  35. package/src/components/manage/Blocks/MissionSignatoriesProfile/TabSections/ActionPagesTab.test.jsx +93 -0
  36. package/src/components/manage/Blocks/MissionSignatoriesProfile/TabSections/AssessmentTab.jsx +4 -14
  37. package/src/components/manage/Blocks/MissionSignatoriesProfile/TabSections/GovernanceTab.jsx +1 -5
  38. package/src/components/manage/Blocks/MissionSignatoriesProfile/TabSections/IntroductionTab.jsx +2 -4
  39. package/src/components/manage/Blocks/MissionSignatoriesProfile/TabSections/PlanningTab.jsx +2 -8
  40. package/src/components/manage/Blocks/RASTBlock/ContextNavigation.jsx +15 -10
package/locales/volto.pot CHANGED
@@ -1,7 +1,7 @@
1
1
  msgid ""
2
2
  msgstr ""
3
3
  "Project-Id-Version: Plone\n"
4
- "POT-Creation-Date: 2025-03-18T08:52:34.397Z\n"
4
+ "POT-Creation-Date: 2025-04-22T09:13:00.209Z\n"
5
5
  "Last-Translator: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
6
6
  "Language-Team: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
7
7
  "Content-Type: text/plain; charset=utf-8\n"
@@ -21,6 +21,7 @@ msgstr ""
21
21
  #. Default: "Adaptation Approaches"
22
22
  #: search/cca/facets
23
23
  #: search/facets
24
+ #: search/fise/facets
24
25
  #: search/health_observatory/facets-health
25
26
  #: search/mission_all/facets-all
26
27
  #: search/mission_projects/facets-projects
@@ -46,6 +47,7 @@ msgstr ""
46
47
  #: search/cca/facets
47
48
  #: search/common
48
49
  #: search/facets
50
+ #: search/fise/facets
49
51
  msgid "Adaptation Sectors"
50
52
  msgstr ""
51
53
 
@@ -150,6 +152,7 @@ msgstr ""
150
152
  #: search/cca/facets
151
153
  #: search/common
152
154
  #: search/facets
155
+ #: search/fise/facets
153
156
  msgid "Climate Impacts"
154
157
  msgstr ""
155
158
 
@@ -316,6 +319,7 @@ msgstr ""
316
319
  #. Default: "Funding Programme"
317
320
  #: search/cca/facets
318
321
  #: search/facets
322
+ #: search/fise/facets
319
323
  #: search/mission_projects/facets-projects
320
324
  #: search/mission_stories/facets-stories
321
325
  msgid "Funding Programme"
@@ -430,6 +434,7 @@ msgstr ""
430
434
  #. Default: "Item from third parties"
431
435
  #: search/cca/facets
432
436
  #: search/facets
437
+ #: search/fise/facets
433
438
  msgid "Item from third parties"
434
439
  msgstr ""
435
440
 
@@ -442,6 +447,7 @@ msgstr ""
442
447
  #: components/manage/Blocks/FilterAceContent/FilterAceContentView
443
448
  #: search/cca/facets
444
449
  #: search/facets
450
+ #: search/fise/facets
445
451
  msgid "Key Type Measure"
446
452
  msgstr ""
447
453
 
@@ -724,6 +730,7 @@ msgstr ""
724
730
  #. Default: "Section"
725
731
  #: search/cca/facets
726
732
  #: search/facets
733
+ #: search/fise/facets
727
734
  msgid "Section"
728
735
  msgstr ""
729
736
 
@@ -843,6 +850,7 @@ msgstr ""
843
850
  #. Default: "Transnational regions"
844
851
  #: search/cca/facets
845
852
  #: search/facets
853
+ #: search/fise/facets
846
854
  msgid "Transnational regions"
847
855
  msgstr ""
848
856
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-cca-policy",
3
- "version": "0.3.28",
3
+ "version": "0.3.29",
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",
@@ -115,6 +115,7 @@ export default function CollectionStatsView(props) {
115
115
  const { queryParameterStyle = 'SearchBlock', query = {}, showLabel } = data;
116
116
  const base = getBase(props);
117
117
  let stats = useStats(getBaseUrl(pathname), id, data);
118
+ const intl = useIntl();
118
119
 
119
120
  const groupDefinition =
120
121
  config.blocks.blocksConfig.collectionStats?.groups?.[field] || {};
@@ -141,7 +142,10 @@ export default function CollectionStatsView(props) {
141
142
  base,
142
143
  query: query.query,
143
144
  field: groupDefinition.searchFieldName || field,
144
- value: kV,
145
+ value: intl.formatMessage({
146
+ id: kV,
147
+ defaultMessage: kV,
148
+ }),
145
149
  extraFilters,
146
150
  })}
147
151
  >
@@ -3,6 +3,14 @@
3
3
 
4
4
  @import (multiple, reference, optional) '../../theme.config';
5
5
 
6
+ body.cca-main-homepage {
7
+ .collection-stats {
8
+ a {
9
+ word-break: break-word;
10
+ }
11
+ }
12
+ }
13
+
6
14
  .collection-stats {
7
15
  display: flex;
8
16
  flex-direction: row;
@@ -15,6 +15,7 @@ const MissionSignatoriesProfileView = (props) => {
15
15
  const governance = result?.governance?.[0] || [];
16
16
  const planning = result?.planning || {};
17
17
  const assessment = result?.assessment || {};
18
+ const action = result?.action || {};
18
19
 
19
20
  // const dataJson = JSON.parse(result?.Cooperation_Experience);
20
21
  const [activeIndex, setActiveIndex] = React.useState(0);
@@ -61,7 +62,7 @@ const MissionSignatoriesProfileView = (props) => {
61
62
  },
62
63
  {
63
64
  menuItem: 'Action Pages',
64
- render: () => <ActionPagesTab />,
65
+ render: () => <ActionPagesTab result={action} />,
65
66
  },
66
67
  ]}
67
68
  />
@@ -1,25 +1,102 @@
1
1
  import React from 'react';
2
- import { Tab } from 'semantic-ui-react';
2
+ import { Tab, Grid } from 'semantic-ui-react';
3
3
  import { Callout } from '@eeacms/volto-eea-design-system/ui';
4
+ import AccordionList from './../AccordionList';
5
+
6
+ const ActionsTabContent = ({ action }) => {
7
+ const hasHazards = action?.Climate_Hazards?.length > 0;
8
+ const hasSectors = !!action?.Sectors;
9
+ const hasBenefits = !!action?.Co_Benefits;
10
+ return (
11
+ <>
12
+ <Grid columns="12">
13
+ <Grid.Column mobile={12} tablet={12} computer={6}>
14
+ {hasHazards && (
15
+ <>
16
+ <h5>{action.Hazards_Addressed_Label}</h5>
17
+ <ul>
18
+ {action.Climate_Hazards.map((hazard, index) => (
19
+ <li key={index}>{hazard}</li>
20
+ ))}
21
+ </ul>
22
+ </>
23
+ )}
24
+ {hasSectors && (
25
+ <>
26
+ <h5>{action.Sectors_Label}</h5>
27
+ <ul>
28
+ {action.Sectors.map((hazard, index) => (
29
+ <li key={index}>{hazard}</li>
30
+ ))}
31
+ </ul>
32
+ </>
33
+ )}
34
+ </Grid.Column>
35
+
36
+ <Grid.Column mobile={12} tablet={12} computer={6}>
37
+ {hasBenefits && (
38
+ <>
39
+ <h5 className="small-label">{action.Co_Benefits_Label}</h5>
40
+ <ul>
41
+ {action.Co_Benefits.map((benefit, index) => (
42
+ <li key={index}>{benefit}</li>
43
+ ))}
44
+ </ul>
45
+ </>
46
+ )}
47
+ </Grid.Column>
48
+ </Grid>
49
+ {action.Funding_Sources && (
50
+ <>
51
+ <br />
52
+ <p>
53
+ <span>{action.Funding_Sources_Label} </span>
54
+ <strong>{action.Funding_Sources}</strong>
55
+ </p>
56
+ </>
57
+ )}
58
+ </>
59
+ );
60
+ };
61
+
62
+ const ActionPagesTab = ({ result }) => {
63
+ const { Title, Abstract, Abstract_Line } = result.action_text?.[0] || [];
64
+ const actions = result.actions || [];
65
+
66
+ const sortedActions = [...actions].sort((a, b) => {
67
+ const aNum = parseInt(a.Action_Id.replace(/\D/g, ''), 10);
68
+ const bNum = parseInt(b.Action_Id.replace(/\D/g, ''), 10);
69
+ return aNum - bNum;
70
+ });
4
71
 
5
- const ActionPagesTab = () => {
6
72
  return (
7
73
  <Tab.Pane>
8
- <h2>Action Pages</h2>
9
- <Callout>
10
- <p>
11
- Donec et urna vel risus feugiat pharetra. Proin id lacus vitae velit
12
- accumsan venenatis. Aenean non mi vel nisi lacinia maximus.
13
- </p>
14
- </Callout>
15
- <p>
16
- Duis efficitur, sapien quis bibendum auctor, lectus risus feugiat
17
- sapien, ac pulvinar orci est a arcu. Integer id augue vitae urna
18
- tristique tempus. Etiam id velit feugiat, scelerisque velit a,
19
- scelerisque nunc. Vestibulum ante ipsum primis in faucibus orci luctus
20
- et ultrices posuere cubilia curae; Integer dignissim risus non nibh
21
- scelerisque, sit amet tincidunt sapien rutrum.
22
- </p>
74
+ {Title && <h2>{Title}</h2>}
75
+ {Abstract && <p>{Abstract}</p>}
76
+ {Abstract_Line && <Callout>{Abstract_Line}</Callout>}
77
+
78
+ <br />
79
+
80
+ {sortedActions.map((action, index) => {
81
+ return (
82
+ <div key={index} className="section-wrapper">
83
+ <h5 className="section-title">
84
+ <span className="section-number">{action.Order}. </span>
85
+ <span>{action?.Action}</span>
86
+ </h5>
87
+
88
+ <AccordionList
89
+ variation="tertiary"
90
+ accordions={[
91
+ {
92
+ title: action?.More_Details_Label || 'More details',
93
+ content: <ActionsTabContent action={action} />,
94
+ },
95
+ ]}
96
+ />
97
+ </div>
98
+ );
99
+ })}
23
100
  </Tab.Pane>
24
101
  );
25
102
  };
@@ -0,0 +1,93 @@
1
+ import React from 'react';
2
+ import { render, within } from '@testing-library/react';
3
+ import '@testing-library/jest-dom';
4
+ import ActionPagesTab from './ActionPagesTab';
5
+
6
+ // Mocking components used inside
7
+ jest.mock('@eeacms/volto-eea-design-system/ui', () => ({
8
+ Callout: ({ children }) => <div>{children}</div>,
9
+ }));
10
+
11
+ jest.mock('./../AccordionList', () => ({ variation, accordions }) => (
12
+ <div>
13
+ {accordions.map((item, index) => (
14
+ <div key={index}>
15
+ <div>{item.title}</div>
16
+ <div>{item.content}</div>
17
+ </div>
18
+ ))}
19
+ </div>
20
+ ));
21
+
22
+ describe('ActionPagesTab', () => {
23
+ const mockResult = {
24
+ action_text: [
25
+ {
26
+ Title: 'Adaptation Actions',
27
+ Abstract: 'This is an overview of adaptation actions.',
28
+ Abstract_Line: 'Summary line here.',
29
+ },
30
+ ],
31
+ actions: [
32
+ {
33
+ Action_Id: 'A-002',
34
+ Order: 2,
35
+ Action: 'Second action',
36
+ More_Details_Label: 'Details 2',
37
+ Climate_Hazards: ['Flood', 'Heatwave'],
38
+ Hazards_Addressed_Label: 'Hazards addressed',
39
+ Sectors: ['Health', 'Infrastructure'],
40
+ Sectors_Label: 'Affected sectors',
41
+ Co_Benefits: ['Biodiversity', 'Air quality'],
42
+ Co_Benefits_Label: 'Co-benefits',
43
+ Funding_Sources: 'EU Funds',
44
+ Funding_Sources_Label: 'Funding source:',
45
+ },
46
+ {
47
+ Action_Id: 'A-001',
48
+ Order: 1,
49
+ Action: 'First action',
50
+ More_Details_Label: 'Details 1',
51
+ Climate_Hazards: ['Drought'],
52
+ Hazards_Addressed_Label: 'Hazards addressed',
53
+ Sectors: ['Agriculture'],
54
+ Sectors_Label: 'Affected sectors',
55
+ Co_Benefits: ['Water retention'],
56
+ Co_Benefits_Label: 'Co-benefits',
57
+ Funding_Sources: 'National Funds',
58
+ Funding_Sources_Label: 'Funding source:',
59
+ },
60
+ ],
61
+ };
62
+
63
+ it('renders action tab content correctly', () => {
64
+ const { getByText, getAllByText } = render(
65
+ <ActionPagesTab result={mockResult} />,
66
+ );
67
+
68
+ expect(getByText('Adaptation Actions')).toBeInTheDocument();
69
+ expect(
70
+ getByText('This is an overview of adaptation actions.'),
71
+ ).toBeInTheDocument();
72
+ expect(getByText('Summary line here.')).toBeInTheDocument();
73
+
74
+ const sections = getAllByText(/^\d+\./).map((el) =>
75
+ el.closest('.section-wrapper'),
76
+ );
77
+
78
+ // First action
79
+ const firstAction = within(sections[0]);
80
+ expect(firstAction.getByText('First action')).toBeInTheDocument();
81
+ expect(firstAction.getByText('Hazards addressed')).toBeInTheDocument();
82
+ expect(firstAction.getByText('Drought')).toBeInTheDocument();
83
+ expect(firstAction.getByText('Funding source:')).toBeInTheDocument();
84
+ expect(firstAction.getByText('National Funds')).toBeInTheDocument();
85
+
86
+ // Second action
87
+ const secondAction = within(sections[1]);
88
+ expect(secondAction.getByText('Second action')).toBeInTheDocument();
89
+ expect(secondAction.getByText('Hazards addressed')).toBeInTheDocument();
90
+ expect(secondAction.getByText('Flood')).toBeInTheDocument();
91
+ expect(secondAction.getByText('EU Funds')).toBeInTheDocument();
92
+ });
93
+ });
@@ -61,18 +61,15 @@ const AssessmentTab = ({ result }) => {
61
61
  Attachments,
62
62
  Hazards_Title,
63
63
  Hazards_Abstract,
64
- } = result.assessment_text[0] || [];
64
+ } = result.assessment_text?.[0] || [];
65
+ const assessment_risks = result.assessment_risks || [];
65
66
 
66
67
  const [activeIndex, setActiveIndex] = React.useState(0);
67
68
 
68
69
  return (
69
70
  <Tab.Pane>
70
71
  {Title && <h2>{Title}</h2>}
71
- {Subheading && (
72
- <Callout>
73
- <p>{Subheading}</p>
74
- </Callout>
75
- )}
72
+ {Subheading && <Callout>{Subheading}</Callout>}
76
73
 
77
74
  {Abstract && <p>{Abstract}</p>}
78
75
 
@@ -84,14 +81,7 @@ const AssessmentTab = ({ result }) => {
84
81
 
85
82
  {Attachments && <h4>{Attachments}</h4>}
86
83
 
87
- <p>
88
- Lorem ipsum dolor sit amet consectetur. Quam porta convallis ultrices
89
- aliquet. Imperdiet maecenas at velit gravida arcu blandit eget. Etiam
90
- tellus vulputate mi vitae bibendum fermentum condimentum facilisis.
91
- Amet et sed nunc pretium fames nibh lacus mi magna.
92
- </p>
93
-
94
- {result.assessment_risks.map((risk, index) => {
84
+ {assessment_risks.map((risk, index) => {
95
85
  const title = risk?.Attachment_Title
96
86
  ? `${risk.Assessment_Id}. ${risk.Attachment_Title} - ${
97
87
  risk.Year_Of_Publication || ''
@@ -19,11 +19,7 @@ const GovernanceTab = ({ result }) => {
19
19
  <Tab.Pane>
20
20
  {Title && <h2>{Title}</h2>}
21
21
 
22
- {Introduction && (
23
- <Callout>
24
- <p>{Introduction}</p>
25
- </Callout>
26
- )}
22
+ {Introduction && <Callout>{Introduction}</Callout>}
27
23
 
28
24
  {Describe_Title && <h3>{Describe_Title}</h3>}
29
25
 
@@ -7,10 +7,8 @@ const IntroductionTab = () => {
7
7
  <Tab.Pane>
8
8
  <h2>Introduction</h2>
9
9
  <Callout>
10
- <p>
11
- Duis non quam et nisi tincidunt fermentum. Pellentesque habitant morbi
12
- tristique senectus et netus et malesuada fames ac turpis egestas.
13
- </p>
10
+ Duis non quam et nisi tincidunt fermentum. Pellentesque habitant morbi
11
+ tristique senectus et netus et malesuada fames ac turpis egestas.
14
12
  </Callout>
15
13
  <h3>The Mission on Adaptation</h3>
16
14
  <p>
@@ -95,11 +95,7 @@ const PlanningTab = ({ result }) => {
95
95
  return (
96
96
  <Tab.Pane>
97
97
  {titleData?.Title && <h2>{titleData.Title}</h2>}
98
- {titleData?.Abstract_Line && (
99
- <Callout>
100
- <p>{titleData.Abstract_Line}</p>
101
- </Callout>
102
- )}
98
+ {titleData?.Abstract_Line && <Callout>{titleData.Abstract_Line}</Callout>}
103
99
 
104
100
  {sortedGoals.map((goal, index) => {
105
101
  return (
@@ -126,9 +122,7 @@ const PlanningTab = ({ result }) => {
126
122
  )}
127
123
 
128
124
  {goalData?.Climate_Action_Abstract && (
129
- <Callout>
130
- <p>{goalData.Climate_Action_Abstract}</p>
131
- </Callout>
125
+ <Callout>{goalData.Climate_Action_Abstract}</Callout>
132
126
  )}
133
127
 
134
128
  {planning_climate_action.map((action, index) => {
@@ -11,18 +11,23 @@ import { useLocation } from 'react-router-dom';
11
11
  * INavigationPortlet
12
12
  */
13
13
  export function ContextNavigationComponent(props) {
14
+ const curentLocation = useLocation();
14
15
  const { location, items, skip_items, show_subfolders } = props;
15
- let activeMenu = null;
16
+ const [activeMenu, setActiveMenu] = React.useState(null);
16
17
 
17
- const curent_location = useLocation();
18
- for (let i = 0; i < items.length; i++) {
19
- let itemUrl = '/' + items[i]['@id'].split('/').slice(3).join('/');
20
- items[i].is_active = false;
21
- if (curent_location.pathname.includes(itemUrl)) {
22
- activeMenu = i;
23
- items[i].is_active = true;
18
+ React.useEffect(() => {
19
+ let newItems = [...items];
20
+ let activeIndex = null;
21
+
22
+ for (let i = 0; i < newItems.length; i++) {
23
+ let itemUrl = '/' + newItems[i]['@id'].split('/').slice(3).join('/');
24
+ if (curentLocation.pathname.includes(itemUrl)) {
25
+ activeIndex = i;
26
+ }
24
27
  }
25
- }
28
+
29
+ setActiveMenu(activeIndex);
30
+ }, [curentLocation, items]);
26
31
 
27
32
  return (
28
33
  <>
@@ -36,7 +41,7 @@ export function ContextNavigationComponent(props) {
36
41
  <RASTAccordion
37
42
  items={items}
38
43
  show_subfolders={show_subfolders}
39
- curent_location={curent_location}
44
+ curent_location={curentLocation}
40
45
  activeMenu={activeMenu}
41
46
  />
42
47
  ) : null}