@eeacms/volto-cca-policy 0.2.38 → 0.2.40

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,6 +4,29 @@ 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.2.40](https://github.com/eea/volto-cca-policy/compare/0.2.39...0.2.40) - 31 May 2024
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix: wrong tooltip for date info; simplify code [kreafox - [`2aa1bdb`](https://github.com/eea/volto-cca-policy/commit/2aa1bdb0fe380e8f3d0559c215ae0f3006cb2e76)]
12
+ - fix: typo in constants [kreafox - [`2372a2c`](https://github.com/eea/volto-cca-policy/commit/2372a2c0c61c7dd360e74f3cdd997d2afa577c4d)]
13
+ - fix: add missing region to constants [kreafox - [`a89d899`](https://github.com/eea/volto-cca-policy/commit/a89d899e72ae49e655e4ef518b7a1e55f973335b)]
14
+
15
+ #### :hammer_and_wrench: Others
16
+
17
+ - test: update snapshots [kreafox - [`9eb9a6c`](https://github.com/eea/volto-cca-policy/commit/9eb9a6c3bdf7db07c07a0472550e71ed314fc4cd)]
18
+ ### [0.2.39](https://github.com/eea/volto-cca-policy/compare/0.2.38...0.2.39) - 30 May 2024
19
+
20
+ #### :bug: Bug Fixes
21
+
22
+ - fix: privacy protection [kreafox - [`8c2ecd9`](https://github.com/eea/volto-cca-policy/commit/8c2ecd9677b01b7fe98c22afbf0707e582feb27f)]
23
+
24
+ #### :hammer_and_wrench: Others
25
+
26
+ - test: update snapshot [kreafox - [`137a7ec`](https://github.com/eea/volto-cca-policy/commit/137a7ec6b9ddc14265ab8b07d73b9562947ac3b9)]
27
+ - Proper urls [Tiberiu Ichim - [`3fa085b`](https://github.com/eea/volto-cca-policy/commit/3fa085b287d9fe37b19bd626c19b51e73b72d898)]
28
+ - Fix typo [Tiberiu Ichim - [`b2fdb30`](https://github.com/eea/volto-cca-policy/commit/b2fdb30ce29312b6c41687a0aedc45ad2a13c548)]
29
+ - WIP [Tiberiu Ichim - [`cd161ef`](https://github.com/eea/volto-cca-policy/commit/cd161efbd05acec99af576a2132730696e0ed3b6)]
7
30
  ### [0.2.38](https://github.com/eea/volto-cca-policy/compare/0.2.37...0.2.38) - 29 May 2024
8
31
 
9
32
  #### :house: Internal changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-cca-policy",
3
- "version": "0.2.38",
3
+ "version": "0.2.40",
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",
@@ -16,6 +16,7 @@ import {
16
16
  import { PortalMessage } from '@eeacms/volto-cca-policy/components';
17
17
  import { Link } from 'react-router-dom';
18
18
  import { FormattedMessage } from 'react-intl';
19
+ import { useSelector } from 'react-redux';
19
20
 
20
21
  if (!__SERVER__) {
21
22
  window.cds_toolbox = {
@@ -98,12 +99,10 @@ function C3SIndicatorView(props) {
98
99
  logo,
99
100
  // c3sjs_overview,
100
101
  } = content;
101
- // console.log('c3sjs_overview', c3sjs_overview, props);
102
102
  const [showDetails, setShowDetails] = useState(false);
103
- // const hasIndicatorTitle =
104
- // indicator_title && indicator_title !== '_' && indicator_title !== '-';
105
103
 
106
104
  const [activeAccordion, setActiveAccordion] = React.useState([true, false]);
105
+ const currentLanguage = useSelector((state) => state.intl.locale);
107
106
 
108
107
  function handleAccordionClick(e, index) {
109
108
  const _activeAccordion = JSON.parse(JSON.stringify(activeAccordion));
@@ -261,7 +260,13 @@ function C3SIndicatorView(props) {
261
260
  implemented by ECMWF.
262
261
  </p>
263
262
  <p>
264
- <a href="/knowledge/european-climate-data-explorer/disclaimer">
263
+ <a
264
+ href={
265
+ '/' +
266
+ currentLanguage +
267
+ '/knowledge/european-climate-data-explorer/disclaimer'
268
+ }
269
+ >
265
270
  <FormattedMessage id="Disclaimer" defaultMessage="Disclaimer" />
266
271
  </a>
267
272
  </p>
@@ -16,7 +16,7 @@ import {
16
16
  GUIDANCE,
17
17
  INDICATOR,
18
18
  INFORMATION_PORTAL,
19
- PUBICATION_REPORT,
19
+ PUBLICATION_REPORT,
20
20
  ORGANISATION,
21
21
  VIDEO,
22
22
  } from '@eeacms/volto-cca-policy/helpers/Constants';
@@ -76,7 +76,7 @@ const DatabaseItemView = (props) => {
76
76
  case TOOL:
77
77
  subtitle = 'Tools';
78
78
  break;
79
- case PUBICATION_REPORT:
79
+ case PUBLICATION_REPORT:
80
80
  subtitle = 'Publications and Report';
81
81
  break;
82
82
  case GUIDANCE:
@@ -111,6 +111,10 @@ const DatabaseItemView = (props) => {
111
111
  }
112
112
  return null;
113
113
  };
114
+ const flourishPath = data_src(map_graphs);
115
+ const flourishUrl = map_graphs
116
+ ? `https://flo.uri.sh/${flourishPath}/embed`
117
+ : null;
114
118
 
115
119
  const is_cmshare_video = share_eea.some((domain) =>
116
120
  content?.embed_url?.includes(domain),
@@ -213,22 +217,23 @@ const DatabaseItemView = (props) => {
213
217
  </>
214
218
  )}
215
219
 
216
- <PrivacyProtection
217
- data={{
218
- dataprotection,
219
- }}
220
- >
221
- {!!data_src(map_graphs) && (
220
+ {!!flourishPath && (
221
+ <PrivacyProtection
222
+ data={{
223
+ url: flourishUrl,
224
+ dataprotection: dataprotection,
225
+ }}
226
+ >
222
227
  <iframe
223
228
  height="980"
224
229
  width="100%"
225
- src={`https://flo.uri.sh/${data_src(map_graphs)}/embed`}
230
+ src={flourishUrl}
226
231
  title="Interactive or visual content"
227
232
  className="flourish-embed-iframe"
228
233
  sandbox="allow-same-origin allow-forms allow-scripts allow-downloads allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation"
229
234
  ></iframe>
230
- )}
231
- </PrivacyProtection>
235
+ </PrivacyProtection>
236
+ )}
232
237
 
233
238
  <Divider />
234
239
 
@@ -5,7 +5,7 @@ export const INDICATOR = 'eea.climateadapt.indicator';
5
5
  export const INFORMATION_PORTAL = 'eea.climateadapt.informationportal';
6
6
  export const ORGANISATION = 'eea.climateadapt.organisation';
7
7
  export const ACE_PROJECT = 'eea.climateadapt.aceproject';
8
- export const PUBICATION_REPORT = 'eea.climateadapt.publicationreport';
8
+ export const PUBLICATION_REPORT = 'eea.climateadapt.publicationreport';
9
9
  export const TOOL = 'eea.climateadapt.tool';
10
10
  export const VIDEO = 'eea.climateadapt.video';
11
11
  export const C3S_INDICATOR = 'eea.climateadapt.c3sindicator';
@@ -95,6 +95,7 @@ export const BIOREGIONS = {
95
95
  COUNTRIES: 'Countries',
96
96
  SUBNATIONAL: 'Subnational Regions',
97
97
  CITY: 'Municipality Name',
98
+ TRANS_MACRO_OUTERMOST: 'Outermost Regions',
98
99
  TRANS_MACRO_NORTHPERI: 'Northern Periphery and Arctic',
99
100
  TRANS_MACRO_BACLITC: 'Baltic Sea',
100
101
  TRANS_MACRO_NW_EUROPE: 'North West Europe',
@@ -11,7 +11,7 @@ import {
11
11
  VIDEO,
12
12
  GUIDANCE,
13
13
  INDICATOR,
14
- PUBICATION_REPORT,
14
+ PUBLICATION_REPORT,
15
15
  } from '@eeacms/volto-cca-policy/helpers/Constants';
16
16
  import {
17
17
  isObservatoryMetadataURL,
@@ -19,30 +19,34 @@ import {
19
19
  } from '@eeacms/volto-cca-policy/helpers';
20
20
 
21
21
  const messages = defineMessages({
22
- 'The date refers to the moment in which the item has been prepared or updated by contributing experts to be submitted for the publication in Climate ADAPT': {
22
+ default_info_tooltip: {
23
23
  id:
24
- 'The date refers to the moment in which the item has been prepared or updated by contributing experts to be submitted for the publication in Climate ADAPT',
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',
25
27
  defaultMessage:
26
- 'The date refers to the moment in which the item has been prepared or updated by contributing experts to be submitted for the publication in Climate ADAPT',
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',
27
31
  },
28
- 'The date refers to the date of release of the video': {
32
+ release_info_tooltip: {
29
33
  id: 'The date refers to the date of release of the video',
30
34
  defaultMessage: 'The date refers to the date of release of the video',
31
35
  },
32
- 'The date refers to the latest date of publication of the item': {
36
+ publication_info_tooltip: {
33
37
  id: 'The date refers to the latest date of publication of the item',
34
38
  defaultMessage:
35
39
  'The date refers to the latest date of publication of the item',
36
40
  },
37
- 'Date of release:': {
41
+ release_date: {
38
42
  id: 'Date of release:',
39
43
  defaultMessage: 'Date of release:',
40
44
  },
41
- 'Date of publication:': {
45
+ publication_date: {
42
46
  id: 'Date of publication:',
43
47
  defaultMessage: 'Date of publication:',
44
48
  },
45
- 'Date of creation:': {
49
+ creation_date: {
46
50
  id: 'Date of creation:',
47
51
  defaultMessage: 'Date of creation:',
48
52
  },
@@ -266,13 +270,7 @@ function GeoChar(props) {
266
270
  section.value && (
267
271
  <Fragment key={index}>
268
272
  {section.title && (
269
- <h5>
270
- {intl.formatMessage(messages[section.title])}
271
- {/* <FormattedMessage
272
- id="{section.title}"
273
- defaultMessage="Countries2344:"
274
- /> */}
275
- </h5>
273
+ <h5>{intl.formatMessage(messages[section.title])}</h5>
276
274
  )}
277
275
  <p>{section.value.join(', ')}</p>
278
276
  </Fragment>
@@ -282,37 +280,34 @@ function GeoChar(props) {
282
280
  );
283
281
  }
284
282
 
285
- function PublicationDateInfo(props) {
286
- const { value, portaltype, title } = props;
287
- let tooltipText =
288
- 'The date refers to the moment in which the item has been prepared or updated by contributing experts to be submitted for the publication in Climate ADAPT';
283
+ function PublicationDateInfo({ value, portaltype, title }) {
284
+ const intl = useIntl();
285
+ const publicationYear = new Date(value).getFullYear();
289
286
 
290
- if (portaltype === VIDEO) {
291
- tooltipText = 'The date refers to the date of release of the video';
292
- }
293
- if (
294
- portaltype === GUIDANCE ||
295
- portaltype === INDICATOR ||
296
- portaltype === PUBICATION_REPORT
297
- ) {
298
- tooltipText =
299
- 'The date refers to the latest date of publication of the item';
300
- }
287
+ const tooltipMessages = {
288
+ [VIDEO]: intl.formatMessage(messages.release_info_tooltip),
289
+ [GUIDANCE]: intl.formatMessage(messages.publication_info_tooltip),
290
+ [INDICATOR]: intl.formatMessage(messages.publication_info_tooltip),
291
+ [PUBLICATION_REPORT]: intl.formatMessage(messages.publication_info_tooltip),
292
+ default: intl.formatMessage(messages.default_info_tooltip),
293
+ };
301
294
 
302
- const publicationYear = new Date(value).getFullYear();
303
- const intl = useIntl();
304
- return publicationYear > 1970 ? (
295
+ const tooltipText = tooltipMessages[portaltype] || tooltipMessages.default;
296
+
297
+ if (publicationYear <= 1970) return null;
298
+
299
+ return (
305
300
  <>
306
301
  <h5>{title}</h5>
307
302
  <p>
308
303
  {publicationYear}
309
304
  <Popup
310
- content={intl.formatMessage(messages[tooltipText])}
305
+ content={tooltipText}
311
306
  trigger={<i className="ri-question-fill"></i>}
312
307
  />
313
308
  </p>
314
309
  </>
315
- ) : null;
310
+ );
316
311
  }
317
312
 
318
313
  function ContentMetadata(props) {
@@ -337,26 +332,23 @@ function ContentMetadata(props) {
337
332
  const isObservatoryItem = isObservatoryMetadataURL(location.pathname);
338
333
  const hasGeoChars = geochars !== null || spatial_layer.length > 0;
339
334
 
340
- let date_title;
341
- if (type === VIDEO) {
342
- date_title = intl.formatMessage(messages['Date of release:']);
343
- } else if (
344
- type === PUBICATION_REPORT ||
345
- type === INDICATOR ||
346
- type === GUIDANCE
347
- ) {
348
- date_title = intl.formatMessage(messages['Date of publication:']);
349
- } else {
350
- date_title = intl.formatMessage(messages['Date of creation:']);
351
- }
335
+ const dateTitles = {
336
+ [VIDEO]: intl.formatMessage(messages.release_date),
337
+ [PUBLICATION_REPORT]: intl.formatMessage(messages.publication_date),
338
+ [INDICATOR]: intl.formatMessage(messages.publication_date),
339
+ [GUIDANCE]: intl.formatMessage(messages.publication_date),
340
+ default: intl.formatMessage(messages.creation_date),
341
+ };
342
+
343
+ const dateTitle = dateTitles[type] || dateTitles.default;
352
344
 
353
345
  return (
354
346
  <Segment>
355
347
  <div className="content-metadata">
356
348
  <PublicationDateInfo
357
- title={date_title}
349
+ title={dateTitle}
358
350
  value={content?.publication_date}
359
- portaltype={content?.portal_type}
351
+ portaltype={type}
360
352
  />
361
353
 
362
354
  {isObservatoryItem && (
@@ -14,7 +14,7 @@ import {
14
14
  } from 'semantic-ui-react';
15
15
  import {
16
16
  CASE_STUDY,
17
- PUBICATION_REPORT,
17
+ PUBLICATION_REPORT,
18
18
  ORGANISATION,
19
19
  ADAPTATION_OPTION,
20
20
  ACE_PROJECT,
@@ -341,7 +341,7 @@ export const DocumentsList = (props) => {
341
341
  section_title = intl.formatMessage(messages.caseStudiesDocuments);
342
342
  }
343
343
 
344
- if (type === PUBICATION_REPORT) {
344
+ if (type === PUBLICATION_REPORT) {
345
345
  section_title = intl.formatMessage(
346
346
  messages.publicationsAndReportsDocuments,
347
347
  );