@eeacms/volto-cca-policy 0.1.68 → 0.1.70
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 +11 -0
- package/package.json +1 -1
- package/src/components/manage/Blocks/CountryMapHeatIndex/View.js +2 -5
- package/src/components/manage/Blocks/CountryMapHeatIndex/map-utils.js +4 -8
- package/src/components/manage/Blocks/CountryMapObservatory/CountryMapObservatoryView.js +3 -40
- package/src/components/manage/Blocks/CountryMapObservatory/map-utils.js +1 -19
- package/src/components/manage/Blocks/CountryMapProfile/View.js +3 -40
- package/src/components/manage/Blocks/CountryMapProfile/map-utils.js +1 -26
- package/src/helpers/country_map/countryMap.js +107 -0
- package/src/helpers/country_map/euro-countries-simplified.js +46195 -0
- package/src/helpers/country_map/flags.js +57 -0
- package/src/index.js +94 -4
- package/src/components/manage/Blocks/countryMap.js +0 -41
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,17 @@ 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.70](https://github.com/eea/volto-cca-policy/compare/0.1.69...0.1.70) - 2 February 2024
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- Refs #161485 - observatory page search description [Tripon Eugen - [`6dd9046`](https://github.com/eea/volto-cca-policy/commit/6dd9046ace2e894e721a1cd65553a6d9435f2ad5)]
|
|
12
|
+
### [0.1.69](https://github.com/eea/volto-cca-policy/compare/0.1.68...0.1.69) - 31 January 2024
|
|
13
|
+
|
|
14
|
+
#### :hammer_and_wrench: Others
|
|
15
|
+
|
|
16
|
+
- Refs #161485 - observatory resource catalog menu [Tripon Eugen - [`31bbb1a`](https://github.com/eea/volto-cca-policy/commit/31bbb1a2bf361d7000d11d2f9665a9de50cd240f)]
|
|
17
|
+
- Refs #161485 - observatory resource catalog menu [Tripon Eugen - [`c2c31be`](https://github.com/eea/volto-cca-policy/commit/c2c31be706b255d58d08e2f9210bd2f1dc0b160b)]
|
|
7
18
|
### [0.1.68](https://github.com/eea/volto-cca-policy/compare/0.1.67...0.1.68) - 30 January 2024
|
|
8
19
|
|
|
9
20
|
#### :bug: Bug Fixes
|
package/package.json
CHANGED
|
@@ -7,11 +7,8 @@ import { compose } from 'redux';
|
|
|
7
7
|
import { clientOnly } from '@eeacms/volto-cca-policy/helpers';
|
|
8
8
|
import withResponsiveContainer from './../withResponsiveContainer.js';
|
|
9
9
|
import { addAppURL } from '@plone/volto/helpers';
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
getFocusCountryNames,
|
|
13
|
-
renderCountriesBox,
|
|
14
|
-
} from './map-utils.js';
|
|
10
|
+
import { getFocusCountryNames, renderCountriesBox } from './map-utils.js';
|
|
11
|
+
import { getFocusCountriesFeature } from '@eeacms/volto-cca-policy/helpers/country_map/countryMap.js';
|
|
15
12
|
|
|
16
13
|
import Filter from './Filter';
|
|
17
14
|
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
euCountryNames,
|
|
3
|
+
removeTooltip,
|
|
4
|
+
} from '@eeacms/volto-cca-policy/helpers/country_map/countryMap.js';
|
|
2
5
|
export function getFocusCountryNames() {
|
|
3
6
|
return euCountryNames;
|
|
4
7
|
}
|
|
@@ -503,13 +506,6 @@ function showMapTooltip(d, countries_metadata, d3) {
|
|
|
503
506
|
d3.event.stopPropagation();
|
|
504
507
|
}
|
|
505
508
|
|
|
506
|
-
function removeTooltip() {
|
|
507
|
-
const elem = document.getElementById('map-tooltip');
|
|
508
|
-
if (elem) {
|
|
509
|
-
elem.parentElement.removeChild(elem);
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
|
|
513
509
|
function createTooltip(opts) {
|
|
514
510
|
const x = opts['coords'][0];
|
|
515
511
|
const y = opts['coords'][1];
|
|
@@ -1,52 +1,15 @@
|
|
|
1
1
|
import React, { useRef, useEffect } from 'react';
|
|
2
|
-
import flags from './flags.js';
|
|
3
2
|
import './styles.css';
|
|
4
3
|
import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
|
|
5
4
|
import { compose } from 'redux';
|
|
6
5
|
import { clientOnly } from '@eeacms/volto-cca-policy/helpers';
|
|
7
6
|
import withResponsiveContainer from './../withResponsiveContainer.js';
|
|
7
|
+
import { renderCountriesBox } from './map-utils.js';
|
|
8
8
|
import {
|
|
9
9
|
getFocusCountriesFeature,
|
|
10
10
|
getFocusCountryNames,
|
|
11
|
-
|
|
12
|
-
} from '
|
|
13
|
-
|
|
14
|
-
const withCountriesData = (WrappedComponent) => {
|
|
15
|
-
function WithCountriesDataWrapped(props) {
|
|
16
|
-
let [cpath, setCpath] = React.useState();
|
|
17
|
-
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
if (!cpath) {
|
|
20
|
-
import('./euro-countries-simplified.js').then((mod) => {
|
|
21
|
-
const _cpath = mod.default;
|
|
22
|
-
_cpath.features = _cpath.features.map(function (c) {
|
|
23
|
-
//console.log(c);
|
|
24
|
-
var name = c.properties.SHRT_ENGL;
|
|
25
|
-
if (!name) {
|
|
26
|
-
// console.log('No flag for', c.properties);
|
|
27
|
-
return c;
|
|
28
|
-
} else if (name === 'Czechia') {
|
|
29
|
-
name = 'Czech Republic';
|
|
30
|
-
}
|
|
31
|
-
var cname = name.replace(' ', '_');
|
|
32
|
-
flags.forEach(function (f) {
|
|
33
|
-
if (f.indexOf(cname) > -1) {
|
|
34
|
-
c.url = f;
|
|
35
|
-
//console.log(c.url);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
return c;
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
setCpath(_cpath);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}, [cpath]);
|
|
45
|
-
|
|
46
|
-
return cpath ? <WrappedComponent {...props} cpath={cpath} /> : null;
|
|
47
|
-
}
|
|
48
|
-
return WithCountriesDataWrapped;
|
|
49
|
-
};
|
|
11
|
+
withCountriesData,
|
|
12
|
+
} from '@eeacms/volto-cca-policy/helpers/country_map/countryMap.js';
|
|
50
13
|
|
|
51
14
|
const CountryMapObservatoryView = (props) => {
|
|
52
15
|
const svgRef = useRef(null);
|
|
@@ -1,22 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export function getFocusCountryNames() {
|
|
3
|
-
return euCountryNames;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export function getFocusCountriesFeature(world) {
|
|
7
|
-
const focusCountryNames = getFocusCountryNames();
|
|
8
|
-
let features = {
|
|
9
|
-
type: 'FeatureCollection',
|
|
10
|
-
features: [],
|
|
11
|
-
};
|
|
12
|
-
world.features.forEach(function (c) {
|
|
13
|
-
if (focusCountryNames.indexOf(c.properties.SHRT_ENGL) === -1) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
features.features.push(c);
|
|
17
|
-
});
|
|
18
|
-
return features;
|
|
19
|
-
}
|
|
1
|
+
import { getFocusCountryNames } from '@eeacms/volto-cca-policy/helpers/country_map/countryMap.js';
|
|
20
2
|
|
|
21
3
|
export function renderCountriesBox(opts, d3, d3Geo) {
|
|
22
4
|
var coords = opts.coordinates;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useRef, useEffect } from 'react';
|
|
2
|
-
import flags from './flags.js';
|
|
3
2
|
import './styles.css';
|
|
4
3
|
import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
|
|
5
4
|
import { Grid } from 'semantic-ui-react';
|
|
@@ -7,11 +6,12 @@ import { compose } from 'redux';
|
|
|
7
6
|
import { clientOnly } from '@eeacms/volto-cca-policy/helpers';
|
|
8
7
|
import withResponsiveContainer from './../withResponsiveContainer.js';
|
|
9
8
|
import { addAppURL } from '@plone/volto/helpers';
|
|
9
|
+
import { renderCountriesBox } from './map-utils.js';
|
|
10
10
|
import {
|
|
11
11
|
getFocusCountriesFeature,
|
|
12
12
|
getFocusCountryNames,
|
|
13
|
-
|
|
14
|
-
} from '
|
|
13
|
+
withCountriesData,
|
|
14
|
+
} from '@eeacms/volto-cca-policy/helpers/country_map/countryMap.js';
|
|
15
15
|
|
|
16
16
|
import Filter from './Filter';
|
|
17
17
|
|
|
@@ -20,43 +20,6 @@ import { useCountriesMetadata } from './hooks';
|
|
|
20
20
|
const countries_metadata_url =
|
|
21
21
|
'/en/countries-regions/countries/@@countries-metadata-extract?langflag=1';
|
|
22
22
|
|
|
23
|
-
const withCountriesData = (WrappedComponent) => {
|
|
24
|
-
function WithCountriesDataWrapped(props) {
|
|
25
|
-
let [cpath, setCpath] = React.useState();
|
|
26
|
-
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
if (!cpath) {
|
|
29
|
-
import('./euro-countries-simplified.js').then((mod) => {
|
|
30
|
-
const _cpath = mod.default;
|
|
31
|
-
_cpath.features = _cpath.features.map(function (c) {
|
|
32
|
-
//console.log(c);
|
|
33
|
-
var name = c.properties.SHRT_ENGL;
|
|
34
|
-
if (!name) {
|
|
35
|
-
// console.log('No flag for', c.properties);
|
|
36
|
-
return c;
|
|
37
|
-
} else if (name === 'Czechia') {
|
|
38
|
-
name = 'Czech Republic';
|
|
39
|
-
}
|
|
40
|
-
var cname = name.replace(' ', '_');
|
|
41
|
-
flags.forEach(function (f) {
|
|
42
|
-
if (f.indexOf(cname) > -1) {
|
|
43
|
-
c.url = f;
|
|
44
|
-
//console.log(c.url);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
return c;
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
setCpath(_cpath);
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}, [cpath]);
|
|
54
|
-
|
|
55
|
-
return cpath ? <WrappedComponent {...props} cpath={cpath} /> : null;
|
|
56
|
-
}
|
|
57
|
-
return WithCountriesDataWrapped;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
23
|
const CountryMapObservatoryView = (props) => {
|
|
61
24
|
const svgRef = useRef(null);
|
|
62
25
|
const { d3, d3Geo, size, cpath } = props;
|
|
@@ -1,22 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export function getFocusCountryNames() {
|
|
3
|
-
return euCountryNames;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export function getFocusCountriesFeature(world) {
|
|
7
|
-
const focusCountryNames = getFocusCountryNames();
|
|
8
|
-
let features = {
|
|
9
|
-
type: 'FeatureCollection',
|
|
10
|
-
features: [],
|
|
11
|
-
};
|
|
12
|
-
world.features.forEach(function (c) {
|
|
13
|
-
if (focusCountryNames.indexOf(c.properties.SHRT_ENGL) === -1) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
features.features.push(c);
|
|
17
|
-
});
|
|
18
|
-
return features;
|
|
19
|
-
}
|
|
1
|
+
import { removeTooltip } from '@eeacms/volto-cca-policy/helpers/country_map/countryMap.js';
|
|
20
2
|
|
|
21
3
|
// tooltip with country names on hover
|
|
22
4
|
let countryNameTooltip = null;
|
|
@@ -444,13 +426,6 @@ function showMapTooltip(d, countries_metadata, d3) {
|
|
|
444
426
|
d3.event.stopPropagation();
|
|
445
427
|
}
|
|
446
428
|
|
|
447
|
-
function removeTooltip() {
|
|
448
|
-
const elem = document.getElementById('map-tooltip');
|
|
449
|
-
if (elem) {
|
|
450
|
-
elem.parentElement.removeChild(elem);
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
|
|
454
429
|
function createTooltip(opts) {
|
|
455
430
|
const x = opts['coords'][0];
|
|
456
431
|
const y = opts['coords'][1];
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import flags from './flags.js';
|
|
3
|
+
|
|
4
|
+
export const euCountryNames = [
|
|
5
|
+
'Albania',
|
|
6
|
+
'Austria',
|
|
7
|
+
'Belgium',
|
|
8
|
+
'Bosnia-Herzegovina',
|
|
9
|
+
'Bosnia and Herzegovina',
|
|
10
|
+
'Bulgaria',
|
|
11
|
+
'Cyprus',
|
|
12
|
+
'Croatia',
|
|
13
|
+
'Czechia',
|
|
14
|
+
'Denmark',
|
|
15
|
+
'Estonia',
|
|
16
|
+
'Finland',
|
|
17
|
+
'France',
|
|
18
|
+
'Germany',
|
|
19
|
+
'Greece',
|
|
20
|
+
'Hungary',
|
|
21
|
+
'Iceland',
|
|
22
|
+
'Ireland',
|
|
23
|
+
'Italy',
|
|
24
|
+
'Latvia',
|
|
25
|
+
'Lithuania',
|
|
26
|
+
'Luxembourg',
|
|
27
|
+
'Malta',
|
|
28
|
+
'Montenegro',
|
|
29
|
+
'Netherlands',
|
|
30
|
+
'North Macedonia',
|
|
31
|
+
'Poland',
|
|
32
|
+
'Portugal',
|
|
33
|
+
'Romania',
|
|
34
|
+
'Serbia',
|
|
35
|
+
'Slovakia',
|
|
36
|
+
'Slovenia',
|
|
37
|
+
'Spain',
|
|
38
|
+
'Sweden',
|
|
39
|
+
'United Kingdom',
|
|
40
|
+
'Liechtenstein',
|
|
41
|
+
'Norway',
|
|
42
|
+
'Switzerland',
|
|
43
|
+
'Turkey',
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
export function getFocusCountryNames() {
|
|
47
|
+
return euCountryNames;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const getFocusCountriesFeature = (world) => {
|
|
51
|
+
const focusCountryNames = getFocusCountryNames();
|
|
52
|
+
let features = {
|
|
53
|
+
type: 'FeatureCollection',
|
|
54
|
+
features: [],
|
|
55
|
+
};
|
|
56
|
+
world.features.forEach(function (c) {
|
|
57
|
+
if (focusCountryNames.indexOf(c.properties.SHRT_ENGL) === -1) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
features.features.push(c);
|
|
61
|
+
});
|
|
62
|
+
return features;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export function removeTooltip() {
|
|
66
|
+
const elem = document.getElementById('map-tooltip');
|
|
67
|
+
if (elem) {
|
|
68
|
+
elem.parentElement.removeChild(elem);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export const withCountriesData = (WrappedComponent) => {
|
|
73
|
+
function WithCountriesDataWrapped(props) {
|
|
74
|
+
let [cpath, setCpath] = React.useState();
|
|
75
|
+
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (!cpath) {
|
|
78
|
+
import('./euro-countries-simplified.js').then((mod) => {
|
|
79
|
+
const _cpath = mod.default;
|
|
80
|
+
_cpath.features = _cpath.features.map(function (c) {
|
|
81
|
+
//console.log(c);
|
|
82
|
+
var name = c.properties.SHRT_ENGL;
|
|
83
|
+
if (!name) {
|
|
84
|
+
// console.log('No flag for', c.properties);
|
|
85
|
+
return c;
|
|
86
|
+
} else if (name === 'Czechia') {
|
|
87
|
+
name = 'Czech Republic';
|
|
88
|
+
}
|
|
89
|
+
var cname = name.replace(' ', '_');
|
|
90
|
+
flags.forEach(function (f) {
|
|
91
|
+
if (f.indexOf(cname) > -1) {
|
|
92
|
+
c.url = f;
|
|
93
|
+
//console.log(c.url);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
return c;
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
setCpath(_cpath);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}, [cpath]);
|
|
103
|
+
|
|
104
|
+
return cpath ? <WrappedComponent {...props} cpath={cpath} /> : null;
|
|
105
|
+
}
|
|
106
|
+
return WithCountriesDataWrapped;
|
|
107
|
+
};
|