@eeacms/volto-cca-policy 1.0.6 → 1.0.8

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 (124) hide show
  1. package/CHANGELOG.md +65 -1
  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/manage/Widgets/VisualizationsWidget.jsx +151 -0
  43. package/src/components/manage/Widgets/visualizations.less +60 -0
  44. package/src/components/theme/Content/Fields/BooleanField.jsx +7 -0
  45. package/src/components/theme/Content/Fields/HTMLField.jsx +14 -0
  46. package/src/components/theme/Content/Fields/TextField.jsx +12 -0
  47. package/src/components/theme/Content/Fields/VocabularyField.jsx +26 -0
  48. package/src/components/theme/Content/Fields/index.js +4 -0
  49. package/src/components/theme/Content/Sections/ContentBannerTitle.jsx +26 -0
  50. package/src/{helpers → components/theme/Content/Sections}/ContentMetadata.jsx +11 -312
  51. package/src/components/theme/Content/Sections/ContentRelatedItems.jsx +35 -0
  52. package/src/components/theme/Content/Sections/DocumentsList.jsx +80 -0
  53. package/src/components/theme/Content/Sections/EventDetails.jsx +90 -0
  54. package/src/components/theme/Content/Sections/GeographicMetadata.jsx +83 -0
  55. package/src/components/theme/Content/Sections/ImageGallery/index.js +1 -0
  56. package/src/components/theme/Content/Sections/ItemLogo.jsx +29 -0
  57. package/src/components/theme/Content/Sections/LinkedMetadataItemList.jsx +63 -0
  58. package/src/components/theme/Content/Sections/LinksList.jsx +48 -0
  59. package/src/components/theme/Content/Sections/MetadataItemList.jsx +43 -0
  60. package/src/components/theme/Content/Sections/PublicationDateInfo.jsx +62 -0
  61. package/src/components/theme/Content/Sections/PublishedModifiedInfo.jsx +33 -0
  62. package/src/components/theme/Content/Sections/ReferenceInfo.jsx +137 -0
  63. package/src/components/theme/Content/Sections/ShareInfoButton.jsx +24 -0
  64. package/src/components/theme/Content/Sections/SubjectTags.jsx +19 -0
  65. package/src/components/theme/Content/Sections/Versioning/index.js +3 -0
  66. package/src/components/theme/Content/Sections/geographicMetadataUtils.js +177 -0
  67. package/src/components/theme/Content/Sections/index.js +17 -0
  68. package/src/components/theme/Content/index.js +20 -0
  69. package/src/components/theme/Views/AdaptationOptionView.jsx +6 -8
  70. package/src/components/theme/Views/AdaptationOptionView.test.jsx +5 -8
  71. package/src/components/theme/Views/C3SIndicatorView.jsx +5 -5
  72. package/src/components/theme/Views/CaseStudyView.jsx +6 -8
  73. package/src/components/theme/Views/CcaEventView.jsx +4 -4
  74. package/src/components/theme/Views/DatabaseItemView.jsx +79 -40
  75. package/src/components/theme/Views/DatabaseItemView.test.jsx +98 -38
  76. package/src/components/theme/Views/EventView.jsx +3 -3
  77. package/src/components/theme/Views/ExtendedToolView.jsx +6 -8
  78. package/src/components/theme/Views/ExtendedToolView.test.jsx +10 -16
  79. package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/MissionSignatoryProfileView.jsx +5 -2
  80. package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/MissionSignatoryProfileView.test.jsx +2 -2
  81. package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/TabSections/ActionTab.jsx +1 -2
  82. package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/TabSections/ActionTab.test.jsx +3 -0
  83. package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/TabSections/AssessmentTab.jsx +1 -2
  84. package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/TabSections/AssessmentTab.test.jsx +11 -1
  85. package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/TabSections/GovernanceTab.jsx +1 -2
  86. package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/TabSections/PlanningTab.jsx +1 -2
  87. package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/TabSections/PlanningTab.test.jsx +11 -1
  88. package/src/components/theme/Views/NewsItemView.jsx +5 -2
  89. package/src/components/theme/Views/ProjectView.jsx +4 -6
  90. package/src/constants.js +7 -0
  91. package/src/helpers/countryMap.js +1 -4
  92. package/src/helpers/embed.js +11 -0
  93. package/src/helpers/index.js +13 -101
  94. package/src/helpers/string.js +4 -0
  95. package/src/hocs/index.js +1 -0
  96. package/src/{helpers/clientOnly.jsx → hocs/withClientOnly.jsx} +1 -1
  97. package/src/index.js +5 -3
  98. package/src/search/queryUtils.js +64 -0
  99. package/src/components/theme/ShareInfoButton/ShareInfoButton.jsx +0 -26
  100. package/src/components/theme/Widgets/ImageWidget.test.jsx +0 -90
  101. package/src/helpers/Utils.jsx +0 -620
  102. /package/src/components/manage/{TransparentOverlay.jsx → Blocks/CollectionStatistics/TransparentOverlay.jsx} +0 -0
  103. /package/src/components/{theme → manage}/Widgets/GeocharsWidget.jsx +0 -0
  104. /package/src/components/{theme → manage}/Widgets/GeolocationWidgetMapContainer.jsx +0 -0
  105. /package/src/components/{theme → manage}/Widgets/PromotionalImageWidget.jsx +0 -0
  106. /package/src/components/{theme → manage}/Widgets/RASTWidgetView.jsx +0 -0
  107. /package/src/components/{theme → manage}/Widgets/__mocks__/GeolocationWidgetMapContainer.jsx +0 -0
  108. /package/src/components/{theme → manage}/Widgets/utils.js +0 -0
  109. /package/src/components/theme/{ImageGallery → Content/Sections/ImageGallery}/ImageGallery.jsx +0 -0
  110. /package/src/components/theme/{ImageGallery → Content/Sections/ImageGallery}/ImageGallery.test.jsx +0 -0
  111. /package/src/components/theme/{ImageGallery → Content/Sections/ImageGallery}/styles.less +0 -0
  112. /package/src/components/theme/{Views → Content/Sections/Versioning}/ArchivedVersionListing.jsx +0 -0
  113. /package/src/components/theme/{Views → Content/Sections/Versioning}/ArchivedVersionListing.test.jsx +0 -0
  114. /package/src/components/theme/{Views → Content/Sections/Versioning}/ArchivedVersionNotice.jsx +0 -0
  115. /package/src/components/theme/{Views → Content/Sections/Versioning}/ArchivedVersionNotice.test.jsx +0 -0
  116. /package/src/components/theme/{Views → Content/Sections/Versioning}/VersionsGroup.jsx +0 -0
  117. /package/src/components/theme/{Views → Content/Sections/Versioning}/VersionsGroup.test.jsx +0 -0
  118. /package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/ItemsSection.jsx +0 -0
  119. /package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/ItemsSection.test.jsx +0 -0
  120. /package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/NoDataReported.jsx +0 -0
  121. /package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/NoDataReported.test.jsx +0 -0
  122. /package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/StatisticSection.jsx +0 -0
  123. /package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/StatisticSection.test.jsx +0 -0
  124. /package/src/components/theme/{MissionSignatoryProfile → Views/MissionSignatoryProfile}/TabSections/GovernanceTab.test.jsx +0 -0
@@ -2,7 +2,17 @@ import '@testing-library/jest-dom';
2
2
  import { render } from '@testing-library/react';
3
3
  import PlanningTab from './PlanningTab';
4
4
 
5
- jest.mock('@eeacms/volto-cca-policy/helpers', () => ({
5
+ jest.mock('@eeacms/volto-cca-policy/components', () => ({
6
+ AccordionList: ({ accordions }) => (
7
+ <div>
8
+ {accordions.map((item, index) => (
9
+ <div key={index}>
10
+ <div>{item.title}</div>
11
+ <div>{item.content}</div>
12
+ </div>
13
+ ))}
14
+ </div>
15
+ ),
6
16
  HTMLField: ({ value }) => (
7
17
  <div dangerouslySetInnerHTML={{ __html: value.data }} />
8
18
  ),
@@ -1,8 +1,11 @@
1
1
  import React from 'react';
2
2
  import { Container } from 'semantic-ui-react';
3
3
  import { filterBlocks } from '@eeacms/volto-cca-policy/utils';
4
- import { HTMLField, SubjectTags } from '@eeacms/volto-cca-policy/helpers';
5
- import { PortalMessage } from '@eeacms/volto-cca-policy/components';
4
+ import {
5
+ HTMLField,
6
+ PortalMessage,
7
+ SubjectTags,
8
+ } from '@eeacms/volto-cca-policy/components';
6
9
  import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
7
10
  import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
8
11
 
@@ -1,15 +1,13 @@
1
1
  import React from 'react';
2
+ import { Container, Divider, Grid } from 'semantic-ui-react';
2
3
  import {
3
- HTMLField,
4
4
  ContentMetadata,
5
- PublishedModifiedInfo,
5
+ HTMLField,
6
6
  ItemLogo,
7
+ PortalMessage,
8
+ PublishedModifiedInfo,
7
9
  ReferenceInfo,
8
- } from '@eeacms/volto-cca-policy/helpers';
9
- import { Container, Divider, Grid } from 'semantic-ui-react';
10
- import {
11
10
  ShareInfoButton,
12
- PortalMessage,
13
11
  } from '@eeacms/volto-cca-policy/components';
14
12
 
15
13
  import { FormattedMessage } from 'react-intl';
package/src/constants.js CHANGED
@@ -43,10 +43,17 @@ export const DOWNLOAD_FIELDS = [
43
43
  { field: 'cca_keywords', name: 'Keywords' },
44
44
  { field: 'cca_adaptation_sectors', name: 'Sectors' },
45
45
  { field: 'cca_climate_impacts', name: 'Climate impact' },
46
+ { field: 'cca_governance_level_list', name: 'Governance level' },
47
+ {
48
+ field: 'cca_geographic_characterisation',
49
+ name: 'Geographic characterization',
50
+ },
46
51
  {
47
52
  field: 'cca_geographic_transnational_region',
48
53
  name: 'Transnational regions',
49
54
  },
55
+ { field: 'cca_sub_nationals', name: 'Sub national regions' },
56
+ { field: 'cca_city', name: 'City' },
50
57
  { field: 'cca_adaptation_elements', name: 'Adaptation Approaches' },
51
58
  { field: 'cca_funding_programme', name: 'Funding programme' },
52
59
  { field: 'cca_key_type_measure', name: 'Key type measure' },
@@ -1,6 +1,3 @@
1
- // import React, { useEffect } from 'react';
2
- // import flags from './flags.js';
3
-
4
1
  export const euCountryNames = [
5
2
  'Austria',
6
3
  'Belgium',
@@ -38,7 +35,7 @@ export const euCountryNames = [
38
35
  'Turkey',
39
36
  ];
40
37
 
41
- export const euCountryNamesEnergy = [
38
+ const euCountryNamesEnergy = [
42
39
  'Albania',
43
40
  'Bosnia-Herzegovina',
44
41
  'Bosnia and Herzegovina',
@@ -0,0 +1,11 @@
1
+ export const fixEmbedURL = (url, is_cmshare_video) => {
2
+ const suffix = '/download';
3
+
4
+ if (!is_cmshare_video) return url;
5
+
6
+ const base = url.split('?')[0];
7
+
8
+ if (base.endsWith(suffix)) return base;
9
+
10
+ return base + suffix;
11
+ };
@@ -1,102 +1,14 @@
1
- import { OBSERVATORY_PARTNERS } from '@eeacms/volto-cca-policy/constants';
1
+ export { fixEmbedURL } from './embed';
2
+ export { capitalizeFirstLetter } from './string';
2
3
  export {
3
- HTMLField,
4
- TextField,
5
- BooleanField,
6
- VocabularyField,
7
- ExternalLink,
8
- PublishedModifiedInfo,
9
- LinksList,
10
- DocumentsList,
11
- ReferenceInfo,
12
- BannerTitle,
13
- LogoWrapper,
14
- ContentRelatedItems,
15
- ItemLogo,
16
- SubjectTags,
17
- EventDetails,
18
- MetadataItemList,
19
- LinkedMetadataItemList,
20
- } from './Utils';
21
- export { default as ContentMetadata } from './ContentMetadata';
22
- export { default as clientOnly } from './clientOnly';
23
-
24
- export const capitalizeFirstLetter = (str) =>
25
- str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
26
-
27
- export const addFilterParams = (params, filters) => {
28
- filters.forEach((f, i) => {
29
- params.set(`filters[${i}][field]`, f.field);
30
- params.set(`filters[${i}][type]`, f.type);
31
- (f.values || []).forEach((val, vi) => {
32
- params.set(`filters[${i}][values][${vi}]`, val);
33
- });
34
- });
35
- };
36
-
37
- export const makeContributionsSearchQuery = ({ id } = {}) => {
38
- const organisation = OBSERVATORY_PARTNERS?.[id];
39
- const base = '/en/observatory/advanced-search';
40
-
41
- // If partner is missing, fall back to base (or return null if you prefer)
42
- if (!organisation) return `${base}?size=n_10_n`;
43
-
44
- const params = new URLSearchParams();
45
- params.set('size', 'n_10_n');
46
-
47
- addFilterParams(params, [
48
- {
49
- field: 'cca_partner_contributors.keyword',
50
- type: 'any',
51
- values: [organisation],
52
- },
53
- { field: 'issued.date', type: 'any', values: ['All time'] },
54
- { field: 'language', type: 'any', values: ['en'] },
55
- ]);
56
-
57
- params.set('sort-field', 'issued.date');
58
- params.set('sort-direction', 'desc');
59
-
60
- return `${base}?${params.toString()}`;
61
- };
62
-
63
- export const makeAdvancedSearchQuery = ({ field, value }) => {
64
- const base = '/en/data-and-downloads/';
65
- const params = new URLSearchParams();
66
- params.set('size', 'n_10_n');
67
-
68
- const filters = [
69
- { field: 'issued.date', values: ['All time'], type: 'any' },
70
- { field: 'language', values: ['en'], type: 'any' },
71
- // { field: 'objectProvides', values: [contentType], type: 'any' },
72
- ];
73
-
74
- if (field) {
75
- filters.push({ field, values: [value], type: 'all' });
76
- }
77
-
78
- addFilterParams(params, filters);
79
-
80
- params.set('sort-field', 'issued.date');
81
- params.set('sort-direction', 'desc');
82
-
83
- if (!field) {
84
- params.set('q', value ?? '');
85
- }
86
-
87
- return `${base}?${params.toString()}`;
88
- };
89
-
90
- export const fixEmbedURL = (url, is_cmshare_video) => {
91
- const suffix = '/download';
92
-
93
- if (!is_cmshare_video) return url;
94
-
95
- const base = url.split('?')[0];
96
-
97
- if (base.endsWith(suffix)) return base;
98
-
99
- return base + suffix;
100
- };
101
-
102
- export * from './countryMap';
4
+ adjustEuCountryNames,
5
+ euCountryNames,
6
+ euCountryNamesIncludingEnergy,
7
+ getClosestFeatureToCoordinate,
8
+ getFocusCountriesFeature,
9
+ getFocusCountryNames,
10
+ getImageUrl,
11
+ removeTooltip,
12
+ setTooltipVisibility,
13
+ tooltipStyle,
14
+ } from './countryMap';
@@ -0,0 +1,4 @@
1
+ export const capitalizeFirstLetter = (str) => {
2
+ if (!str || typeof str !== 'string') return '';
3
+ return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
4
+ };
package/src/hocs/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export { default as withClientOnly } from './withClientOnly';
1
2
  export { default as withResponsiveContainer } from './withResponsiveContainer';
2
3
  export { default as withVisibilitySensor } from './withVisibilitySensor';
3
4
  export { withGeoJsonData } from './withGeoJsonData';
@@ -1,4 +1,4 @@
1
- export default function clientOnly(WrappedComponent) {
1
+ export default function withClientOnly(WrappedComponent) {
2
2
  const WithClientWrappedComponent = (props) => {
3
3
  return __SERVER__ ? null : <WrappedComponent {...props} />;
4
4
  };
package/src/index.js CHANGED
@@ -46,8 +46,9 @@ import {
46
46
  NON_EU_LANGS,
47
47
  } from '@eeacms/volto-cca-policy/constants';
48
48
 
49
- import GeocharsWidget from './components/theme/Widgets/GeocharsWidget';
50
- import PromotionalImageWidget from './components/theme/Widgets/PromotionalImageWidget';
49
+ import GeocharsWidget from './components/manage/Widgets/GeocharsWidget';
50
+ import PromotionalImageWidget from './components/manage/Widgets/PromotionalImageWidget';
51
+ import VisualizationsWidget from './components/manage/Widgets/VisualizationsWidget';
51
52
  import HealthHorizontalCardItem from './components/Search/Result/HealthHorizontalCardItem';
52
53
  import ClusterHorizontalCardItem from './components/Search/Result/ClusterHorizontalCardItem';
53
54
  import NavigatorCatalogueCardItem from './components/Search/NavigatorCatalogue/NavigatorCatalogueCardItem';
@@ -71,7 +72,7 @@ import eeaWhiteLogo from '@eeacms/volto-eea-design-system/../theme/themes/eea/as
71
72
  import './slate-styles.less';
72
73
  import BrokenLinks from './components/theme/Views/BrokenLinks';
73
74
 
74
- import GeolocationWidget from './components/theme/Widgets/GeolocationWidget';
75
+ import GeolocationWidget from './components/manage/Widgets/GeolocationWidget';
75
76
  // import MigrationButtons from './components/MigrationButtons';
76
77
 
77
78
  const getEnv = () => (typeof window !== 'undefined' ? window.env : process.env);
@@ -443,6 +444,7 @@ const applyConfig = (config) => {
443
444
  config.widgets.id.geochars = GeocharsWidget;
444
445
  config.widgets.id.geolocation = GeolocationWidget;
445
446
  config.widgets.id.promotional_image = PromotionalImageWidget;
447
+ config.widgets.id.visualizations = VisualizationsWidget;
446
448
  config.widgets.id.image = ImageWidget;
447
449
 
448
450
  if (config.widgets.views?.widget) {
@@ -0,0 +1,64 @@
1
+ import { OBSERVATORY_PARTNERS } from '@eeacms/volto-cca-policy/constants';
2
+
3
+ const addFilterParams = (params, filters) => {
4
+ filters.forEach((f, i) => {
5
+ params.set(`filters[${i}][field]`, f.field);
6
+ params.set(`filters[${i}][type]`, f.type);
7
+ (f.values || []).forEach((val, vi) => {
8
+ params.set(`filters[${i}][values][${vi}]`, val);
9
+ });
10
+ });
11
+ };
12
+
13
+ export const makeContributionsSearchQuery = ({ id } = {}) => {
14
+ const organisation = OBSERVATORY_PARTNERS?.[id];
15
+ const base = '/en/observatory/advanced-search';
16
+
17
+ // If partner is missing, fall back to base (or return null if you prefer)
18
+ if (!organisation) return `${base}?size=n_10_n`;
19
+
20
+ const params = new URLSearchParams();
21
+ params.set('size', 'n_10_n');
22
+
23
+ addFilterParams(params, [
24
+ {
25
+ field: 'cca_partner_contributors.keyword',
26
+ type: 'any',
27
+ values: [organisation],
28
+ },
29
+ { field: 'issued.date', type: 'any', values: ['All time'] },
30
+ { field: 'language', type: 'any', values: ['en'] },
31
+ ]);
32
+
33
+ params.set('sort-field', 'issued.date');
34
+ params.set('sort-direction', 'desc');
35
+
36
+ return `${base}?${params.toString()}`;
37
+ };
38
+
39
+ export const makeAdvancedSearchQuery = ({ field, value } = {}) => {
40
+ const base = '/en/data-and-downloads/';
41
+ const params = new URLSearchParams();
42
+ params.set('size', 'n_10_n');
43
+
44
+ const filters = [
45
+ { field: 'issued.date', values: ['All time'], type: 'any' },
46
+ { field: 'language', values: ['en'], type: 'any' },
47
+ // { field: 'objectProvides', values: [contentType], type: 'any' },
48
+ ];
49
+
50
+ if (field) {
51
+ filters.push({ field, values: [value], type: 'all' });
52
+ }
53
+
54
+ addFilterParams(params, filters);
55
+
56
+ params.set('sort-field', 'issued.date');
57
+ params.set('sort-direction', 'desc');
58
+
59
+ if (!field) {
60
+ params.set('q', value ?? '');
61
+ }
62
+
63
+ return `${base}?${params.toString()}`;
64
+ };
@@ -1,26 +0,0 @@
1
- import { Link } from 'react-router-dom';
2
- import { useSelector } from 'react-redux';
3
- import { Button, Icon } from 'semantic-ui-react';
4
- import { FormattedMessage } from 'react-intl';
5
-
6
- const ShareInfoButton = (props) => {
7
- const currentLang = useSelector((state) => state.intl.locale);
8
-
9
- return (
10
- <>
11
- <div className="share-info">
12
- <Link to={`/${currentLang + '/help/share-your-info'}`}>
13
- <Button icon primary labelPosition="left">
14
- <FormattedMessage
15
- id="Share your information"
16
- defaultMessage="Share your information"
17
- />
18
- <Icon className="ri-share-line" />
19
- </Button>
20
- </Link>
21
- </div>
22
- </>
23
- );
24
- };
25
-
26
- export default ShareInfoButton;
@@ -1,90 +0,0 @@
1
- import React from 'react';
2
- import { MemoryRouter } from 'react-router-dom';
3
- import { render } from '@testing-library/react';
4
- import '@testing-library/jest-dom';
5
- import { Provider } from 'react-intl-redux';
6
- import configureStore from 'redux-mock-store';
7
-
8
- import ImageWidget from './ImageWidget';
9
-
10
- global.__SERVER__ = false;
11
-
12
- // mock Dropzone (avoids drag/drop complexity)
13
- jest.mock(
14
- 'react-dropzone',
15
- () => (props) =>
16
- props.children({
17
- getRootProps: () => ({}),
18
- getInputProps: () => ({}),
19
- }),
20
- );
21
-
22
- // mock loadable
23
- jest.mock('@loadable/component', () => (importFn) => {
24
- const Component = (props) => {
25
- const Loaded = require('react-dropzone');
26
- return <Loaded {...props} />;
27
- };
28
- return Component;
29
- });
30
-
31
- const mockStore = configureStore();
32
-
33
- describe('ImageUploadWidget', () => {
34
- it('renders empty state', () => {
35
- const store = mockStore({
36
- intl: {
37
- locale: 'en',
38
- messages: {},
39
- },
40
- });
41
-
42
- const props = {
43
- id: 'image',
44
- title: 'Image',
45
- value: null,
46
- onChange: jest.fn(),
47
- };
48
-
49
- const { container } = render(
50
- <Provider store={store}>
51
- <MemoryRouter>
52
- <ImageWidget {...props} />
53
- </MemoryRouter>
54
- </Provider>,
55
- );
56
-
57
- expect(container).toBeTruthy();
58
- });
59
-
60
- it('renders with image value', () => {
61
- const store = mockStore({
62
- intl: {
63
- locale: 'en',
64
- messages: {},
65
- },
66
- });
67
-
68
- const props = {
69
- id: 'image',
70
- title: 'Image',
71
- value: {
72
- data: 'fakebase64',
73
- encoding: 'base64',
74
- 'content-type': 'image/png',
75
- filename: 'test.png',
76
- },
77
- onChange: jest.fn(),
78
- };
79
-
80
- const { getByText } = render(
81
- <Provider store={store}>
82
- <MemoryRouter>
83
- <ImageWidget {...props} />
84
- </MemoryRouter>
85
- </Provider>,
86
- );
87
-
88
- expect(getByText('test.png')).toBeInTheDocument();
89
- });
90
- });