@eeacms/volto-cca-policy 1.0.2 → 1.0.4

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 (78) hide show
  1. package/CHANGELOG.md +259 -3
  2. package/jest-addon.config.js +4 -2
  3. package/locales/bg/LC_MESSAGES/volto.po +576 -0
  4. package/locales/cs/LC_MESSAGES/volto.po +576 -0
  5. package/locales/da/LC_MESSAGES/volto.po +576 -0
  6. package/locales/de/LC_MESSAGES/volto.po +576 -0
  7. package/locales/el/LC_MESSAGES/volto.po +576 -0
  8. package/locales/en/LC_MESSAGES/volto.po +576 -0
  9. package/locales/es/LC_MESSAGES/volto.po +576 -0
  10. package/locales/et/LC_MESSAGES/volto.po +576 -0
  11. package/locales/fi/LC_MESSAGES/volto.po +576 -0
  12. package/locales/fr/LC_MESSAGES/volto.po +576 -0
  13. package/locales/ga/LC_MESSAGES/volto.po +576 -0
  14. package/locales/hr/LC_MESSAGES/volto.po +576 -0
  15. package/locales/hu/LC_MESSAGES/volto.po +576 -0
  16. package/locales/is/LC_MESSAGES/volto.po +576 -0
  17. package/locales/it/LC_MESSAGES/volto.po +576 -0
  18. package/locales/lt/LC_MESSAGES/volto.po +576 -0
  19. package/locales/lv/LC_MESSAGES/volto.po +576 -0
  20. package/locales/mt/LC_MESSAGES/volto.po +576 -0
  21. package/locales/nl/LC_MESSAGES/volto.po +576 -0
  22. package/locales/nn/LC_MESSAGES/volto.po +576 -0
  23. package/locales/pl/LC_MESSAGES/volto.po +576 -0
  24. package/locales/pt/LC_MESSAGES/volto.po +576 -0
  25. package/locales/ro/LC_MESSAGES/volto.po +576 -0
  26. package/locales/sk/LC_MESSAGES/volto.po +576 -0
  27. package/locales/sl/LC_MESSAGES/volto.po +576 -0
  28. package/locales/sv/LC_MESSAGES/volto.po +576 -0
  29. package/locales/tr/LC_MESSAGES/volto.po +576 -0
  30. package/locales/volto.pot +577 -1
  31. package/package.json +1 -1
  32. package/src/components/Search/NavigatorCatalogue/NavigatorCatalogueCardItem.jsx +224 -0
  33. package/src/components/Search/NavigatorCatalogue/NavigatorCatalogueCardItem.test.jsx +173 -0
  34. package/src/components/Search/NavigatorCatalogue/NavigatorCatalogueContentView.jsx +189 -0
  35. package/src/components/Search/NavigatorCatalogue/NavigatorCatalogueMapView.jsx +272 -0
  36. package/src/components/Search/NavigatorCatalogue/NavigatorCatalogueMapView.test.jsx +160 -0
  37. package/src/components/Search/NavigatorCatalogue/utils.js +157 -0
  38. package/src/components/Search/NavigatorCatalogue/utils.test.js +132 -0
  39. package/src/components/Search/NavigatorGuide/NavigatorGuideContentView.jsx +409 -0
  40. package/src/components/Search/NavigatorGuide/NavigatorGuideLayout.jsx +8 -0
  41. package/src/components/index.js +2 -0
  42. package/src/components/theme/CompareTools/CompareToolsPanel.jsx +151 -0
  43. package/src/components/theme/CompareTools/CompareToolsPanel.test.jsx +96 -0
  44. package/src/components/theme/CompareTools/CompareToolsView.jsx +475 -0
  45. package/src/components/theme/CompareTools/CompareToolsView.test.jsx +110 -0
  46. package/src/components/theme/CompareTools/utils.js +111 -0
  47. package/src/components/theme/CompareTools/utils.test.jsx +217 -0
  48. package/src/components/theme/Views/ExtendedToolView.jsx +201 -201
  49. package/src/components/theme/Views/ExtendedToolView.test.jsx +420 -58
  50. package/src/constants.js +0 -48
  51. package/src/customizations/volto/reducers/breadcrumbs/breadcrumbs.js +1 -1
  52. package/src/helpers/Utils.jsx +29 -0
  53. package/src/helpers/index.js +3 -0
  54. package/src/index.js +28 -2
  55. package/src/search/index.js +6 -0
  56. package/src/search/navigator_catalogue/config.js +89 -0
  57. package/src/search/navigator_catalogue/facets.js +86 -0
  58. package/src/search/navigator_catalogue/views.js +28 -0
  59. package/src/search/navigator_guide/config.js +70 -0
  60. package/src/search/navigator_guide/facets.js +31 -0
  61. package/src/search/navigator_guide/guideSteps.js +93 -0
  62. package/src/slate-styles.less +4 -0
  63. package/src/state.js +1 -0
  64. package/theme/elements/button.overrides +0 -11
  65. package/theme/elements/label.overrides +15 -0
  66. package/theme/globals/blocks.less +3 -2
  67. package/theme/globals/navigator.less +1090 -0
  68. package/theme/globals/site.overrides +5 -0
  69. package/theme/tokens/colors.less +2 -0
  70. package/artifacts/BLOCKS.md +0 -167
  71. package/artifacts/link-integrity-workflow/README.md +0 -76
  72. package/artifacts/link-integrity-workflow/index.md +0 -33
  73. package/artifacts/link-integrity-workflow/link-integrity-block-fields-report.md +0 -132
  74. package/artifacts/link-integrity-workflow/link-integrity-blocks-report.md +0 -52
  75. package/artifacts/link-integrity-workflow/understanding-link-integrity.md +0 -143
  76. package/artifacts/link-integrity-workflow/volto-block-link-analysis.md +0 -63
  77. package/artifacts/link-integrity-workflow/volto-block-link-discovery.md +0 -60
  78. package/artifacts/test-fixes/test-fixes-specification.md +0 -267
@@ -1,20 +1,27 @@
1
- import { Container, Grid } from 'semantic-ui-react';
2
- import { PortalMessage } from '@eeacms/volto-cca-policy/components';
1
+ import { Button, Container, Grid, Icon } from 'semantic-ui-react';
2
+ import {
3
+ CompareToolsPanel,
4
+ PortalMessage,
5
+ } from '@eeacms/volto-cca-policy/components';
3
6
  import {
4
7
  HTMLField,
8
+ TextField,
9
+ BooleanField,
10
+ VocabularyField,
5
11
  ContentMetadata,
6
12
  ItemLogo,
7
13
  DocumentsList,
8
- ExternalLink,
9
14
  } from '@eeacms/volto-cca-policy/helpers';
10
15
  import { defineMessages, useIntl } from 'react-intl';
11
16
  import config from '@plone/volto/registry';
17
+ import { useCompareTools } from '../CompareTools/utils';
18
+ import { formatFunctionalityScore } from '../../Search/NavigatorCatalogue/utils';
12
19
 
13
20
  const ExtendedToolView = (props) => {
14
- const { content } = props;
21
+ const { content = {} } = props;
15
22
  const {
16
- title,
17
- acronym,
23
+ title = '',
24
+ acronym = '',
18
25
  long_description,
19
26
  tool_provider,
20
27
  public_private_mode,
@@ -51,15 +58,24 @@ const ExtendedToolView = (props) => {
51
58
  strengths_and_possible_limitations,
52
59
  } = content;
53
60
 
54
- let tool_available_language_list = [];
61
+ const availableLanguageValues = [];
55
62
  if (tool_available_english) {
56
- tool_available_language_list.push('English');
63
+ availableLanguageValues.push('English');
57
64
  }
58
65
  if (tool_available_language) {
59
- tool_available_language_list.push(tool_available_language);
66
+ availableLanguageValues.push(tool_available_language);
60
67
  }
68
+ const availableLanguageText = availableLanguageValues.join(', ');
69
+ const hasHyperlink = Boolean(hyperlink && hyperlink.length > 0);
70
+ const hasCompareTool = Boolean(content.UID);
61
71
 
62
72
  const item_title = acronym ? title + ' (' + acronym + ')' : title;
73
+ const compareTool = {
74
+ uid: content.UID,
75
+ title,
76
+ href: content['@id'],
77
+ };
78
+ const { isSelected, isLimitReached, toggle } = useCompareTools(compareTool);
63
79
 
64
80
  const messages = defineMessages({
65
81
  yes: { id: 'YES', defaultMessage: 'YES' },
@@ -74,8 +90,8 @@ const ExtendedToolView = (props) => {
74
90
  defaultMessage: 'Only online interactive support tool',
75
91
  },
76
92
  adaptation_cycle_step: {
77
- id: 'Supports ≥1 adaptation cycle step ',
78
- defaultMessage: 'Supports ≥1 adaptation cycle step ',
93
+ id: 'Supports ≥1 adaptation cycle step',
94
+ defaultMessage: 'Supports ≥1 adaptation cycle step',
79
95
  },
80
96
  updating_cycle_of_the_tool: {
81
97
  id: 'Updating cycle of the tool',
@@ -86,8 +102,8 @@ const ExtendedToolView = (props) => {
86
102
  defaultMessage: 'Language Accessibility',
87
103
  },
88
104
  free_access: {
89
- id: 'Free [full or core functionality] access ',
90
- defaultMessage: 'Free [full or core functionality] access ',
105
+ id: 'Free [full or core functionality] access',
106
+ defaultMessage: 'Free [full or core functionality] access',
91
107
  },
92
108
  place_of_implementation: {
93
109
  id: 'Place of implementation',
@@ -97,8 +113,8 @@ const ExtendedToolView = (props) => {
97
113
  data_sources: { id: 'Data sources', defaultMessage: 'Data sources' },
98
114
  license_status: { id: 'License status', defaultMessage: 'License status' },
99
115
  user_support_provisions: {
100
- id: 'User support provisions ',
101
- defaultMessage: 'User support provisions ',
116
+ id: 'User support provisions',
117
+ defaultMessage: 'User support provisions',
102
118
  },
103
119
  tool_validation_use: {
104
120
  id: 'Tool validation use',
@@ -161,13 +177,29 @@ const ExtendedToolView = (props) => {
161
177
  id: 'Underlying data maintenance',
162
178
  defaultMessage: 'Underlying data maintenance',
163
179
  },
164
- hyperlink: { id: 'Tool hyperlink', defaultMessage: 'Tool hyperlink' },
180
+ addToComparison: {
181
+ id: 'Add to comparison',
182
+ defaultMessage: 'Add to comparison',
183
+ },
184
+ openTool: {
185
+ id: 'Open tool',
186
+ defaultMessage: 'Open tool',
187
+ },
188
+ share: {
189
+ id: 'Share',
190
+ defaultMessage: 'Share',
191
+ },
192
+ linkCopied: {
193
+ id: 'Link copied',
194
+ defaultMessage: 'Link copied',
195
+ },
165
196
  });
166
197
  const intl = useIntl();
198
+
167
199
  const {
168
200
  blocks: { blocksConfig },
169
201
  } = config;
170
- const TitleBlockView = blocksConfig?.title?.view;
202
+ const TitleBlockView = blocksConfig?.title?.view || (() => null);
171
203
  const titleBlockData = { ...content, title: item_title, image: '' };
172
204
 
173
205
  return (
@@ -189,6 +221,35 @@ const ExtendedToolView = (props) => {
189
221
  properties={titleBlockData}
190
222
  />
191
223
  <Container>
224
+ {(hasHyperlink || hasCompareTool) && (
225
+ <div className="extended-tool-compare-action">
226
+ {hasHyperlink && (
227
+ <Button
228
+ as="a"
229
+ primary
230
+ href={hyperlink}
231
+ target="_blank"
232
+ rel="noopener noreferrer"
233
+ >
234
+ <Icon className="ri-external-link-line" />
235
+ <span>{intl.formatMessage(messages.openTool)}</span>
236
+ </Button>
237
+ )}
238
+ {hasCompareTool && (
239
+ <Button
240
+ primary
241
+ inverted
242
+ disabled={isSelected || isLimitReached}
243
+ aria-pressed={isSelected}
244
+ onClick={toggle}
245
+ >
246
+ <Icon className="ri-layout-column-line" />
247
+ <span>{intl.formatMessage(messages.addToComparison)}</span>
248
+ </Button>
249
+ )}
250
+ </div>
251
+ )}
252
+ <CompareToolsPanel />
192
253
  <PortalMessage content={content} />
193
254
  <Grid columns="12">
194
255
  <Grid.Row>
@@ -201,194 +262,133 @@ const ExtendedToolView = (props) => {
201
262
  <ItemLogo {...props} />
202
263
 
203
264
  <HTMLField value={long_description} />
204
- {tool_provider && tool_provider.length > 0 && (
205
- <>
206
- <h4>{intl.formatMessage(messages.tool_provider)}</h4>
207
- <p>{tool_provider}</p>
208
- </>
209
- )}
210
- {public_private_mode && public_private_mode.length > 0 && (
211
- <>
212
- <h5>{intl.formatMessage(messages.public_private_mode)}</h5>
213
- <p>{public_private_mode}</p>
214
- </>
215
- )}
265
+ <TextField
266
+ label={intl.formatMessage(messages.tool_provider)}
267
+ value={tool_provider}
268
+ />
269
+ <TextField
270
+ label={intl.formatMessage(messages.public_private_mode)}
271
+ value={public_private_mode}
272
+ />
216
273
  <HTMLField value={description} />
217
- {coder_1 && coder_1.length > 0 && (
218
- <>
219
- <h5>Coder1</h5>
220
- <p>{coder_1}</p>
221
- </>
222
- )}
223
- {coder_2 && coder_2.length > 0 && (
224
- <>
225
- <h5>Coder2</h5>
226
- <p>{coder_2}</p>
227
- </>
228
- )}
229
- <h5>
230
- {intl.formatMessage(messages.only_interactive_support_tool)}
231
- </h5>
232
- {only_interactive_support_tool
233
- ? intl.formatMessage(messages.yes)
234
- : intl.formatMessage(messages.no)}
235
- <h5>{intl.formatMessage(messages.adaptation_cycle_step)}</h5>
236
- {adaptation_cycle_step
237
- ? intl.formatMessage(messages.yes)
238
- : intl.formatMessage(messages.no)}
239
- <h5>{intl.formatMessage(messages.updating_cycle_of_the_tool)}</h5>
240
- {updating_cycle_of_the_tool
241
- ? intl.formatMessage(messages.yes)
242
- : intl.formatMessage(messages.no)}
243
- <h5>{intl.formatMessage(messages.language_accessibility)}</h5>
244
- {language_accessibility
245
- ? intl.formatMessage(messages.yes)
246
- : intl.formatMessage(messages.no)}
247
- <h5>{intl.formatMessage(messages.free_access)}</h5>
248
- {free_access
249
- ? intl.formatMessage(messages.yes)
250
- : intl.formatMessage(messages.no)}
251
- {hyperlink && hyperlink.length > 0 && (
252
- <>
253
- <h5>{intl.formatMessage(messages.hyperlink)}</h5>
254
- <ExternalLink url={hyperlink} text={hyperlink} />
255
- </>
256
- )}
257
- {intended_user_groups && intended_user_groups.length > 0 && (
258
- <>
259
- <h5>{intl.formatMessage(messages.intended_user_groups)}</h5>
260
- {intended_user_groups.map((item) => item.title).join(', ')}
261
- </>
262
- )}
263
- {place_of_implementation &&
264
- place_of_implementation.length > 0 && (
265
- <>
266
- <h5>
267
- {intl.formatMessage(messages.place_of_implementation)}
268
- </h5>
269
- {place_of_implementation
270
- .map((item) => item.title)
271
- .join(', ')}
272
- </>
274
+ <TextField label="Coder1" value={coder_1} />
275
+ <TextField label="Coder2" value={coder_2} />
276
+ <BooleanField
277
+ label={intl.formatMessage(
278
+ messages.only_interactive_support_tool,
273
279
  )}
274
- {type_of_data && type_of_data.length > 0 && (
275
- <>
276
- <h5>{intl.formatMessage(messages.type_of_data)}</h5>
277
- {type_of_data.map((item) => item.title).join(', ')}
278
- </>
279
- )}
280
- {data_sources && data_sources.length > 0 && (
281
- <>
282
- <h5>{intl.formatMessage(messages.data_sources)}</h5>
283
- {data_sources.map((item) => item.title).join(', ')}
284
- </>
285
- )}
286
- {license_status && license_status.length > 0 && (
287
- <>
288
- <h5>{intl.formatMessage(messages.license_status)}</h5>
289
- {license_status.map((item) => item.title).join(', ')}
290
- </>
291
- )}
292
- {user_support_provisions &&
293
- user_support_provisions.length > 0 && (
294
- <>
295
- <h5>
296
- {intl.formatMessage(messages.user_support_provisions)}
297
- </h5>
298
- {user_support_provisions
299
- .map((item) => item.title)
300
- .join(', ')}
301
- </>
280
+ value={only_interactive_support_tool}
281
+ yesLabel={intl.formatMessage(messages.yes)}
282
+ noLabel={intl.formatMessage(messages.no)}
283
+ />
284
+ <BooleanField
285
+ label={intl.formatMessage(messages.adaptation_cycle_step)}
286
+ value={adaptation_cycle_step}
287
+ yesLabel={intl.formatMessage(messages.yes)}
288
+ noLabel={intl.formatMessage(messages.no)}
289
+ />
290
+ <BooleanField
291
+ label={intl.formatMessage(messages.updating_cycle_of_the_tool)}
292
+ value={updating_cycle_of_the_tool}
293
+ yesLabel={intl.formatMessage(messages.yes)}
294
+ noLabel={intl.formatMessage(messages.no)}
295
+ />
296
+ <BooleanField
297
+ label={intl.formatMessage(messages.language_accessibility)}
298
+ value={language_accessibility}
299
+ yesLabel={intl.formatMessage(messages.yes)}
300
+ noLabel={intl.formatMessage(messages.no)}
301
+ />
302
+ <BooleanField
303
+ label={intl.formatMessage(messages.free_access)}
304
+ value={free_access}
305
+ yesLabel={intl.formatMessage(messages.yes)}
306
+ noLabel={intl.formatMessage(messages.no)}
307
+ />
308
+ <VocabularyField
309
+ label={intl.formatMessage(messages.intended_user_groups)}
310
+ values={intended_user_groups}
311
+ />
312
+ <VocabularyField
313
+ label={intl.formatMessage(messages.place_of_implementation)}
314
+ values={place_of_implementation}
315
+ />
316
+ <VocabularyField
317
+ label={intl.formatMessage(messages.type_of_data)}
318
+ values={type_of_data}
319
+ />
320
+ <VocabularyField
321
+ label={intl.formatMessage(messages.data_sources)}
322
+ values={data_sources}
323
+ />
324
+ <VocabularyField
325
+ label={intl.formatMessage(messages.license_status)}
326
+ values={license_status}
327
+ />
328
+ <VocabularyField
329
+ label={intl.formatMessage(messages.user_support_provisions)}
330
+ values={user_support_provisions}
331
+ />
332
+ <VocabularyField
333
+ label={intl.formatMessage(messages.tool_validation_use)}
334
+ values={tool_validation_use}
335
+ />
336
+ <VocabularyField
337
+ label={intl.formatMessage(messages.number_of_users_tool)}
338
+ values={number_of_users_tool}
339
+ />
340
+ <VocabularyField
341
+ label={intl.formatMessage(messages.tool_provider_mode)}
342
+ values={tool_provider_mode}
343
+ />
344
+ <VocabularyField
345
+ label={intl.formatMessage(
346
+ messages.adaptation_support_cycle_step,
302
347
  )}
303
- {tool_validation_use && tool_validation_use.length > 0 && (
304
- <>
305
- <h5>{intl.formatMessage(messages.tool_validation_use)}</h5>
306
- {tool_validation_use.map((item) => item.title).join(', ')}
307
- </>
308
- )}
309
- {number_of_users_tool && number_of_users_tool.length > 0 && (
310
- <>
311
- <h5>{intl.formatMessage(messages.number_of_users_tool)}</h5>
312
- {number_of_users_tool.map((item) => item.title).join(', ')}
313
- </>
314
- )}
315
- {tool_provider_mode && tool_provider_mode.length > 0 && (
316
- <>
317
- <h5>{intl.formatMessage(messages.tool_provider_mode)}</h5>
318
- {tool_provider_mode.map((item) => item.title).join(', ')}
319
- </>
320
- )}
321
- {adaptation_support_cycle_step &&
322
- adaptation_support_cycle_step.length > 0 && (
323
- <>
324
- <h5>
325
- {intl.formatMessage(
326
- messages.adaptation_support_cycle_step,
327
- )}
328
- </h5>
329
- {adaptation_support_cycle_step
330
- .map((item) => item.title)
331
- .join(', ')}
332
- </>
348
+ values={adaptation_support_cycle_step}
349
+ />
350
+ <TextField
351
+ label={intl.formatMessage(messages.tool_available_language)}
352
+ value={availableLanguageText}
353
+ />
354
+ <VocabularyField
355
+ label={intl.formatMessage(messages.type_of_outputs)}
356
+ values={type_of_outputs}
357
+ />
358
+ <VocabularyField
359
+ label={intl.formatMessage(messages.temporality_of_data)}
360
+ values={temporality_of_data}
361
+ />
362
+ <TextField
363
+ label={intl.formatMessage(messages.spatial_resolution)}
364
+ value={spatial_resolution}
365
+ />
366
+ <TextField
367
+ label={intl.formatMessage(messages.functionality)}
368
+ value={
369
+ functionality === null || functionality === undefined
370
+ ? null
371
+ : formatFunctionalityScore(functionality)
372
+ }
373
+ />
374
+ <TextField
375
+ label={intl.formatMessage(messages.underlying_data_maintenance)}
376
+ value={underlying_data_maintenance}
377
+ />
378
+ <VocabularyField
379
+ label={intl.formatMessage(messages.accessibility_and_usability)}
380
+ values={
381
+ accessibility_and_usability
382
+ ? [accessibility_and_usability]
383
+ : []
384
+ }
385
+ />
386
+ <TextField
387
+ label={intl.formatMessage(
388
+ messages.strengths_and_possible_limitations,
333
389
  )}
334
- <h5>{intl.formatMessage(messages.tool_available_language)}</h5>
335
- {tool_available_language_list.join(', ')}
336
- {type_of_outputs && type_of_outputs.length > 0 && (
337
- <>
338
- <h5>{intl.formatMessage(messages.type_of_outputs)}</h5>
339
- {type_of_outputs.map((item) => item.title).join(', ')}
340
- </>
341
- )}
342
- <h5>{intl.formatMessage(messages.tool_available_language)}</h5>
343
- {tool_available_english ? 'English' : tool_available_language}
344
- {temporality_of_data && temporality_of_data.length > 0 && (
345
- <>
346
- <h5>{intl.formatMessage(messages.temporality_of_data)}</h5>
347
- {temporality_of_data.map((item) => item.title).join(', ')}
348
- </>
349
- )}
350
- {spatial_resolution && spatial_resolution.length > 0 && (
351
- <p>
352
- <strong>
353
- {intl.formatMessage(messages.spatial_resolution)}
354
- </strong>
355
- {spatial_resolution}
356
- </p>
357
- )}
358
- <h5>{intl.formatMessage(messages.functionality)}</h5>
359
- <p>{functionality}</p>
360
- {underlying_data_maintenance && (
361
- <>
362
- <p>
363
- <strong>
364
- {intl.formatMessage(messages.underlying_data_maintenance)}
365
- </strong>
366
- </p>
367
- <p>{underlying_data_maintenance}</p>
368
- </>
369
- )}
370
- {accessibility_and_usability && (
371
- <>
372
- <p>
373
- <strong>
374
- {intl.formatMessage(messages.accessibility_and_usability)}
375
- </strong>
376
- </p>
377
- <p>{accessibility_and_usability.title}</p>
378
- </>
379
- )}
380
- {strengths_and_possible_limitations && (
381
- <>
382
- <p>
383
- <strong>
384
- {intl.formatMessage(
385
- messages.strengths_and_possible_limitations,
386
- )}
387
- </strong>
388
- </p>
389
- <p>{strengths_and_possible_limitations}</p>
390
- </>
391
- )}
390
+ value={strengths_and_possible_limitations}
391
+ />
392
392
  </Grid.Column>
393
393
  <Grid.Column
394
394
  mobile={12}