@eeacms/volto-cca-policy 0.1.102 → 0.2.0

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 (61) hide show
  1. package/CHANGELOG.md +61 -8
  2. package/README.md +0 -1
  3. package/package.json +1 -1
  4. package/src/components/manage/Blocks/C3SIndicatorsGlossaryBlock/C3SIndicatorsGlossaryBlockView.jsx +13 -26
  5. package/src/components/manage/Blocks/C3SIndicatorsListingBlock/C3SIndicatorsListingBlockEdit.jsx +32 -0
  6. package/src/components/manage/Blocks/C3SIndicatorsListingBlock/C3SIndicatorsListingBlockView.jsx +36 -0
  7. package/src/components/manage/Blocks/C3SIndicatorsListingBlock/index.js +29 -0
  8. package/src/components/manage/Blocks/C3SIndicatorsListingBlock/schema.js +14 -0
  9. package/src/components/manage/Blocks/C3SIndicatorsOverviewBlock/C3SIndicatorsOverviewBlockView.jsx +11 -40
  10. package/src/components/manage/Blocks/C3SIndicatorsOverviewBlock/schema.js +21 -21
  11. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyExplorerView.js +32 -6
  12. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyFilters.jsx +133 -54
  13. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyFilters.test.jsx +50 -0
  14. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyMap.jsx +1 -1
  15. package/src/components/manage/Blocks/CaseStudyExplorer/FeatureDisplay.jsx +25 -22
  16. package/src/components/manage/Blocks/CaseStudyExplorer/FeatureInteraction.jsx +0 -3
  17. package/src/components/manage/Blocks/CaseStudyExplorer/hooks.js +2 -2
  18. package/src/components/manage/Blocks/CaseStudyExplorer/styles.less +41 -4
  19. package/src/components/manage/Blocks/CaseStudyExplorer/utils.js +23 -3
  20. package/src/components/manage/Blocks/CollectionStatistics/CollectionStatsView.jsx +1 -1
  21. package/src/components/manage/Blocks/CollectionStatistics/CollectionStatsView.test.jsx +93 -0
  22. package/src/components/manage/Blocks/CountryProfileDetail/Edit.js +5 -0
  23. package/src/components/manage/Blocks/CountryProfileDetail/View.js +67 -0
  24. package/src/components/manage/Blocks/CountryProfileDetail/index.js +25 -0
  25. package/src/components/manage/Blocks/RASTBlock/ContextNavigation.jsx +3 -1
  26. package/src/components/manage/Blocks/RASTBlock/RASTAccordion.jsx +22 -17
  27. package/src/components/manage/Blocks/RASTBlock/RASTMap.jsx +17 -11
  28. package/src/components/manage/Blocks/RASTBlock/RASTMap.test.jsx +81 -0
  29. package/src/components/manage/Blocks/RASTBlock/RASTView.jsx +8 -0
  30. package/src/components/manage/Blocks/RASTBlock/schema.js +14 -1
  31. package/src/components/manage/Blocks/SearchAceContent/SearchAceContentView.jsx +3 -3
  32. package/src/components/manage/Blocks/TransRegionSelect/TransRegionSelectView.jsx +37 -88
  33. package/src/components/manage/Blocks/index.js +8 -0
  34. package/src/components/theme/BannerTitle/BannerTitle.jsx +28 -17
  35. package/src/components/theme/Header/Header.jsx +11 -2
  36. package/src/components/theme/TranslationDisclaimer/LanguagePreference.jsx +40 -53
  37. package/src/components/theme/TranslationDisclaimer/TranslationDisclaimer.jsx +20 -78
  38. package/src/components/theme/TranslationDisclaimer/TranslationInfo.jsx +124 -0
  39. package/src/components/theme/Views/AdaptationOptionView.jsx +10 -5
  40. package/src/components/theme/Views/C3SIndicatorView.jsx +10 -7
  41. package/src/components/theme/Views/CaseStudyView.jsx +11 -5
  42. package/src/components/theme/Views/CcaEventView.jsx +1 -5
  43. package/src/components/theme/Views/DatabaseItemView.jsx +3 -5
  44. package/src/components/theme/Views/EventView.jsx +0 -2
  45. package/src/components/theme/Views/NewsItemView.jsx +0 -2
  46. package/src/components/theme/Views/ProjectView.jsx +3 -5
  47. package/src/components/theme/Widgets/GeolocationWidget.jsx +1 -6
  48. package/src/customizations/@eeacms/volto-eea-design-system/ui/Header/Header.jsx +1 -1
  49. package/src/customizations/volto/components/theme/View/DefaultView.jsx +1 -6
  50. package/src/index.js +23 -6
  51. package/src/search/index.js +3 -0
  52. package/src/slate-styles.less +15 -0
  53. package/theme/assets/images/Header/climate-adapt-logo-white.svg +61 -0
  54. package/theme/assets/images/Header/observatory-logo.svg +1 -0
  55. package/theme/assets/images/Header/observatory-white-logo.svg +1 -0
  56. package/theme/globals/observatory.less +1 -1
  57. package/theme/globals/site.overrides +10 -7
  58. package/theme/globals/views.less +72 -24
  59. package/src/components/manage/Blocks/TransRegionSelect/countries.json +0 -150
  60. package/src/components/manage/Widgets/CreatableSelectWidget.jsx +0 -316
  61. package/src/components/manage/Widgets/CreatableSelectWidget.test.jsx +0 -89
package/CHANGELOG.md CHANGED
@@ -4,6 +4,67 @@ 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.0](https://github.com/eea/volto-cca-policy/compare/0.1.102...0.2.0) - 5 April 2024
8
+
9
+ #### :rocket: New Features
10
+
11
+ - feat: add option to use white variant of logo for subsites [kreafox - [`7a443d5`](https://github.com/eea/volto-cca-policy/commit/7a443d534e824f3e576a39810b116aa224ff50c7)]
12
+ - feat: use toast message for translation disclaimers [kreafox - [`941a53c`](https://github.com/eea/volto-cca-policy/commit/941a53c682b922f049740ab56ea996a0d4f7a1bf)]
13
+ - feat: add white variant of logo, add slate styles [kreafox - [`ad0dabf`](https://github.com/eea/volto-cca-policy/commit/ad0dabff55a42ff1b88ef58ac51f752252cf3344)]
14
+
15
+ #### :bug: Bug Fixes
16
+
17
+ - fix: banner title component in case of homepage [kreafox - [`868d45d`](https://github.com/eea/volto-cca-policy/commit/868d45d8652935913a9a054e6ce897a1013c5fe6)]
18
+ - fix: disclaimers on inversed homepage [kreafox - [`5d61622`](https://github.com/eea/volto-cca-policy/commit/5d6162289d8cda47452186e85b4e9439b677eebd)]
19
+
20
+ #### :nail_care: Enhancements
21
+
22
+ - change: remove CreatableSelectWidget (we can use it now from volto-eea-website-theme) [kreafox - [`6c8a242`](https://github.com/eea/volto-cca-policy/commit/6c8a242cb22b4ee65c8d391ce96e5639bba687bf)]
23
+ - change: move disclaimer to appExtras [kreafox - [`55c665f`](https://github.com/eea/volto-cca-policy/commit/55c665fec06c8174db0d8f92eefc04b5b8af1512)]
24
+
25
+ #### :house: Internal changes
26
+
27
+ - style: improve translation disclaimer on mobile [kreafox - [`604e3a1`](https://github.com/eea/volto-cca-policy/commit/604e3a1007a0b0a3daf7f6ce335c41676b6d0efc)]
28
+
29
+ #### :hammer_and_wrench: Others
30
+
31
+ - Fix test [Tiberiu Ichim - [`3e2760b`](https://github.com/eea/volto-cca-policy/commit/3e2760b4c3ebb0559283e0fea32c35f44b7cb987)]
32
+ - Refs #268061 - reactui checkbox [Tripon Eugen - [`a227576`](https://github.com/eea/volto-cca-policy/commit/a22757632d0ef96ed365ceab04845961c271450c)]
33
+ - Update README.md (just to retry tests) [Ghiță Bizău - [`db26abd`](https://github.com/eea/volto-cca-policy/commit/db26abd73d52118185340de2b3ca6335939d005e)]
34
+ - Try to fix test: Uncaught [TypeError: Cannot read properties of undefined (reading 'groups')] [GhitaB - [`d1d1e8e`](https://github.com/eea/volto-cca-policy/commit/d1d1e8eefbf96b96384a1584e25eaf0591416308)]
35
+ - RASTMap: fix Invalid DOM property stop-color. Did you mean stopColor?. [GhitaB - [`eb167d4`](https://github.com/eea/volto-cca-policy/commit/eb167d4b012643e8e6fc720767446804a9fdf260)]
36
+ - Refs #268061 - testing [Tripon Eugen - [`095371a`](https://github.com/eea/volto-cca-policy/commit/095371af6eb57b1fcfcadf70c26afdef90b2d8ef)]
37
+ - Add test. [GhitaB - [`6a50882`](https://github.com/eea/volto-cca-policy/commit/6a508821236df764d5ab07c38215f13445fc4e9a)]
38
+ - Don't fail in SSR [Tiberiu Ichim - [`8cd6b71`](https://github.com/eea/volto-cca-policy/commit/8cd6b71cba148e505a00007dfc1c164cb8df401f)]
39
+ - Refs #268061 - coverage test [Tripon Eugen - [`8374f66`](https://github.com/eea/volto-cca-policy/commit/8374f66f2feecfe672596c6b50f70ff1f3fc653e)]
40
+ - Refs #268061 - rastmap coverage unit test [Tripon Eugen - [`07bb646`](https://github.com/eea/volto-cca-policy/commit/07bb646e9c73bb1f42bd258877d0ef01cf8e6353)]
41
+ - Refs #268061 - add filter test and effect [Tripon Eugen - [`e2daa4b`](https://github.com/eea/volto-cca-policy/commit/e2daa4b9c00232ed7fc7cbfdbc7bcd3880940e67)]
42
+ - Refs #268061 - add filter test [Tripon Eugen - [`9bacc3d`](https://github.com/eea/volto-cca-policy/commit/9bacc3d4176d391d6565d32f953054b1bf348e39)]
43
+ - Refs #268061 - key type measure filter css [Tripon Eugen - [`7bd2e22`](https://github.com/eea/volto-cca-policy/commit/7bd2e2266ff18604161b6fba57fa5d7e06f068dd)]
44
+ - Refs #268061 - key type measure filter css [Tripon Eugen - [`270fd0c`](https://github.com/eea/volto-cca-policy/commit/270fd0cb252a08a443ec9a14b32c915c443511f1)]
45
+ - Refs #268061 - accordion css [Tripon Eugen - [`6665dc6`](https://github.com/eea/volto-cca-policy/commit/6665dc630e9292d6b7b2e36e4cd35f5caaa38dcd)]
46
+ - Refs #268061 - add key type measure design, popup design and filter accordion [Tripon Eugen - [`71b1b21`](https://github.com/eea/volto-cca-policy/commit/71b1b211524f3938c0a6e1c09b4e163bd15e31ae)]
47
+ - Refs #161494 - country profile detail [Tripon Eugen - [`109e56a`](https://github.com/eea/volto-cca-policy/commit/109e56ace11974d98667c5e4038d894c9cc0671a)]
48
+ - bump 0.2.0 [kreafox - [`83c5d52`](https://github.com/eea/volto-cca-policy/commit/83c5d52aa9e97ff635d7199acde4cc3d1579dae9)]
49
+ - tests: fix duplicated code issue [kreafox - [`1b291a4`](https://github.com/eea/volto-cca-policy/commit/1b291a43d7461b0b8930c6c9bb87944b8e2e73c5)]
50
+ - eslint fixes [Tiberiu Ichim - [`370410b`](https://github.com/eea/volto-cca-policy/commit/370410b41b2e5b01c11ce1ca2955bb96dcc5e529)]
51
+ - We don't need the category here, its provided by the backend [Tiberiu Ichim - [`1a60c4e`](https://github.com/eea/volto-cca-policy/commit/1a60c4e3cf298effd35608678a1270d29b6c08d9)]
52
+ - Refactor indicators listing/overview blocks [Tiberiu Ichim - [`635a812`](https://github.com/eea/volto-cca-policy/commit/635a812f87e8a7ac248b6aa4012f6c2a6de37283)]
53
+ - No need axios [Tiberiu Ichim - [`1d6e5b1`](https://github.com/eea/volto-cca-policy/commit/1d6e5b1d40a456674683bf09a623139df360c5f8)]
54
+ - Simplify c3s_indicators_overview code [Tiberiu Ichim - [`f29a446`](https://github.com/eea/volto-cca-policy/commit/f29a4462727316dbd661cbca62dd970ba9640f92)]
55
+ - test: update snapshots [kreafox - [`03cdb0b`](https://github.com/eea/volto-cca-policy/commit/03cdb0bfbd42d2f01abdc6d3e1ff1cd80126b943)]
56
+ - Don't call hook conditionally [Tiberiu Ichim - [`2256907`](https://github.com/eea/volto-cca-policy/commit/2256907e6f6a6379b2dd9e3525d0e881febca4b7)]
57
+ - Refactor TransRegionSelectView [Tiberiu Ichim - [`89b00c2`](https://github.com/eea/volto-cca-policy/commit/89b00c272b6407b215a4785e7c7ce9f212797954)]
58
+ - Refs #260715 - test coverage add RASTMap add items [Tripon Eugen - [`58a898c`](https://github.com/eea/volto-cca-policy/commit/58a898c44e3353ed14ff32531dce26bda20901f6)]
59
+ - Refs #260715 - test coverage add RASTMap [Tripon Eugen - [`3fc0193`](https://github.com/eea/volto-cca-policy/commit/3fc0193108808edaac934c5bbd6ec6002cd28917)]
60
+ - Refs #260715 - display arrow icons only if show sub_folders [Tripon Eugen - [`772a8ad`](https://github.com/eea/volto-cca-policy/commit/772a8add196bdeb8d6ebe954225bd5146a6231a1)]
61
+ - Add alias for North West Europe [Tiberiu Ichim - [`644c75b`](https://github.com/eea/volto-cca-policy/commit/644c75bf5a73f87890a6f7fb8199cea9e81634ff)]
62
+ - Refs #260715 - remove comment [Tripon Eugen - [`33283d7`](https://github.com/eea/volto-cca-policy/commit/33283d7f6367bda2ae7d20f830e9ed842ba4a625)]
63
+ - Refs #260715 - rast options show/hide subfolders [Tripon Eugen - [`18bff32`](https://github.com/eea/volto-cca-policy/commit/18bff32426a94a9a174509ffd67d92342e1f12e8)]
64
+ - Refs #260715 - rename label [Tripon Eugen - [`cba2862`](https://github.com/eea/volto-cca-policy/commit/cba28622fc26bedc895511e3e6091430bbcd973d)]
65
+ - Refs #260715 - eslint [Tripon Eugen - [`182369c`](https://github.com/eea/volto-cca-policy/commit/182369c92ecd94694bf704347675984024a9fa42)]
66
+ - Refs #260715 - rast map skip folders by index list [Tripon Eugen - [`09b0ddd`](https://github.com/eea/volto-cca-policy/commit/09b0dddb9b5355cdf68b1f5483d9e1069eeb3615)]
67
+ - Refs #267596 - set extraQueryParams [Tripon Eugen - [`4205b72`](https://github.com/eea/volto-cca-policy/commit/4205b728e863588ff279d03413cd02796b490a38)]
7
68
  ### [0.1.102](https://github.com/eea/volto-cca-policy/compare/0.1.101...0.1.102) - 27 March 2024
8
69
 
9
70
  #### :hammer_and_wrench: Others
@@ -778,13 +839,10 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
778
839
  - Refs #260715 rast-block wip [Tripon Eugen - [`f19d54e`](https://github.com/eea/volto-cca-policy/commit/f19d54e0b9a6a86bf344eb85b6a1cda7f3de91bf)]
779
840
  - Refs #260715 rast-block wip [Tripon Eugen - [`2828537`](https://github.com/eea/volto-cca-policy/commit/2828537b6c084cd1a82162d552fb4ef025b71f9f)]
780
841
  - Refs #260715 rast-block updates [Tripon Eugen - [`1e803e5`](https://github.com/eea/volto-cca-policy/commit/1e803e5bd3d3fb7558f261c76c68866be7beb8b5)]
781
- - test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`0a15e1b`](https://github.com/eea/volto-cca-policy/commit/0a15e1b2ad081233685e80d5b3c60a8663f6b896)]
782
- - test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`9554e44`](https://github.com/eea/volto-cca-policy/commit/9554e44c92a621a52b2adb5a4830fb084ee5734b)]
783
842
  ### [0.1.49](https://github.com/eea/volto-cca-policy/compare/0.1.48...0.1.49) - 15 November 2023
784
843
 
785
844
  #### :house: Internal changes
786
845
 
787
- - chore: [JENKINS] Refactor automated testing [valentinab25 - [`7b820a6`](https://github.com/eea/volto-cca-policy/commit/7b820a6369c2ddd5203b1a4abe352cb4bb43db7a)]
788
846
  - chore: husky, lint-staged use fixed versions [valentinab25 - [`f0a8061`](https://github.com/eea/volto-cca-policy/commit/f0a8061c275c236deb00087c23fac9860a073106)]
789
847
 
790
848
  #### :hammer_and_wrench: Others
@@ -801,9 +859,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
801
859
  - Refs #259267 - jenkins test [Tripon Eugen - [`cacd31e`](https://github.com/eea/volto-cca-policy/commit/cacd31e7b1afe0983674ed5c7632d2e1d7fa752e)]
802
860
  - Refs #259267 - jenkins [Tripon Eugen - [`5b3affe`](https://github.com/eea/volto-cca-policy/commit/5b3affee8401239de10097884c1b7f2349d15ec0)]
803
861
  - Refs #259267 - add When, lead image and title to files [Tripon Eugen - [`2cedb23`](https://github.com/eea/volto-cca-policy/commit/2cedb237f898af9057e13fba94b615ef71077204)]
804
- - test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`4d607a5`](https://github.com/eea/volto-cca-policy/commit/4d607a576e9d0a5c34e48c41b409e7df616ee3d6)]
805
- - test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`b7f74d5`](https://github.com/eea/volto-cca-policy/commit/b7f74d53513a6edbfbca5cb6d19687929bb1e5db)]
806
- - test: [JENKINS] Improve cypress time [valentinab25 - [`db65617`](https://github.com/eea/volto-cca-policy/commit/db656173391f65157098d95d388c25f6429753d8)]
807
862
  - Refs #259267 - cca event blocks attachments and check not mandatoty fields [Tripon Eugen - [`3138e5a`](https://github.com/eea/volto-cca-policy/commit/3138e5afb5bfbdbed14e27ed457b16867b7fa414)]
808
863
  - Refs #256681 - Fix error in CCA Event view menu. ([React Intl] An id must be provided to format a message.) [GhitaB - [`517eeb8`](https://github.com/eea/volto-cca-policy/commit/517eeb817264a47bbfd6b9b7d22aaf22d44ed224)]
809
864
  - Refs #161485 - Fix ECDE name conflict. [GhitaB - [`8bfd99f`](https://github.com/eea/volto-cca-policy/commit/8bfd99ff68bb82a04d1c0ed625fa514fcf46289e)]
@@ -1020,7 +1075,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1020
1075
 
1021
1076
  #### :house: Internal changes
1022
1077
 
1023
- - chore: [JENKINS] Remove alpha testing version [valentinab25 - [`ad1ced0`](https://github.com/eea/volto-cca-policy/commit/ad1ced0971ba116c13a3b5fcc039172cc915c919)]
1024
1078
 
1025
1079
  #### :hammer_and_wrench: Others
1026
1080
 
@@ -1501,7 +1555,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1501
1555
  #### :hammer_and_wrench: Others
1502
1556
 
1503
1557
  - Refs #158294 - Update supported languages list. [GhitaB - [`0a4f91f`](https://github.com/eea/volto-cca-policy/commit/0a4f91f39b7edc367bd4c127d6a8f273c7788361)]
1504
- - Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`8f1f9ce`](https://github.com/eea/volto-cca-policy/commit/8f1f9ce6c22805670cc0800d3c779b6d619d0f31)]
1505
1558
  ### [0.1.1](https://github.com/eea/volto-cca-policy/compare/0.1.0...0.1.1) - 13 December 2022
1506
1559
 
1507
1560
  #### :hammer_and_wrench: Others
package/README.md CHANGED
@@ -96,4 +96,3 @@ don-template/blob/master/LICENSE.md) for details.
96
96
  ## Funding
97
97
 
98
98
  [European Environment Agency (EU)](http://eea.europa.eu)
99
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-cca-policy",
3
- "version": "0.1.102",
3
+ "version": "0.2.0",
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",
@@ -1,35 +1,22 @@
1
1
  import React from 'react';
2
- import axios from 'axios';
3
2
 
4
3
  export default function C3SIndicatorsGlossaryBlockView(props) {
5
- const [tableHTML, setTableHTML] = React.useState('');
6
-
7
- const getIndicatorsData = () => {
8
- const url =
9
- '/++api++/en/knowledge/european-climate-data-explorer/@c3s_indicators_glossary_table_api';
10
-
11
- axios
12
- .get(url)
13
- .then((response) => {
14
- setTableHTML(response.data.c3s_indicators_glossary_table);
15
- })
16
- .catch((error) => {
17
- // console.error(error);
18
- });
19
- };
20
-
21
- React.useEffect(() => {
22
- getIndicatorsData();
23
- });
4
+ const { metadata, properties, mode = 'view' } = props;
5
+ const content = metadata || properties;
6
+ const { c3s_indicators_glossary_table } = content?.['@components'] || {};
24
7
 
25
8
  return (
26
9
  <div className="block c3sindicators-glossary-block">
27
- <div
28
- className="glossary-table"
29
- dangerouslySetInnerHTML={{
30
- __html: tableHTML,
31
- }}
32
- />
10
+ {mode === 'view' ? (
11
+ <div
12
+ className="glossary-table"
13
+ dangerouslySetInnerHTML={{
14
+ __html: c3s_indicators_glossary_table || 'No content',
15
+ }}
16
+ />
17
+ ) : (
18
+ <div>C3SIndicatorsGlossaryBlockView</div>
19
+ )}
33
20
  </div>
34
21
  );
35
22
  }
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+
3
+ import { SidebarPortal } from '@plone/volto/components';
4
+ import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
5
+
6
+ import C3SIndicatorsListingBlockView from './C3SIndicatorsListingBlockView';
7
+ import schema from './schema';
8
+
9
+ export default function C3SIndicatorsOverviewBlockEdit(props) {
10
+ const { block, data, onChangeBlock, selected, id } = props;
11
+
12
+ return (
13
+ <div>
14
+ <C3SIndicatorsListingBlockView data={data} id={id} mode="edit" />
15
+ <SidebarPortal selected={selected}>
16
+ <BlockDataForm
17
+ block={block}
18
+ title={schema.title}
19
+ schema={schema}
20
+ onChangeField={(id, value) => {
21
+ onChangeBlock(block, {
22
+ ...data,
23
+ [id]: value,
24
+ });
25
+ }}
26
+ onChangeBlock={onChangeBlock}
27
+ formData={data}
28
+ />
29
+ </SidebarPortal>
30
+ </div>
31
+ );
32
+ }
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import { UniversalLink } from '@plone/volto/components';
3
+
4
+ export default function C3SIndicatorsListingBlockView(props) {
5
+ const { metadata, properties, mode = 'view' } = props;
6
+ const content = metadata || properties;
7
+ const { c3s_indicators_listing } = content?.['@components'] || {};
8
+
9
+ if (!c3s_indicators_listing) {
10
+ if (mode === 'edit') {
11
+ return <div>C3SIndicatorsListingBlockView</div>;
12
+ } else {
13
+ return null;
14
+ }
15
+ }
16
+
17
+ const { description, items } = c3s_indicators_listing;
18
+
19
+ return (
20
+ <div className="block c3sindicators-listing-block">
21
+ <div
22
+ className="description"
23
+ dangerouslySetInnerHTML={{
24
+ __html: description,
25
+ }}
26
+ />
27
+ <ul>
28
+ {items?.map((item, index) => (
29
+ <li key={index}>
30
+ <UniversalLink href={item.url}>{item.title}</UniversalLink>
31
+ </li>
32
+ ))}
33
+ </ul>
34
+ </div>
35
+ );
36
+ }
@@ -0,0 +1,29 @@
1
+ import zoomSVG from '@plone/volto/icons/zoom.svg';
2
+ import C3SIndicatorsListingBlockEdit from './C3SIndicatorsListingBlockEdit';
3
+ import C3SIndicatorsListingBlockView from './C3SIndicatorsListingBlockView';
4
+
5
+ import { blockAvailableInMission } from '@eeacms/volto-cca-policy/utils';
6
+
7
+ export default function installBlock(config) {
8
+ const blocksConfig = config.blocks.blocksConfig;
9
+
10
+ blocksConfig.c3SIndicatorListingBlock = {
11
+ id: 'c3SIndicatorListingBlock',
12
+ title: 'C3S Indicators Listing',
13
+ icon: zoomSVG,
14
+ group: 'site',
15
+ view: C3SIndicatorsListingBlockView,
16
+ edit: C3SIndicatorsListingBlockEdit,
17
+ sidebarTab: 1,
18
+ security: {
19
+ addPermission: [],
20
+ view: [],
21
+ },
22
+ variations: [],
23
+ restricted: ({ properties, block }) => {
24
+ return blockAvailableInMission(properties, block);
25
+ },
26
+ };
27
+
28
+ return config;
29
+ }
@@ -0,0 +1,14 @@
1
+ export default {
2
+ title: 'C3S Indicators Listing',
3
+
4
+ fieldsets: [
5
+ {
6
+ id: 'default',
7
+ title: 'Default',
8
+ fields: [],
9
+ },
10
+ ],
11
+
12
+ properties: {},
13
+ required: [],
14
+ };
@@ -1,55 +1,26 @@
1
1
  import React from 'react';
2
- import axios from 'axios';
3
- import { UniversalLink } from '@plone/volto/components';
4
2
 
5
3
  export default function C3SIndicatorsOverviewBlockView(props) {
6
- const [pageDescription, setPageDescription] = React.useState('');
7
- const [indicators, setIndicators] = React.useState([]);
4
+ const { metadata, properties, mode = 'view' } = props;
5
+ const content = metadata || properties;
6
+ const { c3s_indicators_overview } = content?.['@components'] || {};
8
7
 
9
- const category = props.data.category;
10
-
11
- const getIndicatorsData = () => {
12
- const url =
13
- '/++api++/en/knowledge/european-climate-data-explorer/' +
14
- category +
15
- '/@c3s_indicators_overview_api';
16
-
17
- axios
18
- .get(url)
19
- .then((response) => {
20
- setPageDescription(response.data.c3s_indicators_overview.description);
21
- setIndicators(response.data.c3s_indicators_overview.items);
22
- })
23
- .catch((error) => {
24
- // console.error(error);
25
- });
26
- };
27
-
28
- React.useEffect(() => {
29
- getIndicatorsData();
30
- // eslint-disable-next-line react-hooks/exhaustive-deps
31
- }, [category]);
8
+ if (!c3s_indicators_overview) {
9
+ if (mode === 'edit') {
10
+ return <div>C3SIndicatorsOverviewBlockView</div>;
11
+ } else {
12
+ return null;
13
+ }
14
+ }
32
15
 
33
16
  return (
34
17
  <div className="block c3sindicators-overview-block">
35
18
  <div
36
19
  className="description"
37
20
  dangerouslySetInnerHTML={{
38
- __html: pageDescription,
21
+ __html: c3s_indicators_overview,
39
22
  }}
40
23
  />
41
-
42
- {indicators ? (
43
- <ul>
44
- {indicators.map((item, index) => (
45
- <li key={index}>
46
- <UniversalLink href={item.url}>{item.title}</UniversalLink>
47
- </li>
48
- ))}
49
- </ul>
50
- ) : (
51
- <p>Loading...</p>
52
- )}
53
24
  </div>
54
25
  );
55
26
  }
@@ -1,4 +1,22 @@
1
- const fields = ['category'];
1
+ // const fields = ['category'];
2
+ //
3
+ // category: {
4
+ // title: 'Category',
5
+ // type: 'string',
6
+ // factory: 'Choice',
7
+ // choices: [
8
+ // ['health', 'Health'],
9
+ // ['agriculture', 'Agriculture'],
10
+ // ['forestry', 'Forestry'],
11
+ // ['energy', 'Energy'],
12
+ // ['tourism', 'Tourism'],
13
+ // ['water-and-coastal', 'Water and Coastal'],
14
+ // ],
15
+ // default: 'health',
16
+ // description: 'Choose indicators category to be used as filter.',
17
+ // required: true,
18
+ // noValueOption: false,
19
+ // },
2
20
 
3
21
  export default {
4
22
  title: 'C3S Indicators Overview',
@@ -7,29 +25,11 @@ export default {
7
25
  {
8
26
  id: 'default',
9
27
  title: 'Default',
10
- fields,
28
+ fields: [],
11
29
  },
12
30
  ],
13
31
 
14
- properties: {
15
- category: {
16
- title: 'Category',
17
- type: 'string',
18
- factory: 'Choice',
19
- choices: [
20
- ['health', 'Health'],
21
- ['agriculture', 'Agriculture'],
22
- ['forestry', 'Forestry'],
23
- ['energy', 'Energy'],
24
- ['tourism', 'Tourism'],
25
- ['water-and-coastal', 'Water and Coastal'],
26
- ],
27
- default: 'health',
28
- description: 'Choose indicators category to be used as filter.',
29
- required: true,
30
- noValueOption: false,
31
- },
32
- },
32
+ properties: {},
33
33
 
34
34
  required: [],
35
35
  };
@@ -13,20 +13,46 @@ import './styles.less';
13
13
  const cases_url = '@@case-studies-map.arcgis.json';
14
14
 
15
15
  export default function CaseStudyExplorerView(props) {
16
- const cases = useCases(addAppURL(cases_url));
16
+ const casesData = useCases(addAppURL(cases_url));
17
+ const [cases, setCases] = React.useState([]);
17
18
 
18
19
  const [activeFilters, setActiveFilters] = React.useState({
19
20
  sectors: [],
20
21
  impacts: [],
22
+ measures: [],
21
23
  });
22
24
 
23
25
  const [activeItems, setActiveItems] = React.useState(cases);
24
- const [filters, setFilters] = React.useState([]);
26
+ const [filters, setFilters] = React.useState({
27
+ impacts: [],
28
+ sectors: [],
29
+ measures: {},
30
+ });
31
+
32
+ React.useEffect(() => {
33
+ if (casesData.hasOwnProperty('features')) {
34
+ const _cases = casesData.features;
35
+ let _filters = filters;
36
+ setCases(_cases);
37
+ _filters.measures = casesData.filters.measures;
38
+ setFilters(_filters);
39
+ }
40
+ }, [casesData, filters]);
25
41
 
26
42
  React.useEffect(() => {
27
- const _filters = getFilters(cases);
43
+ const _filters_data = getFilters(cases);
44
+ let _filters = filters;
45
+ _filters.impacts = _filters_data.impacts;
46
+ _filters.sectors = _filters_data.sectors;
28
47
  setFilters(_filters);
29
- }, [cases, activeFilters.impacts, activeFilters.sectors, activeItems.length]);
48
+ }, [
49
+ filters,
50
+ cases,
51
+ activeFilters.impacts,
52
+ activeFilters.sectors,
53
+ activeFilters.measures,
54
+ activeItems.length,
55
+ ]);
30
56
 
31
57
  React.useEffect(() => {
32
58
  const activeItems = filterCases(cases, activeFilters);
@@ -38,7 +64,7 @@ export default function CaseStudyExplorerView(props) {
38
64
  return (
39
65
  <div>
40
66
  <Grid columns="12">
41
- <Grid.Column mobile={9} tablet={9} computer={10} className="col-left">
67
+ <Grid.Column mobile={9} tablet={9} computer={9} className="col-left">
42
68
  {cases.length ? (
43
69
  <CaseStudyMap items={cases} activeItems={activeItems} />
44
70
  ) : null}
@@ -46,7 +72,7 @@ export default function CaseStudyExplorerView(props) {
46
72
  <Grid.Column
47
73
  mobile={3}
48
74
  tablet={3}
49
- computer={2}
75
+ computer={3}
50
76
  className="col-left"
51
77
  id="cse-filter"
52
78
  >