@eeacms/volto-n2k 1.0.15 → 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 +16 -2
- package/package.json +1 -1
- package/src/components/manage/Blocks/CddaShape/View.jsx +5 -2
- package/src/components/manage/Blocks/HabitatDistribution/View.jsx +5 -2
- package/src/components/manage/Blocks/HabitatProtectedSites/View.jsx +5 -2
- package/src/components/manage/Blocks/HabitatsBanner/View.jsx +11 -8
- package/src/components/manage/Blocks/HabitatsBanner/style.less +29 -1
- package/src/components/manage/Blocks/Landing/DefalutView.jsx +4 -1
- package/src/components/manage/Blocks/NavigationAnchors/styles.less +2 -0
- package/src/components/manage/Blocks/SiteShape/View.jsx +5 -2
- package/src/components/manage/Blocks/SpeciesBanner/View.jsx +36 -9
- package/src/components/manage/Blocks/SpeciesBanner/style.less +35 -0
- package/src/components/manage/Blocks/SpeciesDistribution/View.jsx +12 -4
- package/src/components/manage/Blocks/SpeciesDistribution/index.js +7 -1
- package/src/components/manage/Blocks/SpeciesProtectedSites/View.jsx +6 -2
- package/src/components/theme/Header/Header.jsx +82 -37
- package/src/components/theme/LanguageSelector/styles.less +29 -18
- package/src/components/theme/Navigation/Navigation.jsx +148 -234
- package/src/less/styles.less +77 -234
package/CHANGELOG.md
CHANGED
|
@@ -4,13 +4,27 @@ 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.
|
|
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)]
|
|
15
|
+
### [1.0.16](https://github.com/eea/volto-n2k/compare/1.0.15...1.0.16) - 22 February 2023
|
|
16
|
+
|
|
17
|
+
#### :hammer_and_wrench: Others
|
|
18
|
+
|
|
19
|
+
- stylelint fix [Miu Razvan - [`4b97345`](https://github.com/eea/volto-n2k/commit/4b973453416261c5a9e00a8860f3dd4f1072b815)]
|
|
20
|
+
- update styles [Miu Razvan - [`ba5cfaf`](https://github.com/eea/volto-n2k/commit/ba5cfafe4fb6a25937ea96501da6ee7e94001237)]
|
|
21
|
+
- update styles [Miu Razvan - [`4fabfe2`](https://github.com/eea/volto-n2k/commit/4fabfe2d4c94bef263d59e806a4ad242fbc08963)]
|
|
22
|
+
### [1.0.15](https://github.com/eea/volto-n2k/compare/1.0.14...1.0.15) - 17 February 2023
|
|
8
23
|
|
|
9
24
|
#### :hammer_and_wrench: Others
|
|
10
25
|
|
|
11
26
|
- fix prettier [Claudia Ifrim - [`aa0d6fe`](https://github.com/eea/volto-n2k/commit/aa0d6fee19dcf0fc83dae5daa09e615fdeaa2b53)]
|
|
12
27
|
- fix prettier [Claudia Ifrim - [`726a157`](https://github.com/eea/volto-n2k/commit/726a157f0467977ccb970e8a2dc583b25a6de37f)]
|
|
13
|
-
- update species and habitats urls [Claudia Ifrim - [`92e4b07`](https://github.com/eea/volto-n2k/commit/92e4b075eaee7c72cfcd7fad83d15a9ee1658953)]
|
|
14
28
|
### [1.0.14](https://github.com/eea/volto-n2k/compare/1.0.13...1.0.14) - 16 February 2023
|
|
15
29
|
|
|
16
30
|
### [1.0.13](https://github.com/eea/volto-n2k/compare/1.0.12...1.0.13) - 16 February 2023
|
package/package.json
CHANGED
|
@@ -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])
|
|
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])
|
|
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])
|
|
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,8 +7,7 @@ const View = (props) => {
|
|
|
7
7
|
const {
|
|
8
8
|
code_2000 = [],
|
|
9
9
|
// habitat_description = [],
|
|
10
|
-
|
|
11
|
-
habitat_type = [],
|
|
10
|
+
// habitat_type = [],
|
|
12
11
|
// number_countries = [],
|
|
13
12
|
// number_sites = [],
|
|
14
13
|
scientific_name = [],
|
|
@@ -22,13 +21,17 @@ const View = (props) => {
|
|
|
22
21
|
<div className="habitat-metadata">
|
|
23
22
|
<h2 className="name">{scientific_name[0]}</h2>
|
|
24
23
|
<p className="info">
|
|
25
|
-
|
|
24
|
+
ANNEX I habitat code {code_2000[0]}
|
|
26
25
|
</p>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
<br />
|
|
27
|
+
{/* {number_sites[0] && (
|
|
28
|
+
<>
|
|
29
|
+
<h3 style={{ marginBottom: '0.15rem' }}>{number_sites[0]}</h3>
|
|
30
|
+
<h4 className="radjhan-normal">
|
|
31
|
+
NATURA 2000 SITES PROTECTING THIS HABITAT
|
|
32
|
+
</h4>
|
|
33
|
+
</>
|
|
34
|
+
)} */}
|
|
32
35
|
</div>
|
|
33
36
|
</div>
|
|
34
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,12 +28,39 @@ 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
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
h3 {
|
|
43
|
+
margin-top: 0 !important;
|
|
44
|
+
margin-bottom: 0 !important;
|
|
45
|
+
color: #fff !important;
|
|
46
|
+
font-family: inherit;
|
|
47
|
+
font-size: 32px;
|
|
48
|
+
line-height: 32px;
|
|
49
|
+
text-transform: uppercase;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
h4 {
|
|
53
|
+
margin-top: 0 !important;
|
|
54
|
+
margin-bottom: 0 !important;
|
|
55
|
+
color: #fff !important;
|
|
56
|
+
font-family: inherit;
|
|
57
|
+
font-size: 32px;
|
|
58
|
+
line-height: 32px;
|
|
59
|
+
text-transform: uppercase;
|
|
33
60
|
}
|
|
34
61
|
|
|
35
|
-
.info
|
|
62
|
+
.info,
|
|
63
|
+
.info > * {
|
|
36
64
|
font-family: 'RajdhaniR', 'Helvetica Neue', Arial, Helvetica, sans-serif;
|
|
37
65
|
font-size: 18px;
|
|
38
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 (
|
|
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])
|
|
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 (
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-no-target-blank */
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { Container } from 'semantic-ui-react';
|
|
3
4
|
import loadable from '@loadable/component';
|
|
@@ -15,9 +16,10 @@ const View = (props) => {
|
|
|
15
16
|
const {
|
|
16
17
|
author = [],
|
|
17
18
|
common_name = [],
|
|
18
|
-
|
|
19
|
+
code_2000 = [],
|
|
19
20
|
id_eunis = [],
|
|
20
21
|
license = [],
|
|
22
|
+
// number_sites = [],
|
|
21
23
|
picture_url = [],
|
|
22
24
|
scientific_name = [],
|
|
23
25
|
source = [],
|
|
@@ -47,15 +49,32 @@ const View = (props) => {
|
|
|
47
49
|
<Container>
|
|
48
50
|
<div className="species-details">
|
|
49
51
|
<div className="species-metadata">
|
|
50
|
-
<h2 className="name">
|
|
51
|
-
|
|
52
|
-
{
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
<h2 className="name">
|
|
53
|
+
{common_name[0] ? common_name[0] + ' - ' : ''}{' '}
|
|
54
|
+
<span style={{ fontStyle: 'italic', textTransform: 'none' }}>
|
|
55
|
+
{scientific_name[0]}
|
|
56
|
+
</span>
|
|
57
|
+
</h2>
|
|
58
|
+
{author[0] && (
|
|
59
|
+
<p
|
|
60
|
+
className="info radjhan-bold"
|
|
61
|
+
style={{ marginBottom: '0.5rem' }}
|
|
62
|
+
>
|
|
63
|
+
{author[0]}
|
|
64
|
+
</p>
|
|
65
|
+
)}
|
|
66
|
+
{code_2000[0] && (
|
|
67
|
+
<p className="info">
|
|
68
|
+
Natura 2000 species code {code_2000[0]}
|
|
69
|
+
</p>
|
|
70
|
+
)}
|
|
71
|
+
{/* <br />
|
|
72
|
+
{number_sites[0] && (
|
|
73
|
+
<h3 style={{ marginBottom: '0.5rem' }}>{number_sites[0]}</h3>
|
|
58
74
|
)}
|
|
75
|
+
<h4 className="radjhan-normal">
|
|
76
|
+
NATURA 2000 SITES PROTECTING THIS SPECIES
|
|
77
|
+
</h4> */}
|
|
59
78
|
</div>
|
|
60
79
|
<div
|
|
61
80
|
className={cx('species-pictures', {
|
|
@@ -99,6 +118,14 @@ const View = (props) => {
|
|
|
99
118
|
/>
|
|
100
119
|
</div>
|
|
101
120
|
)}
|
|
121
|
+
<div className="find-image">
|
|
122
|
+
<a
|
|
123
|
+
href={`http://images.google.com/images?q=${scientific_name[0]}`}
|
|
124
|
+
target="_blank"
|
|
125
|
+
>
|
|
126
|
+
Find image on the web
|
|
127
|
+
</a>
|
|
128
|
+
</div>
|
|
102
129
|
</div>
|
|
103
130
|
</div>
|
|
104
131
|
</Container>
|
|
@@ -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,34 @@ 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
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
h3 {
|
|
40
|
+
margin-top: 0 !important;
|
|
41
|
+
margin-bottom: 0 !important;
|
|
42
|
+
color: #fff !important;
|
|
43
|
+
font-family: inherit;
|
|
44
|
+
font-size: 32px;
|
|
45
|
+
line-height: 32px;
|
|
46
|
+
text-transform: uppercase;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
h4 {
|
|
50
|
+
margin-top: 0 !important;
|
|
51
|
+
margin-bottom: 0 !important;
|
|
52
|
+
color: #fff !important;
|
|
53
|
+
font-family: inherit;
|
|
54
|
+
font-size: 32px;
|
|
55
|
+
line-height: 32px;
|
|
56
|
+
text-transform: uppercase;
|
|
31
57
|
}
|
|
32
58
|
|
|
33
59
|
.info {
|
|
@@ -100,6 +126,15 @@ div#view .species-banner-details .ui.container > * {
|
|
|
100
126
|
height: fit-content;
|
|
101
127
|
}
|
|
102
128
|
}
|
|
129
|
+
|
|
130
|
+
.find-image {
|
|
131
|
+
padding: 0.25rem 1rem;
|
|
132
|
+
text-align: left;
|
|
133
|
+
|
|
134
|
+
a {
|
|
135
|
+
color: #fff;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
103
138
|
}
|
|
104
139
|
}
|
|
105
140
|
|
|
@@ -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])
|
|
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(
|
|
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])
|
|
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 (
|