@eeacms/volto-n2k 1.0.0 → 1.0.2

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 (31) hide show
  1. package/CHANGELOG.md +16 -3
  2. package/package.json +2 -4
  3. package/src/actions/hashlink.js +13 -0
  4. package/src/actions/index.js +1 -0
  5. package/src/components/manage/Blocks/CddaShape/View.jsx +14 -1
  6. package/src/components/manage/Blocks/ExploreHabitats/View.jsx +17 -5
  7. package/src/components/manage/Blocks/ExploreSites/View.jsx +6 -2
  8. package/src/components/manage/Blocks/ExploreSpecies/View.jsx +15 -5
  9. package/src/components/manage/Blocks/HabitatDistribution/View.jsx +14 -1
  10. package/src/components/manage/Blocks/HabitatProtectedSites/View.jsx +14 -1
  11. package/src/components/manage/Blocks/ImageText/Edit.jsx +1 -1
  12. package/src/components/manage/Blocks/ImageText/View.jsx +1 -1
  13. package/src/components/manage/Blocks/Landing/DefalutView.jsx +0 -16
  14. package/src/components/manage/Blocks/Landing/Edit.jsx +0 -16
  15. package/src/components/manage/Blocks/NavigationAnchors/View.jsx +1 -1
  16. package/src/components/manage/Blocks/SiteShape/View.jsx +14 -1
  17. package/src/components/manage/Blocks/SlateLink/render.jsx +1 -1
  18. package/src/components/manage/Blocks/SlateSVG/index.js +1 -1
  19. package/src/components/manage/Blocks/SpeciesDistribution/View.jsx +14 -1
  20. package/src/components/manage/Blocks/SpeciesProtectedSites/View.jsx +14 -1
  21. package/src/components/theme/AppExtras/HashLink.jsx +52 -0
  22. package/src/components/theme/AppExtras/index.js +5 -0
  23. package/src/components/theme/Header/Header.jsx +9 -7
  24. package/src/components/theme/LanguageSelector/LanguageSelector.jsx +2 -42
  25. package/src/components/theme/Navigation/Navigation.jsx +3 -2
  26. package/src/hocs/index.js +2 -1
  27. package/src/hocs/withHashLink.jsx +22 -0
  28. package/src/index.js +3 -3
  29. package/src/reducers/hashlink.js +27 -0
  30. package/src/reducers/index.js +2 -0
  31. /package/src/{store.js → reducers/store.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -4,11 +4,23 @@ 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
- ### [1.0.0](https://github.com/eea/volto-n2k/compare/0.1.15...1.0.0) - 1 November 2022
7
+ ### [1.0.2](https://github.com/eea/volto-n2k/compare/1.0.1...1.0.2) - 4 November 2022
8
8
 
9
- #### :nail_care: Enhancements
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Remove volto-slate dependency [Miu Razvan - [`a966c5b`](https://github.com/eea/volto-n2k/commit/a966c5b0d79552706683fd9620161b9e5e559e10)]
12
+ ### [1.0.1](https://github.com/eea/volto-n2k/compare/1.0.0...1.0.1) - 2 November 2022
13
+
14
+ #### :hammer_and_wrench: Others
10
15
 
11
- - refactor: use latest volto [Miu Razvan - [`92c4e10`](https://github.com/eea/volto-n2k/commit/92c4e1076c75f2d59042c4075804531b3899fc6b)]
16
+ - Update [Miu Razvan - [`923d3f5`](https://github.com/eea/volto-n2k/commit/923d3f5213dfa930ba7aa6fcd85fd75b7ed709a4)]
17
+ - Fix language selector [Miu Razvan - [`a47cffa`](https://github.com/eea/volto-n2k/commit/a47cffa07bb74b5337e36611dc0c8f037c887430)]
18
+ - Use eea basemap [Miu Razvan - [`1531a7c`](https://github.com/eea/volto-n2k/commit/1531a7ca624bb7c1ad584983b19ecc86fa182340)]
19
+ - bugfix for maps - macos [Claudia Ifrim - [`881d066`](https://github.com/eea/volto-n2k/commit/881d06614e517d1d31da712ae3b7562e375f8664)]
20
+ - change basemap for explore species [Claudia Ifrim - [`cd0f217`](https://github.com/eea/volto-n2k/commit/cd0f217f89743892f2a682f0210a29b6daf93698)]
21
+ - change basemap for explore habitats [Claudia Ifrim - [`43535a8`](https://github.com/eea/volto-n2k/commit/43535a82952c460bb712bdc6c995bf24c404b023)]
22
+ - change basemap for explore sites [Claudia Ifrim - [`dd854c7`](https://github.com/eea/volto-n2k/commit/dd854c75b17854a067ffa863863d0b984db99b1b)]
23
+ ## [1.0.0](https://github.com/eea/volto-n2k/compare/0.1.15...1.0.0) - 1 November 2022
12
24
 
13
25
  #### :hammer_and_wrench: Others
14
26
 
@@ -101,6 +113,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
101
113
  - Update [razvanMiu - [`42ab50e`](https://github.com/eea/volto-n2k/commit/42ab50e6681a47251d15ac06b836c6f8c27157fa)]
102
114
  - Added bubble chart [razvanMiu - [`89fba5e`](https://github.com/eea/volto-n2k/commit/89fba5e5db41aa955ba2d0ed58c9f0042c461504)]
103
115
  - Group species by id_eunis in species list [razvanMiu - [`543c957`](https://github.com/eea/volto-n2k/commit/543c9573b53acd8eecc9afbb6ae7beeddba53966)]
116
+ - Add Sonarqube tag using frontend addons list [EEA Jenkins - [`2ca3e4c`](https://github.com/eea/volto-n2k/commit/2ca3e4c092211f92339791d71db81f5b4ca2d562)]
104
117
  - update maps - species and habitats distribution maps [Claudia Ifrim - [`ad12eb1`](https://github.com/eea/volto-n2k/commit/ad12eb141907d6f28444f1eafc3f687735d2a68d)]
105
118
  - update format for common name and author [Claudia Ifrim - [`26b7a2f`](https://github.com/eea/volto-n2k/commit/26b7a2f3d20c7701b57fb24f39fc7dfeceec3ce8)]
106
119
  - update format for species name (common / scientific) [Claudia Ifrim - [`abdedcf`](https://github.com/eea/volto-n2k/commit/abdedcfe645665031dedf050fd2c5cdde8c14a50)]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-n2k",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "volto-n2k: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -13,7 +13,6 @@
13
13
  "react"
14
14
  ],
15
15
  "addons": [
16
- "volto-slate",
17
16
  "@eeacms/volto-datablocks",
18
17
  "@eeacms/volto-openlayers-map",
19
18
  "@eeacms/volto-resize-helper",
@@ -29,8 +28,7 @@
29
28
  "@eeacms/volto-resize-helper": "*",
30
29
  "@eeacms/volto-openlayers-map": "*",
31
30
  "@eeacms/volto-tabs-block": "*",
32
- "@eeacms/volto-bise": "github:eea/volto-bise#develop",
33
- "volto-slate": "*",
31
+ "@eeacms/volto-bise": "*",
34
32
  "d3": "^7.6.1",
35
33
  "d3-shape": "^3.1.0",
36
34
  "react-lazy-load-image-component": "1.5.1",
@@ -0,0 +1,13 @@
1
+ export function setHashLink(hash, data = {}) {
2
+ return {
3
+ type: 'SET_HASH_LINK',
4
+ hash,
5
+ data,
6
+ };
7
+ }
8
+
9
+ export function resetHashLink() {
10
+ return {
11
+ type: 'RESET_HASH_LINK',
12
+ };
13
+ }
@@ -0,0 +1 @@
1
+ export * from './hashlink';
@@ -11,6 +11,7 @@ import './style.less';
11
11
  const View = (props) => {
12
12
  const [options, setOptions] = React.useState({});
13
13
  const [vectorSource, setVectorSource] = useState(null);
14
+ const [tileWMSSources, setTileWMSSources] = useState([]);
14
15
  const { extent, format, proj, style, source } = openlayers;
15
16
  const provider_data = props.provider_data || {};
16
17
  const { site_code = [] } = provider_data;
@@ -18,6 +19,17 @@ const View = (props) => {
18
19
  useEffect(() => {
19
20
  if (__SERVER__) return;
20
21
  setVectorSource(new source.Vector());
22
+ setTileWMSSources([
23
+ new source.TileWMS({
24
+ url: 'https://gisco-services.ec.europa.eu/maps/service',
25
+ params: {
26
+ LAYERS: 'OSMPositronComposite',
27
+ TILED: true,
28
+ },
29
+ serverType: 'geoserver',
30
+ transition: 0,
31
+ }),
32
+ ]);
21
33
  /* eslint-disable-next-line */
22
34
  }, []);
23
35
 
@@ -57,10 +69,11 @@ const View = (props) => {
57
69
  minZoom: 10,
58
70
  zoom: 10,
59
71
  }}
72
+ pixelRatio={1}
60
73
  {...options}
61
74
  >
62
75
  <Layers>
63
- <Layer.Tile zIndex={0} />
76
+ <Layer.Tile source={tileWMSSources[0]} zIndex={0} />
64
77
  <Layer.Vector
65
78
  source={vectorSource}
66
79
  style={
@@ -12,7 +12,7 @@ import './style.less';
12
12
  const View = (props) => {
13
13
  const [options, setOptions] = React.useState({});
14
14
  const [vectorSource, setVectorSource] = useState(null);
15
- const [tileWMSSource, setTileWMSSource] = useState(null);
15
+ const [tileWMSSources, setTileWMSSources] = useState([]);
16
16
  const { extent, format, proj, style, source } = openlayers;
17
17
 
18
18
  const { results = [], payload = {} } = props.search || {};
@@ -27,7 +27,18 @@ const View = (props) => {
27
27
  useEffect(() => {
28
28
  if (__SERVER__) return;
29
29
  setVectorSource(new source.Vector());
30
- setTileWMSSource(
30
+ setTileWMSSources([
31
+ new source.TileWMS({
32
+ url: 'https://gisco-services.ec.europa.eu/maps/service',
33
+ params: {
34
+ LAYERS: 'OSMPositronComposite',
35
+ TILED: true,
36
+ with: 256,
37
+ height: 256,
38
+ },
39
+ serverType: 'geoserver',
40
+ transition: 0,
41
+ }),
31
42
  new source.TileWMS({
32
43
  extent: [
33
44
  -3959514.742799999,
@@ -42,7 +53,7 @@ const View = (props) => {
42
53
  // Countries have transparency, so do not fade tiles:
43
54
  transition: 0,
44
55
  }),
45
- );
56
+ ]);
46
57
  /* eslint-disable-next-line */
47
58
  }, []);
48
59
 
@@ -108,11 +119,12 @@ const View = (props) => {
108
119
  showFullExtent: true,
109
120
  zoom: 5,
110
121
  }}
122
+ pixelRatio={1}
111
123
  {...options}
112
124
  >
113
125
  <Layers>
114
- <Layer.Tile zIndex={0} />
115
- <Layer.Tile source={tileWMSSource} zIndex={1} />
126
+ <Layer.Tile source={tileWMSSources[0]} zIndex={0} />
127
+ <Layer.Tile source={tileWMSSources[1]} zIndex={1} />
116
128
  <Layer.Vector
117
129
  source={vectorSource}
118
130
  title="highlightLayer"
@@ -30,7 +30,10 @@ const View = (props) => {
30
30
  setTileWMSSources([
31
31
  new source.TileWMS({
32
32
  url: 'https://gisco-services.ec.europa.eu/maps/service',
33
- params: { LAYERS: 'OSMPositronComposite', TILED: true },
33
+ params: {
34
+ LAYERS: 'OSMPositronComposite',
35
+ TILED: true,
36
+ },
34
37
  serverType: 'geoserver',
35
38
  transition: 0,
36
39
  }),
@@ -111,10 +114,11 @@ const View = (props) => {
111
114
  showFullExtent: true,
112
115
  zoom: 5,
113
116
  }}
117
+ pixelRatio={1}
114
118
  {...options}
115
119
  >
116
120
  <Layers>
117
- <Layer.Tile zIndex={0} />
121
+ <Layer.Tile source={tileWMSSources[0]} zIndex={0} />
118
122
  <Layer.Tile source={tileWMSSources[1]} zIndex={1} />
119
123
  <Layer.Vector
120
124
  source={vectorSource}
@@ -12,7 +12,7 @@ import './style.less';
12
12
  const View = (props) => {
13
13
  const [options, setOptions] = React.useState({});
14
14
  const [vectorSource, setVectorSource] = useState(null);
15
- const [tileWMSSource, setTileWMSSource] = useState(null);
15
+ const [tileWMSSources, setTileWMSSources] = useState([]);
16
16
  const { extent, format, proj, style, source } = openlayers;
17
17
 
18
18
  const { results = [], payload = {} } = props.search || {};
@@ -27,7 +27,16 @@ const View = (props) => {
27
27
  useEffect(() => {
28
28
  if (__SERVER__) return;
29
29
  setVectorSource(new source.Vector());
30
- setTileWMSSource(
30
+ setTileWMSSources([
31
+ new source.TileWMS({
32
+ url: 'https://gisco-services.ec.europa.eu/maps/service',
33
+ params: {
34
+ LAYERS: 'OSMPositronComposite',
35
+ TILED: true,
36
+ },
37
+ serverType: 'geoserver',
38
+ transition: 0,
39
+ }),
31
40
  new source.TileWMS({
32
41
  extent: [
33
42
  -3690067.3068000004,
@@ -42,7 +51,7 @@ const View = (props) => {
42
51
  // Countries have transparency, so do not fade tiles:
43
52
  transition: 0,
44
53
  }),
45
- );
54
+ ]);
46
55
  /* eslint-disable-next-line */
47
56
  }, []);
48
57
 
@@ -108,11 +117,12 @@ const View = (props) => {
108
117
  showFullExtent: true,
109
118
  zoom: 5,
110
119
  }}
120
+ pixelRatio={1}
111
121
  {...options}
112
122
  >
113
123
  <Layers>
114
- <Layer.Tile zIndex={0} />
115
- <Layer.Tile source={tileWMSSource} zIndex={1} />
124
+ <Layer.Tile source={tileWMSSources[0]} zIndex={0} />
125
+ <Layer.Tile source={tileWMSSources[1]} zIndex={1} />
116
126
  <Layer.Vector
117
127
  source={vectorSource}
118
128
  title="highlightLayer"
@@ -11,6 +11,7 @@ import './style.less';
11
11
  const View = (props) => {
12
12
  const [options, setOptions] = React.useState({});
13
13
  const [vectorSource, setVectorSource] = useState(null);
14
+ const [tileWMSSources, setTileWMSSources] = useState([]);
14
15
  const { extent, format, proj, style, source } = openlayers;
15
16
  const provider_data = props.provider_data || {};
16
17
  const { code_2000 = [] } = provider_data;
@@ -18,6 +19,17 @@ const View = (props) => {
18
19
  useEffect(() => {
19
20
  if (__SERVER__) return;
20
21
  setVectorSource(new source.Vector());
22
+ setTileWMSSources([
23
+ new source.TileWMS({
24
+ url: 'https://gisco-services.ec.europa.eu/maps/service',
25
+ params: {
26
+ LAYERS: 'OSMPositronComposite',
27
+ TILED: true,
28
+ },
29
+ serverType: 'geoserver',
30
+ transition: 0,
31
+ }),
32
+ ]);
21
33
  /* eslint-disable-next-line */
22
34
  }, []);
23
35
 
@@ -55,10 +67,11 @@ const View = (props) => {
55
67
  showFullExtent: true,
56
68
  zoom: 5,
57
69
  }}
70
+ pixelRatio={1}
58
71
  {...options}
59
72
  >
60
73
  <Layers>
61
- <Layer.Tile zIndex={0} />
74
+ <Layer.Tile source={tileWMSSources[0]} zIndex={0} />
62
75
  <Layer.Vector
63
76
  source={vectorSource}
64
77
  style={
@@ -11,6 +11,7 @@ import './style.less';
11
11
  const View = (props) => {
12
12
  const [options, setOptions] = React.useState({});
13
13
  const [vectorSource, setVectorSource] = useState(null);
14
+ const [tileWMSSources, setTileWMSSources] = useState([]);
14
15
  const { extent, format, proj, style, source } = openlayers;
15
16
  const provider_data = props.provider_data || {};
16
17
  const { code_2000 = [] } = provider_data;
@@ -18,6 +19,17 @@ const View = (props) => {
18
19
  useEffect(() => {
19
20
  if (__SERVER__) return;
20
21
  setVectorSource(new source.Vector());
22
+ setTileWMSSources([
23
+ new source.TileWMS({
24
+ url: 'https://gisco-services.ec.europa.eu/maps/service',
25
+ params: {
26
+ LAYERS: 'OSMPositronComposite',
27
+ TILED: true,
28
+ },
29
+ serverType: 'geoserver',
30
+ transition: 0,
31
+ }),
32
+ ]);
21
33
  /* eslint-disable-next-line */
22
34
  }, []);
23
35
 
@@ -55,10 +67,11 @@ const View = (props) => {
55
67
  showFullExtent: true,
56
68
  zoom: 5,
57
69
  }}
70
+ pixelRatio={1}
58
71
  {...options}
59
72
  >
60
73
  <Layers>
61
- <Layer.Tile zIndex={0} />
74
+ <Layer.Tile source={tileWMSSources[0]} zIndex={0} />
62
75
  <Layer.VectorImage
63
76
  source={vectorSource}
64
77
  style={
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import config from '@plone/volto/registry';
3
3
  import { SidebarPortal } from '@plone/volto/components';
4
4
  import InlineForm from '@plone/volto/components/manage/Form/InlineForm';
5
- import SlateEditor from 'volto-slate/editor/SlateEditor';
5
+ import SlateEditor from '@plone/volto-slate/editor/SlateEditor';
6
6
  import { Editor } from 'slate';
7
7
  import getSchema from './schema';
8
8
  import cx from 'classnames';
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { UniversalLink } from '@plone/volto/components';
3
- import { serializeNodes } from 'volto-slate/editor/render';
3
+ import { serializeNodes } from '@plone/volto-slate/editor/render';
4
4
  import { Editor } from 'slate';
5
5
  import cx from 'classnames';
6
6
  import './styles.less';
@@ -4,7 +4,6 @@ import { generatePath } from 'react-router';
4
4
  import { Grid } from 'semantic-ui-react';
5
5
  import { UniversalLink } from '@plone/volto/components';
6
6
  import { withLocalStorage } from '@eeacms/volto-n2k/hocs';
7
- import LanguageSelector from '@eeacms/volto-n2k/components/theme/LanguageSelector/LanguageSelector';
8
7
  import hiker from './images/hiker.webp';
9
8
  import { tiles, tileProps, getStyle } from './index';
10
9
 
@@ -19,21 +18,6 @@ const DefaultView = (props) => {
19
18
  >
20
19
  <Grid className="landing-page" container columns="12">
21
20
  <Grid.Row>
22
- <Grid.Column
23
- {...{
24
- mobile: 12,
25
- tablet: 12,
26
- computer: 12,
27
- largeScreen: 12,
28
- widescreen: 12,
29
- }}
30
- style={{ zIndex: 1, marginBottom: '1rem' }}
31
- >
32
- <LanguageSelector
33
- navigation={props.navigation}
34
- className="landingpage-variation"
35
- />
36
- </Grid.Column>
37
21
  <Grid.Column
38
22
  className="landing-page-description"
39
23
  widescreen="6"
@@ -9,7 +9,6 @@ import { SidebarPortal, UniversalLink } from '@plone/volto/components';
9
9
  import InlineForm from '@plone/volto/components/manage/Form/InlineForm';
10
10
  import config from '@plone/volto/registry';
11
11
  import settingsSVG from '@plone/volto/icons/settings.svg';
12
- import LanguageSelector from '@eeacms/volto-n2k/components/theme/LanguageSelector/LanguageSelector';
13
12
  import DefaultView from './DefalutView';
14
13
  import getSchema from './schema';
15
14
  import hiker from './images/hiker.webp';
@@ -100,21 +99,6 @@ const Edit = (props) => {
100
99
  >
101
100
  <Grid className="landing-page" container columns="12">
102
101
  <Grid.Row>
103
- <Grid.Column
104
- {...{
105
- mobile: 12,
106
- tablet: 12,
107
- computer: 12,
108
- largeScreen: 12,
109
- widescreen: 12,
110
- }}
111
- style={{ zIndex: 1, marginBottom: '1rem' }}
112
- >
113
- <LanguageSelector
114
- navigation={props.navigation}
115
- className="landingpage-variation"
116
- />
117
- </Grid.Column>
118
102
  <Grid.Column
119
103
  className="landing-page-description"
120
104
  widescreen="6"
@@ -5,8 +5,8 @@ import { Menu, Container, Sticky } from 'semantic-ui-react';
5
5
  import qs from 'querystring';
6
6
  import cx from 'classnames';
7
7
  import { UniversalLink } from '@plone/volto/components';
8
- import { withHashLink } from 'volto-slate/hooks';
9
8
  import { StickyContext } from '@eeacms/volto-bise/components';
9
+ import { withHashLink } from '@eeacms/volto-n2k/hocs';
10
10
  import './styles.less';
11
11
 
12
12
  const formatLink = (str, obj) => {
@@ -11,6 +11,7 @@ import './style.less';
11
11
  const View = (props) => {
12
12
  const [options, setOptions] = React.useState({});
13
13
  const [vectorSource, setVectorSource] = useState(null);
14
+ const [tileWMSSources, setTileWMSSources] = useState([]);
14
15
  const { extent, format, proj, style, source } = openlayers;
15
16
  const provider_data = props.provider_data || {};
16
17
  const { site_code = [] } = provider_data;
@@ -18,6 +19,17 @@ const View = (props) => {
18
19
  useEffect(() => {
19
20
  if (__SERVER__) return;
20
21
  setVectorSource(new source.Vector());
22
+ setTileWMSSources([
23
+ new source.TileWMS({
24
+ url: 'https://gisco-services.ec.europa.eu/maps/service',
25
+ params: {
26
+ LAYERS: 'OSMPositronComposite',
27
+ TILED: true,
28
+ },
29
+ serverType: 'geoserver',
30
+ transition: 0,
31
+ }),
32
+ ]);
21
33
  /* eslint-disable-next-line */
22
34
  }, []);
23
35
 
@@ -55,10 +67,11 @@ const View = (props) => {
55
67
  showFullExtent: true,
56
68
  zoom: 5,
57
69
  }}
70
+ pixelRatio={1}
58
71
  {...options}
59
72
  >
60
73
  <Layers>
61
- <Layer.Tile zIndex={0} />
74
+ <Layer.Tile source={tileWMSSources[0]} zIndex={0} />
62
75
  <Layer.Vector
63
76
  source={vectorSource}
64
77
  style={
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { UniversalLink } from '@plone/volto/components';
3
3
  import { withRouter } from 'react-router';
4
4
  import { useSelector } from 'react-redux';
5
- import { withHashLink } from 'volto-slate/hooks';
5
+ import { withHashLink } from '@eeacms/volto-n2k/hocs';
6
6
  import qs from 'querystring';
7
7
  import './styles.less';
8
8
 
@@ -1,5 +1,5 @@
1
1
  import { defineMessages } from 'react-intl';
2
- import { makeInlineElementPlugin } from 'volto-slate/components/ElementEditor';
2
+ import { makeInlineElementPlugin } from '@plone/volto-slate/elementEditor';
3
3
  import { SlateSvgSchema } from './schema';
4
4
  import { withSlateSvg } from './extensions';
5
5
  import { SLATESVG } from './constants';
@@ -11,6 +11,7 @@ import './style.less';
11
11
  const View = (props) => {
12
12
  const [options, setOptions] = React.useState({});
13
13
  const [vectorSource, setVectorSource] = useState(null);
14
+ const [tileWMSSources, setTileWMSSources] = useState([]);
14
15
  const { extent, format, proj, style, source } = openlayers;
15
16
  const provider_data = props.provider_data || {};
16
17
  const { code_2000 = [] } = provider_data;
@@ -18,6 +19,17 @@ const View = (props) => {
18
19
  useEffect(() => {
19
20
  if (__SERVER__) return;
20
21
  setVectorSource(new source.Vector());
22
+ setTileWMSSources([
23
+ new source.TileWMS({
24
+ url: 'https://gisco-services.ec.europa.eu/maps/service',
25
+ params: {
26
+ LAYERS: 'OSMPositronComposite',
27
+ TILED: true,
28
+ },
29
+ serverType: 'geoserver',
30
+ transition: 0,
31
+ }),
32
+ ]);
21
33
  /* eslint-disable-next-line */
22
34
  }, []);
23
35
 
@@ -55,10 +67,11 @@ const View = (props) => {
55
67
  showFullExtent: true,
56
68
  zoom: 5,
57
69
  }}
70
+ pixelRatio={1}
58
71
  {...options}
59
72
  >
60
73
  <Layers>
61
- <Layer.Tile zIndex={0} />
74
+ <Layer.Tile source={tileWMSSources[0]} zIndex={0} />
62
75
  <Layer.Vector
63
76
  source={vectorSource}
64
77
  style={
@@ -11,6 +11,7 @@ import './style.less';
11
11
  const View = (props) => {
12
12
  const [options, setOptions] = React.useState({});
13
13
  const [vectorSource, setVectorSource] = useState(null);
14
+ const [tileWMSSources, setTileWMSSources] = useState([]);
14
15
  const { extent, format, proj, style, source } = openlayers;
15
16
  const provider_data = props.provider_data || {};
16
17
  const { code_2000 = [] } = provider_data;
@@ -18,6 +19,17 @@ const View = (props) => {
18
19
  useEffect(() => {
19
20
  if (__SERVER__) return;
20
21
  setVectorSource(new source.Vector());
22
+ setTileWMSSources([
23
+ new source.TileWMS({
24
+ url: 'https://gisco-services.ec.europa.eu/maps/service',
25
+ params: {
26
+ LAYERS: 'OSMPositronComposite',
27
+ TILED: true,
28
+ },
29
+ serverType: 'geoserver',
30
+ transition: 0,
31
+ }),
32
+ ]);
21
33
  /* eslint-disable-next-line */
22
34
  }, []);
23
35
 
@@ -55,10 +67,11 @@ const View = (props) => {
55
67
  showFullExtent: true,
56
68
  zoom: 5,
57
69
  }}
70
+ pixelRatio={1}
58
71
  {...options}
59
72
  >
60
73
  <Layers>
61
- <Layer.Tile zIndex={0} />
74
+ <Layer.Tile source={tileWMSSources[0]} zIndex={0} />
62
75
  <Layer.VectorImage
63
76
  source={vectorSource}
64
77
  style={
@@ -0,0 +1,52 @@
1
+ import React from 'react';
2
+ import { withRouter } from 'react-router';
3
+ import { withHashLink } from '@eeacms/volto-n2k/hocs';
4
+
5
+ import config from '@plone/volto/registry';
6
+
7
+ const scrollToTarget = (target, offsetHeight = 0) => {
8
+ const bodyRect = document.body.getBoundingClientRect().top;
9
+ const targetRect = target.getBoundingClientRect().top;
10
+ const targetPosition = targetRect - bodyRect - offsetHeight;
11
+
12
+ return window.scrollTo({
13
+ top: targetPosition,
14
+ behavior: 'smooth',
15
+ });
16
+ };
17
+
18
+ function HashLink({ history, pathname, hashlink, resetHashLink }) {
19
+ const { settings } = config;
20
+ const blacklist = settings.hashlinkBlacklist || [];
21
+ const id = hashlink.hash;
22
+ const type = hashlink.data.type || '';
23
+
24
+ React.useEffect(() => {
25
+ const unlisten = history.listen((location) => {
26
+ if (location.pathname !== pathname) {
27
+ resetHashLink();
28
+ }
29
+ });
30
+ return () => {
31
+ unlisten();
32
+ };
33
+ /* eslint-disable-next-line */
34
+ }, []);
35
+
36
+ React.useEffect(() => {
37
+ if (hashlink.counter > 0 && blacklist.indexOf(type) === -1) {
38
+ const element = document.getElementById(id);
39
+ const headerWrapper = document.querySelector('.header-wrapper');
40
+ const offsetHeight =
41
+ hashlink.data.offsetHeight || headerWrapper?.offsetHeight || 0;
42
+ if (element) {
43
+ scrollToTarget(element, offsetHeight);
44
+ }
45
+ }
46
+ /* eslint-disable-next-line */
47
+ }, [hashlink.counter]);
48
+
49
+ return <React.Fragment />;
50
+ }
51
+
52
+ export default withRouter(withHashLink(HashLink));
@@ -1,4 +1,5 @@
1
1
  import CopyPaste from './CopyPaste';
2
+ import HashLink from './HashLink';
2
3
 
3
4
  export default (config) => {
4
5
  config.settings.appExtras = [
@@ -7,6 +8,10 @@ export default (config) => {
7
8
  match: '/**/edit',
8
9
  component: CopyPaste,
9
10
  },
11
+ {
12
+ match: '',
13
+ component: HashLink,
14
+ },
10
15
  ];
11
16
 
12
17
  return config;
@@ -82,13 +82,15 @@ const Header = (props) => {
82
82
  }, []);
83
83
 
84
84
  return isRoot || isExplorer ? (
85
- <div className="ui basic segment sticky-header-wrapper" role="banner">
86
- <Navbar
87
- {...props}
88
- isSticky={false}
89
- isRoot={isRoot}
90
- isExplorer={isExplorer}
91
- />
85
+ <div className="ui basic segment sticky-header-wrapper">
86
+ <div className="ui sticky">
87
+ <Navbar
88
+ {...props}
89
+ isSticky={false}
90
+ isRoot={isRoot}
91
+ isExplorer={isExplorer}
92
+ />
93
+ </div>
92
94
  </div>
93
95
  ) : (
94
96
  <Sticky
@@ -60,47 +60,6 @@ const LanguageSelector = (props) => {
60
60
 
61
61
  return (
62
62
  <div className={cx('language-selector', props.className)}>
63
- {/* <Header.TopDropdownMenu
64
- id="language-switcher"
65
- className="item"
66
- text={`${language.toUpperCase()}`}
67
- mobileText={`${language.toUpperCase()}`}
68
- icon={
69
- <Image src={globeIcon} alt="language dropdown globe icon"></Image>
70
- }
71
- viewportWidth={width}
72
- >
73
- <ul
74
- className="wrapper language-list"
75
- role="listbox"
76
- aria-label="language switcher"
77
- >
78
- {eea.languages.map((item, index) => (
79
- <Dropdown.Item
80
- as="li"
81
- key={index}
82
- text={
83
- <span>
84
- {item.name}
85
- <span className="country-code">
86
- {item.code.toUpperCase()}
87
- </span>
88
- </span>
89
- }
90
- onClick={() => {
91
- const translation = find(translations, {
92
- language: item.code,
93
- });
94
- const to = translation
95
- ? flattenToAppURL(translation['@id'])
96
- : `/${item.code}`;
97
- setLanguage(item.code);
98
- history.push(to);
99
- }}
100
- ></Dropdown.Item>
101
- ))}
102
- </ul>
103
- </Header.TopDropdownMenu> */}
104
63
  <Dropdown
105
64
  aria-label="Language selector"
106
65
  disabled={content.get.loading}
@@ -111,7 +70,8 @@ const LanguageSelector = (props) => {
111
70
  <Image src={globeIcon} alt="language dropdown globe icon"></Image>
112
71
  }
113
72
  options={supportedLanguagesOptions}
114
- onChange={(e, data) => {
73
+ value={currentLang}
74
+ onChange={(_, data) => {
115
75
  const lang = data.value;
116
76
  const translation = translations.filter(
117
77
  (item) => item.lang === lang,
@@ -110,7 +110,6 @@ class Navigation extends Component {
110
110
  this.state = {
111
111
  isMobileMenuOpen: false,
112
112
  isSdf: false,
113
- language: this.props.localStorage.get('N2K_LANGUAGE'),
114
113
  };
115
114
  this.container = React.createRef();
116
115
  }
@@ -241,6 +240,8 @@ class Navigation extends Component {
241
240
  ...(this.props.route_parameters || {}),
242
241
  ...qs.parse(this.props.location.search.replace('?', '')),
243
242
  };
243
+ const currentLang = this.props.localStorage.get('N2K_LANGUAGE');
244
+
244
245
  return (
245
246
  <nav
246
247
  className={cx('navigation', this.props.className || '')}
@@ -275,7 +276,7 @@ class Navigation extends Component {
275
276
  />
276
277
  </div>
277
278
  <Menu.Item className="home-button logo">
278
- <Link title="Natura 2000" to={`/natura2000/${this.state.language}`}>
279
+ <Link title="Natura 2000" to={`/natura2000/${currentLang}`}>
279
280
  <Icon name={n2kLogo} size={44} />
280
281
  </Link>
281
282
  </Menu.Item>
package/src/hocs/index.js CHANGED
@@ -2,5 +2,6 @@ import useResizeObserver from './useResizeObserver';
2
2
 
3
3
  import withScreenSize from './withScreenSize';
4
4
  import withLocalStorage from './withLocalStorage';
5
+ import withHashLink from './withHashLink';
5
6
 
6
- export { useResizeObserver, withScreenSize, withLocalStorage };
7
+ export { useResizeObserver, withScreenSize, withLocalStorage, withHashLink };
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { connect } from 'react-redux';
3
+ import { setHashLink, resetHashLink } from '@eeacms/volto-n2k/actions/hashlink';
4
+
5
+ export default function withHashLink(WrappedComponent) {
6
+ return connect(
7
+ (state) => {
8
+ return {
9
+ hashlink: state.hashlink,
10
+ };
11
+ },
12
+ { setHashLink, resetHashLink },
13
+ )((props) => {
14
+ return (
15
+ <WrappedComponent
16
+ {...props}
17
+ setHashLink={props.setHashLink}
18
+ resetHashLink={props.resetHashLink}
19
+ />
20
+ );
21
+ });
22
+ }
package/src/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import React from 'react';
3
3
  import loadable from '@loadable/component';
4
4
 
5
- import localStorage from './store';
5
+ import { hashlink, localStorage } from './reducers';
6
6
 
7
7
  import installAppExtras from './components/theme/AppExtras';
8
8
 
@@ -39,7 +39,7 @@ import installSpeciesProtectedSites from './components/manage/Blocks/SpeciesProt
39
39
  import installStackedBarChart from './components/manage/Blocks/StackedBarChart';
40
40
  import installTilesImages from './components/manage/Blocks/TilesImages';
41
41
 
42
- import { LINK } from 'volto-slate/constants';
42
+ import { LINK } from '@plone/volto-slate/constants';
43
43
 
44
44
  import { Header, Footer } from '@eeacms/volto-n2k/components';
45
45
 
@@ -64,6 +64,7 @@ const applyConfig = (config) => {
64
64
  config.addonReducers = {
65
65
  ...config.addonReducers,
66
66
  localStorage,
67
+ hashlink,
67
68
  };
68
69
 
69
70
  config.settings.persistentReducers.push('localStorage');
@@ -133,7 +134,6 @@ const applyConfig = (config) => {
133
134
 
134
135
  return [
135
136
  installAppExtras,
136
-
137
137
  installBodyClass,
138
138
  installBubbleChart,
139
139
  installCarouselHorizontal,
@@ -0,0 +1,27 @@
1
+ const initialState = {
2
+ hash: null,
3
+ data: {},
4
+ counter: 0,
5
+ };
6
+
7
+ export default function hashlink(state = initialState, action = {}) {
8
+ const { type, hash, data = {} } = action;
9
+ switch (type) {
10
+ case 'SET_HASH_LINK':
11
+ return {
12
+ ...state,
13
+ hash,
14
+ data,
15
+ counter: state.counter + 1,
16
+ };
17
+ case 'RESET_HASH_LINK':
18
+ return {
19
+ ...state,
20
+ hash: null,
21
+ data: {},
22
+ counter: 0,
23
+ };
24
+ default:
25
+ return state;
26
+ }
27
+ }
@@ -0,0 +1,2 @@
1
+ export { default as hashlink } from './hashlink';
2
+ export { default as localStorage } from './store';
File without changes