@eeacms/volto-n2k 1.0.3 → 1.0.5
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 +15 -0
- package/package.json +1 -1
- package/src/components/manage/Blocks/BodyClass/View.jsx +2 -1
- package/src/components/manage/Blocks/Landing/DefalutView.jsx +12 -1
- package/src/components/manage/Blocks/SiteBanner/View.jsx +3 -10
- package/src/components/manage/Blocks/SiteHabitatsList/View.jsx +63 -46
- package/src/components/theme/Navigation/Navigation.jsx +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,21 @@ 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.5](https://github.com/eea/volto-n2k/compare/1.0.4...1.0.5) - 13 December 2022
|
|
8
|
+
|
|
9
|
+
#### :rocket: New Features
|
|
10
|
+
|
|
11
|
+
- feat: small improvments - #158303 [Miu Razvan - [`0c6cba7`](https://github.com/eea/volto-n2k/commit/0c6cba7dabd5feaa4f95786ec8171988adeff344)]
|
|
12
|
+
|
|
13
|
+
#### :hammer_and_wrench: Others
|
|
14
|
+
|
|
15
|
+
- Don't run cypress [Miu Razvan - [`3afcc02`](https://github.com/eea/volto-n2k/commit/3afcc02e64e90046e109a71bcc69b6160566197d)]
|
|
16
|
+
### [1.0.4](https://github.com/eea/volto-n2k/compare/1.0.3...1.0.4) - 7 December 2022
|
|
17
|
+
|
|
18
|
+
#### :hammer_and_wrench: Others
|
|
19
|
+
|
|
20
|
+
- Update View.jsx [Nilesh - [`747144a`](https://github.com/eea/volto-n2k/commit/747144ac9d7deeff8b5924d3ee23fafc5bdf91ae)]
|
|
21
|
+
- do not break on empty DOMlist class [Nilesh - [`f1298a0`](https://github.com/eea/volto-n2k/commit/f1298a06e2587b576065d97a1da18a3537286d59)]
|
|
7
22
|
### [1.0.3](https://github.com/eea/volto-n2k/compare/1.0.2...1.0.3) - 10 November 2022
|
|
8
23
|
|
|
9
24
|
#### :bug: Bug Fixes
|
package/package.json
CHANGED
|
@@ -2,10 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import { BodyClass } from '@plone/volto/helpers';
|
|
3
3
|
|
|
4
4
|
const View = (props) => {
|
|
5
|
+
const { data } = props;
|
|
5
6
|
return (
|
|
6
7
|
<>
|
|
7
8
|
{props.mode === 'edit' ? <p>Body className: {props.data.class}</p> : ''}
|
|
8
|
-
<BodyClass className={
|
|
9
|
+
<BodyClass className={data.class ? data.class.trim() : ''} />
|
|
9
10
|
</>
|
|
10
11
|
);
|
|
11
12
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import { connect } from 'react-redux';
|
|
3
3
|
import { generatePath } from 'react-router';
|
|
4
4
|
import { Grid } from 'semantic-ui-react';
|
|
@@ -7,9 +7,20 @@ import { withLocalStorage } from '@eeacms/volto-n2k/hocs';
|
|
|
7
7
|
import hiker from './images/hiker.webp';
|
|
8
8
|
import { tiles, tileProps, getStyle } from './index';
|
|
9
9
|
|
|
10
|
+
function removeTrailingSlash(str) {
|
|
11
|
+
return str.replace(/\/+$/, '');
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
const DefaultView = (props) => {
|
|
11
15
|
const currentLang = props.localStorage.get('N2K_LANGUAGE');
|
|
12
16
|
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (removeTrailingSlash(props.location.pathname) === '/natura2000') {
|
|
19
|
+
props.history.push(`/natura2000/${currentLang}`);
|
|
20
|
+
}
|
|
21
|
+
/* eslint-disable-next-line */
|
|
22
|
+
}, []);
|
|
23
|
+
|
|
13
24
|
return (
|
|
14
25
|
<>
|
|
15
26
|
<div
|
|
@@ -15,7 +15,6 @@ const View = (props) => {
|
|
|
15
15
|
cdda_designation_national_language = [],
|
|
16
16
|
site_type = [],
|
|
17
17
|
site_code = [],
|
|
18
|
-
area_km2 = [],
|
|
19
18
|
area_ha = [],
|
|
20
19
|
year_stablished = [],
|
|
21
20
|
number_protected_habitat_types = [],
|
|
@@ -70,14 +69,8 @@ const View = (props) => {
|
|
|
70
69
|
|
|
71
70
|
<div className="site-detail">
|
|
72
71
|
<div className="upper">
|
|
73
|
-
{isNumber(
|
|
74
|
-
|
|
75
|
-
<div>
|
|
76
|
-
{area_km2} km<sup>2</sup>
|
|
77
|
-
</div>
|
|
78
|
-
) : (
|
|
79
|
-
<div>{area_ha} ha</div>
|
|
80
|
-
)
|
|
72
|
+
{isNumber(area_ha[0]) ? (
|
|
73
|
+
<div>{area_ha} ha</div>
|
|
81
74
|
) : (
|
|
82
75
|
<div>No data</div>
|
|
83
76
|
)}
|
|
@@ -93,7 +86,7 @@ const View = (props) => {
|
|
|
93
86
|
<div>-</div>
|
|
94
87
|
)}
|
|
95
88
|
</div>
|
|
96
|
-
<div className="lower">
|
|
89
|
+
<div className="lower">Site established</div>
|
|
97
90
|
</div>
|
|
98
91
|
|
|
99
92
|
{site_type[0] === 'CDDA' && (
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import findIndex from 'lodash/findIndex';
|
|
2
3
|
import { Icon } from '@plone/volto/components';
|
|
3
4
|
import { Link } from 'react-router-dom';
|
|
4
5
|
import cx from 'classnames';
|
|
@@ -9,7 +10,7 @@ import './style.less';
|
|
|
9
10
|
|
|
10
11
|
const View = (props) => {
|
|
11
12
|
const [habitats, setHabitats] = React.useState({});
|
|
12
|
-
const [
|
|
13
|
+
const [expandedHabitats, setExpandedHabitats] = React.useState([]);
|
|
13
14
|
const { provider_data = {}, placeholder = 'No results' } = props;
|
|
14
15
|
|
|
15
16
|
React.useEffect(() => {
|
|
@@ -31,54 +32,70 @@ const View = (props) => {
|
|
|
31
32
|
{Object.keys(habitats)?.length ? (
|
|
32
33
|
Object.keys(habitats)
|
|
33
34
|
.sort()
|
|
34
|
-
.map((habitat) =>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<
|
|
35
|
+
.map((habitat) => {
|
|
36
|
+
const expanded = expandedHabitats.includes(habitat);
|
|
37
|
+
return (
|
|
38
|
+
<div className="habitat" key={habitat}>
|
|
39
|
+
<div
|
|
40
|
+
className={cx({
|
|
41
|
+
'habitat-toolbar': true,
|
|
42
|
+
marginless: !expanded,
|
|
43
|
+
})}
|
|
44
|
+
>
|
|
45
|
+
<div className="habitat-name">
|
|
46
|
+
<h3>{habitat}</h3>
|
|
47
|
+
<p className="count">{habitats[habitat].length}</p>
|
|
48
|
+
</div>
|
|
49
|
+
<Icon
|
|
50
|
+
name={expanded ? upKeySVG : downKeySVG}
|
|
51
|
+
onClick={(e) => {
|
|
52
|
+
const index = findIndex(
|
|
53
|
+
expandedHabitats,
|
|
54
|
+
(name) => name === habitat,
|
|
55
|
+
);
|
|
56
|
+
if (index === -1) {
|
|
57
|
+
setExpandedHabitats((prevExpandedHabitats) => [
|
|
58
|
+
...prevExpandedHabitats,
|
|
59
|
+
habitat,
|
|
60
|
+
]);
|
|
61
|
+
} else {
|
|
62
|
+
setExpandedHabitats((prevExpandedHabitats) => {
|
|
63
|
+
const newExpandedHabitats = [...prevExpandedHabitats];
|
|
64
|
+
newExpandedHabitats.splice(index, 1);
|
|
65
|
+
return newExpandedHabitats;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
e.stopPropagation();
|
|
70
|
+
}}
|
|
71
|
+
color="#8C8C8C"
|
|
72
|
+
size="32px"
|
|
73
|
+
/>
|
|
45
74
|
</div>
|
|
46
|
-
<Icon
|
|
47
|
-
name={selectedHabitat === habitat ? upKeySVG : downKeySVG}
|
|
48
|
-
onClick={(e) => {
|
|
49
|
-
setSelectedHabitat(
|
|
50
|
-
selectedHabitat === habitat ? null : habitat,
|
|
51
|
-
);
|
|
52
|
-
e.preventDefault();
|
|
53
|
-
e.stopPropagation();
|
|
54
|
-
}}
|
|
55
|
-
color="#8C8C8C"
|
|
56
|
-
size="32px"
|
|
57
|
-
/>
|
|
58
|
-
</div>
|
|
59
75
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
>
|
|
66
|
-
<Link
|
|
67
|
-
className="description"
|
|
68
|
-
to={`/natura2000/habitats/h/${item.code_2000}`}
|
|
76
|
+
{expanded
|
|
77
|
+
? habitats[habitat].map((item, index) => (
|
|
78
|
+
<div
|
|
79
|
+
className="habitat-item"
|
|
80
|
+
key={`${habitat}-${index}-item`}
|
|
69
81
|
>
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
<Link
|
|
83
|
+
className="description"
|
|
84
|
+
to={`/natura2000/habitats/h/${item.code_2000}`}
|
|
85
|
+
>
|
|
86
|
+
{item.habitat_description} ({item.code_2000})
|
|
87
|
+
</Link>
|
|
88
|
+
<p className="coverage">
|
|
89
|
+
{item.coverage_ha.toFixed(2)} ha (
|
|
90
|
+
{(item.coverage_ha / 100).toFixed(4)} km
|
|
91
|
+
<sup>2</sup>)
|
|
92
|
+
</p>
|
|
93
|
+
</div>
|
|
94
|
+
))
|
|
95
|
+
: ''}
|
|
96
|
+
</div>
|
|
97
|
+
);
|
|
98
|
+
})
|
|
82
99
|
) : (
|
|
83
100
|
<p>{placeholder}</p>
|
|
84
101
|
)}
|
|
@@ -303,10 +303,10 @@ class Navigation extends Component {
|
|
|
303
303
|
: '#'
|
|
304
304
|
}
|
|
305
305
|
openLinkInNewTab={true}
|
|
306
|
-
title="
|
|
306
|
+
title="Go to expert view"
|
|
307
307
|
className="item firstLevel deep-dive"
|
|
308
308
|
>
|
|
309
|
-
|
|
309
|
+
GO TO EXPERT VIEW
|
|
310
310
|
</UniversalLink>
|
|
311
311
|
</>
|
|
312
312
|
) : (
|