@eeacms/volto-cca-policy 0.3.28 → 0.3.30

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 (41) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/locales/bg/LC_MESSAGES/volto.po +53 -5
  3. package/locales/cs/LC_MESSAGES/volto.po +53 -5
  4. package/locales/da/LC_MESSAGES/volto.po +58 -10
  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 +58 -10
  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 -5
  11. package/locales/fi/LC_MESSAGES/volto.po +53 -5
  12. package/locales/fr/LC_MESSAGES/volto.po +53 -5
  13. package/locales/ga/LC_MESSAGES/volto.po +53 -5
  14. package/locales/hr/LC_MESSAGES/volto.po +53 -5
  15. package/locales/hu/LC_MESSAGES/volto.po +53 -5
  16. package/locales/is/LC_MESSAGES/volto.po +58 -10
  17. package/locales/it/LC_MESSAGES/volto.po +53 -5
  18. package/locales/lt/LC_MESSAGES/volto.po +53 -5
  19. package/locales/lv/LC_MESSAGES/volto.po +58 -10
  20. package/locales/mt/LC_MESSAGES/volto.po +58 -10
  21. package/locales/nl/LC_MESSAGES/volto.po +53 -5
  22. package/locales/nn/LC_MESSAGES/volto.po +58 -10
  23. package/locales/pl/LC_MESSAGES/volto.po +53 -5
  24. package/locales/pt/LC_MESSAGES/volto.po +53 -5
  25. package/locales/ro/LC_MESSAGES/volto.po +53 -5
  26. package/locales/sk/LC_MESSAGES/volto.po +58 -10
  27. package/locales/sl/LC_MESSAGES/volto.po +53 -5
  28. package/locales/sv/LC_MESSAGES/volto.po +58 -10
  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
  41. package/src/index.js +1 -0
@@ -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}
package/src/index.js CHANGED
@@ -138,6 +138,7 @@ const applyConfig = (config) => {
138
138
  'nn', // norwegean (one of 2)
139
139
  'tr', // turkish
140
140
  ];
141
+ config.settings.querystringSearchGet = true; // let's use get because we have varnish
141
142
 
142
143
  // EEA customizations
143
144
  config.settings.eea = {