@eeacms/volto-cca-policy 1.0.6 → 1.0.7

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 (121) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/locales/bg/LC_MESSAGES/volto.po +63 -63
  3. package/locales/cs/LC_MESSAGES/volto.po +63 -63
  4. package/locales/da/LC_MESSAGES/volto.po +63 -63
  5. package/locales/de/LC_MESSAGES/volto.po +63 -63
  6. package/locales/el/LC_MESSAGES/volto.po +63 -63
  7. package/locales/en/LC_MESSAGES/volto.po +63 -63
  8. package/locales/es/LC_MESSAGES/volto.po +63 -63
  9. package/locales/et/LC_MESSAGES/volto.po +63 -63
  10. package/locales/fi/LC_MESSAGES/volto.po +63 -63
  11. package/locales/fr/LC_MESSAGES/volto.po +63 -63
  12. package/locales/ga/LC_MESSAGES/volto.po +63 -63
  13. package/locales/hr/LC_MESSAGES/volto.po +63 -63
  14. package/locales/hu/LC_MESSAGES/volto.po +63 -63
  15. package/locales/is/LC_MESSAGES/volto.po +63 -63
  16. package/locales/it/LC_MESSAGES/volto.po +63 -63
  17. package/locales/lt/LC_MESSAGES/volto.po +63 -63
  18. package/locales/lv/LC_MESSAGES/volto.po +63 -63
  19. package/locales/mt/LC_MESSAGES/volto.po +63 -63
  20. package/locales/nl/LC_MESSAGES/volto.po +63 -63
  21. package/locales/nn/LC_MESSAGES/volto.po +63 -63
  22. package/locales/pl/LC_MESSAGES/volto.po +63 -63
  23. package/locales/pt/LC_MESSAGES/volto.po +63 -63
  24. package/locales/ro/LC_MESSAGES/volto.po +63 -63
  25. package/locales/sk/LC_MESSAGES/volto.po +63 -63
  26. package/locales/sl/LC_MESSAGES/volto.po +63 -63
  27. package/locales/sv/LC_MESSAGES/volto.po +63 -63
  28. package/locales/tr/LC_MESSAGES/volto.po +63 -63
  29. package/locales/volto.pot +64 -64
  30. package/package.json +2 -2
  31. package/src/components/Search/NavigatorCatalogue/NavigatorCatalogueMapView.jsx +3 -2
  32. package/src/components/index.js +26 -10
  33. package/src/components/manage/Blocks/CollectionStatistics/CollectionStatsEdit.jsx +1 -1
  34. package/src/components/manage/Blocks/CountryMapHeatIndex/View.jsx +2 -2
  35. package/src/components/manage/Blocks/CountryMapObservatory/CountryMapObservatoryOLView.jsx +2 -2
  36. package/src/components/manage/Blocks/CountryMapProfile/OLView.jsx +2 -2
  37. package/src/components/{theme → manage}/Widgets/GeolocationWidget.jsx +1 -1
  38. package/src/components/{theme → manage}/Widgets/GeolocationWidget.test.jsx +1 -1
  39. package/src/components/{theme → manage}/Widgets/ImageWidget.jsx +2 -2
  40. package/src/components/manage/Widgets/ImageWidget.test.jsx +187 -0
  41. package/src/components/{theme → manage}/Widgets/PromotionalImageWidget.test.jsx +9 -3
  42. package/src/components/theme/Content/Fields/BooleanField.jsx +7 -0
  43. package/src/components/theme/Content/Fields/HTMLField.jsx +14 -0
  44. package/src/components/theme/Content/Fields/TextField.jsx +12 -0
  45. package/src/components/theme/Content/Fields/VocabularyField.jsx +26 -0
  46. package/src/components/theme/Content/Fields/index.js +4 -0
  47. package/src/components/theme/Content/Sections/ContentBannerTitle.jsx +26 -0
  48. package/src/{helpers → components/theme/Content/Sections}/ContentMetadata.jsx +11 -312
  49. package/src/components/theme/Content/Sections/ContentRelatedItems.jsx +35 -0
  50. package/src/components/theme/Content/Sections/DocumentsList.jsx +80 -0
  51. package/src/components/theme/Content/Sections/EventDetails.jsx +90 -0
  52. package/src/components/theme/Content/Sections/GeographicMetadata.jsx +83 -0
  53. package/src/components/theme/Content/Sections/ImageGallery/index.js +1 -0
  54. package/src/components/theme/Content/Sections/ItemLogo.jsx +29 -0
  55. package/src/components/theme/Content/Sections/LinkedMetadataItemList.jsx +63 -0
  56. package/src/components/theme/Content/Sections/LinksList.jsx +48 -0
  57. package/src/components/theme/Content/Sections/MetadataItemList.jsx +43 -0
  58. package/src/components/theme/Content/Sections/PublicationDateInfo.jsx +62 -0
  59. package/src/components/theme/Content/Sections/PublishedModifiedInfo.jsx +33 -0
  60. package/src/components/theme/Content/Sections/ReferenceInfo.jsx +137 -0
  61. package/src/components/theme/Content/Sections/ShareInfoButton.jsx +24 -0
  62. package/src/components/theme/Content/Sections/SubjectTags.jsx +19 -0
  63. package/src/components/theme/Content/Sections/Versioning/index.js +3 -0
  64. package/src/components/theme/Content/Sections/geographicMetadataUtils.js +177 -0
  65. package/src/components/theme/Content/Sections/index.js +17 -0
  66. package/src/components/theme/Content/index.js +20 -0
  67. package/src/components/theme/Views/AdaptationOptionView.jsx +6 -8
  68. package/src/components/theme/Views/AdaptationOptionView.test.jsx +5 -8
  69. package/src/components/theme/Views/C3SIndicatorView.jsx +5 -5
  70. package/src/components/theme/Views/CaseStudyView.jsx +6 -8
  71. package/src/components/theme/Views/CcaEventView.jsx +4 -4
  72. package/src/components/theme/Views/DatabaseItemView.jsx +14 -18
  73. package/src/components/theme/Views/EventView.jsx +3 -3
  74. package/src/components/theme/Views/ExtendedToolView.jsx +6 -8
  75. package/src/components/theme/Views/ExtendedToolView.test.jsx +10 -16
  76. package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/MissionSignatoryProfileView.jsx +5 -2
  77. package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/MissionSignatoryProfileView.test.jsx +2 -2
  78. package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/TabSections/ActionTab.jsx +1 -2
  79. package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/TabSections/ActionTab.test.jsx +3 -0
  80. package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/TabSections/AssessmentTab.jsx +1 -2
  81. package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/TabSections/AssessmentTab.test.jsx +11 -1
  82. package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/TabSections/GovernanceTab.jsx +1 -2
  83. package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/TabSections/PlanningTab.jsx +1 -2
  84. package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/TabSections/PlanningTab.test.jsx +11 -1
  85. package/src/components/theme/Views/NewsItemView.jsx +5 -2
  86. package/src/components/theme/Views/ProjectView.jsx +4 -6
  87. package/src/constants.js +7 -0
  88. package/src/helpers/countryMap.js +1 -4
  89. package/src/helpers/embed.js +11 -0
  90. package/src/helpers/index.js +13 -101
  91. package/src/helpers/string.js +4 -0
  92. package/src/hocs/index.js +1 -0
  93. package/src/{helpers/clientOnly.jsx → hocs/withClientOnly.jsx} +1 -1
  94. package/src/index.js +3 -3
  95. package/src/search/queryUtils.js +64 -0
  96. package/src/components/theme/ShareInfoButton/ShareInfoButton.jsx +0 -26
  97. package/src/components/theme/Widgets/ImageWidget.test.jsx +0 -90
  98. package/src/helpers/Utils.jsx +0 -620
  99. /package/src/components/manage/{TransparentOverlay.jsx → Blocks/CollectionStatistics/TransparentOverlay.jsx} +0 -0
  100. /package/src/components/{theme → manage}/Widgets/GeocharsWidget.jsx +0 -0
  101. /package/src/components/{theme → manage}/Widgets/GeolocationWidgetMapContainer.jsx +0 -0
  102. /package/src/components/{theme → manage}/Widgets/PromotionalImageWidget.jsx +0 -0
  103. /package/src/components/{theme → manage}/Widgets/RASTWidgetView.jsx +0 -0
  104. /package/src/components/{theme → manage}/Widgets/__mocks__/GeolocationWidgetMapContainer.jsx +0 -0
  105. /package/src/components/{theme → manage}/Widgets/utils.js +0 -0
  106. /package/src/components/theme/{ImageGallery → Content/Sections/ImageGallery}/ImageGallery.jsx +0 -0
  107. /package/src/components/theme/{ImageGallery → Content/Sections/ImageGallery}/ImageGallery.test.jsx +0 -0
  108. /package/src/components/theme/{ImageGallery → Content/Sections/ImageGallery}/styles.less +0 -0
  109. /package/src/components/theme/{Views → Content/Sections/Versioning}/ArchivedVersionListing.jsx +0 -0
  110. /package/src/components/theme/{Views → Content/Sections/Versioning}/ArchivedVersionListing.test.jsx +0 -0
  111. /package/src/components/theme/{Views → Content/Sections/Versioning}/ArchivedVersionNotice.jsx +0 -0
  112. /package/src/components/theme/{Views → Content/Sections/Versioning}/ArchivedVersionNotice.test.jsx +0 -0
  113. /package/src/components/theme/{Views → Content/Sections/Versioning}/VersionsGroup.jsx +0 -0
  114. /package/src/components/theme/{Views → Content/Sections/Versioning}/VersionsGroup.test.jsx +0 -0
  115. /package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/ItemsSection.jsx +0 -0
  116. /package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/ItemsSection.test.jsx +0 -0
  117. /package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/NoDataReported.jsx +0 -0
  118. /package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/NoDataReported.test.jsx +0 -0
  119. /package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/StatisticSection.jsx +0 -0
  120. /package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/StatisticSection.test.jsx +0 -0
  121. /package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/TabSections/GovernanceTab.test.jsx +0 -0
@@ -1,43 +1,19 @@
1
- import { Fragment } from 'react';
1
+ import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
2
2
  import { Popup, Segment } from 'semantic-ui-react';
3
- import { useIntl, defineMessages, FormattedMessage } from 'react-intl';
4
- import {
5
- MetadataItemList,
6
- LinkedMetadataItemList,
7
- } from '@eeacms/volto-cca-policy/helpers';
3
+ import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
8
4
  import {
9
- VIDEO,
5
+ ADAPTATION_OPTION,
10
6
  GUIDANCE,
11
7
  INDICATOR,
12
8
  PUBLICATION_REPORT,
13
- ADAPTATION_OPTION,
14
- ACE_COUNTRIES,
15
- BIOREGIONS,
16
- SUBNATIONAL_REGIONS,
17
- // CONTENT_TYPE_LABELS,
9
+ VIDEO,
18
10
  } from '@eeacms/volto-cca-policy/constants';
19
- import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
11
+ import GeographicMetadata from './GeographicMetadata';
12
+ import LinkedMetadataItemList from './LinkedMetadataItemList';
13
+ import MetadataItemList from './MetadataItemList';
14
+ import PublicationDateInfo from './PublicationDateInfo';
20
15
 
21
16
  const messages = defineMessages({
22
- default_info_tooltip: {
23
- id:
24
- 'The date refers to the moment in which the item has been prepared ' +
25
- 'or updated by contributing experts to be submitted for the publication ' +
26
- 'in Climate ADAPT',
27
- defaultMessage:
28
- 'The date refers to the moment in which the item has been prepared ' +
29
- 'or updated by contributing experts to be submitted for the publication ' +
30
- 'in Climate ADAPT',
31
- },
32
- release_info_tooltip: {
33
- id: 'The date refers to the date of release of the video',
34
- defaultMessage: 'The date refers to the date of release of the video',
35
- },
36
- publication_info_tooltip: {
37
- id: 'The date refers to the latest date of publication of the item',
38
- defaultMessage:
39
- 'The date refers to the latest date of publication of the item',
40
- },
41
17
  release_date: {
42
18
  id: 'Date of release:',
43
19
  defaultMessage: 'Date of release:',
@@ -50,286 +26,9 @@ const messages = defineMessages({
50
26
  id: 'Date of creation:',
51
27
  defaultMessage: 'Date of creation:',
52
28
  },
53
- 'Macro-Transnational region:': {
54
- id: 'Macro-Transnational region:',
55
- defaultMessage: 'Macro-Transnational region:',
56
- },
57
- 'Biogeographical regions:': {
58
- id: 'Biogeographical regions:',
59
- defaultMessage: 'Biogeographical regions:',
60
- },
61
- 'Countries:': { id: 'Countries:', defaultMessage: 'Countries:' },
62
- 'Sub Nationals:': { id: 'Sub Nationals:', defaultMessage: 'Sub Nationals:' },
63
- 'City:': { id: 'City:', defaultMessage: 'City:' },
64
29
  });
65
30
 
66
- function renderElement(value) {
67
- return [BIOREGIONS[value]];
68
- }
69
-
70
- function renderBiotrans(value) {
71
- if (value === null) {
72
- return null;
73
- }
74
- let out = [];
75
- let temp = null;
76
- if (Array.isArray(value)) {
77
- if (value.length === 0) {
78
- return null;
79
- }
80
- } else {
81
- temp = BIOREGIONS[value];
82
- if (temp !== undefined) {
83
- return [temp];
84
- } else {
85
- return [value];
86
- }
87
- }
88
- for (let region of value) {
89
- temp = BIOREGIONS[region];
90
- if (temp !== undefined) {
91
- out.push(temp);
92
- } else {
93
- out.push(region);
94
- }
95
- }
96
- return out;
97
- }
98
-
99
- function renderCountries(value) {
100
- let out = [];
101
- let temp = null;
102
- if (Array.isArray(value)) {
103
- if (value.length === 0) {
104
- return null;
105
- }
106
- } else {
107
- temp = ACE_COUNTRIES[value];
108
- if (temp !== undefined) {
109
- return [temp];
110
- } else {
111
- return [value];
112
- }
113
- }
114
- for (let region of value) {
115
- temp = ACE_COUNTRIES[region];
116
- if (temp !== undefined) {
117
- out.push(temp);
118
- } else {
119
- out.push(region);
120
- }
121
- }
122
- return out;
123
- }
124
-
125
- function renderSubnational(value) {
126
- let out = [];
127
- let temp = null;
128
- if (Array.isArray(value)) {
129
- if (value.length === 0) {
130
- return null;
131
- }
132
- } else {
133
- temp = SUBNATIONAL_REGIONS[value];
134
- if (temp !== undefined) {
135
- return [temp];
136
- } else {
137
- return [value];
138
- }
139
- }
140
- for (let region of value) {
141
- temp = SUBNATIONAL_REGIONS[region];
142
- if (temp !== undefined) {
143
- out.push(temp);
144
- } else {
145
- // Show only defined terms, or show all (including missing IDs):
146
- // out.push(region);
147
- }
148
- }
149
- return out;
150
- }
151
-
152
- function renderCity(value) {
153
- if (Array.isArray(value)) {
154
- if (value.length === 0) {
155
- return null;
156
- }
157
- return value;
158
- } else {
159
- if (value.length === 0) {
160
- return null;
161
- }
162
- let out = [];
163
- out.push(value);
164
- return out;
165
- }
166
- }
167
-
168
- function renderSection(value, valueType) {
169
- if (valueType === 'element') {
170
- return renderElement(value);
171
- }
172
-
173
- if (valueType === 'macrotrans') {
174
- return renderBiotrans(value);
175
- }
176
-
177
- if (valueType === 'biotrans') {
178
- return renderBiotrans(value);
179
- }
180
-
181
- if (valueType === 'countries') {
182
- return renderCountries(value);
183
- }
184
-
185
- if (valueType === 'subnational') {
186
- return renderSubnational(value);
187
- }
188
-
189
- if (valueType === 'city') {
190
- return renderCity(value);
191
- }
192
- return null;
193
- }
194
-
195
- function renderGeochar(geoElements, isObservatoryPage = false) {
196
- if (!geoElements) {
197
- return null;
198
- }
199
-
200
- let out = [];
201
- let orderedSections = [
202
- 'element',
203
- 'macrotrans',
204
- 'biotrans',
205
- 'countries',
206
- 'subnational',
207
- 'city',
208
- ];
209
-
210
- const sectionTitles = {
211
- element: null,
212
- macrotrans: 'Macro-Transnational region:',
213
- biotrans: 'Biogeographical regions:',
214
- countries: 'Countries:',
215
- subnational: 'Sub Nationals:',
216
- city: 'City:',
217
- };
218
-
219
- if (isObservatoryPage) {
220
- orderedSections = ['element', 'macrotrans'];
221
- }
222
-
223
- for (let key of orderedSections) {
224
- let section = geoElements[key];
225
-
226
- if (section !== undefined) {
227
- let rendered = renderSection(section, key);
228
- out[key] = out.push({
229
- title: sectionTitles[key],
230
- value: rendered,
231
- });
232
- }
233
- }
234
-
235
- return out;
236
- }
237
-
238
- function GeoChar(props) {
239
- const { content } = props;
240
- const { spatial_values, spatial_layer, geochars } = content;
241
- const j = JSON.parse(geochars);
242
- const intl = useIntl();
243
-
244
- if (j === null) {
245
- if (spatial_layer) {
246
- return (
247
- <div className="geochar">
248
- <p>{spatial_layer}</p>
249
- <h5>
250
- <FormattedMessage id="Countries:" defaultMessage="Countries:" />
251
- </h5>
252
- {spatial_values && spatial_values.length > 0 && (
253
- <p>
254
- {spatial_values
255
- .map((item) => item.token)
256
- .map((token) =>
257
- intl.formatMessage({
258
- id: token,
259
- defaultMessage: token,
260
- }),
261
- )
262
- .join(', ')}
263
- </p>
264
- )}
265
- </div>
266
- );
267
- }
268
-
269
- return '';
270
- }
271
-
272
- const { geoElements } = j;
273
-
274
- let rendered = renderGeochar(geoElements);
275
-
276
- return (
277
- <div className="geochar">
278
- {rendered.map(
279
- (section, index) =>
280
- section.value && (
281
- <Fragment key={index}>
282
- {section.title && (
283
- <h5>{intl.formatMessage(messages[section.title])}</h5>
284
- )}
285
- <p>
286
- {section.value
287
- .map((countryName) =>
288
- intl.formatMessage({
289
- id: countryName,
290
- defaultMessage: countryName,
291
- }),
292
- )
293
- .join(', ')}
294
- </p>
295
- </Fragment>
296
- ),
297
- )}
298
- </div>
299
- );
300
- }
301
-
302
- function PublicationDateInfo({ value, portaltype, title }) {
303
- const intl = useIntl();
304
- const publicationYear = new Date(value).getFullYear();
305
-
306
- const tooltipMessages = {
307
- [VIDEO]: intl.formatMessage(messages.release_info_tooltip),
308
- [GUIDANCE]: intl.formatMessage(messages.publication_info_tooltip),
309
- [INDICATOR]: intl.formatMessage(messages.publication_info_tooltip),
310
- [PUBLICATION_REPORT]: intl.formatMessage(messages.publication_info_tooltip),
311
- default: intl.formatMessage(messages.default_info_tooltip),
312
- };
313
-
314
- const tooltipText = tooltipMessages[portaltype] || tooltipMessages.default;
315
-
316
- if (publicationYear <= 1970) return null;
317
-
318
- return (
319
- <>
320
- <h5>{title}</h5>
321
- <p>
322
- {publicationYear}
323
- <Popup
324
- content={tooltipText}
325
- trigger={<i className="ri-question-fill"></i>}
326
- />
327
- </p>
328
- </>
329
- );
330
- }
331
-
332
- function ContentMetadata(props) {
31
+ const ContentMetadata = (props) => {
333
32
  const intl = useIntl();
334
33
  const { content, related_case_studies } = props;
335
34
  const {
@@ -577,7 +276,7 @@ function ContentMetadata(props) {
577
276
  defaultMessage="Geographic characterisation:"
578
277
  />
579
278
  </h5>
580
- <GeoChar {...props} />
279
+ <GeographicMetadata {...props} />
581
280
  </>
582
281
  )}
583
282
  </Segment>
@@ -597,6 +296,6 @@ function ContentMetadata(props) {
597
296
  )}
598
297
  </>
599
298
  );
600
- }
299
+ };
601
300
 
602
301
  export default ContentMetadata;
@@ -0,0 +1,35 @@
1
+ import { Fragment } from 'react';
2
+ import { FormattedMessage } from 'react-intl';
3
+ import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
4
+
5
+ const ContentRelatedItems = (props) => {
6
+ const { content } = props;
7
+ const { relatedItems } = content;
8
+
9
+ let contentRelatedItems = [];
10
+ if (relatedItems && relatedItems?.length > 0) {
11
+ contentRelatedItems = relatedItems.filter((item) =>
12
+ item['@type'].includes('eea.climateadapt'),
13
+ );
14
+ }
15
+
16
+ return contentRelatedItems.length > 0 ? (
17
+ <>
18
+ <h5>
19
+ <FormattedMessage
20
+ id="Related content:"
21
+ defaultMessage="Related content:"
22
+ />
23
+ </h5>
24
+
25
+ {contentRelatedItems.map((item) => (
26
+ <Fragment key={item['@id']}>
27
+ <UniversalLink item={item}>{item.title}</UniversalLink>
28
+ <br />
29
+ </Fragment>
30
+ ))}
31
+ </>
32
+ ) : null;
33
+ };
34
+
35
+ export default ContentRelatedItems;
@@ -0,0 +1,80 @@
1
+ import { defineMessages, useIntl } from 'react-intl';
2
+ import { List, ListItem, Segment } from 'semantic-ui-react';
3
+ import {
4
+ CASE_STUDY,
5
+ ORGANISATION,
6
+ PUBLICATION_REPORT,
7
+ } from '@eeacms/volto-cca-policy/constants';
8
+
9
+ const messages = defineMessages({
10
+ documents: {
11
+ id: 'Documents',
12
+ defaultMessage: 'Documents',
13
+ },
14
+ caseStudiesDocuments: {
15
+ id: 'Case Studies Documents',
16
+ defaultMessage: 'Case Studies Documents',
17
+ },
18
+ publicationsAndReportsDocuments: {
19
+ id: 'Publications and Reports Documents',
20
+ defaultMessage: 'Publications and Reports Documents',
21
+ },
22
+ organisationDocuments: {
23
+ id: 'Organisation Documents',
24
+ defaultMessage: 'Organisation Documents',
25
+ },
26
+ });
27
+
28
+ const DocumentsList = (props) => {
29
+ const { content } = props;
30
+ const type = content['@type'];
31
+ const files = content?.cca_files;
32
+ const intl = useIntl();
33
+
34
+ if (!files || files.length === 0) {
35
+ return null;
36
+ }
37
+ if (!content.hasOwnProperty('show_counter')) {
38
+ content.show_counter = true;
39
+ }
40
+
41
+ let section_title = intl.formatMessage(messages.documents);
42
+
43
+ if (content['section_title']) {
44
+ section_title = content['section_title'];
45
+ }
46
+
47
+ if (type === CASE_STUDY) {
48
+ section_title = intl.formatMessage(messages.caseStudiesDocuments);
49
+ }
50
+
51
+ if (type === PUBLICATION_REPORT) {
52
+ section_title = intl.formatMessage(
53
+ messages.publicationsAndReportsDocuments,
54
+ );
55
+ }
56
+
57
+ if (type === ORGANISATION) {
58
+ section_title = intl.formatMessage(messages.organisationDocuments);
59
+ }
60
+
61
+ return (
62
+ <Segment>
63
+ <h5>
64
+ {section_title} {content.show_counter && <>({files.length})</>}
65
+ </h5>
66
+ <List className="documents-list">
67
+ {files.map((file) => (
68
+ <ListItem key={file.url}>
69
+ <a href={file.url} className="document-list-item">
70
+ <i className="file alternate icon"></i>
71
+ <span>{file.title}</span>
72
+ </a>
73
+ </ListItem>
74
+ ))}
75
+ </List>
76
+ </Segment>
77
+ );
78
+ };
79
+
80
+ export default DocumentsList;
@@ -0,0 +1,90 @@
1
+ import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
2
+ import { Button, Icon } from 'semantic-ui-react';
3
+ import { expandToBackendURL } from '@plone/volto/helpers/Url/Url';
4
+ import { When } from '@plone/volto/components/theme/View/EventDatesInfo';
5
+
6
+ const messages = defineMessages({
7
+ downloadEvent: {
8
+ id: 'Download this event in iCal format',
9
+ defaultMessage: 'Download this event in iCal format',
10
+ },
11
+ });
12
+
13
+ export const WebDetails = (props) => {
14
+ const { content } = props;
15
+ const eventUrl = content?.event_url;
16
+ return eventUrl ? (
17
+ <>
18
+ <h4>
19
+ <FormattedMessage id="Web" defaultMessage="Web" />
20
+ </h4>
21
+ <p>
22
+ <a href={eventUrl} target="_blank" rel="noopener">
23
+ <FormattedMessage
24
+ id="Visit external website"
25
+ defaultMessage="Visit external website"
26
+ />
27
+ </a>
28
+ </p>
29
+ </>
30
+ ) : null;
31
+ };
32
+
33
+ const EventDetails = (props) => {
34
+ const { content } = props;
35
+ const intl = useIntl();
36
+
37
+ return (
38
+ <>
39
+ <h4>
40
+ <FormattedMessage id="When" defaultMessage="When" />
41
+ </h4>
42
+ <When
43
+ start={content.start}
44
+ end={content.end}
45
+ whole_day={content.whole_day}
46
+ open_end={content.open_end}
47
+ />
48
+ {content?.location !== null && (
49
+ <>
50
+ <h4>
51
+ <FormattedMessage id="Where" defaultMessage="Where" />
52
+ </h4>
53
+ <p>{content.location}</p>
54
+ </>
55
+ )}
56
+ {!!content.contact_email && (
57
+ <>
58
+ <h4>
59
+ <FormattedMessage id="Info" defaultMessage="Info" />
60
+ </h4>
61
+ <p>{content.contact_email}</p>
62
+ </>
63
+ )}
64
+
65
+ <WebDetails {...props} />
66
+
67
+ <div className="download-event">
68
+ <a
69
+ className="ics-download"
70
+ target="_blank"
71
+ rel="noreferrer"
72
+ href={`${expandToBackendURL(content['@id'])}/ics_view`}
73
+ >
74
+ <Button
75
+ className="icon inverted primary labeled"
76
+ title={intl.formatMessage(messages.downloadEvent)}
77
+ >
78
+ <Icon name="calendar alternate outline" />
79
+ <FormattedMessage
80
+ id="Download Event"
81
+ defaultMessage="Download Event"
82
+ />
83
+ </Button>
84
+ </a>
85
+ </div>
86
+ </>
87
+ );
88
+ };
89
+
90
+ export default EventDetails;
@@ -0,0 +1,83 @@
1
+ import { Fragment } from 'react';
2
+ import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
3
+ import { renderGeochar } from './geographicMetadataUtils';
4
+
5
+ const messages = defineMessages({
6
+ 'Macro-Transnational region:': {
7
+ id: 'Macro-Transnational region:',
8
+ defaultMessage: 'Macro-Transnational region:',
9
+ },
10
+ 'Biogeographical regions:': {
11
+ id: 'Biogeographical regions:',
12
+ defaultMessage: 'Biogeographical regions:',
13
+ },
14
+ 'Countries:': { id: 'Countries:', defaultMessage: 'Countries:' },
15
+ 'Sub Nationals:': { id: 'Sub Nationals:', defaultMessage: 'Sub Nationals:' },
16
+ 'City:': { id: 'City:', defaultMessage: 'City:' },
17
+ });
18
+
19
+ const GeographicMetadata = (props) => {
20
+ const { content } = props;
21
+ const { spatial_values, spatial_layer, geochars } = content;
22
+ const j = geochars ? JSON.parse(geochars) : null;
23
+ const intl = useIntl();
24
+
25
+ if (j === null) {
26
+ if (spatial_layer) {
27
+ return (
28
+ <div className="geochar">
29
+ <p>{spatial_layer}</p>
30
+ <h5>
31
+ <FormattedMessage id="Countries:" defaultMessage="Countries:" />
32
+ </h5>
33
+ {spatial_values && spatial_values.length > 0 && (
34
+ <p>
35
+ {spatial_values
36
+ .map((item) => item.token)
37
+ .map((token) =>
38
+ intl.formatMessage({
39
+ id: token,
40
+ defaultMessage: token,
41
+ }),
42
+ )
43
+ .join(', ')}
44
+ </p>
45
+ )}
46
+ </div>
47
+ );
48
+ }
49
+
50
+ return '';
51
+ }
52
+
53
+ const { geoElements } = j;
54
+
55
+ let rendered = renderGeochar(geoElements);
56
+
57
+ return (
58
+ <div className="geochar">
59
+ {rendered.map(
60
+ (section, index) =>
61
+ section.value && (
62
+ <Fragment key={index}>
63
+ {section.title && (
64
+ <h5>{intl.formatMessage(messages[section.title])}</h5>
65
+ )}
66
+ <p>
67
+ {section.value
68
+ .map((countryName) =>
69
+ intl.formatMessage({
70
+ id: countryName,
71
+ defaultMessage: countryName,
72
+ }),
73
+ )
74
+ .join(', ')}
75
+ </p>
76
+ </Fragment>
77
+ ),
78
+ )}
79
+ </div>
80
+ );
81
+ };
82
+
83
+ export default GeographicMetadata;
@@ -0,0 +1 @@
1
+ export { default } from './ImageGallery';
@@ -0,0 +1,29 @@
1
+ import { FormattedMessage } from 'react-intl';
2
+ import { Image } from 'semantic-ui-react';
3
+ import { VIDEO } from '@eeacms/volto-cca-policy/constants';
4
+
5
+ export const LogoWrapper = ({ logo, children }) =>
6
+ logo ? <div className="has-logo">{children}</div> : children;
7
+
8
+ const ItemLogo = (props) => {
9
+ const { content } = props;
10
+ const type = content['@type'];
11
+ const { logo, title } = content;
12
+
13
+ return type !== VIDEO ? (
14
+ <LogoWrapper logo={logo}>
15
+ <h2>
16
+ <FormattedMessage id="Description" defaultMessage="Description" />
17
+ </h2>
18
+ {logo && (
19
+ <Image
20
+ src={logo?.scales?.mini?.download}
21
+ alt={title}
22
+ className="db-logo"
23
+ />
24
+ )}
25
+ </LogoWrapper>
26
+ ) : null;
27
+ };
28
+
29
+ export default ItemLogo;