@eeacms/volto-cca-policy 0.1.83 → 0.1.85

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 (60) hide show
  1. package/CHANGELOG.md +75 -9
  2. package/package.json +4 -2
  3. package/src/components/index.js +1 -0
  4. package/src/components/manage/Blocks/CollectionStatistics/CollectionStatsEdit.jsx +30 -0
  5. package/src/components/manage/Blocks/CollectionStatistics/CollectionStatsView.jsx +124 -0
  6. package/src/components/manage/Blocks/CollectionStatistics/index.js +128 -0
  7. package/src/components/manage/Blocks/CollectionStatistics/schema.js +76 -0
  8. package/src/components/manage/Blocks/CollectionStatistics/styles.less +49 -0
  9. package/src/components/manage/Blocks/CountryMapObservatory/CountryMapObservatoryEdit.jsx +24 -1
  10. package/src/components/manage/Blocks/CountryMapObservatory/CountryMapObservatoryOLView.jsx +5 -1
  11. package/src/components/manage/Blocks/CountryMapObservatory/Interactions.jsx +0 -2
  12. package/src/components/manage/Blocks/CountryMapObservatory/schema.js +11 -14
  13. package/src/components/manage/Blocks/CountryMapProfile/Edit.js +1 -1
  14. package/src/components/manage/Blocks/CountryMapProfile/Filter.jsx +25 -59
  15. package/src/components/manage/Blocks/CountryMapProfile/Interactions.jsx +197 -0
  16. package/src/components/manage/Blocks/CountryMapProfile/OLView.jsx +232 -0
  17. package/src/components/manage/Blocks/CountryMapProfile/hocs.jsx +28 -0
  18. package/src/components/manage/Blocks/CountryMapProfile/index.js +1 -1
  19. package/src/components/manage/Blocks/CountryMapProfile/mapstyle.js +86 -0
  20. package/src/components/manage/Blocks/CountryMapProfile/styles.less +43 -10
  21. package/src/components/manage/Blocks/Listing/EventCardsListingView.jsx +10 -3
  22. package/src/components/manage/Blocks/index.js +2 -0
  23. package/src/components/manage/Blocks/withVisibilitySensor.jsx +61 -0
  24. package/src/components/theme/ImageGallery/ImageGallery.jsx +82 -0
  25. package/src/components/theme/Views/AdaptationOptionView.jsx +102 -88
  26. package/src/components/theme/Views/C3SIndicatorView.jsx +81 -42
  27. package/src/components/theme/Views/CaseStudyView.jsx +91 -79
  28. package/src/components/theme/Views/CcaEventView.jsx +3 -12
  29. package/src/components/theme/Views/CcaEventView.test.jsx +109 -0
  30. package/src/components/theme/Views/EventView.jsx +3 -12
  31. package/src/components/theme/Views/GuidanceView.jsx +38 -48
  32. package/src/components/theme/Views/IndicatorView.jsx +39 -49
  33. package/src/components/theme/Views/InformationPortalView.jsx +23 -40
  34. package/src/components/theme/Views/OrganisationView.jsx +51 -68
  35. package/src/components/theme/Views/ProjectView.jsx +47 -47
  36. package/src/components/theme/Views/PublicationReportView.jsx +17 -25
  37. package/src/components/theme/Views/ToolView.jsx +10 -24
  38. package/src/components/theme/Views/VideoView.jsx +77 -81
  39. package/src/helpers/ContentMetadata.jsx +13 -33
  40. package/src/helpers/Utils.jsx +8 -15
  41. package/src/icons/air_pollution_and_aero-allergens.svg +1 -0
  42. package/src/icons/climate-sensitive_diseases.svg +7 -0
  43. package/src/icons/droughts_and_floods.svg +20 -0
  44. package/src/icons/heat.svg +1 -0
  45. package/src/icons/wildfires.svg +1 -0
  46. package/src/index.js +0 -1
  47. package/src/policy.js +0 -2
  48. package/src/search/mission_stories/config-stories.js +2 -2
  49. package/src/store/actions/querystats.js +13 -0
  50. package/src/store/constants.js +1 -0
  51. package/src/store/index.js +9 -1
  52. package/src/store/reducers/querystats.js +40 -0
  53. package/src/utils.js +17 -0
  54. package/theme/extras/header.overrides +1 -0
  55. package/theme/globals/mission.less +20 -0
  56. package/theme/globals/observatory.less +115 -0
  57. package/theme/globals/site.overrides +209 -65
  58. package/src/components/manage/Blocks/CountryMapProfile/View.js +0 -121
  59. package/src/components/manage/Blocks/CountryMapProfile/map-utils.js +0 -457
  60. package/src/customizations/@eeacms/volto-eea-design-system/ui/Footer/Contact.jsx +0 -36
package/CHANGELOG.md CHANGED
@@ -4,7 +4,81 @@ 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.1.83](https://github.com/eea/volto-cca-policy/compare/0.1.82...0.1.83) - 26 February 2024
7
+ ### [0.1.85](https://github.com/eea/volto-cca-policy/compare/0.1.84...0.1.85) - 29 February 2024
8
+
9
+ #### :house: Internal changes
10
+
11
+ - style: improve tabs with labels [kreafox - [`5a5ff35`](https://github.com/eea/volto-cca-policy/commit/5a5ff350bcd4d6a876c0d5e86950d89d84b84c7c)]
12
+ - style: increase the count size a bit [kreafox - [`2f1e26c`](https://github.com/eea/volto-cca-policy/commit/2f1e26c14deab6e240f7357ba6283fc7532640c4)]
13
+ - style: improve tabs [kreafox - [`7939172`](https://github.com/eea/volto-cca-policy/commit/7939172ec5badcffc489599cd02783b117609e36)]
14
+ - style: Automated code fix [eea-jenkins - [`69f7534`](https://github.com/eea/volto-cca-policy/commit/69f753479ef255be149b3604777fd035bb767ddc)]
15
+
16
+ #### :hammer_and_wrench: Others
17
+
18
+ - test: increase coverage [kreafox - [`004a588`](https://github.com/eea/volto-cca-policy/commit/004a5883f1569222022ee4e7d81fda039691f9b8)]
19
+ - test: fix issue reported by sonarqube [kreafox - [`c71a32e`](https://github.com/eea/volto-cca-policy/commit/c71a32e37791a2def50117a4d7e1722dd7352c24)]
20
+ - Add show label [Tiberiu Ichim - [`138e61e`](https://github.com/eea/volto-cca-policy/commit/138e61e37a52bb2de92273841aa120a0902e50d4)]
21
+ - test: fix issue reported by sonarqube [kreafox - [`4985ecf`](https://github.com/eea/volto-cca-policy/commit/4985ecfa7d0444c00f34e9f04f90df22ed6e379d)]
22
+ - Add titles [Tiberiu Ichim - [`0357d59`](https://github.com/eea/volto-cca-policy/commit/0357d590ae65b17af7739b6bfd1912f756d389c1)]
23
+ - Use universalLink [Tiberiu Ichim - [`23234fd`](https://github.com/eea/volto-cca-policy/commit/23234fd4c480059e1b68cb8e67f0c6dbf869e45b)]
24
+ - Fix portal types [Tiberiu Ichim - [`ec763b5`](https://github.com/eea/volto-cca-policy/commit/ec763b558f6b58ee63c0f5c1c5c828b847a63ef4)]
25
+ - URL for EEA Search [Tiberiu Ichim - [`2aff2a8`](https://github.com/eea/volto-cca-policy/commit/2aff2a8090195bd3d1bdb3e0328f34e7423f2c10)]
26
+ - WIP on eea search [Tiberiu Ichim - [`6c9e19b`](https://github.com/eea/volto-cca-policy/commit/6c9e19bff8c6049e3585cb44af99236310d9d9bb)]
27
+ - Refs #266057 - Fix event URL in event title when event_url is empty. [GhitaB - [`33bfaf0`](https://github.com/eea/volto-cca-policy/commit/33bfaf0957d8ab26fef1d47b9f52925ac5a60748)]
28
+ - Improve icons [Tiberiu Ichim - [`19f2606`](https://github.com/eea/volto-cca-policy/commit/19f2606df7388d3cca1bc0d4af5739b8064d8531)]
29
+ - Refs #266057 - Use DD MMM instead of DD.MMM. in events cards listing. [GhitaB - [`13db0b7`](https://github.com/eea/volto-cca-policy/commit/13db0b7e78bdd78e1e39448e4e373a8d333de11e)]
30
+ - Improve icons [Tiberiu Ichim - [`c9bff8d`](https://github.com/eea/volto-cca-policy/commit/c9bff8d770dcdfe98d58147aa396ce99210269e9)]
31
+ - Improve icons [Tiberiu Ichim - [`b86add7`](https://github.com/eea/volto-cca-policy/commit/b86add76fb86e7c4b71242d0477079424393e1a4)]
32
+ - Improve icons [Tiberiu Ichim - [`23e1a6f`](https://github.com/eea/volto-cca-policy/commit/23e1a6fd59998e7f3179775c194f9f917dba5a55)]
33
+ - Add collection summary WIP [Tiberiu Ichim - [`b637b2d`](https://github.com/eea/volto-cca-policy/commit/b637b2d1593bed2ebf201827d9b358ff9121b424)]
34
+ - Add collection summary WIP [Tiberiu Ichim - [`4b3c952`](https://github.com/eea/volto-cca-policy/commit/4b3c9520d875ed078d59698220617d41b853baa3)]
35
+ - country map ol remove old JS and d3 View [Tripon Eugen - [`2dd7dc6`](https://github.com/eea/volto-cca-policy/commit/2dd7dc68a88abbcf873db37237dc7b1b841194f2)]
36
+ - country map ol style outside eu [Tripon Eugen - [`fa6b322`](https://github.com/eea/volto-cca-policy/commit/fa6b322008ea64596328f5217f1a9b9ca6d91f6d)]
37
+ - Move CSS from voltoCustom.css [kreafox - [`388c70e`](https://github.com/eea/volto-cca-policy/commit/388c70ece86c5b103f84c13819ac7bb8e82c59d7)]
38
+ - style fix [kreafox - [`e2ee48c`](https://github.com/eea/volto-cca-policy/commit/e2ee48cc56167d7f84f62a265f0c7b4771e9aab6)]
39
+ - Add collection summary WIP [Tiberiu Ichim - [`6d94aad`](https://github.com/eea/volto-cca-policy/commit/6d94aadfb565d0ea2699848054c13b24735658a2)]
40
+ - Add parent folder for country map [Tiberiu Ichim - [`a694db9`](https://github.com/eea/volto-cca-policy/commit/a694db9c2d8e45231b208a748c0b02d318282a0d)]
41
+ - Add visibility sensor for map [Tiberiu Ichim - [`51548c6`](https://github.com/eea/volto-cca-policy/commit/51548c6c04ecff65ce7237dce6e9cbff0888184a)]
42
+ - country map ol eslint [Tripon Eugen - [`bc49f3f`](https://github.com/eea/volto-cca-policy/commit/bc49f3f85b892591c6ea7e4764763e3bbe6b387d)]
43
+ - country map ol eslint [Tripon Eugen - [`e2df968`](https://github.com/eea/volto-cca-policy/commit/e2df968ea4b5dc669868c6a2cc51589353b4481b)]
44
+ - country map ol eslint [Tripon Eugen - [`171b34b`](https://github.com/eea/volto-cca-policy/commit/171b34bd0d78000f8a723647194b5aa9c8512915)]
45
+ - country map ol eslint [Tripon Eugen - [`491941f`](https://github.com/eea/volto-cca-policy/commit/491941f9a766acc67d0dcb66bb06f197fe0f5a43)]
46
+ - country map ol eslint [Tripon Eugen - [`0431124`](https://github.com/eea/volto-cca-policy/commit/0431124e3df5e828e5521801da40702642e8085d)]
47
+ - country map ol blues with green hover [Tripon Eugen - [`f8adf0a`](https://github.com/eea/volto-cca-policy/commit/f8adf0a036f9667f3f9b8ba66b50176967d6957c)]
48
+ - WIP [Tiberiu Ichim - [`300d3d0`](https://github.com/eea/volto-cca-policy/commit/300d3d0de2aaa32196274bc44808efaa86dc34f7)]
49
+ - country map ol init [Tripon Eugen - [`1679de1`](https://github.com/eea/volto-cca-policy/commit/1679de1b5a5677a4ae2e3d0a1cdc2010f800a54d)]
50
+ ### [0.1.84](https://github.com/eea/volto-cca-policy/compare/0.1.83...0.1.84) - 28 February 2024
51
+
52
+ #### :bug: Bug Fixes
53
+
54
+ - fix: image gallery [kreafox - [`758a8f3`](https://github.com/eea/volto-cca-policy/commit/758a8f3d187e44e7782c6bba2e9d98e3f179b559)]
55
+ - fix: remove unused import [kreafox - [`9790189`](https://github.com/eea/volto-cca-policy/commit/97901892059d308a9500f53573ea1f1f0e27a587)]
56
+ - fix: className [kreafox - [`851d7f1`](https://github.com/eea/volto-cca-policy/commit/851d7f1c6ac5ccc338225f18ab33f08b414d517f)]
57
+ - fix: more checks on db items [kreafox - [`e673ca8`](https://github.com/eea/volto-cca-policy/commit/e673ca85fed7ebab6879a3dc8d09f6b80b97fce5)]
58
+ - fix: missing content on c3sindicator view [kreafox - [`0126bb5`](https://github.com/eea/volto-cca-policy/commit/0126bb5ad2653956cd2863e03f66b6f18d9a25c4)]
59
+ - fix: error on missing metadata values [kreafox - [`300849b`](https://github.com/eea/volto-cca-policy/commit/300849b0d4b17d6352290479fdd6458af538aa50)]
60
+
61
+ #### :nail_care: Enhancements
62
+
63
+ - change: remove Footer customization [kreafox - [`b1c2c86`](https://github.com/eea/volto-cca-policy/commit/b1c2c8608eaff77db40cbf1d9158a7a72bd558aa)]
64
+ - change: small updates on db items, cleanup [kreafox - [`0a3981b`](https://github.com/eea/volto-cca-policy/commit/0a3981be1d2761d2bdf5049b0a2cffa1417687bc)]
65
+ - change: update mission stories search index [kreafox - [`3ea7107`](https://github.com/eea/volto-cca-policy/commit/3ea71075e30cb8fa8d5a0b28822ab67ea6c1c7e9)]
66
+ - change: update case study view, add ImageGallery component [kreafox - [`5a83100`](https://github.com/eea/volto-cca-policy/commit/5a83100f76f4f64655561f09e20a516a403dd982)]
67
+ - change: formatting [kreafox - [`00a0baa`](https://github.com/eea/volto-cca-policy/commit/00a0baa225d2e39cc3b75e41a870c23a45a9b62a)]
68
+
69
+ #### :house: Internal changes
70
+
71
+ - style: nonclickable menu [kreafox - [`dc11808`](https://github.com/eea/volto-cca-policy/commit/dc11808c1ca5006713522f152c0d8359a4324ea1)]
72
+ - style: update c3s indicator view [kreafox - [`2007587`](https://github.com/eea/volto-cca-policy/commit/2007587f919d2866ea79b846585c3177e4b905fd)]
73
+
74
+ #### :hammer_and_wrench: Others
75
+
76
+ - Refs #265786 - Fix text Climate-ADAPT in events cards listing. [GhitaB - [`66e5f3d`](https://github.com/eea/volto-cca-policy/commit/66e5f3d6876cae0f6e3e2ebda11fcbd19cc10e5b)]
77
+ - test: update tests for db items view [kreafox - [`ed3af67`](https://github.com/eea/volto-cca-policy/commit/ed3af67da0f535b5dda8616fe8523f286bbca935)]
78
+ - CCA Event, Event view: use BannerTitle. [GhitaB - [`84d1dd6`](https://github.com/eea/volto-cca-policy/commit/84d1dd6e9472de069de8c2d1aedf9f00030e60c8)]
79
+ - WIP: improve layout on DB items, code cleanup [kreafox - [`2f14ad1`](https://github.com/eea/volto-cca-policy/commit/2f14ad1be2b09ddf569b1c9893f113031421d6f5)]
80
+ - WIP: database items view [kreafox - [`4602d76`](https://github.com/eea/volto-cca-policy/commit/4602d762849b2c84cc26af9f528fb11f22618c0f)]
81
+ ### [0.1.83](https://github.com/eea/volto-cca-policy/compare/0.1.82...0.1.83) - 27 February 2024
8
82
 
9
83
  #### :hammer_and_wrench: Others
10
84
 
@@ -409,13 +483,10 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
409
483
  - Refs #260715 rast-block wip [Tripon Eugen - [`f19d54e`](https://github.com/eea/volto-cca-policy/commit/f19d54e0b9a6a86bf344eb85b6a1cda7f3de91bf)]
410
484
  - Refs #260715 rast-block wip [Tripon Eugen - [`2828537`](https://github.com/eea/volto-cca-policy/commit/2828537b6c084cd1a82162d552fb4ef025b71f9f)]
411
485
  - Refs #260715 rast-block updates [Tripon Eugen - [`1e803e5`](https://github.com/eea/volto-cca-policy/commit/1e803e5bd3d3fb7558f261c76c68866be7beb8b5)]
412
- - test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`0a15e1b`](https://github.com/eea/volto-cca-policy/commit/0a15e1b2ad081233685e80d5b3c60a8663f6b896)]
413
- - test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`9554e44`](https://github.com/eea/volto-cca-policy/commit/9554e44c92a621a52b2adb5a4830fb084ee5734b)]
414
486
  ### [0.1.49](https://github.com/eea/volto-cca-policy/compare/0.1.48...0.1.49) - 15 November 2023
415
487
 
416
488
  #### :house: Internal changes
417
489
 
418
- - chore: [JENKINS] Refactor automated testing [valentinab25 - [`7b820a6`](https://github.com/eea/volto-cca-policy/commit/7b820a6369c2ddd5203b1a4abe352cb4bb43db7a)]
419
490
  - chore: husky, lint-staged use fixed versions [valentinab25 - [`f0a8061`](https://github.com/eea/volto-cca-policy/commit/f0a8061c275c236deb00087c23fac9860a073106)]
420
491
 
421
492
  #### :hammer_and_wrench: Others
@@ -432,9 +503,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
432
503
  - Refs #259267 - jenkins test [Tripon Eugen - [`cacd31e`](https://github.com/eea/volto-cca-policy/commit/cacd31e7b1afe0983674ed5c7632d2e1d7fa752e)]
433
504
  - Refs #259267 - jenkins [Tripon Eugen - [`5b3affe`](https://github.com/eea/volto-cca-policy/commit/5b3affee8401239de10097884c1b7f2349d15ec0)]
434
505
  - Refs #259267 - add When, lead image and title to files [Tripon Eugen - [`2cedb23`](https://github.com/eea/volto-cca-policy/commit/2cedb237f898af9057e13fba94b615ef71077204)]
435
- - test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`4d607a5`](https://github.com/eea/volto-cca-policy/commit/4d607a576e9d0a5c34e48c41b409e7df616ee3d6)]
436
- - test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`b7f74d5`](https://github.com/eea/volto-cca-policy/commit/b7f74d53513a6edbfbca5cb6d19687929bb1e5db)]
437
- - test: [JENKINS] Improve cypress time [valentinab25 - [`db65617`](https://github.com/eea/volto-cca-policy/commit/db656173391f65157098d95d388c25f6429753d8)]
438
506
  - Refs #259267 - cca event blocks attachments and check not mandatoty fields [Tripon Eugen - [`3138e5a`](https://github.com/eea/volto-cca-policy/commit/3138e5afb5bfbdbed14e27ed457b16867b7fa414)]
439
507
  - 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)]
440
508
  - Refs #161485 - Fix ECDE name conflict. [GhitaB - [`8bfd99f`](https://github.com/eea/volto-cca-policy/commit/8bfd99ff68bb82a04d1c0ed625fa514fcf46289e)]
@@ -651,7 +719,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
651
719
 
652
720
  #### :house: Internal changes
653
721
 
654
- - chore: [JENKINS] Remove alpha testing version [valentinab25 - [`ad1ced0`](https://github.com/eea/volto-cca-policy/commit/ad1ced0971ba116c13a3b5fcc039172cc915c919)]
655
722
 
656
723
  #### :hammer_and_wrench: Others
657
724
 
@@ -1132,7 +1199,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1132
1199
  #### :hammer_and_wrench: Others
1133
1200
 
1134
1201
  - Refs #158294 - Update supported languages list. [GhitaB - [`0a4f91f`](https://github.com/eea/volto-cca-policy/commit/0a4f91f39b7edc367bd4c127d6a8f273c7788361)]
1135
- - Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`8f1f9ce`](https://github.com/eea/volto-cca-policy/commit/8f1f9ce6c22805670cc0800d3c779b6d619d0f31)]
1136
1202
  ### [0.1.1](https://github.com/eea/volto-cca-policy/compare/0.1.0...0.1.1) - 13 December 2022
1137
1203
 
1138
1204
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-cca-policy",
3
- "version": "0.1.83",
3
+ "version": "0.1.85",
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",
@@ -40,7 +40,9 @@
40
40
  "@eeacms/volto-widget-geolocation": "*",
41
41
  "@eeacms/volto-widget-temporal-coverage": "*",
42
42
  "d3": "4",
43
- "d3-geo": "3"
43
+ "d3-geo": "3",
44
+ "query-string": "7.1.0",
45
+ "react-visibility-sensor": "5.1.1"
44
46
  },
45
47
  "devDependencies": {
46
48
  "@cypress/code-coverage": "^3.10.0",
@@ -1 +1,2 @@
1
+ export ImageGallery from './theme/ImageGallery/ImageGallery';
1
2
  export BannerTitle from './theme/BannerTitle/BannerTitle';
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { SidebarPortal } from '@plone/volto/components';
3
+ import InlineForm from '@plone/volto/components/manage/Form/InlineForm';
4
+ import Schema from './schema';
5
+ import View from './CollectionStatsView';
6
+
7
+ const Edit = (props) => {
8
+ const schema = Schema();
9
+ return (
10
+ <>
11
+ <View {...props} mode="edit" />
12
+
13
+ <SidebarPortal selected={props.selected}>
14
+ <InlineForm
15
+ schema={schema}
16
+ title={schema.title}
17
+ onChangeField={(id, value) => {
18
+ props.onChangeBlock(props.block, {
19
+ ...props.data,
20
+ [id]: value,
21
+ });
22
+ }}
23
+ formData={props.data}
24
+ />
25
+ </SidebarPortal>
26
+ </>
27
+ );
28
+ };
29
+
30
+ export default Edit;
@@ -0,0 +1,124 @@
1
+ import React from 'react';
2
+ import { useSelector, useDispatch } from 'react-redux';
3
+ import { getQueryStats } from '@eeacms/volto-cca-policy/store';
4
+ import { getBaseUrl as getBase } from '@eeacms/volto-cca-policy/utils';
5
+ import { getBaseUrl } from '@plone/volto/helpers';
6
+ import { Icon, UniversalLink } from '@plone/volto/components';
7
+ import { Icon as UiIcon } from 'semantic-ui-react';
8
+ import config from '@plone/volto/registry';
9
+
10
+ import qs from 'query-string';
11
+ import './styles.less';
12
+
13
+ const useStats = (path, id, data) => {
14
+ const dispatch = useDispatch();
15
+
16
+ React.useEffect(() => {
17
+ dispatch(getQueryStats(path, id, data));
18
+ }, [path, id, data, dispatch]);
19
+
20
+ const stats = useSelector((store) => store.querystats?.[id]?.items || {});
21
+
22
+ return stats;
23
+ };
24
+
25
+ export const StatVoltoIcon = ({ name, value, source, showLabel = false }) => {
26
+ return (
27
+ <div className="tab-icon" title={value}>
28
+ <div className="tab-icon-wrapper">
29
+ {!source && name}
30
+ {!!source && <Icon title={name} name={source} size="50" />}
31
+ <span className="count">{value}</span>
32
+ </div>
33
+ {!!showLabel && <span className="label">{name}</span>}
34
+ </div>
35
+ );
36
+ };
37
+
38
+ export const RemixIcon = ({ name, value, source, showLabel = false }) => {
39
+ return (
40
+ <div className="tab-icon semantic-icon" title={value}>
41
+ <div className="tab-icon-wrapper">
42
+ {!!source && <UiIcon title={name} name={source} />}
43
+ <span className="count">{value}</span>
44
+ </div>
45
+ {!!showLabel && <span className="label">{name}</span>}
46
+ </div>
47
+ );
48
+ };
49
+
50
+ const makeSearchBlockQuery = ({ base, query, field, value }) => {
51
+ const filtered = [
52
+ ...query.filter(({ i }) => i !== field),
53
+ {
54
+ i: field,
55
+ o: 'plone.app.querystring.operation.selection.any',
56
+ v: [value],
57
+ },
58
+ ];
59
+ const params = qs.stringify({ query: JSON.stringify(filtered) });
60
+
61
+ return `${base}?${params}`;
62
+ };
63
+
64
+ const makeEEASearchQuery = ({ base, field, value }) => {
65
+ // TODO: don't hardcode the language
66
+ const rest =
67
+ 'filters[1][field]=issued.date&filters[1][values][0]=Last 5 years&filters[1][type]=any&filters[2][field]=language&filters[2][values][0]=en&filters[2][type]=any&sort-field=issued.date&sort-direction=desc';
68
+ const filter = `filters[0][field]=${field}&filters[0][type]=any&filters[0][values][0]=${value}`;
69
+
70
+ return `${base}?size=n_10_n&${filter}&${rest}`;
71
+ };
72
+
73
+ const urlBuilders = {
74
+ SearchBlock: makeSearchBlockQuery,
75
+ EEASemanticSearch: makeEEASearchQuery,
76
+ };
77
+
78
+ const nop = () => '';
79
+
80
+ export default function CollectionStatsView(props) {
81
+ const { id, data = {}, pathname = props.path } = props;
82
+ const field = data.aggregateField?.value;
83
+ const { queryParameterStyle = 'SearchBlock', query = {}, showLabel } = data;
84
+ const base = getBase(props);
85
+ let stats = useStats(getBaseUrl(pathname), id, data);
86
+
87
+ const groupDefinition =
88
+ config.blocks.blocksConfig.collectionStats.groups[field] || {};
89
+ const { cleanup, icons = {}, iconComponent: IconComponent } = groupDefinition;
90
+
91
+ if (cleanup) stats = cleanup(stats);
92
+
93
+ const keys = Object.keys(stats);
94
+ const urlHandler = urlBuilders[queryParameterStyle] || nop;
95
+
96
+ return (
97
+ (field && keys.length > 0 && (
98
+ <div className="collection-stats">
99
+ {keys
100
+ .sort((a, b) => a.localeCompare(b))
101
+ .map((k) => (
102
+ <UniversalLink
103
+ key={k}
104
+ href={urlHandler({
105
+ base,
106
+ query: query.query,
107
+ field: groupDefinition.searchFieldName || field,
108
+ value: k,
109
+ })}
110
+ >
111
+ <IconComponent
112
+ name={k}
113
+ value={stats[k]}
114
+ field={field}
115
+ source={icons[k]}
116
+ showLabel={showLabel}
117
+ />
118
+ </UniversalLink>
119
+ ))}
120
+ </div>
121
+ )) ||
122
+ 'no results'
123
+ );
124
+ }
@@ -0,0 +1,128 @@
1
+ import CollectionStatsEdit from './CollectionStatsEdit';
2
+ import CollectionStatsView, {
3
+ StatVoltoIcon,
4
+ RemixIcon,
5
+ } from './CollectionStatsView';
6
+
7
+ import worldSVG from '@plone/volto/icons/world.svg';
8
+ import airPollutionSvg from '@eeacms/volto-cca-policy/icons/air_pollution_and_aero-allergens.svg';
9
+ import heatSvg from '@eeacms/volto-cca-policy/icons/heat.svg';
10
+ import climateSensitiveSvg from '@eeacms/volto-cca-policy/icons/climate-sensitive_diseases.svg';
11
+ import wildfiresSvg from '@eeacms/volto-cca-policy/icons/wildfires.svg';
12
+ import droughtsSvg from '@eeacms/volto-cca-policy/icons/droughts_and_floods.svg';
13
+
14
+ const healthImpactIcons = {
15
+ 'Climate-sensitive diseases': climateSensitiveSvg,
16
+ Heat: heatSvg,
17
+ Wildfires: wildfiresSvg,
18
+ 'Droughts and floods': droughtsSvg,
19
+ 'Air pollution and aero-allergens': airPollutionSvg,
20
+ };
21
+
22
+ const portalTypeIcons = {
23
+ 'Case study': 'file text',
24
+ Guidance: 'compass',
25
+ Indicator: 'area chart',
26
+ 'Information portal': 'info circle',
27
+ 'Publication reference': 'newspaper',
28
+ 'Research and knowledge project': 'university',
29
+ Tool: 'wrench',
30
+ Video: 'video play',
31
+ // 'eea.climateadapt.aceproject': '',
32
+ // 'eea.climateadapt.adaptationoption': '',
33
+ // 'eea.climateadapt.c3sindicator': '',
34
+ // 'eea.climateadapt.mapgraphdataset': '',
35
+ // 'eea.climateadapt.organisation': '',
36
+ };
37
+
38
+ const portalTypesToSearchTypes = {
39
+ 'eea.climateadapt.adaptationoption': 'Adaptation option',
40
+ 'eea.climateadapt.casestudy': 'Case study',
41
+ 'eea.climateadapt.guidancedocument': 'Guidance',
42
+ 'eea.climateadapt.indicator': 'Indicator',
43
+ 'eea.climateadapt.c3sindicator': 'Indicator',
44
+ 'eea.climateadapt.informationportal': 'Information portal',
45
+ 'eea.climateadapt.publicationreport': 'Publication reference',
46
+ 'eea.climateadapt.researchproject': 'Research and knowledge project',
47
+ 'eea.climateadapt.tool': 'Tool',
48
+ 'eea.climateadapt.video': 'Video',
49
+ // TODO: what about these?
50
+ // 'eea.climateadapt.aceproject': '',
51
+ // 'eea.climateadapt.mapgraphdataset': '',
52
+ // 'eea.climateadapt.organisation': '',
53
+ };
54
+
55
+ export default function installCollectionStatsBlock(config) {
56
+ config.blocks.blocksConfig.collectionStats = {
57
+ id: 'collectionStats',
58
+ title: 'Collection Statistics',
59
+ icon: worldSVG,
60
+ group: 'site',
61
+ edit: CollectionStatsEdit,
62
+ view: CollectionStatsView,
63
+ sidebarTab: 1,
64
+ security: {
65
+ addPermission: [],
66
+ view: [],
67
+ },
68
+ groups: {
69
+ health_impacts: {
70
+ cleanup: (stats) => {
71
+ const res = {};
72
+ Object.keys(stats).forEach((name) => {
73
+ const count = parseInt(stats[name]);
74
+
75
+ if (name === 'Air quality and aeroallergens')
76
+ name = 'Air pollution and aero-allergens';
77
+ if (name === 'Heat and cold') name = 'Heat';
78
+ if (name === 'Floods and storms') name = 'Droughts and floods';
79
+
80
+ // if (name === '-NONSPECIFIC-') return;
81
+ // this excludes options that have no icon
82
+ if (!healthImpactIcons[name]) return;
83
+
84
+ if (!res[name]) res[name] = 0;
85
+ res[name] += count;
86
+ });
87
+
88
+ return res;
89
+ },
90
+ icons: healthImpactIcons,
91
+ iconComponent: StatVoltoIcon,
92
+ },
93
+ portal_type: {
94
+ searchFieldName: 'objectProvides',
95
+ cleanup: (stats) => {
96
+ const res = {};
97
+ Object.keys(stats).forEach((name) => {
98
+ const count = parseInt(stats[name]);
99
+
100
+ name = portalTypesToSearchTypes[name];
101
+ if (!name) return;
102
+
103
+ if (!portalTypeIcons[name]) return;
104
+
105
+ if (!res[name]) res[name] = 0;
106
+ res[name] += count;
107
+ });
108
+ return res;
109
+ },
110
+ icons: portalTypeIcons,
111
+ iconComponent: RemixIcon,
112
+ },
113
+ },
114
+ };
115
+
116
+ return config;
117
+ }
118
+
119
+ // -NONSPECIFIC-
120
+ // Air pollution and aero-allergens
121
+ // Air quality and aeroallergens
122
+ // Climate-sensitive diseases
123
+ // Droughts and floods
124
+ // Floods and storms
125
+ // Heat
126
+ // Heat and cold
127
+ // Infectious diseases
128
+ // Wildfires
@@ -0,0 +1,76 @@
1
+ import {
2
+ hasNonValueOperation,
3
+ hasDateOperation,
4
+ } from '@plone/volto/components/manage/Blocks/Search/utils';
5
+
6
+ const Schema = () => {
7
+ return {
8
+ title: 'Collection Statistics',
9
+ fieldsets: [
10
+ {
11
+ id: 'default',
12
+ title: 'Default',
13
+ fields: ['aggregateField', 'queryParameterStyle', 'href', 'showLabel'],
14
+ },
15
+ {
16
+ id: 'query',
17
+ title: 'Query',
18
+ fields: ['query'],
19
+ },
20
+ ],
21
+ properties: {
22
+ query: {
23
+ title: 'Query',
24
+ widget: 'query',
25
+ },
26
+ aggregateField: {
27
+ title: 'Aggregate Field',
28
+ widget: 'select_querystring_field',
29
+ vocabulary: { '@id': 'plone.app.vocabularies.MetadataFields' },
30
+ filterOptions: (options) => {
31
+ // Only allows indexes that provide simple, fixed vocabularies.
32
+ // This should be improved, together with the facets. The querystring
33
+ // widget implementation should serve as inspiration for those dynamic
34
+ // types of facets.
35
+ return Object.assign(
36
+ {},
37
+ ...Object.keys(options).map((k) => {
38
+ const flag =
39
+ Object.keys(options[k].values || {}).length ||
40
+ hasNonValueOperation(options[k].operations) ||
41
+ hasDateOperation(options[k].operations);
42
+ return flag ? { [k]: options[k] } : {};
43
+ }),
44
+ );
45
+ },
46
+ },
47
+ queryParameterStyle: {
48
+ title: 'Query parameters syle',
49
+ description: 'The destination listing page type',
50
+ choices: [
51
+ ['SearchBlock', 'Volto Search block'],
52
+ ['EEASemanticSearch', 'EEA Semantic Search'],
53
+ ],
54
+ default: 'ListingBlock',
55
+ },
56
+ showLabel: {
57
+ type: 'boolean',
58
+ title: 'Show label',
59
+ default: false,
60
+ },
61
+
62
+ href: {
63
+ title: 'Listing page',
64
+ description:
65
+ 'The destination listing page. If empty, the current folder will be used.',
66
+ widget: 'object_browser',
67
+ mode: 'link',
68
+ selectedItemAttrs: [],
69
+ allowExternals: true,
70
+ },
71
+ },
72
+ required: [],
73
+ };
74
+ };
75
+
76
+ export default Schema;
@@ -0,0 +1,49 @@
1
+ @type: 'extra';
2
+ @element: 'custom';
3
+
4
+ @import (multiple, reference, optional) '../../theme.config';
5
+
6
+ .collection-stats {
7
+ display: flex;
8
+ flex-direction: row;
9
+ flex-wrap: wrap;
10
+ margin: 2em 0;
11
+ gap: 2.5em;
12
+
13
+ .semantic-icon i.icon {
14
+ font-size: 3em;
15
+ }
16
+
17
+ .tab-icon-wrapper {
18
+ position: relative;
19
+ display: inline-block;
20
+ }
21
+
22
+ .tab-icon {
23
+ color: @secondaryColor;
24
+ text-align: center;
25
+
26
+ .label {
27
+ display: block;
28
+ max-width: 130px;
29
+ }
30
+
31
+ .count {
32
+ position: absolute;
33
+ z-index: 100;
34
+ top: auto;
35
+ bottom: 0;
36
+ left: 100%;
37
+ width: 25px;
38
+ height: 25px;
39
+ margin-left: -1.5em;
40
+ background-color: #161c23;
41
+ border-radius: 50%;
42
+ color: @white;
43
+ font-size: 9px;
44
+ font-weight: 700;
45
+ line-height: 25px;
46
+ text-align: center;
47
+ }
48
+ }
49
+ }
@@ -1,5 +1,28 @@
1
+ import { BlockDataForm, SidebarPortal } from '@plone/volto/components';
1
2
  import CountryMapObservatoryView from './CountryMapObservatoryOLView';
3
+ import Schema from './schema';
2
4
 
3
5
  export default function CountryMapObservatoryEdit(props) {
4
- return <CountryMapObservatoryView {...props} mode="edit" />;
6
+ const { block, data, onChangeBlock, selected } = props;
7
+ const schema = Schema(data);
8
+ return (
9
+ <>
10
+ <CountryMapObservatoryView {...props} mode="edit" />
11
+ <SidebarPortal selected={selected}>
12
+ <BlockDataForm
13
+ block={block}
14
+ title={schema.title}
15
+ schema={schema}
16
+ onChangeField={(id, value) => {
17
+ onChangeBlock(block, {
18
+ ...data,
19
+ [id]: value,
20
+ });
21
+ }}
22
+ onChangeBlock={onChangeBlock}
23
+ formData={data}
24
+ />
25
+ </SidebarPortal>
26
+ </>
27
+ );
5
28
  }
@@ -1,3 +1,4 @@
1
+ import { getBaseUrl } from '@eeacms/volto-cca-policy/utils';
1
2
  import React from 'react';
2
3
  import { compose } from 'redux';
3
4
  import { clientOnly } from '@eeacms/volto-cca-policy/helpers';
@@ -8,6 +9,7 @@ import { openlayers as ol } from '@eeacms/volto-openlayers-map';
8
9
  import { euCountryNames } from '@eeacms/volto-cca-policy/helpers/country_map/countryMap';
9
10
 
10
11
  import withResponsiveContainer from '../withResponsiveContainer';
12
+ import withVisibilitySensor from '../withVisibilitySensor';
11
13
  import { makeStyles } from './mapstyle';
12
14
  import { Interactions } from './Interactions';
13
15
  import { withGeoJsonData } from './hocs';
@@ -85,7 +87,7 @@ const CountryMapObservatoryView = (props) => {
85
87
  ]);
86
88
  }, [geofeatures]);
87
89
 
88
- const baseUrl = props.path || props.location?.pathname || '';
90
+ const baseUrl = getBaseUrl(props);
89
91
 
90
92
  const onFeatureClick = React.useCallback(
91
93
  (feature) => {
@@ -94,6 +96,7 @@ const CountryMapObservatoryView = (props) => {
94
96
  },
95
97
  [baseUrl, history],
96
98
  );
99
+ // console.log(geofeatures, projection, euCountriesSource, overlaySource);
97
100
 
98
101
  return tileWMSSources ? (
99
102
  <Map
@@ -135,4 +138,5 @@ export default compose(
135
138
  clientOnly,
136
139
  withGeoJsonData,
137
140
  withResponsiveContainer('countryMapObservatory'),
141
+ withVisibilitySensor(),
138
142
  )(CountryMapObservatoryView);
@@ -28,8 +28,6 @@ export const Interactions = ({ overlaySource, tooltipRef, onFeatureClick }) => {
28
28
  if (evt.dragging) {
29
29
  return;
30
30
  }
31
- // eslint-disable-next-line no-console
32
- console.log('CountryObservatoryMap event');
33
31
  const domEvt = evt.originalEvent;
34
32
  const pixel = map.getEventPixel(evt.originalEvent);
35
33
  const feature = map.forEachFeatureAtPixel(pixel, function (feature) {