@eeacms/volto-cca-policy 0.3.46 → 0.3.48

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 (27) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/jest-addon.config.js +421 -6
  3. package/package.json +2 -2
  4. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyMap.jsx +7 -5
  5. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyMap.test.jsx +17 -0
  6. package/src/components/manage/Blocks/CaseStudyExplorer/FeatureInteraction.jsx +8 -7
  7. package/src/components/manage/Blocks/CaseStudyExplorer/useInteractiveStyles.jsx +37 -31
  8. package/src/components/manage/Blocks/CaseStudyExplorer/utils.js +1 -3
  9. package/src/components/manage/Blocks/CountryMapObservatory/CountryMapObservatoryOLView.jsx +5 -4
  10. package/src/components/manage/Blocks/CountryMapObservatory/mapstyle.js +3 -5
  11. package/src/components/manage/Blocks/index.js +7 -6
  12. package/src/components/theme/MissionSignatoryProfile/MissionSignatoryProfileView.jsx +14 -3
  13. package/src/components/theme/MissionSignatoryProfile/MissionSignatoryProfileView.test.jsx +16 -5
  14. package/src/index.js +2 -2
  15. package/theme/globals/mission.less +13 -0
  16. package/src/components/manage/Blocks/MKHMap/Edit.jsx +0 -29
  17. package/src/components/manage/Blocks/MKHMap/FeatureDisplay.jsx +0 -87
  18. package/src/components/manage/Blocks/MKHMap/FeatureInteraction.jsx +0 -56
  19. package/src/components/manage/Blocks/MKHMap/InfoOverlay.jsx +0 -80
  20. package/src/components/manage/Blocks/MKHMap/View.jsx +0 -118
  21. package/src/components/manage/Blocks/MKHMap/index.js +0 -25
  22. package/src/components/manage/Blocks/MKHMap/layers.js +0 -107
  23. package/src/components/manage/Blocks/MKHMap/map.svg +0 -3
  24. package/src/components/manage/Blocks/MKHMap/schema.js +0 -15
  25. package/src/components/manage/Blocks/MKHMap/styles.less +0 -41
  26. package/src/components/manage/Blocks/MKHMap/useWhyDidYouUpdate.js +0 -33
  27. package/src/components/theme/MissionSignatoryProfile/TabSections/IntroductionTab.jsx +0 -37
@@ -1,118 +0,0 @@
1
- import React from 'react';
2
- import { Form, Radio } from 'semantic-ui-react';
3
- import {
4
- Controls,
5
- Interactions,
6
- Layer,
7
- Map,
8
- Layers,
9
- } from '@eeacms/volto-openlayers-map/api';
10
- import { openlayers as ol } from '@eeacms/volto-openlayers-map';
11
-
12
- import * as layers from './layers';
13
- import FeatureInteraction from './FeatureInteraction';
14
- import InfoOverlay from './InfoOverlay';
15
-
16
- import './styles.less';
17
-
18
- function SourceSelector(props) {
19
- const { id, choices, selected, onChange } = props;
20
- return (
21
- <Form>
22
- <Form.Field>
23
- <Radio
24
- key="all"
25
- label="All"
26
- name={id}
27
- value="all"
28
- checked={selected.length === choices.length}
29
- onChange={() => onChange(choices)}
30
- />
31
- {choices.map((name) => (
32
- <Radio
33
- key={name}
34
- label={name}
35
- name={id}
36
- value={name}
37
- checked={selected.length === 1 && selected.indexOf(name) > -1}
38
- onChange={() => onChange([name])}
39
- />
40
- ))}
41
- </Form.Field>
42
- </Form>
43
- );
44
- }
45
-
46
- export default function View(props) {
47
- const [tileWMSSources, setTileWMSSources] = React.useState([]);
48
- const [selectedFeature, onFeatureSelect] = React.useState();
49
-
50
- React.useEffect(() => {
51
- setTileWMSSources([
52
- new ol.source.TileWMS({
53
- url: 'https://gisco-services.ec.europa.eu/maps/service',
54
- params: {
55
- LAYERS: 'OSMBlossomComposite',
56
- TILED: true,
57
- },
58
- serverType: 'geoserver',
59
- transition: 0,
60
- }),
61
- ]);
62
- }, []); // ol.source.TileWMS, ol.source.Vector
63
-
64
- const [sources, setSources] = React.useState([Object.keys(layers)[2]]);
65
-
66
- if (__SERVER__) return '';
67
-
68
- return (
69
- <div className="explore-sites-wrapper">
70
- <SourceSelector
71
- id="layer-selector"
72
- choices={Object.keys(layers)}
73
- selected={sources}
74
- onChange={setSources}
75
- />
76
- <div id="explore-sites">
77
- <Map
78
- view={{
79
- center: ol.proj.fromLonLat([20, 50]),
80
- showFullExtent: true,
81
- zoom: 5,
82
- }}
83
- pixelRatio={1}
84
- controls={ol.control.defaults({ attribution: false })}
85
- >
86
- <Layers>
87
- <InfoOverlay
88
- selectedFeature={selectedFeature}
89
- layerId={sources?.[0]}
90
- hasClusters={false}
91
- />
92
- <Controls attribution={false} zoom={false} />
93
- <Interactions
94
- doubleClickZoom={true}
95
- dragAndDrop={false}
96
- dragPan={true}
97
- keyboardPan={true}
98
- keyboardZoom={true}
99
- mouseWheelZoom={true}
100
- pointer={true}
101
- select={false}
102
- />
103
- <Layer.Tile source={tileWMSSources[0]} zIndex={0} />
104
- {sources.map((name, index) => (
105
- <Layer.Vector
106
- key={name}
107
- title={name}
108
- zIndex={index}
109
- {...layers[name]}
110
- />
111
- ))}
112
- <FeatureInteraction onFeatureSelect={onFeatureSelect} />
113
- </Layers>
114
- </Map>
115
- </div>
116
- </div>
117
- );
118
- }
@@ -1,25 +0,0 @@
1
- import MapBlockEdit from './Edit';
2
- import MapBlockView from './View';
3
- import worldSVG from '@plone/volto/icons/world.svg';
4
- import { blockAvailableInMission } from '@eeacms/volto-cca-policy/utils';
5
-
6
- export default (config) => {
7
- config.blocks.blocksConfig.mkh_map = {
8
- id: 'mkh_map',
9
- title: 'MKH Viewer map',
10
- icon: worldSVG,
11
- group: 'site',
12
- edit: MapBlockEdit,
13
- view: MapBlockView,
14
- sidebarTab: 1,
15
- security: {
16
- addPermission: [],
17
- view: [],
18
- },
19
- restricted: ({ properties, block }) => {
20
- return blockAvailableInMission(properties, block);
21
- },
22
- };
23
-
24
- return config;
25
- };
@@ -1,107 +0,0 @@
1
- import { openlayers as ol } from '@eeacms/volto-openlayers-map';
2
- import mapSVG from './map.svg';
3
-
4
- const serviceUrl =
5
- 'https://nest.discomap.eea.europa.eu/arcgis/rest/services/CLIMA/Regions_cities/MapServer/';
6
-
7
- // console.log('ol', ol);
8
-
9
- function r() {
10
- return Math.floor(Math.random() * 256);
11
- }
12
-
13
- const fillColors = {
14
- '0': [125, 125, 125, 1],
15
- 'NUTS 0': [0, 0, 0, 1],
16
- 'NUTS 1': [255, 0, 0, 1],
17
- 'NUTS 2': [0, 255, 0, 1],
18
- 'NUTS 3': [0, 0, 255, 1],
19
- };
20
-
21
- const makeLayer = (layerId) => {
22
- // return null;
23
-
24
- const fillStyle = new ol.style.Style({
25
- fill: new ol.style.Fill(),
26
- stroke: new ol.style.Stroke({
27
- color: [0, 0, 0, 1],
28
- width: 0.5,
29
- }),
30
- });
31
-
32
- const pinStyle = new ol.style.Style({
33
- image: new ol.style.Icon({
34
- src: mapSVG,
35
- color: '#BADA55',
36
- crossOrigin: 'anonymous',
37
- }),
38
- });
39
-
40
- const vectorSource = new ol.source.Vector({
41
- format: new ol.format.EsriJSON(),
42
- url: function (extent, resolution, projection) {
43
- // ArcGIS Server only wants the numeric portion of the projection ID.
44
- const srid = projection
45
- .getCode()
46
- .split(/:(?=\d+$)/)
47
- .pop();
48
-
49
- const url =
50
- serviceUrl +
51
- layerId +
52
- '/query/?f=json&' +
53
- 'returnGeometry=true&spatialRel=esriSpatialRelIntersects&geometry=' +
54
- encodeURIComponent(
55
- '{"xmin":' +
56
- extent[0] +
57
- ',"ymin":' +
58
- extent[1] +
59
- ',"xmax":' +
60
- extent[2] +
61
- ',"ymax":' +
62
- extent[3] +
63
- ',"spatialReference":{"wkid":' +
64
- srid +
65
- '}}',
66
- ) +
67
- '&geometryType=esriGeometryEnvelope&inSR=' +
68
- srid +
69
- '&outFields=*' +
70
- '&outSR=' +
71
- srid;
72
-
73
- return url;
74
- },
75
- strategy: ol.loadingstrategy.tile(
76
- ol.tilegrid.createXYZ({
77
- tileSize: 512,
78
- }),
79
- ),
80
- attributions: 'European Environment Agency',
81
- });
82
-
83
- return {
84
- source: vectorSource,
85
- style: function (feature) {
86
- const nuts_id = feature.get('NUTS_ID');
87
- const level_code = feature.get('LEVEL_CODE');
88
-
89
- // const nuts_name = feature.get('NUTS_NAME');
90
- // const country_code = feature.get('CNTR_CODE');
91
- // const shape = feature.get('SHAPE');
92
-
93
- // console.log({ country_code, nuts_id, nuts_name, level_code, feature });
94
-
95
- // const classify = feature.get('LU_2014');
96
- const color = fillColors[level_code] || [r(), r(), r(), 1];
97
- fillStyle.getFill().setColor(color);
98
-
99
- return nuts_id ? fillStyle : pinStyle;
100
- },
101
- opacity: 0.7,
102
- };
103
- };
104
-
105
- export const countries = __CLIENT__ && makeLayer('0');
106
- export const cities = __CLIENT__ && makeLayer('1');
107
- export const regions = __CLIENT__ && makeLayer('2');
@@ -1,3 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 36 36">
2
- <path d="M18,32 C11.3333333,23.6818983 8,17.6818983 8,14 C8,8.4771525 12.4771525,4 18,4 C23.5228475,4 28,8.4771525 28,14 C28,17.6818983 24.6666667,23.6818983 18,32 Z M26,14 C26,9.581722 22.418278,6 18,6 C13.581722,6 10,9.581722 10,14 C10,16.8065316 12.6565091,21.827053 18,28.7642044 C23.3434909,21.827053 26,16.8065316 26,14 Z M18,11 C19.656,11 21,12.344 21,14 C21,15.656 19.656,17 18,17 C16.344,17 15,15.656 15,14 C15,12.344 16.344,11 18,11 Z"/>
3
- </svg>
@@ -1,15 +0,0 @@
1
- export default {
2
- title: 'Explore sites map',
3
-
4
- fieldsets: [
5
- {
6
- id: 'default',
7
- title: 'Default',
8
- fields: [],
9
- },
10
- ],
11
-
12
- properties: {},
13
-
14
- required: [],
15
- };
@@ -1,41 +0,0 @@
1
- div#view .ui.container > .explore-sites-wrapper,
2
- div#view .ui.container > .explore-sites {
3
- margin-bottom: 0;
4
- }
5
-
6
- .explore-sites {
7
- display: flex;
8
- justify-content: center;
9
- margin-bottom: 0;
10
- background-color: #f8f8f8;
11
-
12
- &.visible.transition {
13
- display: flex !important;
14
- }
15
- }
16
-
17
- .explore-sites-wrapper {
18
- .field .ui {
19
- margin-right: 2em;
20
- }
21
- }
22
-
23
- #popup-overlay {
24
- width: 40ch;
25
- padding: 0 1em 1em 1em;
26
- background-color: white;
27
- }
28
-
29
- .feature-info {
30
- font-size: small;
31
-
32
- div {
33
- display: flex;
34
- column-gap: 1em;
35
-
36
- dt {
37
- width: 10ch;
38
- font-weight: bold;
39
- }
40
- }
41
- }
@@ -1,33 +0,0 @@
1
- import React from 'react';
2
-
3
- export default function useWhyDidYouUpdate(name, props) {
4
- // Get a mutable ref object where we can store props ...
5
- // ... for comparison next time this hook runs.
6
- const previousProps = React.useRef();
7
- React.useEffect(() => {
8
- if (previousProps.current) {
9
- // Get all keys from previous and current props
10
- const allKeys = Object.keys({ ...previousProps.current, ...props });
11
- // Use this object to keep track of changed props
12
- const changesObj = {};
13
- // Iterate through keys
14
- allKeys.forEach((key) => {
15
- // If previous is different from current
16
- if (previousProps.current[key] !== props[key]) {
17
- // Add to changesObj
18
- changesObj[key] = {
19
- from: previousProps.current[key],
20
- to: props[key],
21
- };
22
- }
23
- });
24
- // If changesObj not empty then output to console
25
- if (Object.keys(changesObj).length) {
26
- // eslint-disable-next-line no-console
27
- console.log('[why-did-you-update]', name, changesObj);
28
- }
29
- }
30
- // Finally update previousProps with current props for next hook call
31
- previousProps.current = props;
32
- });
33
- }
@@ -1,37 +0,0 @@
1
- import React from 'react';
2
- import { Tab } from 'semantic-ui-react';
3
- import { Callout } from '@eeacms/volto-eea-design-system/ui';
4
-
5
- const IntroductionTab = () => {
6
- return (
7
- <Tab.Pane>
8
- <h2>Introduction</h2>
9
- <Callout>
10
- Duis non quam et nisi tincidunt fermentum. Pellentesque habitant morbi
11
- tristique senectus et netus et malesuada fames ac turpis egestas.
12
- </Callout>
13
- <h3>The Mission on Adaptation</h3>
14
- <p>
15
- Nulla facilisi. Donec fringilla urna id ligula ullamcorper, vel
16
- tristique lorem posuere. Donec et orci mauris. Nullam tempor velit id mi
17
- luctus, a scelerisque libero accumsan. In hac habitasse platea dictumst.
18
- Cras ac nunc nec massa tristique fringilla.
19
- </p>
20
- <h3>Data source</h3>
21
- <p>
22
- Donec eget libero id leo congue venenatis. Ut enim ad minim veniam, quis
23
- nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
24
- consequat. Duis aute irure dolor in reprehenderit in voluptate velit
25
- esse cillum dolore eu fugiat nulla pariatur.
26
- </p>
27
- <p>
28
- Donec eget libero id leo congue venenatis. Ut enim ad minim veniam, quis
29
- nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
30
- consequat. Duis aute irure dolor in reprehenderit in voluptate velit
31
- esse cillum dolore eu fugiat nulla pariatur.
32
- </p>
33
- </Tab.Pane>
34
- );
35
- };
36
-
37
- export default IntroductionTab;