@eeacms/volto-cca-policy 0.1.84 → 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 (38) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/package.json +4 -2
  3. package/src/components/manage/Blocks/CollectionStatistics/CollectionStatsEdit.jsx +30 -0
  4. package/src/components/manage/Blocks/CollectionStatistics/CollectionStatsView.jsx +124 -0
  5. package/src/components/manage/Blocks/CollectionStatistics/index.js +128 -0
  6. package/src/components/manage/Blocks/CollectionStatistics/schema.js +76 -0
  7. package/src/components/manage/Blocks/CollectionStatistics/styles.less +49 -0
  8. package/src/components/manage/Blocks/CountryMapObservatory/CountryMapObservatoryEdit.jsx +24 -1
  9. package/src/components/manage/Blocks/CountryMapObservatory/CountryMapObservatoryOLView.jsx +5 -1
  10. package/src/components/manage/Blocks/CountryMapObservatory/Interactions.jsx +0 -2
  11. package/src/components/manage/Blocks/CountryMapObservatory/schema.js +11 -14
  12. package/src/components/manage/Blocks/CountryMapProfile/Edit.js +1 -1
  13. package/src/components/manage/Blocks/CountryMapProfile/Filter.jsx +25 -59
  14. package/src/components/manage/Blocks/CountryMapProfile/Interactions.jsx +197 -0
  15. package/src/components/manage/Blocks/CountryMapProfile/OLView.jsx +232 -0
  16. package/src/components/manage/Blocks/CountryMapProfile/hocs.jsx +28 -0
  17. package/src/components/manage/Blocks/CountryMapProfile/index.js +1 -1
  18. package/src/components/manage/Blocks/CountryMapProfile/mapstyle.js +86 -0
  19. package/src/components/manage/Blocks/CountryMapProfile/styles.less +43 -10
  20. package/src/components/manage/Blocks/Listing/EventCardsListingView.jsx +9 -2
  21. package/src/components/manage/Blocks/index.js +2 -0
  22. package/src/components/manage/Blocks/withVisibilitySensor.jsx +61 -0
  23. package/src/components/theme/Views/CcaEventView.test.jsx +109 -0
  24. package/src/icons/air_pollution_and_aero-allergens.svg +1 -0
  25. package/src/icons/climate-sensitive_diseases.svg +7 -0
  26. package/src/icons/droughts_and_floods.svg +20 -0
  27. package/src/icons/heat.svg +1 -0
  28. package/src/icons/wildfires.svg +1 -0
  29. package/src/store/actions/querystats.js +13 -0
  30. package/src/store/constants.js +1 -0
  31. package/src/store/index.js +9 -1
  32. package/src/store/reducers/querystats.js +40 -0
  33. package/src/utils.js +17 -0
  34. package/theme/globals/mission.less +20 -0
  35. package/theme/globals/observatory.less +115 -0
  36. package/theme/globals/site.overrides +49 -44
  37. package/src/components/manage/Blocks/CountryMapProfile/View.js +0 -121
  38. package/src/components/manage/Blocks/CountryMapProfile/map-utils.js +0 -457
package/CHANGELOG.md CHANGED
@@ -4,6 +4,49 @@ 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.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)]
7
50
  ### [0.1.84](https://github.com/eea/volto-cca-policy/compare/0.1.83...0.1.84) - 28 February 2024
8
51
 
9
52
  #### :bug: Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-cca-policy",
3
- "version": "0.1.84",
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",
@@ -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) {
@@ -1,29 +1,26 @@
1
- const FilterSchema = (data) => {
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: ['display_mode', 'valid_countries'],
8
+ fields: ['href'],
9
9
  },
10
10
  ],
11
11
  properties: {
12
- display_mode: {
13
- title: 'Display Mode',
14
- // description: 'Observatory/country map...',
15
- // choices: [
16
- // ['cca', 'Climate Adapta'],
17
- // ['observatory', 'Observatory'],
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 FilterSchema;
26
+ export default Schema;
@@ -1,4 +1,4 @@
1
- import View from './View';
1
+ import View from './OLView';
2
2
 
3
3
  export default function CountryMapProfileEdit(props) {
4
4
  return <View {...props} mode="edit" />;