@eeacms/volto-cca-policy 0.1.84 → 0.1.86
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.
- package/CHANGELOG.md +63 -0
- package/package.json +4 -2
- package/src/components/manage/Blocks/CollectionStatistics/CollectionStatsEdit.jsx +30 -0
- package/src/components/manage/Blocks/CollectionStatistics/CollectionStatsView.jsx +125 -0
- package/src/components/manage/Blocks/CollectionStatistics/index.js +128 -0
- package/src/components/manage/Blocks/CollectionStatistics/schema.js +76 -0
- package/src/components/manage/Blocks/CollectionStatistics/styles.less +68 -0
- package/src/components/manage/Blocks/CountryMapObservatory/CountryMapObservatoryEdit.jsx +24 -1
- package/src/components/manage/Blocks/CountryMapObservatory/CountryMapObservatoryOLView.jsx +5 -1
- package/src/components/manage/Blocks/CountryMapObservatory/Interactions.jsx +0 -2
- package/src/components/manage/Blocks/CountryMapObservatory/schema.js +11 -14
- package/src/components/manage/Blocks/CountryMapProfile/Edit.js +1 -1
- package/src/components/manage/Blocks/CountryMapProfile/Filter.jsx +25 -59
- package/src/components/manage/Blocks/CountryMapProfile/Interactions.jsx +197 -0
- package/src/components/manage/Blocks/CountryMapProfile/OLView.jsx +232 -0
- package/src/components/manage/Blocks/CountryMapProfile/hocs.jsx +28 -0
- package/src/components/manage/Blocks/CountryMapProfile/index.js +1 -1
- package/src/components/manage/Blocks/CountryMapProfile/mapstyle.js +86 -0
- package/src/components/manage/Blocks/CountryMapProfile/styles.less +43 -10
- package/src/components/manage/Blocks/Listing/EventCardsListingView.jsx +9 -2
- package/src/components/manage/Blocks/index.js +2 -0
- package/src/components/manage/Blocks/withVisibilitySensor.jsx +61 -0
- package/src/components/theme/BannerTitle/BannerTitle.jsx +14 -8
- package/src/components/theme/Views/CcaEventView.test.jsx +109 -0
- package/src/icons/air_pollution_and_aero-allergens.svg +1 -0
- package/src/icons/climate-sensitive_diseases.svg +7 -0
- package/src/icons/droughts_and_floods.svg +20 -0
- package/src/icons/heat.svg +1 -0
- package/src/icons/wildfires.svg +1 -0
- package/src/store/actions/querystats.js +13 -0
- package/src/store/constants.js +1 -0
- package/src/store/index.js +9 -1
- package/src/store/reducers/querystats.js +40 -0
- package/src/utils.js +17 -0
- package/theme/globals/mission.less +20 -0
- package/theme/globals/observatory.less +115 -0
- package/theme/globals/site.overrides +49 -44
- package/src/components/manage/Blocks/CountryMapProfile/View.js +0 -121
- package/src/components/manage/Blocks/CountryMapProfile/map-utils.js +0 -457
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,61 @@ 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.86](https://github.com/eea/volto-cca-policy/compare/0.1.85...0.1.86) - 1 March 2024
|
|
8
|
+
|
|
9
|
+
#### :nail_care: Enhancements
|
|
10
|
+
|
|
11
|
+
- change(banner): improve BannerTitle component [kreafox - [`bb49297`](https://github.com/eea/volto-cca-policy/commit/bb49297ff439dba1b8174cb65c9aae2fc419d047)]
|
|
12
|
+
|
|
13
|
+
#### :house: Internal changes
|
|
14
|
+
|
|
15
|
+
- style(stats): CSS fixes [kreafox - [`696c0fd`](https://github.com/eea/volto-cca-policy/commit/696c0fda6241f264f097e76812ada3b30b2ef760)]
|
|
16
|
+
- style(stats): fix z-index on count [kreafox - [`aeaaf1c`](https://github.com/eea/volto-cca-policy/commit/aeaaf1cc912a946b5c2553937c41940b926d3dd8)]
|
|
17
|
+
- style: improve tab items on hover [kreafox - [`7b0bc8b`](https://github.com/eea/volto-cca-policy/commit/7b0bc8b8e398503521d86048f96c5d2749595a55)]
|
|
18
|
+
|
|
19
|
+
### [0.1.85](https://github.com/eea/volto-cca-policy/compare/0.1.84...0.1.85) - 29 February 2024
|
|
20
|
+
|
|
21
|
+
#### :house: Internal changes
|
|
22
|
+
|
|
23
|
+
- style: improve tabs with labels [kreafox - [`5a5ff35`](https://github.com/eea/volto-cca-policy/commit/5a5ff350bcd4d6a876c0d5e86950d89d84b84c7c)]
|
|
24
|
+
- style: increase the count size a bit [kreafox - [`2f1e26c`](https://github.com/eea/volto-cca-policy/commit/2f1e26c14deab6e240f7357ba6283fc7532640c4)]
|
|
25
|
+
- style: improve tabs [kreafox - [`7939172`](https://github.com/eea/volto-cca-policy/commit/7939172ec5badcffc489599cd02783b117609e36)]
|
|
26
|
+
- style: Automated code fix [eea-jenkins - [`69f7534`](https://github.com/eea/volto-cca-policy/commit/69f753479ef255be149b3604777fd035bb767ddc)]
|
|
27
|
+
|
|
28
|
+
#### :hammer_and_wrench: Others
|
|
29
|
+
|
|
30
|
+
- test: increase coverage [kreafox - [`004a588`](https://github.com/eea/volto-cca-policy/commit/004a5883f1569222022ee4e7d81fda039691f9b8)]
|
|
31
|
+
- test: fix issue reported by sonarqube [kreafox - [`c71a32e`](https://github.com/eea/volto-cca-policy/commit/c71a32e37791a2def50117a4d7e1722dd7352c24)]
|
|
32
|
+
- Add show label [Tiberiu Ichim - [`138e61e`](https://github.com/eea/volto-cca-policy/commit/138e61e37a52bb2de92273841aa120a0902e50d4)]
|
|
33
|
+
- test: fix issue reported by sonarqube [kreafox - [`4985ecf`](https://github.com/eea/volto-cca-policy/commit/4985ecfa7d0444c00f34e9f04f90df22ed6e379d)]
|
|
34
|
+
- Add titles [Tiberiu Ichim - [`0357d59`](https://github.com/eea/volto-cca-policy/commit/0357d590ae65b17af7739b6bfd1912f756d389c1)]
|
|
35
|
+
- Use universalLink [Tiberiu Ichim - [`23234fd`](https://github.com/eea/volto-cca-policy/commit/23234fd4c480059e1b68cb8e67f0c6dbf869e45b)]
|
|
36
|
+
- Fix portal types [Tiberiu Ichim - [`ec763b5`](https://github.com/eea/volto-cca-policy/commit/ec763b558f6b58ee63c0f5c1c5c828b847a63ef4)]
|
|
37
|
+
- URL for EEA Search [Tiberiu Ichim - [`2aff2a8`](https://github.com/eea/volto-cca-policy/commit/2aff2a8090195bd3d1bdb3e0328f34e7423f2c10)]
|
|
38
|
+
- WIP on eea search [Tiberiu Ichim - [`6c9e19b`](https://github.com/eea/volto-cca-policy/commit/6c9e19bff8c6049e3585cb44af99236310d9d9bb)]
|
|
39
|
+
- Refs #266057 - Fix event URL in event title when event_url is empty. [GhitaB - [`33bfaf0`](https://github.com/eea/volto-cca-policy/commit/33bfaf0957d8ab26fef1d47b9f52925ac5a60748)]
|
|
40
|
+
- Improve icons [Tiberiu Ichim - [`19f2606`](https://github.com/eea/volto-cca-policy/commit/19f2606df7388d3cca1bc0d4af5739b8064d8531)]
|
|
41
|
+
- Refs #266057 - Use DD MMM instead of DD.MMM. in events cards listing. [GhitaB - [`13db0b7`](https://github.com/eea/volto-cca-policy/commit/13db0b7e78bdd78e1e39448e4e373a8d333de11e)]
|
|
42
|
+
- Improve icons [Tiberiu Ichim - [`c9bff8d`](https://github.com/eea/volto-cca-policy/commit/c9bff8d770dcdfe98d58147aa396ce99210269e9)]
|
|
43
|
+
- Improve icons [Tiberiu Ichim - [`b86add7`](https://github.com/eea/volto-cca-policy/commit/b86add76fb86e7c4b71242d0477079424393e1a4)]
|
|
44
|
+
- Improve icons [Tiberiu Ichim - [`23e1a6f`](https://github.com/eea/volto-cca-policy/commit/23e1a6fd59998e7f3179775c194f9f917dba5a55)]
|
|
45
|
+
- Add collection summary WIP [Tiberiu Ichim - [`b637b2d`](https://github.com/eea/volto-cca-policy/commit/b637b2d1593bed2ebf201827d9b358ff9121b424)]
|
|
46
|
+
- Add collection summary WIP [Tiberiu Ichim - [`4b3c952`](https://github.com/eea/volto-cca-policy/commit/4b3c9520d875ed078d59698220617d41b853baa3)]
|
|
47
|
+
- country map ol remove old JS and d3 View [Tripon Eugen - [`2dd7dc6`](https://github.com/eea/volto-cca-policy/commit/2dd7dc68a88abbcf873db37237dc7b1b841194f2)]
|
|
48
|
+
- country map ol style outside eu [Tripon Eugen - [`fa6b322`](https://github.com/eea/volto-cca-policy/commit/fa6b322008ea64596328f5217f1a9b9ca6d91f6d)]
|
|
49
|
+
- Move CSS from voltoCustom.css [kreafox - [`388c70e`](https://github.com/eea/volto-cca-policy/commit/388c70ece86c5b103f84c13819ac7bb8e82c59d7)]
|
|
50
|
+
- style fix [kreafox - [`e2ee48c`](https://github.com/eea/volto-cca-policy/commit/e2ee48cc56167d7f84f62a265f0c7b4771e9aab6)]
|
|
51
|
+
- Add collection summary WIP [Tiberiu Ichim - [`6d94aad`](https://github.com/eea/volto-cca-policy/commit/6d94aadfb565d0ea2699848054c13b24735658a2)]
|
|
52
|
+
- Add parent folder for country map [Tiberiu Ichim - [`a694db9`](https://github.com/eea/volto-cca-policy/commit/a694db9c2d8e45231b208a748c0b02d318282a0d)]
|
|
53
|
+
- Add visibility sensor for map [Tiberiu Ichim - [`51548c6`](https://github.com/eea/volto-cca-policy/commit/51548c6c04ecff65ce7237dce6e9cbff0888184a)]
|
|
54
|
+
- country map ol eslint [Tripon Eugen - [`bc49f3f`](https://github.com/eea/volto-cca-policy/commit/bc49f3f85b892591c6ea7e4764763e3bbe6b387d)]
|
|
55
|
+
- country map ol eslint [Tripon Eugen - [`e2df968`](https://github.com/eea/volto-cca-policy/commit/e2df968ea4b5dc669868c6a2cc51589353b4481b)]
|
|
56
|
+
- country map ol eslint [Tripon Eugen - [`171b34b`](https://github.com/eea/volto-cca-policy/commit/171b34bd0d78000f8a723647194b5aa9c8512915)]
|
|
57
|
+
- country map ol eslint [Tripon Eugen - [`491941f`](https://github.com/eea/volto-cca-policy/commit/491941f9a766acc67d0dcb66bb06f197fe0f5a43)]
|
|
58
|
+
- country map ol eslint [Tripon Eugen - [`0431124`](https://github.com/eea/volto-cca-policy/commit/0431124e3df5e828e5521801da40702642e8085d)]
|
|
59
|
+
- country map ol blues with green hover [Tripon Eugen - [`f8adf0a`](https://github.com/eea/volto-cca-policy/commit/f8adf0a036f9667f3f9b8ba66b50176967d6957c)]
|
|
60
|
+
- WIP [Tiberiu Ichim - [`300d3d0`](https://github.com/eea/volto-cca-policy/commit/300d3d0de2aaa32196274bc44808efaa86dc34f7)]
|
|
61
|
+
- country map ol init [Tripon Eugen - [`1679de1`](https://github.com/eea/volto-cca-policy/commit/1679de1b5a5677a4ae2e3d0a1cdc2010f800a54d)]
|
|
7
62
|
### [0.1.84](https://github.com/eea/volto-cca-policy/compare/0.1.83...0.1.84) - 28 February 2024
|
|
8
63
|
|
|
9
64
|
#### :bug: Bug Fixes
|
|
@@ -440,10 +495,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
440
495
|
- Refs #260715 rast-block wip [Tripon Eugen - [`f19d54e`](https://github.com/eea/volto-cca-policy/commit/f19d54e0b9a6a86bf344eb85b6a1cda7f3de91bf)]
|
|
441
496
|
- Refs #260715 rast-block wip [Tripon Eugen - [`2828537`](https://github.com/eea/volto-cca-policy/commit/2828537b6c084cd1a82162d552fb4ef025b71f9f)]
|
|
442
497
|
- Refs #260715 rast-block updates [Tripon Eugen - [`1e803e5`](https://github.com/eea/volto-cca-policy/commit/1e803e5bd3d3fb7558f261c76c68866be7beb8b5)]
|
|
498
|
+
- test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`0a15e1b`](https://github.com/eea/volto-cca-policy/commit/0a15e1b2ad081233685e80d5b3c60a8663f6b896)]
|
|
499
|
+
- test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`9554e44`](https://github.com/eea/volto-cca-policy/commit/9554e44c92a621a52b2adb5a4830fb084ee5734b)]
|
|
443
500
|
### [0.1.49](https://github.com/eea/volto-cca-policy/compare/0.1.48...0.1.49) - 15 November 2023
|
|
444
501
|
|
|
445
502
|
#### :house: Internal changes
|
|
446
503
|
|
|
504
|
+
- chore: [JENKINS] Refactor automated testing [valentinab25 - [`7b820a6`](https://github.com/eea/volto-cca-policy/commit/7b820a6369c2ddd5203b1a4abe352cb4bb43db7a)]
|
|
447
505
|
- chore: husky, lint-staged use fixed versions [valentinab25 - [`f0a8061`](https://github.com/eea/volto-cca-policy/commit/f0a8061c275c236deb00087c23fac9860a073106)]
|
|
448
506
|
|
|
449
507
|
#### :hammer_and_wrench: Others
|
|
@@ -460,6 +518,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
460
518
|
- Refs #259267 - jenkins test [Tripon Eugen - [`cacd31e`](https://github.com/eea/volto-cca-policy/commit/cacd31e7b1afe0983674ed5c7632d2e1d7fa752e)]
|
|
461
519
|
- Refs #259267 - jenkins [Tripon Eugen - [`5b3affe`](https://github.com/eea/volto-cca-policy/commit/5b3affee8401239de10097884c1b7f2349d15ec0)]
|
|
462
520
|
- Refs #259267 - add When, lead image and title to files [Tripon Eugen - [`2cedb23`](https://github.com/eea/volto-cca-policy/commit/2cedb237f898af9057e13fba94b615ef71077204)]
|
|
521
|
+
- test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`4d607a5`](https://github.com/eea/volto-cca-policy/commit/4d607a576e9d0a5c34e48c41b409e7df616ee3d6)]
|
|
522
|
+
- test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`b7f74d5`](https://github.com/eea/volto-cca-policy/commit/b7f74d53513a6edbfbca5cb6d19687929bb1e5db)]
|
|
523
|
+
- test: [JENKINS] Improve cypress time [valentinab25 - [`db65617`](https://github.com/eea/volto-cca-policy/commit/db656173391f65157098d95d388c25f6429753d8)]
|
|
463
524
|
- Refs #259267 - cca event blocks attachments and check not mandatoty fields [Tripon Eugen - [`3138e5a`](https://github.com/eea/volto-cca-policy/commit/3138e5afb5bfbdbed14e27ed457b16867b7fa414)]
|
|
464
525
|
- 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)]
|
|
465
526
|
- Refs #161485 - Fix ECDE name conflict. [GhitaB - [`8bfd99f`](https://github.com/eea/volto-cca-policy/commit/8bfd99ff68bb82a04d1c0ed625fa514fcf46289e)]
|
|
@@ -676,6 +737,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
676
737
|
|
|
677
738
|
#### :house: Internal changes
|
|
678
739
|
|
|
740
|
+
- chore: [JENKINS] Remove alpha testing version [valentinab25 - [`ad1ced0`](https://github.com/eea/volto-cca-policy/commit/ad1ced0971ba116c13a3b5fcc039172cc915c919)]
|
|
679
741
|
|
|
680
742
|
#### :hammer_and_wrench: Others
|
|
681
743
|
|
|
@@ -1156,6 +1218,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
1156
1218
|
#### :hammer_and_wrench: Others
|
|
1157
1219
|
|
|
1158
1220
|
- Refs #158294 - Update supported languages list. [GhitaB - [`0a4f91f`](https://github.com/eea/volto-cca-policy/commit/0a4f91f39b7edc367bd4c127d6a8f273c7788361)]
|
|
1221
|
+
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`8f1f9ce`](https://github.com/eea/volto-cca-policy/commit/8f1f9ce6c22805670cc0800d3c779b6d619d0f31)]
|
|
1159
1222
|
### [0.1.1](https://github.com/eea/volto-cca-policy/compare/0.1.0...0.1.1) - 13 December 2022
|
|
1160
1223
|
|
|
1161
1224
|
#### :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.
|
|
3
|
+
"version": "0.1.86",
|
|
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",
|
|
@@ -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,125 @@
|
|
|
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={name}>
|
|
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={name}>
|
|
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
|
+
className="tab-item-link"
|
|
104
|
+
key={k}
|
|
105
|
+
href={urlHandler({
|
|
106
|
+
base,
|
|
107
|
+
query: query.query,
|
|
108
|
+
field: groupDefinition.searchFieldName || field,
|
|
109
|
+
value: k,
|
|
110
|
+
})}
|
|
111
|
+
>
|
|
112
|
+
<IconComponent
|
|
113
|
+
name={k}
|
|
114
|
+
value={stats[k]}
|
|
115
|
+
field={field}
|
|
116
|
+
source={icons[k]}
|
|
117
|
+
showLabel={showLabel}
|
|
118
|
+
/>
|
|
119
|
+
</UniversalLink>
|
|
120
|
+
))}
|
|
121
|
+
</div>
|
|
122
|
+
)) ||
|
|
123
|
+
'no results'
|
|
124
|
+
);
|
|
125
|
+
}
|
|
@@ -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,68 @@
|
|
|
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: 1em 0;
|
|
11
|
+
gap: 1em;
|
|
12
|
+
|
|
13
|
+
.semantic-icon {
|
|
14
|
+
i.icon {
|
|
15
|
+
font-size: 2em;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.label {
|
|
19
|
+
width: 85px !important;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.tab-icon-wrapper {
|
|
24
|
+
position: relative;
|
|
25
|
+
display: inline-block;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.tab-item-link:hover {
|
|
29
|
+
.count {
|
|
30
|
+
background-color: @ccaGreenColor;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.tab-icon,
|
|
34
|
+
.label {
|
|
35
|
+
color: @primaryColor;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.tab-icon {
|
|
40
|
+
color: @secondaryColor;
|
|
41
|
+
text-align: center;
|
|
42
|
+
|
|
43
|
+
.label {
|
|
44
|
+
display: block;
|
|
45
|
+
width: 120px;
|
|
46
|
+
color: @contentAreaColor;
|
|
47
|
+
font-size: 14px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.count {
|
|
51
|
+
position: absolute;
|
|
52
|
+
z-index: 1;
|
|
53
|
+
top: auto;
|
|
54
|
+
bottom: 0;
|
|
55
|
+
left: 100%;
|
|
56
|
+
width: 25px;
|
|
57
|
+
height: 25px;
|
|
58
|
+
margin-left: -1.5em;
|
|
59
|
+
background-color: #161c23;
|
|
60
|
+
border-radius: 50%;
|
|
61
|
+
color: @white;
|
|
62
|
+
font-size: 9px;
|
|
63
|
+
font-weight: 700;
|
|
64
|
+
line-height: 25px;
|
|
65
|
+
text-align: center;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -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
|
-
|
|
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
|
|
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) {
|
|
@@ -1,29 +1,26 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Schema = () => {
|
|
2
2
|
return {
|
|
3
3
|
title: 'Country Map',
|
|
4
4
|
fieldsets: [
|
|
5
5
|
{
|
|
6
6
|
id: 'default',
|
|
7
7
|
title: 'Default',
|
|
8
|
-
fields: ['
|
|
8
|
+
fields: ['href'],
|
|
9
9
|
},
|
|
10
10
|
],
|
|
11
11
|
properties: {
|
|
12
|
-
|
|
13
|
-
title: '
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
valid_countries: {
|
|
21
|
-
title: 'Valid country list',
|
|
22
|
-
// description: 'List of countries',
|
|
12
|
+
href: {
|
|
13
|
+
title: 'Countries folder',
|
|
14
|
+
description:
|
|
15
|
+
'The parent location of all country profiles. If empty, the current folder will be used as parent.',
|
|
16
|
+
widget: 'object_browser',
|
|
17
|
+
mode: 'link',
|
|
18
|
+
selectedItemAttrs: [],
|
|
19
|
+
allowExternals: true,
|
|
23
20
|
},
|
|
24
21
|
},
|
|
25
22
|
required: [],
|
|
26
23
|
};
|
|
27
24
|
};
|
|
28
25
|
|
|
29
|
-
export default
|
|
26
|
+
export default Schema;
|