@eeacms/volto-cca-policy 0.1.4 → 0.1.6

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 (103) hide show
  1. package/.project.eslintrc.js +4 -5
  2. package/CHANGELOG.md +217 -0
  3. package/cypress.config.js +1 -0
  4. package/package.json +8 -6
  5. package/razzle.extend.js +29 -0
  6. package/src/components/index.js +0 -1
  7. package/src/components/manage/Blocks/ECDEIndicators/ECDEIndicator.jsx +128 -0
  8. package/src/components/manage/Blocks/ECDEIndicators/ECDEIndicatorsEdit.jsx +5 -0
  9. package/src/components/manage/Blocks/ECDEIndicators/ECDEIndicatorsView.jsx +119 -0
  10. package/src/components/manage/Blocks/ECDEIndicators/README.md +72 -0
  11. package/src/components/manage/Blocks/ECDEIndicators/index.js +16 -0
  12. package/src/components/manage/Blocks/ECDEIndicators/styles.less +28 -0
  13. package/src/components/manage/Blocks/MKHMap/Edit.jsx +29 -0
  14. package/src/components/manage/Blocks/MKHMap/FeatureDisplay.jsx +87 -0
  15. package/src/components/manage/Blocks/MKHMap/FeatureInteraction.jsx +56 -0
  16. package/src/components/manage/Blocks/MKHMap/InfoOverlay.jsx +68 -0
  17. package/src/components/manage/Blocks/MKHMap/View.jsx +117 -0
  18. package/src/components/manage/Blocks/MKHMap/index.js +16 -0
  19. package/src/components/manage/Blocks/MKHMap/layers.js +107 -0
  20. package/src/components/manage/Blocks/MKHMap/map.svg +3 -0
  21. package/src/components/manage/Blocks/MKHMap/schema.js +15 -0
  22. package/src/components/manage/Blocks/MKHMap/styles.less +41 -0
  23. package/src/components/manage/Blocks/MKHMap/useWhyDidYouUpdate.js +33 -0
  24. package/src/components/manage/Blocks/index.js +12 -0
  25. package/src/components/theme/Views/AdaptationOptionView.jsx +206 -0
  26. package/src/components/theme/Views/CaseStudyView.jsx +331 -0
  27. package/src/components/theme/Views/GuidanceView.jsx +89 -0
  28. package/src/components/theme/Views/IndicatorView.jsx +59 -0
  29. package/src/components/theme/Views/InformationPortalView.jsx +59 -0
  30. package/src/components/theme/Views/OrganisationView.jsx +104 -0
  31. package/src/components/theme/Views/ProjectView.jsx +73 -0
  32. package/src/components/theme/Views/PublicationReportView.jsx +81 -0
  33. package/src/components/theme/Views/ToolView.jsx +74 -0
  34. package/src/components/theme/Views/VideoView.jsx +125 -0
  35. package/src/customizations/volto/components/theme/Header/Header.jsx +9 -2
  36. package/src/customizations/volto/components/theme/View/DefaultView.jsx +174 -0
  37. package/src/helpers/Constants.jsx +460 -0
  38. package/src/helpers/ContentMetadata.jsx +687 -0
  39. package/src/helpers/ShareInfo.jsx +14 -0
  40. package/src/helpers/Utils.jsx +154 -0
  41. package/src/helpers/index.js +10 -0
  42. package/src/index.js +122 -1
  43. package/src/policy.js +12 -20
  44. package/theme/assets/images/Footer/ec_logo.svg +3 -0
  45. package/theme/assets/images/Header/climate-adapt-logo-1.svg +20 -0
  46. package/theme/assets/images/Header/climate-adapt-logo.svg +22 -0
  47. package/theme/assets/images/spinner.svg +1 -0
  48. package/theme/collections/table.variables +17 -0
  49. package/theme/extras/banner.variables +5 -0
  50. package/theme/extras/contextNavigation.overrides +60 -0
  51. package/theme/extras/contextNavigation.variables +32 -0
  52. package/theme/extras/footer.variables +6 -0
  53. package/theme/extras/header.overrides +14 -0
  54. package/theme/extras/header.variables +7 -0
  55. package/theme/extras/hero.overrides +4 -0
  56. package/theme/extras/inpageNavigation.variables +5 -0
  57. package/theme/globals/site.overrides +142 -0
  58. package/theme/globals/site.variables +16 -0
  59. package/theme/theme.config +136 -0
  60. package/theme/tokens/colors.less +9 -0
  61. package/theme/tokens/tokens.less +1 -0
  62. package/src/components/manage/Blocks/ContextNavigation/ContextNavigationEdit.jsx +0 -31
  63. package/src/components/manage/Blocks/ContextNavigation/ContextNavigationView.jsx +0 -17
  64. package/src/components/manage/Blocks/ContextNavigation/index.js +0 -26
  65. package/src/components/manage/Blocks/ContextNavigation/schema.js +0 -81
  66. package/src/components/manage/Blocks/LayoutSettings/LayoutSettingsEdit.jsx +0 -32
  67. package/src/components/manage/Blocks/LayoutSettings/LayoutSettingsView.jsx +0 -15
  68. package/src/components/manage/Blocks/LayoutSettings/edit.less +0 -4
  69. package/src/components/manage/Blocks/LayoutSettings/index.js +0 -24
  70. package/src/components/manage/Blocks/LayoutSettings/schema.js +0 -32
  71. package/src/components/manage/Blocks/Title/Edit.jsx +0 -226
  72. package/src/components/manage/Blocks/Title/View.jsx +0 -35
  73. package/src/components/manage/Blocks/Title/index.js +0 -13
  74. package/src/components/manage/Blocks/Title/schema.js +0 -80
  75. package/src/components/manage/Blocks/schema-utils.js +0 -16
  76. package/src/components/manage/Blocks/schema.js +0 -52
  77. package/src/components/theme/Banner/Banner.jsx +0 -99
  78. package/src/components/theme/Banner/View.jsx +0 -241
  79. package/src/components/theme/Banner/styles.less +0 -20
  80. package/src/components/theme/CustomCSS/CustomCSS.jsx +0 -12
  81. package/src/components/theme/DraftBackground/DraftBackground.jsx +0 -16
  82. package/src/components/theme/DraftBackground/draft.css +0 -3
  83. package/src/components/theme/DraftBackground/draft.png +0 -0
  84. package/src/components/theme/Homepage/HomePageInverseView.jsx +0 -60
  85. package/src/components/theme/Homepage/HomePageView.jsx +0 -60
  86. package/src/components/theme/Logo.jsx +0 -34
  87. package/src/components/theme/SubsiteClass.jsx +0 -23
  88. package/src/config.js +0 -307
  89. package/src/customizations/@eeacms/volto-block-style/StyleWrapper/schema.js +0 -44
  90. package/src/customizations/@eeacms/volto-eea-design-system/ui/Header/HeaderSearchPopUp.js +0 -80
  91. package/src/customizations/@eeacms/volto-tabs-block/components/templates/default/schema.js +0 -109
  92. package/src/customizations/@eeacms/volto-tabs-block/components/templates/horizontal-responsive/schema.js +0 -109
  93. package/src/customizations/volto/components/manage/Form/Form.jsx +0 -784
  94. package/src/customizations/volto/components/manage/Form/ModalForm.jsx +0 -326
  95. package/src/customizations/volto/components/manage/Sharing/Sharing.jsx +0 -495
  96. package/src/customizations/volto/components/manage/Widgets/ObjectBrowserWidget.jsx +0 -436
  97. package/src/customizations/volto/components/theme/Breadcrumbs/Breadcrumbs.jsx +0 -62
  98. package/src/customizations/volto/components/theme/Comments/Comments.jsx +0 -487
  99. package/src/customizations/volto/components/theme/Footer/Footer.jsx +0 -90
  100. package/src/customizations/volto/components/theme/Tags/Tags.jsx +0 -53
  101. package/src/customizations/volto/components/theme/Unauthorized/Unauthorized.jsx +0 -91
  102. package/src/customizations/volto/components/theme/View/EventView.jsx +0 -90
  103. package/src/middleware/voltoCustom.js +0 -37
@@ -0,0 +1,72 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+
4
+ <head>
5
+ <title>CDS integration test</title>
6
+ <meta charset="utf-8" />
7
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
8
+ <script type="text/javascript">
9
+ window.cds_toolbox = { cds_public_path: 'https://cds.climate.copernicus.eu/toolbox/' };
10
+ </script>
11
+ <script type="text/javascript" src="https://cds.climate.copernicus.eu/toolbox/toolbox-latest.js"></script>
12
+ <script src="https://code.jquery.com/jquery-3.6.3.min.js"
13
+ integrity="sha256-pvPw+upLPUjgMXY0G+8O0xUf+/Im1MZjXxxgOcBQBXU=" crossorigin="anonymous"></script>
14
+
15
+ <body>
16
+
17
+ <h1>Hello world</h1>
18
+
19
+ <select id="app-selection">
20
+ <option selected value="ecde-app-growing-degree-days">ECDE growing degree days</option>
21
+ <option value="ecde-app-mean-temperature">ECDE Mean Temperature</option>
22
+ </select>
23
+
24
+ <div class="t-ct">
25
+ <div id="toolbox-app">
26
+ <div class="pre-app-loading">
27
+ <img src="/toolbox/assets/spinner.svg" alt="Loading">
28
+ <div>
29
+ ...loading configuration...
30
+ </div>
31
+ </div>
32
+ </div>
33
+ </div>
34
+
35
+ <script>
36
+ (function () {
37
+ const ID = 'toolbox-app';
38
+ $(document).ready(() => {
39
+ window.cds_toolbox.runApp(ID, 'https://cds.climate.copernicus.eu/workflows/c3s/ecde-app-growing-degree-days/master/configuration.json', {
40
+ workflowParams: {
41
+ default: 'Bayern'
42
+ }
43
+ });
44
+
45
+ const defaults = {
46
+ 'ecde-app-growing-degree-days': 'Bayern',
47
+ 'ecde-app-mean-temperature': 'Occitanie'
48
+ }
49
+
50
+ let selectedApp = 'ecde-app-growing-degree-days';
51
+ const $appSelector = $('#app-selection');
52
+
53
+ $appSelector.on('change', () => {
54
+ const value = $appSelector.val();
55
+ if (value !== selectedApp) {
56
+ selectedApp = value;
57
+ window.cds_toolbox[ID].app_instance.destroy();
58
+ window.cds_toolbox.runApp(ID, `https://cds.climate.copernicus.eu/workflows/c3s/${selectedApp}/master/configuration.json`, {
59
+ workflowParams: {
60
+ default: defaults[selectedApp]
61
+ }
62
+ });
63
+ }
64
+ })
65
+ });
66
+ })();
67
+
68
+ </script>
69
+
70
+ </body>
71
+
72
+ </html>
@@ -0,0 +1,16 @@
1
+ import worldSVG from '@plone/volto/icons/world.svg';
2
+ import ECDEIndicatorsEdit from './ECDEIndicatorsEdit';
3
+ import ECDEIndicatorsView from './ECDEIndicatorsView';
4
+
5
+ export default function installECDEIndicatorsBlock(config) {
6
+ config.blocks.blocksConfig.ecdeIndicators = {
7
+ id: 'ecdeIndicators',
8
+ title: 'ECDE Indicators',
9
+ icon: worldSVG,
10
+ group: 'common',
11
+ edit: ECDEIndicatorsEdit,
12
+ view: ECDEIndicatorsView,
13
+ };
14
+
15
+ return config;
16
+ }
@@ -0,0 +1,28 @@
1
+ div.col-left {
2
+ div.regions-selector,
3
+ div.indicators-selector {
4
+ width: 100%;
5
+ }
6
+
7
+ div.indicators-selector {
8
+ margin-top: 1em;
9
+ }
10
+
11
+ div.ui.dropdown {
12
+ min-width: 10px;
13
+ }
14
+ }
15
+
16
+ div.col-right {
17
+ div.iframe-container {
18
+ width: 100%;
19
+ height: 100%;
20
+ min-height: 1000px;
21
+
22
+ iframe {
23
+ width: 100%;
24
+ height: 100%;
25
+ border: 1px solid #bcbec0;
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,29 @@
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 './View';
6
+
7
+ const Edit = (props) => {
8
+ return (
9
+ <>
10
+ <View {...props} mode="edit" />
11
+
12
+ <SidebarPortal selected={props.selected}>
13
+ <InlineForm
14
+ schema={schema}
15
+ title={schema.title}
16
+ onChangeField={(id, value) => {
17
+ props.onChangeBlock(props.block, {
18
+ ...props.data,
19
+ [id]: value,
20
+ });
21
+ }}
22
+ formData={props.data}
23
+ />
24
+ </SidebarPortal>
25
+ </>
26
+ );
27
+ };
28
+
29
+ export default Edit;
@@ -0,0 +1,87 @@
1
+ import React from 'react';
2
+ import { UniversalLink } from '@plone/volto/components';
3
+
4
+ // {
5
+ // "feature": {
6
+ // "OBJECTID": 39,
7
+ // "CNTR_CODE": "PL",
8
+ // "CNTR_NAME": "Poland",
9
+ // "NUTS_ID": "PL9",
10
+ // "NUTS_Name_Excel": "Mazovia (Mazowieckie)",
11
+ // "NAME_LATN": "Makroregion województwo mazowieckie",
12
+ // "NUTS_NAME": "Makroregion województwo mazowieckie",
13
+ // "LEVEL_CODE": "NUTS 1",
14
+ // "Comments": null,
15
+ // "CNTR_FLAG": "https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/4.1.4/flags/4x3/pl.svg",
16
+ // "BIOGEO_REG_CODE": "Continental",
17
+ // "BIOGEO_REG_NAME": "Continental Bio-geographical Region",
18
+ // "_maxOverlap": 35559453062.672485,
19
+ // "BIOGEO_NUTS_AREA": "100",
20
+ // "SHAPE_Length": 1473687.3485873593,
21
+ // "SHAPE_Area": 35559453062.672424
22
+ // }
23
+ // }
24
+
25
+ const NutsRegion = ({ feature }) => {
26
+ const fields = [
27
+ ['Name', 'NUTS_NAME'],
28
+ ['Country', 'CNTR_NAME'],
29
+ ['NUTS level', 'LEVEL_CODE'],
30
+ ['NUTS ID', 'NUTS_ID'],
31
+ ['Bioregion', 'BIOGEO_REG_NAME'],
32
+ ['Area', 'SHAPE_Area'],
33
+ ];
34
+ return <FieldsDisplay feature={feature} fields={fields} />;
35
+ };
36
+
37
+ const FieldsDisplay = ({ feature, fields }) => (
38
+ <dl className="feature-info">
39
+ {fields.map(([label, name]) => (
40
+ <div key={name}>
41
+ <dt>{label}</dt>
42
+ <dd>{feature[name]}</dd>
43
+ </div>
44
+ ))}
45
+ </dl>
46
+ );
47
+
48
+ // {
49
+ // "feature": {
50
+ // "OBJECTID": 61,
51
+ // "CNTR_NAME": "Lithuania",
52
+ // "CNTR_CODE": "LT",
53
+ // "LEVEL_CODE": "LAU",
54
+ // "GISCO_ID": "LT_27",
55
+ // "LAU_ID": "27",
56
+ // "LAU_NAME": "Panevėžio miesto savivaldybė",
57
+ // "LAU_Name_Excel": "Panevėžys",
58
+ // "Aggregated": "*",
59
+ // "Value0": null,
60
+ // "CNTR_FLAG": "https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/4.1.4/flags/4x3/lt.svg"
61
+ // }
62
+ // }
63
+
64
+ const City = ({ feature }) => {
65
+ const fields = [
66
+ ['Name', 'LAU_NAME'],
67
+ ['Country', 'CNTR_NAME'],
68
+ ['Level', 'LEVEL_CODE'],
69
+ ['GISCO ID', 'GISCO_ID'],
70
+ ];
71
+ return <FieldsDisplay feature={feature} fields={fields} />;
72
+ };
73
+
74
+ export default function FeatureDisplay({ feature }) {
75
+ return feature ? (
76
+ <div>
77
+ {feature.NUTS_ID ? (
78
+ <NutsRegion feature={feature} />
79
+ ) : (
80
+ <City feature={feature} />
81
+ )}
82
+ <UniversalLink href={`/en/mkh/${feature.NUTS_ID || feature.GISCO_ID}`}>
83
+ Visit
84
+ </UniversalLink>
85
+ </div>
86
+ ) : null;
87
+ }
@@ -0,0 +1,56 @@
1
+ import React from 'react';
2
+ import { openlayers as ol } from '@eeacms/volto-openlayers-map';
3
+ import { useMapContext } from '@eeacms/volto-openlayers-map/api';
4
+
5
+ export default function FeatureInteraction({ onFeatureSelect }) {
6
+ const { map } = useMapContext();
7
+
8
+ const selected = React.useMemo(
9
+ () =>
10
+ new ol.style.Style({
11
+ fill: new ol.style.Fill({
12
+ color: '#cccccc',
13
+ }),
14
+ stroke: new ol.style.Stroke({
15
+ color: 'rgba(255, 0, 0, 0.7)',
16
+ width: 2,
17
+ }),
18
+ }),
19
+ [],
20
+ );
21
+
22
+ const selectStyle = React.useCallback(
23
+ (feature) => {
24
+ const color = feature.get('COLOR') || '#eeeeee';
25
+ selected.getFill().setColor(color);
26
+ return selected;
27
+ },
28
+ [selected],
29
+ );
30
+
31
+ React.useEffect(() => {
32
+ if (!map) return;
33
+ const select = new ol.interaction.Select({
34
+ condition: ol.condition.click,
35
+ style: selectStyle,
36
+ });
37
+ map.addInteraction(select);
38
+ select.on('select', function (e) {
39
+ const features = e.target.getFeatures().getArray();
40
+ features.forEach((feature) => {
41
+ onFeatureSelect(feature.values_);
42
+ });
43
+ // if (!features.length) onFeatureSelect(null);
44
+ });
45
+
46
+ map.on('pointermove', (e) => {
47
+ const pixel = map.getEventPixel(e.originalEvent);
48
+ const hit = map.hasFeatureAtPixel(pixel);
49
+ map.getViewport().style.cursor = hit ? 'pointer' : '';
50
+ });
51
+
52
+ return () => map.removeInteraction(select);
53
+ }, [map, selectStyle, onFeatureSelect]);
54
+
55
+ return null;
56
+ }
@@ -0,0 +1,68 @@
1
+ import React from 'react';
2
+ import { useMapContext } from '@eeacms/volto-openlayers-map/api';
3
+ import { openlayers as ol } from '@eeacms/volto-openlayers-map';
4
+ import FeatureDisplay from './FeatureDisplay';
5
+ import { usePrevious } from '@plone/volto/helpers/Utils/usePrevious';
6
+
7
+ export default function InfoOverlay({ selectedFeature, layerId }) {
8
+ const { map } = useMapContext();
9
+ const [tooltip, setTooltipRef] = React.useState();
10
+ const [showTooltip, setShowTooltip] = React.useState();
11
+
12
+ const prevLayerId = usePrevious(layerId);
13
+
14
+ React.useEffect(() => {
15
+ if (prevLayerId && layerId !== prevLayerId) {
16
+ setShowTooltip(false);
17
+ }
18
+ }, [layerId, prevLayerId]);
19
+
20
+ React.useEffect(() => {
21
+ if (!(map && tooltip)) return;
22
+
23
+ const overlay = new ol.Overlay({
24
+ element: document.getElementById('popup-overlay'),
25
+ positioning: 'bottom-center',
26
+ offset: [0, -10],
27
+ stopEvent: false,
28
+ });
29
+ map.addOverlay(overlay);
30
+
31
+ function handler(evt) {
32
+ const coordinate = evt.coordinate;
33
+ const { pixel, target } = evt;
34
+ const features = target.getFeaturesAtPixel(pixel);
35
+
36
+ if (features.length) {
37
+ overlay.setPosition(coordinate);
38
+ setShowTooltip(true);
39
+ } else {
40
+ setShowTooltip(false);
41
+ }
42
+ }
43
+
44
+ map.on('click', handler);
45
+
46
+ return () => {
47
+ map.un('click', handler);
48
+ map.removeOverlay(overlay);
49
+ };
50
+ }, [map, tooltip]); //
51
+
52
+ const [isClient, setIsClient] = React.useState(false);
53
+ React.useEffect(() => setIsClient(true), []);
54
+
55
+ return isClient ? (
56
+ <div
57
+ id="popup-overlay"
58
+ style={{
59
+ position: 'absolute',
60
+ zIndex: 1,
61
+ visibility: showTooltip ? 'visible' : 'hidden',
62
+ }}
63
+ ref={setTooltipRef}
64
+ >
65
+ <FeatureDisplay feature={selectedFeature} />
66
+ </div>
67
+ ) : null;
68
+ }
@@ -0,0 +1,117 @@
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
+ />
91
+ <Controls attribution={false} zoom={false} />
92
+ <Interactions
93
+ doubleClickZoom={true}
94
+ dragAndDrop={false}
95
+ dragPan={true}
96
+ keyboardPan={true}
97
+ keyboardZoom={true}
98
+ mouseWheelZoom={true}
99
+ pointer={true}
100
+ select={false}
101
+ />
102
+ <Layer.Tile source={tileWMSSources[0]} zIndex={0} />
103
+ {sources.map((name, index) => (
104
+ <Layer.Vector
105
+ key={name}
106
+ title={name}
107
+ zIndex={index}
108
+ {...layers[name]}
109
+ />
110
+ ))}
111
+ <FeatureInteraction onFeatureSelect={onFeatureSelect} />
112
+ </Layers>
113
+ </Map>
114
+ </div>
115
+ </div>
116
+ );
117
+ }
@@ -0,0 +1,16 @@
1
+ import MapBlockEdit from './Edit';
2
+ import MapBlockView from './View';
3
+
4
+ import worldSVG from '@plone/volto/icons/world.svg';
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: 'common',
12
+ edit: MapBlockEdit,
13
+ view: MapBlockView,
14
+ };
15
+ return config;
16
+ };
@@ -0,0 +1,107 @@
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');
@@ -0,0 +1,3 @@
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>
@@ -0,0 +1,15 @@
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
+ };
@@ -0,0 +1,41 @@
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
+ }