@eeacms/volto-cca-policy 0.2.4 → 0.2.6

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 (31) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/locales/de/LC_MESSAGES/volto.po +15 -64
  3. package/locales/en/LC_MESSAGES/volto.po +15 -64
  4. package/locales/es/LC_MESSAGES/volto.po +15 -64
  5. package/locales/fr/LC_MESSAGES/volto.po +15 -64
  6. package/locales/it/LC_MESSAGES/volto.po +15 -64
  7. package/locales/pl/LC_MESSAGES/volto.po +15 -64
  8. package/locales/ro/LC_MESSAGES/volto.po +15 -64
  9. package/locales/volto.pot +16 -55
  10. package/package.json +1 -1
  11. package/src/components/index.js +3 -0
  12. package/src/components/manage/Blocks/CountryProfileDetail/CountryTabPane.js +72 -0
  13. package/src/components/manage/Blocks/CountryProfileDetail/CountryTabPane.test.jsx +47 -0
  14. package/src/components/manage/Blocks/CountryProfileDetail/View.js +65 -48
  15. package/src/components/manage/Blocks/CountryProfileDetail/View.test.jsx +40 -0
  16. package/src/components/manage/Blocks/CountryProfileDetail/styles.less +59 -0
  17. package/src/components/manage/Blocks/RASTBlock/RASTMap.jsx +3 -1
  18. package/src/components/manage/Blocks/RASTBlock/RASTView.jsx +4 -2
  19. package/src/components/theme/ASTNavigation/ASTAccordion.jsx +20 -6
  20. package/src/components/theme/MissionDisclaimer/MissionDisclaimer.jsx +24 -0
  21. package/src/components/theme/Views/MissionFundingCCAView.jsx +22 -53
  22. package/src/components/theme/Views/MissionFundingCCAView.test.jsx +1 -3
  23. package/src/components/theme/Views/MissionToolView.jsx +226 -0
  24. package/src/components/theme/Views/MissionToolView.test.jsx +154 -0
  25. package/src/helpers/ContentMetadata.jsx +16 -34
  26. package/src/helpers/Utils.jsx +23 -0
  27. package/src/helpers/index.js +1 -0
  28. package/src/index.js +3 -0
  29. package/theme/elements/list.variables +1 -1
  30. package/theme/globals/mission.less +15 -0
  31. package/src/components/theme/Views/styles.less +0 -7
@@ -0,0 +1,226 @@
1
+ import React from 'react';
2
+ import {
3
+ HTMLField,
4
+ BannerTitle,
5
+ MetadataItemList,
6
+ } from '@eeacms/volto-cca-policy/helpers';
7
+ import { Container, Grid, Image, Segment, List } from 'semantic-ui-react';
8
+ import {
9
+ PortalMessage,
10
+ MissionDisclaimer,
11
+ } from '@eeacms/volto-cca-policy/components';
12
+
13
+ function MissionToolView(props) {
14
+ const { content } = props;
15
+
16
+ return (
17
+ <div className="mission-item-view">
18
+ <BannerTitle
19
+ content={{ ...content, image: '' }}
20
+ data={{
21
+ info: [{ description: '' }],
22
+ hideContentType: true,
23
+ hideCreationDate: false,
24
+ hideModificationDate: false,
25
+ hidePublishingDate: false,
26
+ hideDownloadButton: false,
27
+ hideShareButton: false,
28
+ }}
29
+ />
30
+
31
+ <Container>
32
+ <PortalMessage content={content} />
33
+ <Grid columns="12">
34
+ <div className="row">
35
+ <Grid.Column
36
+ mobile={12}
37
+ tablet={12}
38
+ computer={8}
39
+ className="col-left"
40
+ >
41
+ {!!content.objective && (
42
+ <>
43
+ <h2>Objective(s)</h2>
44
+ <HTMLField value={content.objective} />
45
+ </>
46
+ )}
47
+
48
+ {!!content.short_description && (
49
+ <>
50
+ <h2>Short description</h2>
51
+ <HTMLField value={content.short_description} />
52
+ </>
53
+ )}
54
+
55
+ {!!content.free_keywords && (
56
+ <>
57
+ <h2>Free keywords</h2>
58
+ <HTMLField value={content.free_keywords} />
59
+ </>
60
+ )}
61
+
62
+ {!!content.readiness_for_use &&
63
+ content.readiness_for_use.length > 0 && (
64
+ <>
65
+ <h2>Readiness for use</h2>
66
+
67
+ <MetadataItemList value={content.readiness_for_use} />
68
+ </>
69
+ )}
70
+
71
+ {!!content.applications && (
72
+ <>
73
+ <h2>Applications</h2>
74
+ <HTMLField value={content.applications} />
75
+ </>
76
+ )}
77
+
78
+ {!!content.strengths_weaknesses && (
79
+ <>
80
+ <h2>
81
+ Strengths and weaknesses, comparative added value to other
82
+ similar tools
83
+ </h2>
84
+ <HTMLField value={content.strengths_weaknesses} />
85
+ </>
86
+ )}
87
+
88
+ {!!content.input && (
89
+ <>
90
+ <h2>Input(s)</h2>
91
+ <HTMLField value={content.input} />
92
+ </>
93
+ )}
94
+
95
+ {!!content.output && (
96
+ <>
97
+ <h3>Output(s)</h3>
98
+ <HTMLField value={content.output} />
99
+ </>
100
+ )}
101
+
102
+ {!!content.output_image && (
103
+ <Image
104
+ src={content.output_image?.scales?.large?.download}
105
+ alt={content.title}
106
+ style={{ margin: '2.5em 0' }}
107
+ />
108
+ )}
109
+
110
+ {!!content.replicability && (
111
+ <>
112
+ <h2>Replicability: Cost/effort for (new) usage</h2>
113
+ <HTMLField value={content.replicability} />
114
+ </>
115
+ )}
116
+
117
+ {!!content.materials && (
118
+ <>
119
+ <h2>Materials or other support available</h2>
120
+ <HTMLField value={content.materials} />
121
+ </>
122
+ )}
123
+
124
+ {!!content.website && (
125
+ <>
126
+ <h2>Website and maintenance</h2>
127
+ <HTMLField value={content.website} />
128
+ </>
129
+ )}
130
+
131
+ {!!content.contact && (
132
+ <>
133
+ <h2>Contact</h2>
134
+ <HTMLField value={content.contact} />
135
+ </>
136
+ )}
137
+
138
+ {!!content.associated_project && (
139
+ <>
140
+ <h2>Associated project(s)</h2>
141
+ <HTMLField value={content.associated_project} />
142
+ </>
143
+ )}
144
+ </Grid.Column>
145
+ <Grid.Column
146
+ mobile={12}
147
+ tablet={12}
148
+ computer={4}
149
+ className="col-right"
150
+ >
151
+ <Segment className="metadata">
152
+ {!!content.rast_steps && content.rast_steps.length > 0 && (
153
+ <>
154
+ <h5>RAST step(s) of relevance:</h5>
155
+ <List>
156
+ {content.rast_steps.map((step, index) => (
157
+ <List.Item key={index}>{step.title}</List.Item>
158
+ ))}
159
+ </List>
160
+ </>
161
+ )}
162
+
163
+ {!!content.geographical_scale &&
164
+ content.geographical_scale.length > 0 && (
165
+ <>
166
+ <h5>Geographical scale:</h5>
167
+ <MetadataItemList value={content.geographical_scale} />
168
+ </>
169
+ )}
170
+
171
+ {!!content.geographical_area && (
172
+ <>
173
+ <h5>Geographical area:</h5>
174
+ <HTMLField value={content.geographical_area} />
175
+ </>
176
+ )}
177
+
178
+ {!!content.climate_impacts &&
179
+ content.climate_impacts.length > 0 && (
180
+ <>
181
+ <h5>Climate impacts:</h5>
182
+ <MetadataItemList value={content.climate_impacts} />
183
+ </>
184
+ )}
185
+
186
+ {!!content.tool_language && content.tool_language.length > 0 && (
187
+ <>
188
+ <h5>Language(s) of the tool:</h5>
189
+ <MetadataItemList value={content.tool_language} />
190
+ </>
191
+ )}
192
+
193
+ {!!content.sectors && content.sectors.length > 0 && (
194
+ <>
195
+ <h5>Adaptation sectors:</h5>
196
+ <MetadataItemList value={content.sectors} />
197
+ </>
198
+ )}
199
+
200
+ {!!content.most_useful_for &&
201
+ content.most_useful_for.length > 0 && (
202
+ <>
203
+ <h5>Most useful for:</h5>
204
+ <MetadataItemList value={content.most_useful_for} />
205
+ </>
206
+ )}
207
+
208
+ {!!content.user_requirements &&
209
+ content.user_requirements.length > 0 && (
210
+ <>
211
+ <h5>User requirements:</h5>
212
+ <MetadataItemList value={content.user_requirements} />
213
+ </>
214
+ )}
215
+ </Segment>
216
+ </Grid.Column>
217
+ </div>
218
+ </Grid>
219
+
220
+ <MissionDisclaimer />
221
+ </Container>
222
+ </div>
223
+ );
224
+ }
225
+
226
+ export default MissionToolView;
@@ -0,0 +1,154 @@
1
+ import React from 'react';
2
+ import { MemoryRouter } from 'react-router-dom';
3
+ import configureStore from 'redux-mock-store';
4
+ import renderer from 'react-test-renderer';
5
+ import '@testing-library/jest-dom/extend-expect';
6
+ import { Provider } from 'react-intl-redux';
7
+ import MissionToolView from './MissionToolView';
8
+ import config from '@plone/volto/registry';
9
+
10
+ config.blocks = {
11
+ blocksConfig: {
12
+ title: {
13
+ view: () => <div>Title Block Component</div>,
14
+ },
15
+ },
16
+ };
17
+
18
+ const mockStore = configureStore();
19
+
20
+ describe('MissionToolView', () => {
21
+ it('should render the component', () => {
22
+ const data = {
23
+ content: {
24
+ contributors: [],
25
+ description: 'Summary',
26
+ objective: {
27
+ 'content-type': 'text/html',
28
+ data: '<p></p>',
29
+ encoding: 'utf8',
30
+ },
31
+ short_description: {
32
+ 'content-type': 'text/html',
33
+ data: '<p></p>',
34
+ encoding: 'utf8',
35
+ },
36
+ free_keywords: {
37
+ 'content-type': 'text/html',
38
+ data: '<p></p>',
39
+ encoding: 'utf8',
40
+ },
41
+ readiness_for_use: [
42
+ {
43
+ title: 'Tool tested in several case studies',
44
+ token: 'Tool tested in several case studies',
45
+ },
46
+ {
47
+ title: 'Tool broadly used',
48
+ token: 'Tool broadly used',
49
+ },
50
+ ],
51
+ application: {
52
+ 'content-type': 'text/html',
53
+ data: '<p></p>',
54
+ encoding: 'utf8',
55
+ },
56
+ strengths_weaknesses: {
57
+ 'content-type': 'text/html',
58
+ data: '<p></p>',
59
+ encoding: 'utf8',
60
+ },
61
+ input: {
62
+ 'content-type': 'text/html',
63
+ data: '<p></p>',
64
+ encoding: 'utf8',
65
+ },
66
+ output: {
67
+ 'content-type': 'text/html',
68
+ data: '<p></p>',
69
+ encoding: 'utf8',
70
+ },
71
+ replicability: {
72
+ 'content-type': 'text/html',
73
+ data: '<p></p>',
74
+ encoding: 'utf8',
75
+ },
76
+ materials: {
77
+ 'content-type': 'text/html',
78
+ data: '<p></p>',
79
+ encoding: 'utf8',
80
+ },
81
+ website: {
82
+ 'content-type': 'text/html',
83
+ data: '<p></p>',
84
+ encoding: 'utf8',
85
+ },
86
+ contact: {
87
+ 'content-type': 'text/html',
88
+ data: '<p></p>',
89
+ encoding: 'utf8',
90
+ },
91
+ associated_project: {
92
+ 'content-type': 'text/html',
93
+ data: '<p></p>',
94
+ encoding: 'utf8',
95
+ },
96
+ rast_steps: [
97
+ {
98
+ title: 'Step 1. Preparing the ground for adaptation',
99
+ token: 'STEP_1',
100
+ },
101
+ {
102
+ title: 'Step 4. Assessing and selecting adaptation options',
103
+ token: 'STEP_4',
104
+ },
105
+ ],
106
+ geographical_scale: [
107
+ {
108
+ title: 'Item 1',
109
+ token: 'Item 1',
110
+ },
111
+ {
112
+ title: 'Item 2',
113
+ token: 'Item 2',
114
+ },
115
+ ],
116
+ geographical_area: {
117
+ 'content-type': 'text/html',
118
+ data: '<p></p>',
119
+ encoding: 'utf8',
120
+ },
121
+ sectors: [
122
+ {
123
+ title: 'Biodiversity',
124
+ token: 'BIODIVERSITY',
125
+ },
126
+ {
127
+ title: 'Coastal areas',
128
+ token: 'COASTAL',
129
+ },
130
+ ],
131
+ title: 'Title here',
132
+ },
133
+ };
134
+
135
+ const store = mockStore({
136
+ userSession: { token: '1234' },
137
+ intl: {
138
+ locale: 'en',
139
+ messages: {},
140
+ },
141
+ });
142
+
143
+ const component = renderer.create(
144
+ <Provider store={store}>
145
+ <MemoryRouter>
146
+ <MissionToolView {...data} />
147
+ </MemoryRouter>
148
+ </Provider>,
149
+ );
150
+
151
+ const json = component.toJSON();
152
+ expect(json).toMatchSnapshot();
153
+ });
154
+ });
@@ -1,3 +1,7 @@
1
+ import { Fragment } from 'react';
2
+ import { useLocation } from 'react-router-dom';
3
+ import { Popup, Segment } from 'semantic-ui-react';
4
+ import { useIntl, defineMessages, FormattedMessage } from 'react-intl';
1
5
  import {
2
6
  ACE_COUNTRIES,
3
7
  BIOREGIONS,
@@ -9,11 +13,10 @@ import {
9
13
  INDICATOR,
10
14
  PUBICATION_REPORT,
11
15
  } from '@eeacms/volto-cca-policy/helpers/Constants';
12
- import { Fragment } from 'react';
13
- import { Popup, Segment } from 'semantic-ui-react';
14
- import { isObservatoryMetadataURL } from '@eeacms/volto-cca-policy/helpers';
15
- import { useLocation } from 'react-router-dom';
16
- import { useIntl, defineMessages, FormattedMessage } from 'react-intl';
16
+ import {
17
+ isObservatoryMetadataURL,
18
+ MetadataItemList,
19
+ } from '@eeacms/volto-cca-policy/helpers';
17
20
 
18
21
  const messages = defineMessages({
19
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': {
@@ -312,27 +315,8 @@ function PublicationDateInfo(props) {
312
315
  ) : null;
313
316
  }
314
317
 
315
- function ItemsList(props) {
316
- let { value, join } = props;
317
- if (join === undefined) {
318
- join = ', ';
319
- }
320
- if (join === '<br />') {
321
- return (
322
- <span>
323
- {value.map((item, index) => (
324
- <Fragment key={index}>
325
- <span>{item.title}</span>
326
- <br />
327
- </Fragment>
328
- ))}
329
- </span>
330
- );
331
- }
332
- return <span>{value.map((item) => item.title).join(join)}</span>;
333
- }
334
-
335
318
  function ContentMetadata(props) {
319
+ const intl = useIntl();
336
320
  const { content } = props;
337
321
  const {
338
322
  sectors,
@@ -353,8 +337,6 @@ function ContentMetadata(props) {
353
337
  const isObservatoryItem = isObservatoryMetadataURL(location.pathname);
354
338
  const hasGeoChars = geochars !== null || spatial_layer.length > 0;
355
339
 
356
- const intl = useIntl();
357
-
358
340
  let date_title;
359
341
  if (type === VIDEO) {
360
342
  date_title = intl.formatMessage(messages['Date of release:']);
@@ -387,7 +369,7 @@ function ContentMetadata(props) {
387
369
  defaultMessage="Health impact:"
388
370
  />
389
371
  </h5>
390
- <ItemsList value={health_impacts} />
372
+ <MetadataItemList value={health_impacts} />
391
373
  </>
392
374
  )}
393
375
  </>
@@ -410,7 +392,7 @@ function ContentMetadata(props) {
410
392
  defaultMessage="Key Type Measures:"
411
393
  />
412
394
  </h5>
413
- <ItemsList value={key_type_measures} />
395
+ <MetadataItemList value={key_type_measures} />
414
396
  </>
415
397
  )}
416
398
 
@@ -422,7 +404,7 @@ function ContentMetadata(props) {
422
404
  defaultMessage="IPCC adaptation options categories:"
423
405
  />
424
406
  </h5>
425
- <ItemsList value={ipcc_category} />
407
+ <MetadataItemList value={ipcc_category} />
426
408
  </>
427
409
  )}
428
410
 
@@ -436,7 +418,7 @@ function ContentMetadata(props) {
436
418
  defaultMessage="Climate impacts:"
437
419
  />
438
420
  </h5>
439
- <ItemsList value={climate_impacts} />
421
+ <MetadataItemList value={climate_impacts} />
440
422
  </>
441
423
  )}
442
424
 
@@ -448,7 +430,7 @@ function ContentMetadata(props) {
448
430
  defaultMessage="Adaptation elements:"
449
431
  />
450
432
  </h5>
451
- <ItemsList value={elements} />
433
+ <MetadataItemList value={elements} />
452
434
  </>
453
435
  )}
454
436
 
@@ -457,7 +439,7 @@ function ContentMetadata(props) {
457
439
  <h5>
458
440
  <FormattedMessage id="Sectors:" defaultMessage="Sectors:" />
459
441
  </h5>
460
- <ItemsList value={sectors} />
442
+ <MetadataItemList value={sectors} />
461
443
  </>
462
444
  )}
463
445
  </>
@@ -471,7 +453,7 @@ function ContentMetadata(props) {
471
453
  defaultMessage="Governance level:"
472
454
  />
473
455
  </h5>
474
- <ItemsList value={governance_level} join="<br />" />
456
+ <MetadataItemList value={governance_level} join_type="<br />" />
475
457
  </>
476
458
  )}
477
459
 
@@ -482,3 +482,26 @@ export const EventDetails = (props) => {
482
482
  </>
483
483
  );
484
484
  };
485
+
486
+ export const MetadataItemList = (props) => {
487
+ const { value, join_type } = props;
488
+
489
+ return value && value.length > 0 ? (
490
+ <>
491
+ {!join_type ? (
492
+ <p>{value.map((item) => item.title).join(', ')}</p>
493
+ ) : (
494
+ <>
495
+ {value.map((item, index) => (
496
+ <React.Fragment key={index}>
497
+ <span>{item.title}</span>
498
+ {index !== value.length - 1 && (
499
+ <span dangerouslySetInnerHTML={{ __html: join_type }} />
500
+ )}
501
+ </React.Fragment>
502
+ ))}
503
+ </>
504
+ )}
505
+ </>
506
+ ) : null;
507
+ };
@@ -15,6 +15,7 @@ export {
15
15
  ItemLogo,
16
16
  SubjectTags,
17
17
  EventDetails,
18
+ MetadataItemList,
18
19
  } from './Utils';
19
20
  export { default as ContentMetadata } from './ContentMetadata';
20
21
  export {
package/src/index.js CHANGED
@@ -11,6 +11,8 @@ import C3SIndicatorView from './components/theme/Views/C3SIndicatorView';
11
11
  import DatabaseItemView from './components/theme/Views/DatabaseItemView';
12
12
  import MissionFundingCCAView from './components/theme/Views/MissionFundingCCAView';
13
13
 
14
+ import { MissionToolView } from '@eeacms/volto-cca-policy/components';
15
+
14
16
  import HealthHorizontalCardItem from './components/Result/HealthHorizontalCardItem';
15
17
 
16
18
  import ccaLogo from '@eeacms/volto-cca-policy/../theme/assets/images/Header/climate-adapt-logo.svg';
@@ -287,6 +289,7 @@ const applyConfig = (config) => {
287
289
  'eea.climateadapt.adaptationoption': AdaptationOptionView,
288
290
  'News Item': NewsItemView,
289
291
  mission_funding_cca: MissionFundingCCAView,
292
+ mission_tool: MissionToolView,
290
293
  };
291
294
 
292
295
  config.views.layoutViewsNamesMapping.view_cca_event = 'CCA Event View';
@@ -6,4 +6,4 @@
6
6
  View
7
7
  --------------------*/
8
8
 
9
- @listFontWeight: 500;
9
+ @listFontWeight: 400;
@@ -1,5 +1,20 @@
1
1
  /* Mission subsite */
2
2
 
3
+ .mission-item-view {
4
+ .ui.segment.metadata {
5
+ border: none;
6
+ background-color: #f9f9f9;
7
+
8
+ h5 {
9
+ margin: 1em 0 0.5em 0;
10
+
11
+ &:first-child {
12
+ margin-top: 0;
13
+ }
14
+ }
15
+ }
16
+ }
17
+
3
18
  body.view-viewview.contenttype-subsite.section-mission
4
19
  .block.__grid.teaserGrid.centered
5
20
  h2 {
@@ -1,7 +0,0 @@
1
- // MissionFundingCCAView
2
- div.col-right {
3
- div.metadata {
4
- padding: 10px;
5
- background: #e6e7e8;
6
- }
7
- }