@eeacms/volto-n2k 1.1.9 → 1.1.10
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 -3
- package/package.json +1 -1
- package/src/components/manage/Blocks/HabitatsBanner/View.jsx +17 -5
- package/src/components/manage/Blocks/SiteHabitatsList/Filters/SortBy.jsx +1 -0
- package/src/components/manage/Blocks/SiteHabitatsList/Filters/View.jsx +2 -16
- package/src/components/manage/Blocks/SiteHabitatsList/View.jsx +18 -32
- package/src/components/manage/Blocks/SiteHabitatsList/style.less +3 -0
- package/src/components/manage/Blocks/SiteHabitatsList/utils.js +3 -2
- package/src/components/manage/Blocks/SiteSpeciesList/style.less +3 -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.1.
|
|
7
|
+
### [1.1.10](https://github.com/eea/volto-n2k/compare/1.1.9...1.1.10) - 1 December 2025
|
|
8
8
|
|
|
9
|
-
#### :
|
|
9
|
+
#### :house: Internal changes
|
|
10
|
+
|
|
11
|
+
- style: Automated code fix [eea-jenkins - [`1990f52`](https://github.com/eea/volto-n2k/commit/1990f520b0223fbaecd5ce4a38f55e8a28beb3eb)]
|
|
12
|
+
- style: Automated code fix [eea-jenkins - [`6bb329d`](https://github.com/eea/volto-n2k/commit/6bb329d70a488f9f4e2673dcc1bceab99a8ff4b7)]
|
|
13
|
+
- style: Automated code fix [eea-jenkins - [`f49ce89`](https://github.com/eea/volto-n2k/commit/f49ce89ad1c659f469d7667f1693b65dce29c55c)]
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
#### :hammer_and_wrench: Others
|
|
16
|
+
|
|
17
|
+
- fix habitat priority [Miu Razvan - [`e69d33e`](https://github.com/eea/volto-n2k/commit/e69d33e9f086e6a7b0005868a0ebda958fdf727d)]
|
|
18
|
+
- fix pipeline [vladcalin-edw - [`9f318d5`](https://github.com/eea/volto-n2k/commit/9f318d5f66073d59e03b14d7d72c2d2cf1e58045)]
|
|
19
|
+
- added sort by code_2000 [vladcalin-edw - [`c641c97`](https://github.com/eea/volto-n2k/commit/c641c9729c10c9bc268568f4a2e2c4d3615cc0c4)]
|
|
20
|
+
- added priority to habitats banner [vladcalin-edw - [`c53b0a4`](https://github.com/eea/volto-n2k/commit/c53b0a49232968045473df72a111afe47bcb916f)]
|
|
21
|
+
- added conditional priority [vladcalin-edw - [`83c0c0a`](https://github.com/eea/volto-n2k/commit/83c0c0aff46b53fc7dd44d0aa802e2bb26599999)]
|
|
22
|
+
- fix no priority count [vladcalin-edw - [`af22479`](https://github.com/eea/volto-n2k/commit/af224793069a6d3acf84905478ee8af6fb799563)]
|
|
23
|
+
### [1.1.9](https://github.com/eea/volto-n2k/compare/1.1.8...1.1.9) - 23 October 2025
|
|
12
24
|
|
|
13
25
|
### [1.1.8](https://github.com/eea/volto-n2k/compare/1.1.7...1.1.8) - 1 October 2025
|
|
14
26
|
|
package/package.json
CHANGED
|
@@ -53,6 +53,20 @@ const ViewComponent = (props) => {
|
|
|
53
53
|
} = habitat;
|
|
54
54
|
const { attribution_copyright = [] } = habitat_pictures;
|
|
55
55
|
|
|
56
|
+
const priorityLabel = useMemo(() => {
|
|
57
|
+
const priority = habitat_prioriy[0];
|
|
58
|
+
|
|
59
|
+
if (priority === 0) {
|
|
60
|
+
return 'Conditional priority';
|
|
61
|
+
}
|
|
62
|
+
if (priority === null) {
|
|
63
|
+
return 'Without priority';
|
|
64
|
+
}
|
|
65
|
+
if (priority === 1) {
|
|
66
|
+
return 'With priority';
|
|
67
|
+
}
|
|
68
|
+
}, [habitat_prioriy]);
|
|
69
|
+
|
|
56
70
|
const pictures = useMemo(
|
|
57
71
|
() => habitat_pictures?.['WebURL'] || [],
|
|
58
72
|
[habitat_pictures],
|
|
@@ -99,11 +113,9 @@ const ViewComponent = (props) => {
|
|
|
99
113
|
<p className="info">
|
|
100
114
|
Habitats Directive Annex I code {code_2000[0]}
|
|
101
115
|
</p>
|
|
102
|
-
{
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
</p>
|
|
106
|
-
)}
|
|
116
|
+
<p className="info" style={{ marginTop: '1rem' }}>
|
|
117
|
+
{priorityLabel}
|
|
118
|
+
</p>
|
|
107
119
|
</div>
|
|
108
120
|
{pictures_length > 0 && (
|
|
109
121
|
<div className={cx('carousel one-slide')}>
|
|
@@ -16,6 +16,7 @@ const View = (props) => {
|
|
|
16
16
|
{ text: 'Name', value: 'scientific_name', key: 'scientific_name' },
|
|
17
17
|
{ text: 'Coverage', value: 'coverage_ha', key: 'coverage_ha' },
|
|
18
18
|
{ text: 'Sites', value: 'number_sites', key: 'number_sites' },
|
|
19
|
+
{ text: 'Code', value: 'code_2000', key: 'code_2000' },
|
|
19
20
|
];
|
|
20
21
|
|
|
21
22
|
return (
|
|
@@ -99,22 +99,8 @@ const View = (props) => {
|
|
|
99
99
|
if (key !== 'getTitle') {
|
|
100
100
|
newFilters[filter][key] =
|
|
101
101
|
filteredHabitats.filter((habitats) => {
|
|
102
|
-
return !!habitats.filter((habitat) =>
|
|
103
|
-
|
|
104
|
-
filtersLabels[filter][key] ===
|
|
105
|
-
filtersLabels.habitat_prioriy.wp
|
|
106
|
-
) {
|
|
107
|
-
return habitat[filter] === 1;
|
|
108
|
-
}
|
|
109
|
-
if (
|
|
110
|
-
filtersLabels[filter][key] ===
|
|
111
|
-
filtersLabels.habitat_prioriy.np
|
|
112
|
-
) {
|
|
113
|
-
return habitat[filter] === null;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return habitat[filter] === filtersLabels[filter][key];
|
|
117
|
-
}).length;
|
|
102
|
+
return !!habitats.filter((habitat) => habitat[filter] === key)
|
|
103
|
+
.length;
|
|
118
104
|
}).length || 'none';
|
|
119
105
|
}
|
|
120
106
|
}
|
|
@@ -16,6 +16,10 @@ const getCurrentPageLength = (pagination, arr) => {
|
|
|
16
16
|
return pagination.itemsPerPage;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
+
function getPriorityString(priority) {
|
|
20
|
+
return filtersLabels.habitat_prioriy[priority] || '';
|
|
21
|
+
}
|
|
22
|
+
|
|
19
23
|
const View = (props) => {
|
|
20
24
|
const {
|
|
21
25
|
provider_data = {},
|
|
@@ -24,7 +28,7 @@ const View = (props) => {
|
|
|
24
28
|
const dataReady = React.useRef(false);
|
|
25
29
|
const [activeHabitatsGroup, setActiveHabitatsGroup] = React.useState('All');
|
|
26
30
|
const [filters, setFilters] = React.useState({});
|
|
27
|
-
const [habitats,
|
|
31
|
+
const [habitats, setHabitats] = React.useState([]);
|
|
28
32
|
const [filteredHabitats, setFilteredHabitats] = React.useState([]);
|
|
29
33
|
const [pagination, setPagination] = React.useState({
|
|
30
34
|
activePage: 1,
|
|
@@ -56,36 +60,13 @@ const View = (props) => {
|
|
|
56
60
|
|
|
57
61
|
const filteredHabitats = habitats.filter((items, index) => {
|
|
58
62
|
let itemsHaveFilter = true;
|
|
59
|
-
|
|
60
63
|
Object.keys(activeFilters).forEach((filter) => {
|
|
61
64
|
let habitatHasFilter = false;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (
|
|
66
|
-
filtersLabels[filter][key] === filtersLabels.habitat_prioriy.wp
|
|
67
|
-
) {
|
|
68
|
-
habitatHasFilter = items[0][filter] === 1;
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
if (
|
|
72
|
-
filtersLabels[filter][key] === filtersLabels.habitat_prioriy.np
|
|
73
|
-
) {
|
|
74
|
-
habitatHasFilter = items[0][filter] === null;
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (filtersLabels[filter][key] === items[0][filter]) {
|
|
79
|
-
habitatHasFilter = true;
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
65
|
+
items.forEach((item) => {
|
|
66
|
+
if (activeFilters[filter].includes(item[filter])) {
|
|
67
|
+
habitatHasFilter = true;
|
|
82
68
|
}
|
|
83
69
|
});
|
|
84
|
-
|
|
85
|
-
if (activeFilters[filter].includes(items[0][filter])) {
|
|
86
|
-
habitatHasFilter = true;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
70
|
if (!habitatHasFilter) {
|
|
90
71
|
itemsHaveFilter = false;
|
|
91
72
|
}
|
|
@@ -115,10 +96,16 @@ const View = (props) => {
|
|
|
115
96
|
if (!newHabitats[habitatsIndex[habitat.code_2000]]) {
|
|
116
97
|
newHabitats[habitatsIndex[habitat.code_2000]] = [];
|
|
117
98
|
}
|
|
118
|
-
newHabitats[habitatsIndex[habitat.code_2000]].push(
|
|
99
|
+
newHabitats[habitatsIndex[habitat.code_2000]].push({
|
|
100
|
+
...habitat,
|
|
101
|
+
habitat_prioriy:
|
|
102
|
+
habitat.habitat_prioriy !== null
|
|
103
|
+
? habitat.habitat_prioriy.toString()
|
|
104
|
+
: '-1',
|
|
105
|
+
});
|
|
119
106
|
});
|
|
120
107
|
}
|
|
121
|
-
|
|
108
|
+
setHabitats(getSortedHabitats(newHabitats.filter((habitats) => habitats)));
|
|
122
109
|
/* eslint-disable-next-line */
|
|
123
110
|
}, [JSON.stringify(provider_data)]);
|
|
124
111
|
|
|
@@ -161,6 +148,7 @@ const View = (props) => {
|
|
|
161
148
|
k + (pagination.activePage - 1) * pagination.itemsPerPage,
|
|
162
149
|
).map((index) => {
|
|
163
150
|
const habitatsData = filteredHabitats[index][0];
|
|
151
|
+
const priority = getPriorityString(habitatsData.habitat_prioriy);
|
|
164
152
|
|
|
165
153
|
return (
|
|
166
154
|
<Grid
|
|
@@ -211,9 +199,7 @@ const View = (props) => {
|
|
|
211
199
|
style={{ fontSize: '1.2rem' }}
|
|
212
200
|
key={`habitat-${index}-${habitat.code_2000}`}
|
|
213
201
|
>
|
|
214
|
-
{
|
|
215
|
-
? `Priority habitat type; `
|
|
216
|
-
: ''}
|
|
202
|
+
{priority ? `${priority}; ` : ''}
|
|
217
203
|
Cover: {habitat.coverage_ha.toFixed(2)} ha (
|
|
218
204
|
{(habitat.coverage_ha / 100).toFixed(2)} km²)
|
|
219
205
|
{habitat.caves > 0
|
|
@@ -14,7 +14,9 @@ div#view .site-habitats-list .habitats-list .ui.container > * {
|
|
|
14
14
|
justify-content: space-between;
|
|
15
15
|
|
|
16
16
|
.active-filters {
|
|
17
|
+
display: flex;
|
|
17
18
|
margin-top: 0;
|
|
19
|
+
gap: 0.5rem;
|
|
18
20
|
|
|
19
21
|
.ui.label.active-filter {
|
|
20
22
|
display: inline-flex;
|
|
@@ -22,6 +24,7 @@ div#view .site-habitats-list .habitats-list .ui.container > * {
|
|
|
22
24
|
align-items: center;
|
|
23
25
|
border: 1px solid #c5c5c5;
|
|
24
26
|
border-radius: 18px;
|
|
27
|
+
background-color: #fff;
|
|
25
28
|
color: #000;
|
|
26
29
|
font-weight: 400;
|
|
27
30
|
|
|
@@ -14,7 +14,9 @@ div#view .site-species-list .species-list .ui.container > * {
|
|
|
14
14
|
justify-content: space-between;
|
|
15
15
|
|
|
16
16
|
.active-filters {
|
|
17
|
+
display: flex;
|
|
17
18
|
margin-top: 0;
|
|
19
|
+
gap: 0.5rem;
|
|
18
20
|
|
|
19
21
|
.ui.label.active-filter {
|
|
20
22
|
display: inline-flex;
|
|
@@ -22,6 +24,7 @@ div#view .site-species-list .species-list .ui.container > * {
|
|
|
22
24
|
align-items: center;
|
|
23
25
|
border: 1px solid #c5c5c5;
|
|
24
26
|
border-radius: 18px;
|
|
27
|
+
background-color: #fff;
|
|
25
28
|
color: #000;
|
|
26
29
|
font-weight: 400;
|
|
27
30
|
|