@eeacms/volto-cca-policy 1.0.19 → 1.0.21

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 +29 -13
  2. package/locales/bg/LC_MESSAGES/volto.po +51 -28
  3. package/locales/cs/LC_MESSAGES/volto.po +51 -28
  4. package/locales/da/LC_MESSAGES/volto.po +51 -28
  5. package/locales/de/LC_MESSAGES/volto.po +51 -28
  6. package/locales/el/LC_MESSAGES/volto.po +51 -28
  7. package/locales/en/LC_MESSAGES/volto.po +51 -28
  8. package/locales/es/LC_MESSAGES/volto.po +51 -28
  9. package/locales/et/LC_MESSAGES/volto.po +51 -28
  10. package/locales/fi/LC_MESSAGES/volto.po +51 -28
  11. package/locales/fr/LC_MESSAGES/volto.po +51 -28
  12. package/locales/ga/LC_MESSAGES/volto.po +51 -28
  13. package/locales/hr/LC_MESSAGES/volto.po +51 -28
  14. package/locales/hu/LC_MESSAGES/volto.po +51 -28
  15. package/locales/is/LC_MESSAGES/volto.po +51 -28
  16. package/locales/it/LC_MESSAGES/volto.po +51 -28
  17. package/locales/lt/LC_MESSAGES/volto.po +51 -28
  18. package/locales/lv/LC_MESSAGES/volto.po +51 -28
  19. package/locales/mt/LC_MESSAGES/volto.po +51 -28
  20. package/locales/nl/LC_MESSAGES/volto.po +51 -28
  21. package/locales/nn/LC_MESSAGES/volto.po +51 -28
  22. package/locales/pl/LC_MESSAGES/volto.po +51 -28
  23. package/locales/pt/LC_MESSAGES/volto.po +51 -28
  24. package/locales/ro/LC_MESSAGES/volto.po +51 -28
  25. package/locales/sk/LC_MESSAGES/volto.po +51 -28
  26. package/locales/sl/LC_MESSAGES/volto.po +51 -28
  27. package/locales/sv/LC_MESSAGES/volto.po +51 -28
  28. package/locales/tr/LC_MESSAGES/volto.po +51 -28
  29. package/locales/volto.pot +52 -29
  30. package/package.json +1 -1
  31. package/src/components/Search/NavigatorCatalogue/NavigatorCatalogueCardItem.jsx +10 -8
  32. package/src/components/Search/NavigatorCatalogue/NavigatorCatalogueCardItem.test.jsx +8 -6
  33. package/src/components/theme/Content/Sections/ExtendedToolGeographicMetadata.jsx +78 -13
  34. package/src/components/theme/Content/Sections/ExtendedToolGeographicMetadata.test.jsx +110 -11
  35. package/src/components/theme/Content/Sections/GeographicMetadata.jsx +10 -1
  36. package/src/components/theme/Content/Sections/geographicMetadataUtils.js +5 -1
  37. package/src/components/theme/Views/ExtendedToolView.jsx +10 -12
  38. package/src/components/theme/Views/ExtendedToolView.test.jsx +1 -2
  39. package/src/search/navigator_catalogue/facets.js +19 -30
  40. package/theme/globals/navigator.less +0 -8
  41. package/theme/globals/views.less +14 -0
@@ -7,8 +7,14 @@ import ExtendedToolGeographicMetadata from './ExtendedToolGeographicMetadata';
7
7
 
8
8
  jest.mock('./MetadataItemList', () => ({
9
9
  __esModule: true,
10
- default: ({ value = [] }) => (
11
- <p>{value.map((item) => item.title || item.token || item).join(', ')}</p>
10
+ default: ({ value = [], asTags, maxItems }) => (
11
+ <div
12
+ data-testid="metadata-item-list"
13
+ data-astags={asTags ? 'true' : 'false'}
14
+ data-maxitems={maxItems}
15
+ >
16
+ {value.map((item) => item.title || item.token || item).join(', ')}
17
+ </div>
12
18
  ),
13
19
  }));
14
20
 
@@ -20,7 +26,7 @@ const renderComponent = (content) =>
20
26
  );
21
27
 
22
28
  describe('ExtendedToolGeographicMetadata', () => {
23
- it('renders geochars in the Extended Tool design order', () => {
29
+ it('renders categories and tags in order without Europe prefix', () => {
24
30
  const { container } = renderComponent({
25
31
  geochars: JSON.stringify({
26
32
  geoElements: {
@@ -34,22 +40,115 @@ describe('ExtendedToolGeographicMetadata', () => {
34
40
  }),
35
41
  });
36
42
 
43
+ const metadataEl = container.querySelector(
44
+ '.extended-tool-geographic-metadata',
45
+ );
46
+ expect(metadataEl).toHaveTextContent(
47
+ 'Countries:Germany, France' +
48
+ 'Macro-Transnational region:Alpine Space, Danube Area' +
49
+ 'Biogeographical regions:Alpine' +
50
+ 'Sub Nationals:Prov. Antwerpen (BE)' +
51
+ 'Municipalities & other:Brussels',
52
+ );
53
+ expect(metadataEl).not.toHaveTextContent('Europe');
54
+
55
+ const titles = container.querySelectorAll('.geographic-category-title');
56
+ expect(titles).toHaveLength(5);
57
+ expect(titles[0]).toHaveTextContent('Countries:');
58
+ expect(titles[1]).toHaveTextContent('Macro-Transnational region:');
59
+ expect(titles[2]).toHaveTextContent('Biogeographical regions:');
60
+ expect(titles[3]).toHaveTextContent('Sub Nationals:');
61
+ expect(titles[4]).toHaveTextContent('Municipalities & other:');
62
+
63
+ const tagContainers = screen.getAllByTestId('metadata-item-list');
64
+ expect(tagContainers).toHaveLength(5);
65
+ tagContainers.forEach((tc) => {
66
+ expect(tc).toHaveAttribute('data-astags', 'true');
67
+ expect(tc).toHaveAttribute('data-maxitems', '3');
68
+ });
69
+ });
70
+
71
+ it('renders country category without Europe prefix (e.g. Portugal)', () => {
72
+ const { container } = renderComponent({
73
+ geochars: JSON.stringify({
74
+ geoElements: {
75
+ element: 'EUROPE',
76
+ countries: ['PT'],
77
+ },
78
+ }),
79
+ });
80
+
81
+ const metadataEl = container.querySelector(
82
+ '.extended-tool-geographic-metadata',
83
+ );
84
+ expect(metadataEl).toHaveTextContent('Countries:Portugal');
85
+ expect(metadataEl).not.toHaveTextContent('Europe');
86
+ });
87
+
88
+ it('renders city category as Municipalities & other without Europe prefix (e.g. Selected cities)', () => {
89
+ const { container } = renderComponent({
90
+ geochars: JSON.stringify({
91
+ geoElements: {
92
+ element: 'EUROPE',
93
+ city: 'Selected cities',
94
+ },
95
+ }),
96
+ });
97
+
98
+ const metadataEl = container.querySelector(
99
+ '.extended-tool-geographic-metadata',
100
+ );
101
+ expect(metadataEl).toHaveTextContent(
102
+ 'Municipalities & other:Selected cities',
103
+ );
104
+ expect(metadataEl).not.toHaveTextContent('Europe');
105
+ });
106
+
107
+ it('renders element when no specific regions exist', () => {
108
+ const { container } = renderComponent({
109
+ geochars: JSON.stringify({
110
+ geoElements: {
111
+ element: 'EUROPE',
112
+ },
113
+ }),
114
+ });
115
+
116
+ const metadataEl = container.querySelector(
117
+ '.extended-tool-geographic-metadata',
118
+ );
119
+ expect(metadataEl).toHaveTextContent('Europe');
37
120
  expect(
38
- container.querySelector('.extended-tool-geographic-metadata'),
39
- ).toHaveTextContent(
40
- 'Europe · Germany, France · Alpine Space, Danube Area · Alpine · Prov. Antwerpen (BE) · Brussels',
121
+ container.querySelector('.geographic-category-title'),
122
+ ).not.toBeInTheDocument();
123
+ });
124
+
125
+ it('renders Global when element is GLOBAL and no specific regions exist', () => {
126
+ const { container } = renderComponent({
127
+ geochars: JSON.stringify({
128
+ geoElements: {
129
+ element: 'GLOBAL',
130
+ },
131
+ }),
132
+ });
133
+
134
+ const metadataEl = container.querySelector(
135
+ '.extended-tool-geographic-metadata',
41
136
  );
42
- expect(screen.queryByRole('heading')).not.toBeInTheDocument();
137
+ expect(metadataEl).toHaveTextContent('Global');
138
+ expect(
139
+ container.querySelector('.geographic-category-title'),
140
+ ).not.toBeInTheDocument();
43
141
  });
44
142
 
45
143
  it('supports legacy spatial fields', () => {
46
144
  const { container } = renderComponent({
47
- spatial_layer: 'Global',
145
+ spatial_layer: 'Countries',
48
146
  spatial_values: [{ token: 'France' }],
49
147
  });
50
148
 
51
- expect(
52
- container.querySelector('.extended-tool-geographic-metadata'),
53
- ).toHaveTextContent('Global · France');
149
+ const metadataEl = container.querySelector(
150
+ '.extended-tool-geographic-metadata',
151
+ );
152
+ expect(metadataEl).toHaveTextContent('Countries:France');
54
153
  });
55
154
  });
@@ -14,6 +14,11 @@ const messages = defineMessages({
14
14
  'Countries:': { id: 'Countries:', defaultMessage: 'Countries:' },
15
15
  'Sub Nationals:': { id: 'Sub Nationals:', defaultMessage: 'Sub Nationals:' },
16
16
  'City:': { id: 'City:', defaultMessage: 'City:' },
17
+ 'Cities:': { id: 'Cities:', defaultMessage: 'Cities:' },
18
+ 'Municipalities & other:': {
19
+ id: 'Municipalities & other:',
20
+ defaultMessage: 'Municipalities & other:',
21
+ },
17
22
  });
18
23
 
19
24
  const GeographicMetadata = (props) => {
@@ -61,7 +66,11 @@ const GeographicMetadata = (props) => {
61
66
  section.value && (
62
67
  <Fragment key={index}>
63
68
  {section.title && (
64
- <h5>{intl.formatMessage(messages[section.title])}</h5>
69
+ <h5>
70
+ {messages[section.title]
71
+ ? intl.formatMessage(messages[section.title])
72
+ : section.title}
73
+ </h5>
65
74
  )}
66
75
  <p>
67
76
  {section.value
@@ -91,6 +91,9 @@ function renderSubnational(value) {
91
91
  }
92
92
 
93
93
  function renderCity(value) {
94
+ if (!value) {
95
+ return null;
96
+ }
94
97
  if (Array.isArray(value)) {
95
98
  if (value.length === 0) {
96
99
  return null;
@@ -154,7 +157,7 @@ export function renderGeochar(geoElements, isObservatoryPage = false) {
154
157
  biotrans: 'Biogeographical regions:',
155
158
  countries: 'Countries:',
156
159
  subnational: 'Sub Nationals:',
157
- city: 'City:',
160
+ city: 'Municipalities & other:',
158
161
  };
159
162
 
160
163
  if (isObservatoryPage) {
@@ -167,6 +170,7 @@ export function renderGeochar(geoElements, isObservatoryPage = false) {
167
170
  if (section !== undefined) {
168
171
  let rendered = renderSection(section, key);
169
172
  out[key] = out.push({
173
+ key,
170
174
  title: sectionTitles[key],
171
175
  value: rendered,
172
176
  });
@@ -34,7 +34,6 @@ const ExtendedToolView = (props) => {
34
34
  adaptation_support_cycle_step,
35
35
  type_of_outputs,
36
36
  temporality_of_data,
37
- tool_available_english,
38
37
  tool_available_language,
39
38
  accessibility_and_usability,
40
39
  tool_input,
@@ -44,17 +43,14 @@ const ExtendedToolView = (props) => {
44
43
  used_in,
45
44
  } = content;
46
45
 
47
- const availableLanguages = tool_available_english ? ['English'] : [];
48
- if (Array.isArray(tool_available_language)) {
49
- availableLanguages.push(...tool_available_language);
50
- } else if (tool_available_language) {
51
- availableLanguages.push(
52
- ...tool_available_language
53
- .split(',')
54
- .map((language) => language.trim())
55
- .filter(Boolean),
56
- );
57
- }
46
+ const availableLanguages = Array.isArray(tool_available_language)
47
+ ? tool_available_language
48
+ : tool_available_language
49
+ ? tool_available_language
50
+ .split(',')
51
+ .map((language) => language.trim())
52
+ .filter(Boolean)
53
+ : [];
58
54
 
59
55
  const hasGeoChars = Boolean(geochars || spatial_layer?.length);
60
56
  const hasHyperlink = Boolean(hyperlink && hyperlink.length > 0);
@@ -293,6 +289,7 @@ const ExtendedToolView = (props) => {
293
289
  />
294
290
  </div>
295
291
  )}
292
+
296
293
  {adaptation_support_cycle_step?.length > 0 && (
297
294
  <div className="metadata-group adaptation-step">
298
295
  <h5>
@@ -415,6 +412,7 @@ const ExtendedToolView = (props) => {
415
412
  </Grid.Row>
416
413
  </Grid>
417
414
  </Container>
415
+
418
416
  <RelatedTools content={content} />
419
417
  </div>
420
418
  );
@@ -574,7 +574,6 @@ describe('ExtendedToolView', () => {
574
574
  sectors: [{ title: 'Agriculture' }, { title: 'Health' }],
575
575
  type_of_outputs: [{ title: 'Maps' }, { title: 'Charts' }],
576
576
  temporality_of_data: [{ title: 'Historical' }, { title: 'Projections' }],
577
- tool_available_english: true,
578
577
  tool_available_language: [{ title: 'French' }, 'Romanian'],
579
578
  intended_user_groups: [{ title: 'Policy makers' }, 'Researchers'],
580
579
  accessibility_and_usability: 'Easy to use',
@@ -623,7 +622,7 @@ describe('ExtendedToolView', () => {
623
622
  expect(
624
623
  screen.getByRole('heading', { name: 'Language' }),
625
624
  ).toBeInTheDocument();
626
- expect(screen.getByText('English, French, Romanian')).toBeInTheDocument();
625
+ expect(screen.getByText('French, Romanian')).toBeInTheDocument();
627
626
  expect(
628
627
  screen.getByRole('heading', { name: 'User Group' }),
629
628
  ).toBeInTheDocument();
@@ -12,28 +12,24 @@ const messages = defineMessages({
12
12
  defaultMessage: 'Climate hazards',
13
13
  },
14
14
  adaptationSupportCycleStep: {
15
- id: 'Adaptation Support Cycle Step',
16
- defaultMessage: 'Adaptation Support Cycle Step',
17
- },
18
- userGroups: {
19
- id: 'User Groups',
20
- defaultMessage: 'User Groups',
15
+ id: 'Adaptation policy cycle',
16
+ defaultMessage: 'Adaptation policy cycle',
21
17
  },
22
18
  typeOfOutputs: {
23
- id: 'Type of Outputs',
24
- defaultMessage: 'Type of Outputs',
19
+ id: 'Type of outputs',
20
+ defaultMessage: 'Type of outputs',
25
21
  },
26
- typeOfData: {
27
- id: 'Type of Data',
28
- defaultMessage: 'Type of Data',
22
+ focusAreas: {
23
+ id: 'Focus areas',
24
+ defaultMessage: 'Focus areas',
29
25
  },
30
- licenseStatus: {
31
- id: 'License status',
32
- defaultMessage: 'License status',
26
+ implementationLevel: {
27
+ id: 'Implementation level',
28
+ defaultMessage: 'Implementation level',
33
29
  },
34
- natureBasedSolution: {
35
- id: 'Nature-based solution',
36
- defaultMessage: 'Nature-based solution',
30
+ adaptationApproaches: {
31
+ id: 'Adaptation approaches',
32
+ defaultMessage: 'Adaptation approaches',
37
33
  },
38
34
  });
39
35
 
@@ -58,13 +54,6 @@ const facets = [
58
54
  label: messages.adaptationSupportCycleStep,
59
55
  alwaysVisible: false,
60
56
  }),
61
- multiTermFacet({
62
- field: 'cca_intended_user_groups.keyword',
63
- isFilterable: false,
64
- isMulti: true,
65
- label: messages.userGroups,
66
- alwaysVisible: false,
67
- }),
68
57
  multiTermFacet({
69
58
  field: 'cca_type_of_outputs.keyword',
70
59
  isFilterable: false,
@@ -73,24 +62,24 @@ const facets = [
73
62
  alwaysVisible: false,
74
63
  }),
75
64
  multiTermFacet({
76
- field: 'cca_type_of_data.keyword',
65
+ field: 'cca_focus_areas.keyword',
77
66
  isFilterable: false,
78
67
  isMulti: true,
79
- label: messages.typeOfData,
68
+ label: messages.focusAreas,
80
69
  alwaysVisible: false,
81
70
  }),
82
71
  multiTermFacet({
83
- field: 'cca_license_status.keyword',
72
+ field: 'cca_place_of_implementation.keyword',
84
73
  isFilterable: false,
85
74
  isMulti: true,
86
- label: messages.licenseStatus,
75
+ label: messages.implementationLevel,
87
76
  alwaysVisible: false,
88
77
  }),
89
78
  multiTermFacet({
90
- field: 'cca_nature_based_solution.keyword',
79
+ field: 'cca_elements.keyword',
91
80
  isFilterable: false,
92
81
  isMulti: true,
93
- label: messages.natureBasedSolution,
82
+ label: messages.adaptationApproaches,
94
83
  alwaysVisible: false,
95
84
  }),
96
85
  ];
@@ -699,14 +699,6 @@
699
699
  gap: 1rem;
700
700
  }
701
701
 
702
- .catalogue-licence {
703
- display: inline-block;
704
- overflow: hidden;
705
- max-width: 300px;
706
- text-overflow: ellipsis;
707
- white-space: nowrap;
708
- }
709
-
710
702
  .license-type {
711
703
  gap: 0.7em;
712
704
  }
@@ -518,6 +518,20 @@ hr {
518
518
  }
519
519
  }
520
520
 
521
+ .extended-tool-geographic-metadata {
522
+ .geographic-category {
523
+ & + .geographic-category {
524
+ margin-top: 0.85rem;
525
+ }
526
+ }
527
+
528
+ .geographic-category-title {
529
+ margin-bottom: 0.35rem;
530
+ color: #4c5a6b;
531
+ font-size: 0.8125rem;
532
+ font-weight: 600;
533
+ }
534
+ }
521
535
  .extended-tool-related {
522
536
  padding: 2.5rem;
523
537
  margin-top: 3rem;