@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,74 +1,436 @@
1
1
  import React from 'react';
2
- import { MemoryRouter } from 'react-router-dom';
3
- import configureStore from 'redux-mock-store';
4
2
  import '@testing-library/jest-dom';
5
- import { Provider } from 'react-intl-redux';
3
+ import { fireEvent, render, screen } from '@testing-library/react';
4
+ import { IntlProvider } from 'react-intl';
5
+
6
6
  import ExtendedToolView from './ExtendedToolView';
7
- import renderer from 'react-test-renderer';
8
- import config from '@plone/volto/registry';
7
+ import { useCompareTools } from '../CompareTools/utils';
8
+ import { formatFunctionalityScore } from '../../Search/NavigatorCatalogue/utils';
9
+
10
+ jest.mock('../CompareTools/utils', () => ({
11
+ useCompareTools: jest.fn(),
12
+ }));
13
+
14
+ jest.mock('@eeacms/volto-cca-policy/components', () => ({
15
+ CompareToolsPanel: () => <div data-testid="compare-tools-panel" />,
16
+ PortalMessage: () => <div data-testid="portal-message" />,
17
+ }));
18
+
19
+ jest.mock('@eeacms/volto-cca-policy/helpers', () => ({
20
+ HTMLField: ({ value }) =>
21
+ value ? <div dangerouslySetInnerHTML={{ __html: value }} /> : null,
22
+
23
+ TextField: ({ label, value }) =>
24
+ value !== null && value !== undefined && value !== '' ? (
25
+ <div>
26
+ <span>{label}</span>
27
+ <span>{String(value)}</span>
28
+ </div>
29
+ ) : null,
30
+
31
+ BooleanField: ({ label, value, yesLabel, noLabel }) => (
32
+ <div>
33
+ <span>{label}</span>
34
+ <span>{value ? yesLabel : noLabel}</span>
35
+ </div>
36
+ ),
37
+
38
+ VocabularyField: ({ label, values = [] }) =>
39
+ values.length > 0 ? (
40
+ <div>
41
+ <span>{label}</span>
42
+ <span>{values.join(', ')}</span>
43
+ </div>
44
+ ) : null,
9
45
 
10
- config.blocks = {
11
- blocksConfig: {
12
- title: {
13
- view: () => <div>Title Block Component</div>,
46
+ ContentMetadata: () => <div data-testid="content-metadata" />,
47
+ ItemLogo: () => <div data-testid="item-logo" />,
48
+ DocumentsList: () => <div data-testid="documents-list" />,
49
+ }));
50
+
51
+ jest.mock('@plone/volto/registry', () => ({
52
+ blocks: {
53
+ blocksConfig: {
54
+ title: {
55
+ view: ({ metadata }) => <h1>{metadata.title}</h1>,
56
+ },
14
57
  },
15
58
  },
16
- };
17
-
18
- const mockStore = configureStore();
59
+ }));
19
60
 
20
- jest.mock('semantic-ui-react', () => ({
21
- ...jest.requireActual('semantic-ui-react'),
61
+ jest.mock('../../Search/NavigatorCatalogue/utils', () => ({
62
+ formatFunctionalityScore: jest.fn((value) => `Formatted score: ${value}`),
22
63
  }));
23
64
 
24
- jest.mock('@eeacms/volto-embed', () => {
25
- return {
26
- PrivacyProtection: jest.fn(({ children }) => <div>{children}</div>),
27
- };
28
- });
65
+ const toggle = jest.fn();
66
+
67
+ const renderComponent = (content = {}) =>
68
+ render(
69
+ <IntlProvider locale="en" messages={{}}>
70
+ <ExtendedToolView content={content} />
71
+ </IntlProvider>,
72
+ );
29
73
 
30
74
  describe('ExtendedToolView', () => {
31
- it('should render the component', () => {
32
- const content = {
33
- title: 'My ExtendedToolView',
34
- long_description: {
35
- 'content-type': null,
36
- data: '<p>Nam commodo suscipit quam. Praesent egestas neque eu enim. Quisque rutrum.</p>',
37
- encoding: 'utf-8',
38
- },
39
- publication_date: '2022-06-24',
40
- geochars:
41
- '{\r\n "geoElements":{"element":"GLOBAL",\r\n "macrotrans":null,"biotrans":null,"countries":[],\r\n "subnational":[],"city":""}}',
42
- keywords: ['keyword 1', 'keyword 2'],
43
- websites: ['https://example.org/'],
44
- contributions: [
45
- {
46
- title: 'Contributor 1',
47
- url: '/contributor-1',
48
- },
49
- {
50
- title: 'Contributor 2',
51
- url: '/contributor-2',
52
- },
53
- ],
54
- };
55
-
56
- const store = mockStore({
57
- userSession: { token: '1234' },
58
- intl: {
59
- locale: 'en',
60
- messages: {},
61
- },
75
+ beforeEach(() => {
76
+ jest.clearAllMocks();
77
+
78
+ useCompareTools.mockReturnValue({
79
+ isSelected: false,
80
+ isLimitReached: false,
81
+ toggle,
82
+ });
83
+ });
84
+
85
+ it('renders the title and acronym', () => {
86
+ renderComponent({
87
+ title: 'Climate Tool',
88
+ acronym: 'CT',
89
+ });
90
+
91
+ expect(
92
+ screen.getByRole('heading', {
93
+ name: 'Climate Tool (CT)',
94
+ }),
95
+ ).toBeInTheDocument();
96
+ });
97
+
98
+ it('renders the title without an acronym', () => {
99
+ renderComponent({
100
+ title: 'Climate Tool',
101
+ });
102
+
103
+ expect(
104
+ screen.getByRole('heading', {
105
+ name: 'Climate Tool',
106
+ }),
107
+ ).toBeInTheDocument();
108
+ });
109
+
110
+ it('renders the open-tool button when a hyperlink is provided', () => {
111
+ renderComponent({
112
+ title: 'Climate Tool',
113
+ hyperlink: 'https://example.com/tool',
114
+ });
115
+
116
+ const openToolButton = screen.getByRole('button', {
117
+ name: /open tool/i,
118
+ });
119
+
120
+ expect(openToolButton).toHaveAttribute('href', 'https://example.com/tool');
121
+ expect(openToolButton).toHaveAttribute('target', '_blank');
122
+ expect(openToolButton).toHaveAttribute('rel', 'noopener noreferrer');
123
+ });
124
+
125
+ it('does not render the open-tool button without a hyperlink', () => {
126
+ renderComponent({
127
+ title: 'Climate Tool',
128
+ });
129
+
130
+ expect(
131
+ screen.queryByRole('button', {
132
+ name: /open tool/i,
133
+ }),
134
+ ).not.toBeInTheDocument();
135
+ });
136
+
137
+ it('adds the tool to comparison when the button is clicked', () => {
138
+ renderComponent({
139
+ UID: 'tool-uid',
140
+ '@id': '/tools/climate-tool',
141
+ title: 'Climate Tool',
62
142
  });
63
143
 
64
- const component = renderer.create(
65
- <Provider store={store}>
66
- <MemoryRouter>
67
- <ExtendedToolView content={content} />
68
- </MemoryRouter>
69
- </Provider>,
144
+ fireEvent.click(
145
+ screen.getByRole('button', {
146
+ name: /add to comparison/i,
147
+ }),
70
148
  );
71
- const json = component.toJSON();
72
- expect(json).toMatchSnapshot();
149
+
150
+ expect(toggle).toHaveBeenCalledTimes(1);
151
+ });
152
+
153
+ it('passes the correct tool data to useCompareTools', () => {
154
+ renderComponent({
155
+ UID: 'tool-uid',
156
+ '@id': '/tools/climate-tool',
157
+ title: 'Climate Tool',
158
+ });
159
+
160
+ expect(useCompareTools).toHaveBeenCalledWith({
161
+ uid: 'tool-uid',
162
+ title: 'Climate Tool',
163
+ href: '/tools/climate-tool',
164
+ });
165
+ });
166
+
167
+ it('disables the comparison button when the tool is selected', () => {
168
+ useCompareTools.mockReturnValue({
169
+ isSelected: true,
170
+ isLimitReached: false,
171
+ toggle,
172
+ });
173
+
174
+ renderComponent({
175
+ UID: 'tool-uid',
176
+ '@id': '/tools/climate-tool',
177
+ title: 'Climate Tool',
178
+ });
179
+
180
+ const button = screen.getByRole('button', {
181
+ name: /add to comparison/i,
182
+ });
183
+
184
+ expect(button).toBeDisabled();
185
+ });
186
+
187
+ it('disables the comparison button when the comparison limit is reached', () => {
188
+ useCompareTools.mockReturnValue({
189
+ isSelected: false,
190
+ isLimitReached: true,
191
+ toggle,
192
+ });
193
+
194
+ renderComponent({
195
+ UID: 'tool-uid',
196
+ '@id': '/tools/climate-tool',
197
+ title: 'Climate Tool',
198
+ });
199
+
200
+ const button = screen.getByRole('button', {
201
+ name: /add to comparison/i,
202
+ });
203
+
204
+ expect(button).toBeDisabled();
205
+ });
206
+
207
+ it('does not call toggle when the comparison button is disabled', () => {
208
+ useCompareTools.mockReturnValue({
209
+ isSelected: true,
210
+ isLimitReached: false,
211
+ toggle,
212
+ });
213
+
214
+ renderComponent({
215
+ UID: 'tool-uid',
216
+ '@id': '/tools/climate-tool',
217
+ title: 'Climate Tool',
218
+ });
219
+
220
+ const button = screen.getByRole('button', {
221
+ name: /add to comparison/i,
222
+ });
223
+
224
+ fireEvent.click(button);
225
+
226
+ expect(toggle).not.toHaveBeenCalled();
227
+ });
228
+
229
+ it('does not render the comparison button without a UID', () => {
230
+ renderComponent({
231
+ title: 'Climate Tool',
232
+ });
233
+
234
+ expect(
235
+ screen.queryByRole('button', {
236
+ name: /add to comparison/i,
237
+ }),
238
+ ).not.toBeInTheDocument();
239
+ });
240
+
241
+ it('renders English and the additional available language', () => {
242
+ renderComponent({
243
+ title: 'Climate Tool',
244
+ tool_available_english: true,
245
+ tool_available_language: 'French',
246
+ });
247
+
248
+ expect(screen.getByText('English, French')).toBeInTheDocument();
249
+ });
250
+
251
+ it('renders only English when no additional language is provided', () => {
252
+ renderComponent({
253
+ title: 'Climate Tool',
254
+ tool_available_english: true,
255
+ });
256
+
257
+ expect(screen.getByText('English')).toBeInTheDocument();
258
+ });
259
+
260
+ it('renders only the additional language when English is unavailable', () => {
261
+ renderComponent({
262
+ title: 'Climate Tool',
263
+ tool_available_english: false,
264
+ tool_available_language: 'Romanian',
265
+ });
266
+
267
+ expect(screen.getByText('Romanian')).toBeInTheDocument();
268
+ expect(screen.queryByText(/English,/)).not.toBeInTheDocument();
269
+ });
270
+
271
+ it('does not render an available-language value when none exists', () => {
272
+ renderComponent({
273
+ title: 'Climate Tool',
274
+ tool_available_english: false,
275
+ tool_available_language: '',
276
+ });
277
+
278
+ expect(screen.queryByText('Available language')).not.toBeInTheDocument();
279
+ });
280
+
281
+ it('formats the functionality score', () => {
282
+ renderComponent({
283
+ title: 'Climate Tool',
284
+ functionality: 4,
285
+ });
286
+
287
+ expect(formatFunctionalityScore).toHaveBeenCalledWith(4);
288
+ expect(screen.getByText('Formatted score: 4')).toBeInTheDocument();
289
+ });
290
+
291
+ it('formats a functionality score of zero', () => {
292
+ renderComponent({
293
+ title: 'Climate Tool',
294
+ functionality: 0,
295
+ });
296
+
297
+ expect(formatFunctionalityScore).toHaveBeenCalledWith(0);
298
+ expect(screen.getByText('Formatted score: 0')).toBeInTheDocument();
299
+ });
300
+
301
+ it('does not format an undefined functionality score', () => {
302
+ renderComponent({
303
+ title: 'Climate Tool',
304
+ });
305
+
306
+ expect(formatFunctionalityScore).not.toHaveBeenCalled();
307
+ });
308
+
309
+ it('does not format a null functionality score', () => {
310
+ renderComponent({
311
+ title: 'Climate Tool',
312
+ functionality: null,
313
+ });
314
+
315
+ expect(formatFunctionalityScore).not.toHaveBeenCalled();
316
+ });
317
+
318
+ it('renders text fields', () => {
319
+ renderComponent({
320
+ title: 'Climate Tool',
321
+ tool_provider: 'Example Provider',
322
+ public_private_mode: 'Public',
323
+ spatial_resolution: 'Regional',
324
+ underlying_data_maintenance: 'Updated yearly',
325
+ strengths_and_possible_limitations: 'Easy to use',
326
+ });
327
+
328
+ expect(screen.getByText('Example Provider')).toBeInTheDocument();
329
+ expect(screen.getByText('Public')).toBeInTheDocument();
330
+ expect(screen.getByText('Regional')).toBeInTheDocument();
331
+ expect(screen.getByText('Updated yearly')).toBeInTheDocument();
332
+ expect(screen.getByText('Easy to use')).toBeInTheDocument();
333
+ });
334
+
335
+ it('renders coder fields', () => {
336
+ renderComponent({
337
+ title: 'Climate Tool',
338
+ coder_1: 'Coder One',
339
+ coder_2: 'Coder Two',
340
+ });
341
+
342
+ expect(screen.getByText('Coder1')).toBeInTheDocument();
343
+ expect(screen.getByText('Coder One')).toBeInTheDocument();
344
+ expect(screen.getByText('Coder2')).toBeInTheDocument();
345
+ expect(screen.getByText('Coder Two')).toBeInTheDocument();
346
+ });
347
+
348
+ it('renders HTML descriptions', () => {
349
+ renderComponent({
350
+ title: 'Climate Tool',
351
+ long_description: '<p>Long tool description</p>',
352
+ description: '<p>Short tool description</p>',
353
+ });
354
+
355
+ expect(screen.getByText('Long tool description')).toBeInTheDocument();
356
+ expect(screen.getByText('Short tool description')).toBeInTheDocument();
357
+ });
358
+
359
+ it('renders boolean fields with YES values', () => {
360
+ renderComponent({
361
+ title: 'Climate Tool',
362
+ only_interactive_support_tool: true,
363
+ adaptation_cycle_step: true,
364
+ updating_cycle_of_the_tool: true,
365
+ language_accessibility: true,
366
+ free_access: true,
367
+ });
368
+
369
+ expect(screen.getAllByText('YES')).toHaveLength(5);
370
+ });
371
+
372
+ it('renders boolean fields with NO values', () => {
373
+ renderComponent({
374
+ title: 'Climate Tool',
375
+ only_interactive_support_tool: false,
376
+ adaptation_cycle_step: false,
377
+ updating_cycle_of_the_tool: false,
378
+ language_accessibility: false,
379
+ free_access: false,
380
+ });
381
+
382
+ expect(screen.getAllByText('NO')).toHaveLength(5);
383
+ });
384
+
385
+ it('renders vocabulary fields', () => {
386
+ renderComponent({
387
+ title: 'Climate Tool',
388
+ intended_user_groups: ['Policy makers', 'Researchers'],
389
+ place_of_implementation: ['Europe'],
390
+ type_of_data: ['Climate data'],
391
+ data_sources: ['Satellite'],
392
+ license_status: ['Open source'],
393
+ user_support_provisions: ['Documentation'],
394
+ tool_validation_use: ['Validated'],
395
+ number_of_users_tool: ['More than 1,000'],
396
+ tool_provider_mode: ['Public provider'],
397
+ adaptation_support_cycle_step: ['Assessing risks'],
398
+ type_of_outputs: ['Maps'],
399
+ temporality_of_data: ['Historical'],
400
+ });
401
+
402
+ expect(screen.getByText('Policy makers, Researchers')).toBeInTheDocument();
403
+ expect(screen.getByText('Europe')).toBeInTheDocument();
404
+ expect(screen.getByText('Climate data')).toBeInTheDocument();
405
+ expect(screen.getByText('Satellite')).toBeInTheDocument();
406
+ expect(screen.getByText('Open source')).toBeInTheDocument();
407
+ expect(screen.getByText('Documentation')).toBeInTheDocument();
408
+ expect(screen.getByText('Validated')).toBeInTheDocument();
409
+ expect(screen.getByText('More than 1,000')).toBeInTheDocument();
410
+ expect(screen.getByText('Public provider')).toBeInTheDocument();
411
+ expect(screen.getByText('Assessing risks')).toBeInTheDocument();
412
+ expect(screen.getByText('Maps')).toBeInTheDocument();
413
+ expect(screen.getByText('Historical')).toBeInTheDocument();
414
+ });
415
+
416
+ it('renders accessibility and usability as a vocabulary value', () => {
417
+ renderComponent({
418
+ title: 'Climate Tool',
419
+ accessibility_and_usability: 'Easy to use',
420
+ });
421
+
422
+ expect(screen.getByText('Easy to use')).toBeInTheDocument();
423
+ });
424
+
425
+ it('renders supporting components', () => {
426
+ renderComponent({
427
+ title: 'Climate Tool',
428
+ });
429
+
430
+ expect(screen.getByTestId('item-logo')).toBeInTheDocument();
431
+ expect(screen.getByTestId('compare-tools-panel')).toBeInTheDocument();
432
+ expect(screen.getByTestId('portal-message')).toBeInTheDocument();
433
+ expect(screen.getByTestId('content-metadata')).toBeInTheDocument();
434
+ expect(screen.getByTestId('documents-list')).toBeInTheDocument();
73
435
  });
74
436
  });
package/src/constants.js CHANGED
@@ -123,54 +123,6 @@ export const DOWNLOAD_MISSION_FUNDING_FIELDS = [
123
123
  },
124
124
  ];
125
125
 
126
- // Download fields for mission content types
127
- // Don't delete - might be needed later (ticket refs #295149)
128
- // export const DOWNLOAD_MISSION_STORIES_FIELDS = [
129
- // { field: 'about', name: 'About' },
130
- // { field: 'title', name: 'Title' },
131
- // { field: 'main_content', name: 'Content' },
132
- // { field: 'created', name: 'Creation Date' },
133
- // { field: 'issued', name: 'Issued Date' },
134
- // { field: 'cca_climate_impacts', name: 'Climate impact' },
135
- // { field: 'cca_adaptation_sectors', name: 'Sectors' },
136
- // { field: 'key_system', name: 'Key Community Systems' },
137
- // { field: 'cca_funding_programme', name: 'Funding programme' },
138
- // {
139
- // field: 'spatial',
140
- // name: 'Countries ',
141
- // },
142
- // { field: 'cca_keywords', name: 'Keywords' },
143
- // ];
144
-
145
- // export const DOWNLOAD_MISSION_PROJECTS_FIELDS = [
146
- // { field: 'about', name: 'About' },
147
- // { field: 'title', name: 'Title' },
148
- // { field: 'main_content', name: 'Content' },
149
- // { field: 'created', name: 'Creation Date' },
150
- // { field: 'issued', name: 'Issued Date' },
151
- // { field: 'cca_keywords', name: 'Keywords' },
152
- // { field: 'cca_funding_programme', name: 'Funding Programme' },
153
- // { field: 'cca_climate_impacts', name: 'Climate impact' },
154
- // { field: 'cca_adaptation_elements', name: 'Adaptation Approaches' },
155
- // { field: 'cca_adaptation_sectors', name: 'Sectors' },
156
- // { field: 'cca_geographic_countries', name: 'Countries' },
157
- // ];
158
-
159
- // export const DOWNLOAD_MISSION_TOOLS_FIELDS = [
160
- // { field: 'about', name: 'About' },
161
- // { field: 'title', name: 'Title' },
162
- // { field: 'main_content', name: 'Content' },
163
- // { field: 'created', name: 'Creation Date' },
164
- // { field: 'issued', name: 'Issued Date' },
165
- // { field: 'cca_rast_steps', name: 'RAST step(s) of relevance' },
166
- // { field: 'cca_geographical_scale', name: 'Geographical scale' },
167
- // { field: 'cca_climate_impacts', name: 'Climate impact' },
168
- // { field: 'cca_tool_language', name: 'Language(s) of the tool' },
169
- // { field: 'cca_adaptation_sectors', name: 'Sectors' },
170
- // { field: 'cca_most_useful_for', name: 'Most useful for' },
171
- // { field: 'cca_user_requirements', name: 'User requirements' },
172
- // ];
173
-
174
126
  export const EEA_LANGUAGES = [
175
127
  { name: 'български', code: 'bg' },
176
128
  { name: 'Español', code: 'es' },
@@ -67,7 +67,7 @@ export default function breadcrumbs(state = initialState, action = {}) {
67
67
  'breadcrumbs',
68
68
  getBaseUrl(flattenToAppURL(action.result['@id'])),
69
69
  );
70
- if (!hasExpander) {
70
+ if (action.manual || !hasExpander) {
71
71
  return {
72
72
  ...state,
73
73
  error: null,
@@ -62,6 +62,35 @@ export const HTMLField = ({ value, className }) => {
62
62
  );
63
63
  };
64
64
 
65
+ export const TextField = ({ label, value }) => {
66
+ if (value === null || value === undefined || value === '') return null;
67
+
68
+ return (
69
+ <>
70
+ <h5>{label}</h5>
71
+ <p>{value}</p>
72
+ </>
73
+ );
74
+ };
75
+
76
+ export const BooleanField = ({ label, value, yesLabel, noLabel }) => (
77
+ <TextField label={label} value={value ? yesLabel : noLabel} />
78
+ );
79
+
80
+ export const VocabularyField = ({ label, values }) => {
81
+ if (!values?.length) return null;
82
+
83
+ return (
84
+ <TextField
85
+ label={label}
86
+ value={values
87
+ .map((value) => value?.title || value?.token || value)
88
+ .filter(Boolean)
89
+ .join(', ')}
90
+ />
91
+ );
92
+ };
93
+
65
94
  export const ExternalLink = (props) => {
66
95
  let { url, text } = props;
67
96
 
@@ -1,6 +1,9 @@
1
1
  import { OBSERVATORY_PARTNERS } from '@eeacms/volto-cca-policy/constants';
2
2
  export {
3
3
  HTMLField,
4
+ TextField,
5
+ BooleanField,
6
+ VocabularyField,
4
7
  ExternalLink,
5
8
  PublishedModifiedInfo,
6
9
  LinksList,
package/src/index.js CHANGED
@@ -13,6 +13,7 @@ import {
13
13
  MissionSignatoryProfileView,
14
14
  CreateArchivedCopyButton,
15
15
  ImageWidget,
16
+ CompareToolsView,
16
17
  } from '@eeacms/volto-cca-policy/components';
17
18
 
18
19
  import CcaEventView from './components/theme/Views/CcaEventView';
@@ -49,6 +50,11 @@ import GeocharsWidget from './components/theme/Widgets/GeocharsWidget';
49
50
  import PromotionalImageWidget from './components/theme/Widgets/PromotionalImageWidget';
50
51
  import HealthHorizontalCardItem from './components/Result/HealthHorizontalCardItem';
51
52
  import ClusterHorizontalCardItem from './components/Result/ClusterHorizontalCardItem';
53
+ import NavigatorCatalogueCardItem from './components/Search/NavigatorCatalogue/NavigatorCatalogueCardItem';
54
+ import NavigatorCatalogueMapView from './components/Search/NavigatorCatalogue/NavigatorCatalogueMapView';
55
+ import NavigatorCatalogueContentView from './components/Search/NavigatorCatalogue/NavigatorCatalogueContentView';
56
+ import NavigatorGuideLayout from './components/Search/NavigatorGuide/NavigatorGuideLayout';
57
+ import NavigatorGuideContentView from './components/Search/NavigatorGuide/NavigatorGuideContentView';
52
58
 
53
59
  import { langRedirection } from './store/middleware';
54
60
 
@@ -418,6 +424,21 @@ const applyConfig = (config) => {
418
424
  config.settings.searchlib.resolve.ClusterHorizontalCardItem = {
419
425
  component: ClusterHorizontalCardItem,
420
426
  };
427
+ config.settings.searchlib.resolve.NavigatorCatalogueCardItem = {
428
+ component: NavigatorCatalogueCardItem,
429
+ };
430
+ config.settings.searchlib.resolve.NavigatorCatalogueMapView = {
431
+ component: NavigatorCatalogueMapView,
432
+ };
433
+ config.settings.searchlib.resolve.NavigatorCatalogueContentView = {
434
+ component: NavigatorCatalogueContentView,
435
+ };
436
+ config.settings.searchlib.resolve.NavigatorGuideLayout = {
437
+ component: NavigatorGuideLayout,
438
+ };
439
+ config.settings.searchlib.resolve.NavigatorGuideContentView = {
440
+ component: NavigatorGuideContentView,
441
+ };
421
442
  // Custom widgets
422
443
  config.widgets.id.geochars = GeocharsWidget;
423
444
  config.widgets.id.geolocation = GeolocationWidget;
@@ -434,6 +455,7 @@ const applyConfig = (config) => {
434
455
  { cssClass: 'large-text', label: 'Large text' },
435
456
  { cssClass: 'medium-text', label: 'Medium text' },
436
457
  { cssClass: 'small-text', label: 'Small text' },
458
+ { cssClass: 'green-text', label: 'Green text' },
437
459
  ];
438
460
 
439
461
  // TODO: fix in all languages
@@ -496,13 +518,17 @@ const applyConfig = (config) => {
496
518
  path: `/broken-links`,
497
519
  component: BrokenLinks,
498
520
  },
499
-
521
+ {
522
+ path: `*/navigator/compare`,
523
+ component: CompareToolsView,
524
+ },
500
525
  ...(config.addonRoutes || []),
501
526
  ];
502
527
 
503
528
  config.settings.nonContentRoutes = [
504
529
  ...config.settings.nonContentRoutes,
505
530
  '/broken-links',
531
+ '/navigator/compare',
506
532
  ];
507
533
 
508
534
  config.settings.appExtras = [
@@ -568,7 +594,7 @@ const applyConfig = (config) => {
568
594
 
569
595
  config.settings.themeColors = [
570
596
  ...config.settings.themeColors,
571
- { value: 'green', title: 'EEA Green' },
597
+ { value: 'green', title: 'Green' },
572
598
  ];
573
599
 
574
600
  config.settings.matomoTrackerIdFn = (pathname) => {