@eeacms/volto-n2k 1.0.16 → 1.0.17

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 CHANGED
@@ -4,6 +4,14 @@ 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.17](https://github.com/eea/volto-n2k/compare/1.0.16...1.0.17) - 24 February 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - eslint fix [Miu Razvan - [`417aa35`](https://github.com/eea/volto-n2k/commit/417aa3588b32920a3e378fad8dd72de6d0f02ca3)]
12
+ - species distribution map for birds group [Miu Razvan - [`7712d28`](https://github.com/eea/volto-n2k/commit/7712d28c0c5a79ffd33d4fc8d1d8e73af55937a2)]
13
+ - update [Miu Razvan - [`6ce1f47`](https://github.com/eea/volto-n2k/commit/6ce1f4776686307f867a481b07d5bddd34e10961)]
14
+ - update [Miu Razvan - [`d017393`](https://github.com/eea/volto-n2k/commit/d017393b02d3628a6a72c9f6fccf59b34e517933)]
7
15
  ### [1.0.16](https://github.com/eea/volto-n2k/compare/1.0.15...1.0.16) - 22 February 2023
8
16
 
9
17
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-n2k",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "volto-n2k: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -9,6 +9,7 @@ import { getCddaShapeURL } from './index';
9
9
  import './style.less';
10
10
 
11
11
  const View = (props) => {
12
+ const dataFetched = React.useRef();
12
13
  const [options, setOptions] = React.useState({});
13
14
  const [vectorSource, setVectorSource] = useState(null);
14
15
  const [tileWMSSources, setTileWMSSources] = useState([]);
@@ -34,12 +35,14 @@ const View = (props) => {
34
35
  }, []);
35
36
 
36
37
  useEffect(() => {
37
- if (__SERVER__ || !vectorSource || !site_code[0]) return;
38
+ if (__SERVER__ || !vectorSource || !site_code[0] || dataFetched.current)
39
+ return;
38
40
  const esrijsonFormat = new format.EsriJSON();
39
41
  // Get site shape
40
42
  fetch(getCddaShapeURL(site_code[0])).then(function (response) {
41
43
  if (response.status !== 200) return;
42
44
  response.json().then(function (data) {
45
+ dataFetched.current = true;
43
46
  if (data.features && data.features.length > 0) {
44
47
  const features = esrijsonFormat.readFeatures(data);
45
48
  if (features.length > 0) {
@@ -55,7 +58,7 @@ const View = (props) => {
55
58
  });
56
59
  });
57
60
  /* eslint-disable-next-line */
58
- }, [site_code?.[0]]);
61
+ }, [vectorSource, site_code?.[0]]);
59
62
 
60
63
  if (__SERVER__ || !vectorSource) return '';
61
64
  return (
@@ -9,6 +9,7 @@ import { getHabitatDistributionURL } from './index';
9
9
  import './style.less';
10
10
 
11
11
  const View = (props) => {
12
+ const dataFetched = React.useRef();
12
13
  const [options, setOptions] = React.useState({});
13
14
  const [vectorSource, setVectorSource] = useState(null);
14
15
  const [tileWMSSources, setTileWMSSources] = useState([]);
@@ -34,12 +35,14 @@ const View = (props) => {
34
35
  }, []);
35
36
 
36
37
  useEffect(() => {
37
- if (__SERVER__ || !vectorSource || !code_2000[0]) return;
38
+ if (__SERVER__ || !vectorSource || !code_2000[0] || dataFetched.current)
39
+ return;
38
40
  const esrijsonFormat = new format.EsriJSON();
39
41
  // Get habitat location on sites
40
42
  fetch(getHabitatDistributionURL(code_2000[0])).then(function (response) {
41
43
  if (response.status !== 200) return;
42
44
  response.json().then(function (data) {
45
+ dataFetched.current = true;
43
46
  if (data.features && data.features.length > 0) {
44
47
  const features = esrijsonFormat.readFeatures(data);
45
48
  if (features.length > 0) {
@@ -55,7 +58,7 @@ const View = (props) => {
55
58
  });
56
59
  });
57
60
  /* eslint-disable-next-line */
58
- }, [code_2000?.[0]]);
61
+ }, [vectorSource, code_2000?.[0]]);
59
62
 
60
63
  if (__SERVER__ || !vectorSource) return '';
61
64
  return (
@@ -9,6 +9,7 @@ import { getHabitatProtectedSitesURL } from './index';
9
9
  import './style.less';
10
10
 
11
11
  const View = (props) => {
12
+ const dataFetched = React.useRef();
12
13
  const [options, setOptions] = React.useState({});
13
14
  const [vectorSource, setVectorSource] = useState(null);
14
15
  const [tileWMSSources, setTileWMSSources] = useState([]);
@@ -34,12 +35,14 @@ const View = (props) => {
34
35
  }, []);
35
36
 
36
37
  useEffect(() => {
37
- if (__SERVER__ || !vectorSource || !code_2000[0]) return;
38
+ if (__SERVER__ || !vectorSource || !code_2000[0] || dataFetched.current)
39
+ return;
38
40
  const esrijsonFormat = new format.EsriJSON();
39
41
  // Get habitat protected sites
40
42
  fetch(getHabitatProtectedSitesURL(code_2000[0])).then(function (response) {
41
43
  if (response.status !== 200) return;
42
44
  response.json().then(function (data) {
45
+ dataFetched.current = true;
43
46
  if (data.features && data.features.length > 0) {
44
47
  const features = esrijsonFormat.readFeatures(data);
45
48
  if (features.length > 0) {
@@ -55,7 +58,7 @@ const View = (props) => {
55
58
  });
56
59
  });
57
60
  /* eslint-disable-next-line */
58
- }, [code_2000?.[0]]);
61
+ }, [vectorSource, code_2000?.[0]]);
59
62
 
60
63
  if (__SERVER__ || !vectorSource) return '';
61
64
  return (
@@ -7,9 +7,9 @@ const View = (props) => {
7
7
  const {
8
8
  code_2000 = [],
9
9
  // habitat_description = [],
10
- habitat_type = [],
10
+ // habitat_type = [],
11
11
  // number_countries = [],
12
- number_sites = [],
12
+ // number_sites = [],
13
13
  scientific_name = [],
14
14
  } = provider_data;
15
15
 
@@ -21,17 +21,17 @@ const View = (props) => {
21
21
  <div className="habitat-metadata">
22
22
  <h2 className="name">{scientific_name[0]}</h2>
23
23
  <p className="info">
24
- {habitat_type[0]} habitat code {code_2000[0]}
24
+ ANNEX I habitat code&nbsp;&nbsp;&nbsp;{code_2000[0]}
25
25
  </p>
26
26
  <br />
27
- {number_sites[0] && (
27
+ {/* {number_sites[0] && (
28
28
  <>
29
29
  <h3 style={{ marginBottom: '0.15rem' }}>{number_sites[0]}</h3>
30
30
  <h4 className="radjhan-normal">
31
31
  NATURA 2000 SITES PROTECTING THIS HABITAT
32
32
  </h4>
33
33
  </>
34
- )}
34
+ )} */}
35
35
  </div>
36
36
  </div>
37
37
  </Container>
@@ -12,6 +12,7 @@ div#view .habitat-banner-details .ui.container > * {
12
12
  display: flex;
13
13
  align-items: flex-start;
14
14
  justify-content: space-between;
15
+ gap: 1rem;
15
16
 
16
17
  @media only screen and (max-width: 765px) {
17
18
  flex-flow: column;
@@ -27,9 +28,15 @@ div#view .habitat-banner-details .ui.container > * {
27
28
  margin-bottom: 0 !important;
28
29
  color: #fff !important;
29
30
  font-family: inherit;
31
+
32
+ font-family: RajdhaniB, 'Helvetica Neue', Arial, Helvetica, sans-serif;
30
33
  font-size: 54px;
31
34
  line-height: 54px;
32
35
  text-transform: uppercase;
36
+
37
+ > * {
38
+ font-family: RajdhaniB, 'Helvetica Neue', Arial, Helvetica, sans-serif;
39
+ }
33
40
  }
34
41
 
35
42
  h3 {
@@ -52,7 +59,8 @@ div#view .habitat-banner-details .ui.container > * {
52
59
  text-transform: uppercase;
53
60
  }
54
61
 
55
- .info {
62
+ .info,
63
+ .info > * {
56
64
  font-family: 'RajdhaniR', 'Helvetica Neue', Arial, Helvetica, sans-serif;
57
65
  font-size: 18px;
58
66
  font-weight: 600;
@@ -15,7 +15,10 @@ const DefaultView = (props) => {
15
15
  const currentLang = props.localStorage.get('N2K_LANGUAGE');
16
16
 
17
17
  useEffect(() => {
18
- if (removeTrailingSlash(props.location.pathname) === '/natura2000') {
18
+ if (
19
+ props.location?.pathname &&
20
+ removeTrailingSlash(props.location.pathname) === '/natura2000'
21
+ ) {
19
22
  props.history.push(`/natura2000/${currentLang || 'en'}`);
20
23
  }
21
24
  /* eslint-disable-next-line */
@@ -9,6 +9,7 @@ import { getSiteShapeURL } from './index';
9
9
  import './style.less';
10
10
 
11
11
  const View = (props) => {
12
+ const dataFetched = React.useRef();
12
13
  const [options, setOptions] = React.useState({});
13
14
  const [vectorSource, setVectorSource] = useState(null);
14
15
  const [tileWMSSources, setTileWMSSources] = useState([]);
@@ -34,12 +35,14 @@ const View = (props) => {
34
35
  }, []);
35
36
 
36
37
  useEffect(() => {
37
- if (__SERVER__ || !vectorSource || !site_code[0]) return;
38
+ if (__SERVER__ || !vectorSource || !site_code[0] || dataFetched.current)
39
+ return;
38
40
  const esrijsonFormat = new format.EsriJSON();
39
41
  // Get site shape
40
42
  fetch(getSiteShapeURL(site_code[0])).then(function (response) {
41
43
  if (response.status !== 200) return;
42
44
  response.json().then(function (data) {
45
+ dataFetched.current = true;
43
46
  if (data.features && data.features.length > 0) {
44
47
  const features = esrijsonFormat.readFeatures(data);
45
48
  if (features.length > 0) {
@@ -55,7 +58,7 @@ const View = (props) => {
55
58
  });
56
59
  });
57
60
  /* eslint-disable-next-line */
58
- }, [site_code?.[0]]);
61
+ }, [vectorSource, site_code?.[0]]);
59
62
 
60
63
  if (__SERVER__ || !vectorSource) return '';
61
64
  return (
@@ -19,7 +19,7 @@ const View = (props) => {
19
19
  code_2000 = [],
20
20
  id_eunis = [],
21
21
  license = [],
22
- number_sites = [],
22
+ // number_sites = [],
23
23
  picture_url = [],
24
24
  scientific_name = [],
25
25
  source = [],
@@ -51,26 +51,30 @@ const View = (props) => {
51
51
  <div className="species-metadata">
52
52
  <h2 className="name">
53
53
  {common_name[0] ? common_name[0] + ' - ' : ''}{' '}
54
- <span style={{ fontStyle: 'italic' }}>{scientific_name[0]}</span>
54
+ <span style={{ fontStyle: 'italic', textTransform: 'none' }}>
55
+ {scientific_name[0]}
56
+ </span>
55
57
  </h2>
56
58
  {author[0] && (
57
59
  <p
58
60
  className="info radjhan-bold"
59
- style={{ marginBottom: '0.15rem' }}
61
+ style={{ marginBottom: '0.5rem' }}
60
62
  >
61
63
  {author[0]}
62
64
  </p>
63
65
  )}
64
66
  {code_2000[0] && (
65
- <p className="info">Natura 2000 species code {code_2000[0]}</p>
67
+ <p className="info">
68
+ Natura 2000 species code&nbsp;&nbsp;&nbsp;{code_2000[0]}
69
+ </p>
66
70
  )}
67
- <br />
71
+ {/* <br />
68
72
  {number_sites[0] && (
69
- <h3 style={{ marginBottom: '0.15rem' }}>{number_sites[0]}</h3>
73
+ <h3 style={{ marginBottom: '0.5rem' }}>{number_sites[0]}</h3>
70
74
  )}
71
75
  <h4 className="radjhan-normal">
72
76
  NATURA 2000 SITES PROTECTING THIS SPECIES
73
- </h4>
77
+ </h4> */}
74
78
  </div>
75
79
  <div
76
80
  className={cx('species-pictures', {
@@ -14,6 +14,7 @@ div#view .species-banner-details .ui.container > * {
14
14
  flex-flow: row;
15
15
  align-items: center;
16
16
  justify-content: space-between;
17
+ gap: 2rem;
17
18
 
18
19
  @media only screen and (max-width: 800px) {
19
20
  flex-flow: column;
@@ -25,9 +26,14 @@ div#view .species-banner-details .ui.container > * {
25
26
  margin-bottom: 0 !important;
26
27
  color: #fff !important;
27
28
  font-family: inherit;
29
+ font-family: RajdhaniB, 'Helvetica Neue', Arial, Helvetica, sans-serif;
28
30
  font-size: 54px;
29
31
  line-height: 54px;
30
32
  text-transform: uppercase;
33
+
34
+ > * {
35
+ font-family: RajdhaniB, 'Helvetica Neue', Arial, Helvetica, sans-serif;
36
+ }
31
37
  }
32
38
 
33
39
  h3 {
@@ -9,12 +9,13 @@ import { getSpeciesDistributionURL } from './index';
9
9
  import './style.less';
10
10
 
11
11
  const View = (props) => {
12
+ const dataFetched = React.useRef();
12
13
  const [options, setOptions] = React.useState({});
13
14
  const [vectorSource, setVectorSource] = useState(null);
14
15
  const [tileWMSSources, setTileWMSSources] = useState([]);
15
16
  const { extent, format, proj, style, source } = openlayers;
16
17
  const provider_data = props.provider_data || {};
17
- const { code_2000 = [] } = provider_data;
18
+ const { code_2000 = [], species_group_name = [] } = provider_data;
18
19
 
19
20
  useEffect(() => {
20
21
  if (__SERVER__) return;
@@ -34,12 +35,19 @@ const View = (props) => {
34
35
  }, []);
35
36
 
36
37
  useEffect(() => {
37
- if (__SERVER__ || !vectorSource || !code_2000[0]) return;
38
+ if (__SERVER__ || !vectorSource || !code_2000[0] || dataFetched.current)
39
+ return;
38
40
  const esrijsonFormat = new format.EsriJSON();
39
41
  // Get species location on sites
40
- fetch(getSpeciesDistributionURL(code_2000[0])).then(function (response) {
42
+ fetch(
43
+ getSpeciesDistributionURL(
44
+ code_2000[0],
45
+ species_group_name[0] === 'Birds',
46
+ ),
47
+ ).then(function (response) {
41
48
  if (response.status !== 200) return;
42
49
  response.json().then(function (data) {
50
+ dataFetched.current = true;
43
51
  if (data.features && data.features.length > 0) {
44
52
  const features = esrijsonFormat.readFeatures(data);
45
53
  if (features.length > 0) {
@@ -55,7 +63,7 @@ const View = (props) => {
55
63
  });
56
64
  });
57
65
  /* eslint-disable-next-line */
58
- }, [code_2000?.[0]]);
66
+ }, [vectorSource, code_2000?.[0]]);
59
67
 
60
68
  if (__SERVER__ || !vectorSource) return '';
61
69
  return (
@@ -1,7 +1,13 @@
1
1
  import SpeciesDistributionView from './View';
2
2
  import getSchema from './schema';
3
3
 
4
- export function getSpeciesDistributionURL(code_2000) {
4
+ export function getSpeciesDistributionURL(code_2000, isBird) {
5
+ if (isBird) {
6
+ return encodeURI(
7
+ `https://bio.discomap.eea.europa.eu/arcgis/rest/services/Article_12/BirdsDirective_ART_12_version_2020_08_public_VM/MapServer/3/query?f=json&where=speciescode LIKE '%${code_2000.toUpperCase()}%'&returnGeometry=true&spatialRel=esriSpatialRelIntersects&outFields=speciescode&outSR=102100`,
8
+ );
9
+ }
10
+
5
11
  return encodeURI(
6
12
  `https://bio.discomap.eea.europa.eu/arcgis/rest/services/Article17/HabitatsDirective_ART_17_WMS_version_2020_08_public/MapServer/3/query?f=json&where=speciescode LIKE '%${code_2000.toUpperCase()}%'&returnGeometry=true&spatialRel=esriSpatialRelIntersects&outFields=speciescode&outSR=102100`,
7
13
  );
@@ -9,6 +9,7 @@ import { getSpeciesProtectedSitesURL } from './index';
9
9
  import './style.less';
10
10
 
11
11
  const View = (props) => {
12
+ const dataFetched = React.useRef();
12
13
  const [options, setOptions] = React.useState({});
13
14
  const [vectorSource, setVectorSource] = useState(null);
14
15
  const [tileWMSSources, setTileWMSSources] = useState([]);
@@ -34,12 +35,15 @@ const View = (props) => {
34
35
  }, []);
35
36
 
36
37
  useEffect(() => {
37
- if (__SERVER__ || !vectorSource || !code_2000[0]) return;
38
+ if (__SERVER__ || !vectorSource || !code_2000[0] || dataFetched.current)
39
+ return;
40
+
38
41
  const esrijsonFormat = new format.EsriJSON();
39
42
  // Get species protected sites
40
43
  fetch(getSpeciesProtectedSitesURL(code_2000[0])).then(function (response) {
41
44
  if (response.status !== 200) return;
42
45
  response.json().then(function (data) {
46
+ dataFetched.current = true;
43
47
  if (data.features && data.features.length > 0) {
44
48
  const features = esrijsonFormat.readFeatures(data);
45
49
  if (features.length > 0) {
@@ -55,7 +59,7 @@ const View = (props) => {
55
59
  });
56
60
  });
57
61
  /* eslint-disable-next-line */
58
- }, [code_2000?.[0]]);
62
+ }, [vectorSource, code_2000?.[0]]);
59
63
 
60
64
  if (__SERVER__ || !vectorSource) return '';
61
65
  return (
@@ -331,6 +331,16 @@ body.grey-bg {
331
331
  .readmore-button {
332
332
  color: #00a390;
333
333
  }
334
+
335
+ .ui.basic.segment .header {
336
+ .logo-nav-wrapper {
337
+ .navigation {
338
+ > .ui.menu a {
339
+ font-size: 14px;
340
+ }
341
+ }
342
+ }
343
+ }
334
344
  }
335
345
 
336
346
  .sdf-nav {