@eeacms/volto-bise-policy 1.2.32 → 1.2.34

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 (34) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/package.json +3 -1
  3. package/src/components/Widgets/GeolocationWidget.jsx +143 -0
  4. package/src/components/Widgets/GeolocationWidgetMapContainer.jsx +131 -0
  5. package/src/components/Widgets/NRRWidgets.jsx +95 -0
  6. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyExplorerEdit.jsx +5 -0
  7. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyExplorerView.jsx +107 -0
  8. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyExplorerView.test.jsx +89 -0
  9. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyFilters.jsx +339 -0
  10. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyFilters.test.jsx +111 -0
  11. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyListing.jsx +330 -0
  12. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyListing.test.jsx +166 -0
  13. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyMap.jsx +237 -0
  14. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyMap.test.jsx +176 -0
  15. package/src/components/manage/Blocks/CaseStudyExplorer/FeatureDisplay.jsx +41 -0
  16. package/src/components/manage/Blocks/CaseStudyExplorer/FeatureDisplay.test.jsx +32 -0
  17. package/src/components/manage/Blocks/CaseStudyExplorer/FeatureInteraction.jsx +98 -0
  18. package/src/components/manage/Blocks/CaseStudyExplorer/FeatureInteraction.test.jsx +160 -0
  19. package/src/components/manage/Blocks/CaseStudyExplorer/InfoOverlay.jsx +82 -0
  20. package/src/components/manage/Blocks/CaseStudyExplorer/InfoOverlay.test.jsx +153 -0
  21. package/src/components/manage/Blocks/CaseStudyExplorer/hooks.js +20 -0
  22. package/src/components/manage/Blocks/CaseStudyExplorer/images/icon-depth.png +0 -0
  23. package/src/components/manage/Blocks/CaseStudyExplorer/images/icon-light.png +0 -0
  24. package/src/components/manage/Blocks/CaseStudyExplorer/images/search.svg +3 -0
  25. package/src/components/manage/Blocks/CaseStudyExplorer/index.js +16 -0
  26. package/src/components/manage/Blocks/CaseStudyExplorer/mockJsdom.js +8 -0
  27. package/src/components/manage/Blocks/CaseStudyExplorer/styles.less +359 -0
  28. package/src/components/manage/Blocks/CaseStudyExplorer/styles.less_old +201 -0
  29. package/src/components/manage/Blocks/CaseStudyExplorer/utils.js +144 -0
  30. package/src/components/manage/Blocks/CaseStudyExplorer/utils.test.js +88 -0
  31. package/src/components/manage/Blocks/index.js +2 -0
  32. package/src/express-middleware.js +37 -0
  33. package/src/index.js +29 -0
  34. package/theme/globals/site.overrides +12 -4
@@ -0,0 +1,359 @@
1
+ .nrr-case-study-map-container .listing .u-item:first-child .slot-top {
2
+ padding-top: 2em;
3
+ }
4
+
5
+ #csepopup > span {
6
+ display: 'block';
7
+ margin-bottom: '10px';
8
+ background-color: '#ddd';
9
+ }
10
+
11
+ #csepopup {
12
+ // width: 300px;
13
+ width: 100%;
14
+ // height: 100%;
15
+ padding: 1em;
16
+ // border: 1px solid black;
17
+ // font-size: 14px;
18
+ // line-height: initial;
19
+ font-size: 1rem;
20
+
21
+ a:hover {
22
+ color: #289588;
23
+ }
24
+
25
+ h3 {
26
+ font-size: 1.4rem;
27
+ }
28
+
29
+ h4 {
30
+ margin: 0px;
31
+ }
32
+
33
+ div {
34
+ margin-bottom: 16px;
35
+ }
36
+
37
+ ul {
38
+ margin: 0px;
39
+
40
+ li {
41
+ line-height: 22px;
42
+ }
43
+ }
44
+
45
+ p {
46
+ font-size: 13px;
47
+
48
+ p {
49
+ margin-bottom: 10px;
50
+ }
51
+ }
52
+
53
+ span.blue {
54
+ color: #069;
55
+ }
56
+
57
+ span.img {
58
+ display: block;
59
+ margin-bottom: 10px;
60
+ background-color: #ddd;
61
+
62
+ img {
63
+ max-height: 133px;
64
+ }
65
+ }
66
+ }
67
+
68
+ #external-popup-overlay {
69
+ width: 370px;
70
+ height: 100%;
71
+
72
+ .ol-overlay-container {
73
+ position: relative !important;
74
+ // display: block !important;
75
+ width: 100%;
76
+ height: 100%;
77
+ background-color: #dae8f4;
78
+
79
+ #popup-overlay {
80
+ position: relative !important;
81
+ display: flex;
82
+ width: 100%;
83
+ height: 100%;
84
+ align-items: center;
85
+ }
86
+ }
87
+ }
88
+
89
+ #cse-filter {
90
+ display: flex;
91
+ flex-direction: row;
92
+ margin-top: 1em;
93
+ font-family: sans-serif;
94
+ // gap: 3em;
95
+
96
+ .filter-wrapper {
97
+ // flex-grow: 1;
98
+
99
+ &.active {
100
+ button span {
101
+ // box-shadow: 0 5px 0 #ffffff, 0 0 4px rgba(0, 0, 0, 0.25);
102
+ color: #289588;
103
+ }
104
+
105
+ button {
106
+ box-shadow:
107
+ 0 5px 0 #ffffff,
108
+ 0 0 4px rgba(0, 0, 0, 0.25) !important;
109
+ }
110
+
111
+ .filter-inputs-wrapper {
112
+ display: block;
113
+ }
114
+ }
115
+
116
+ .ri-arrow-down-s-line:before {
117
+ content: '\ea4e';
118
+ }
119
+
120
+ .ui.basic.button.facet-btn {
121
+ position: relative !important;
122
+ z-index: 99999;
123
+ display: inline-block;
124
+ overflow: hidden;
125
+ padding: 0.5em 0em;
126
+ margin: 0 0.25em 0.25em 0;
127
+ background-color: white !important;
128
+ color: #3d5265 !important;
129
+
130
+ &:active {
131
+ background: white !important;
132
+ }
133
+
134
+ // &:hover,
135
+ // &:focus {
136
+ // color: rgba(0, 0, 0, 0.6) !important;
137
+ // }
138
+ &:hover {
139
+ box-shadow: none;
140
+ }
141
+
142
+ span {
143
+ position: relative !important;
144
+ z-index: 99999;
145
+ display: inline-block;
146
+ overflow: hidden;
147
+ padding: 0.5em 1em;
148
+ background-color: white;
149
+ }
150
+ }
151
+
152
+ .filter-inputs-wrapper {
153
+ position: absolute;
154
+ z-index: 1;
155
+ display: none;
156
+ padding: 1em;
157
+ margin-top: -3px;
158
+ background-color: #fff;
159
+ box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.25);
160
+ color: #4f4f4f;
161
+
162
+ .filterInputText {
163
+ padding: 6px;
164
+ border: 0.5px solid #c4c4c4;
165
+ border-radius: 0;
166
+ margin-bottom: 0.7em;
167
+ font-size: 14px;
168
+ }
169
+
170
+ .filter-inputs {
171
+ overflow: auto;
172
+ min-width: 200px;
173
+ max-width: 400px;
174
+ max-height: 200px;
175
+
176
+ &::-webkit-scrollbar {
177
+ width: 8px;
178
+ height: 0.3rem !important;
179
+ }
180
+
181
+ &::-webkit-scrollbar-track {
182
+ border-radius: 10px;
183
+ background-color: #d9d9d9;
184
+ }
185
+
186
+ &::-webkit-scrollbar-thumb {
187
+ border-radius: 10px;
188
+ background: #004b7f;
189
+ }
190
+
191
+ .filter-input {
192
+ display: flex;
193
+ align-items: center;
194
+ justify-content: flex-start;
195
+ cursor: pointer;
196
+ font-size: 14px;
197
+
198
+ span {
199
+ padding-right: 5px;
200
+ }
201
+
202
+ input {
203
+ margin-right: 8px;
204
+ cursor: pointer;
205
+ }
206
+ }
207
+ }
208
+ }
209
+ }
210
+
211
+ h4 {
212
+ position: relative;
213
+ padding: 10px;
214
+ border-bottom: 1px solid #d8d8d8;
215
+ margin-bottom: 0 !important;
216
+ background-color: #005c96;
217
+ color: #fff;
218
+ cursor: pointer;
219
+ font-size: 14px;
220
+ }
221
+ }
222
+
223
+ .active-filter-list {
224
+ border: 1px solid #e6e7e8;
225
+ background-color: #f9f9f9 !important;
226
+
227
+ .filter-list-header {
228
+ display: flex;
229
+ align-items: center;
230
+ gap: 1em;
231
+
232
+ h4 {
233
+ margin: 0;
234
+ color: #3d5265;
235
+ }
236
+ }
237
+
238
+ .filter-list-content {
239
+ padding: 1em 0 0;
240
+ background-color: transparent;
241
+
242
+ .filter {
243
+ display: flex;
244
+ flex-wrap: wrap;
245
+ font-size: 15px;
246
+
247
+ .filter-wrapper {
248
+ display: flex;
249
+ flex-direction: row;
250
+ flex-wrap: wrap;
251
+ align-items: baseline;
252
+ padding: 8px 15px;
253
+ margin-top: 10px;
254
+ margin-right: 11px;
255
+ background-color: #ebebeb;
256
+ gap: 1em;
257
+
258
+ .filter-label {
259
+ font-weight: 500;
260
+ }
261
+
262
+ .filter-value {
263
+ position: relative;
264
+ display: flex;
265
+ align-items: center;
266
+ padding: 0;
267
+ border: none;
268
+ margin: 0;
269
+ background-color: transparent;
270
+ font-size: 15px;
271
+
272
+ .close.icon {
273
+ position: relative;
274
+ width: 16px;
275
+ height: 16px;
276
+ padding: 3px;
277
+ border: 1px solid #004b7f !important;
278
+ border-radius: 2px;
279
+ color: #2e3e4c;
280
+ opacity: 1;
281
+
282
+ &:before,
283
+ &:after {
284
+ position: absolute;
285
+ top: 2px;
286
+ left: 7px;
287
+ width: 1px;
288
+ height: 9px;
289
+ background-color: #004b7f !important;
290
+ content: ' ';
291
+ }
292
+
293
+ &:before {
294
+ transform: rotate(45deg);
295
+ }
296
+
297
+ &:after {
298
+ transform: rotate(-45deg);
299
+ }
300
+ }
301
+ }
302
+ }
303
+ }
304
+ }
305
+ }
306
+
307
+ .sui-search-box .search-input .terms-box .terms-box-left .search-icon img {
308
+ fill: #004b7f !important;
309
+ }
310
+
311
+ .searchlib-block .ui.basic.button.clear-btn {
312
+ color: #289588 !important;
313
+ }
314
+
315
+ .searchlib-block .result-item .result-info {
316
+ align-items: center;
317
+
318
+ &.show-on-map {
319
+ color: #289588 !important;
320
+ cursor: pointer;
321
+
322
+ .result-info-title {
323
+ color: #289588 !important;
324
+ }
325
+ }
326
+ }
327
+
328
+ .searchlib-block .search-body-footer {
329
+ margin-top: 2em;
330
+ }
331
+
332
+ .reset-map-button.ui.button.secondary {
333
+ position: absolute;
334
+ z-index: 2;
335
+ top: 1.3em;
336
+ right: 0.7em;
337
+ display: flex;
338
+ padding: 8px 6px 8px 12px;
339
+ border: 4px solid #efefef;
340
+ border-radius: 2px;
341
+ background-color: #289588;
342
+ gap: 0.5em;
343
+ opacity: 0.6;
344
+
345
+ &.active {
346
+ display: flex;
347
+ }
348
+
349
+ &.inactive {
350
+ display: none;
351
+ }
352
+ }
353
+
354
+ .ol-zoom.ol-control {
355
+ .ol-zoom-in,
356
+ .ol-zoom-out {
357
+ background-color: rgba(0, 131, 224, 0.5);
358
+ }
359
+ }
@@ -0,0 +1,201 @@
1
+ #csepopup > span {
2
+ display: 'block';
3
+ margin-bottom: '10px';
4
+ background-color: '#ddd';
5
+ }
6
+
7
+ #csepopup {
8
+ // width: 300px;
9
+ width: 100%;
10
+ // height: 100%;
11
+ padding: 1em;
12
+ // border: 1px solid black;
13
+ // font-size: 14px;
14
+ // line-height: initial;
15
+ font-size: 1rem;
16
+
17
+ a:hover {
18
+ color: #0099bb;
19
+ }
20
+
21
+ h3 {
22
+ font-size: 1.4rem;
23
+ }
24
+
25
+ h4 {
26
+ margin: 0px;
27
+ }
28
+
29
+ div {
30
+ margin-bottom: 16px;
31
+ }
32
+
33
+ ul {
34
+ margin: 0px;
35
+
36
+ li {
37
+ line-height: 22px;
38
+ }
39
+ }
40
+
41
+ p {
42
+ font-size: 13px;
43
+
44
+ p {
45
+ margin-bottom: 10px;
46
+ }
47
+ }
48
+
49
+ span.blue {
50
+ color: #069;
51
+ }
52
+
53
+ span.img {
54
+ display: block;
55
+ margin-bottom: 10px;
56
+ background-color: #ddd;
57
+
58
+ img {
59
+ max-height: 133px;
60
+ }
61
+ }
62
+ }
63
+
64
+ #external-popup-overlay {
65
+ width: 370px;
66
+ height: 100%;
67
+
68
+ .ol-overlay-container {
69
+ position: relative !important;
70
+ // display: block !important;
71
+ width: 100%;
72
+ height: 100%;
73
+ background-color: #dae8f4;
74
+
75
+ #popup-overlay {
76
+ position: relative !important;
77
+ display: flex;
78
+ width: 100%;
79
+ height: 100%;
80
+ align-items: center;
81
+ }
82
+ }
83
+ }
84
+
85
+ #cse-filter {
86
+ display: flex;
87
+ flex-direction: row;
88
+ font-family: sans-serif;
89
+ // gap: 3em;
90
+
91
+ .filter-wrapper {
92
+ // flex-grow: 1;
93
+
94
+ &.active {
95
+ button span {
96
+ // box-shadow: 0 0 4px #aaa !important;
97
+ box-shadow: 0 5px 0 #ffffff, 0 0 4px rgba(0, 0, 0, 0.25);
98
+ color: #0099bb;
99
+ }
100
+
101
+ .filter-inputs-wrapper {
102
+ display: block;
103
+ }
104
+ }
105
+
106
+ .ri-arrow-down-s-line:before {
107
+ content: '\ea4e';
108
+ }
109
+
110
+ .ui.basic.button.facet-btn {
111
+ margin: 0 0.25em 0.25em 0;
112
+
113
+ &:active {
114
+ background: white !important;
115
+ }
116
+
117
+ &:hover,
118
+ &:focus {
119
+ color: rgba(0, 0, 0, 0.6) !important;
120
+ }
121
+
122
+ span {
123
+ position: relative !important;
124
+ z-index: 99999;
125
+ display: inline-block;
126
+ overflow: hidden;
127
+ padding: 0.5em 1em;
128
+ background-color: white;
129
+ }
130
+ }
131
+
132
+ .filter-inputs-wrapper {
133
+ position: absolute;
134
+ z-index: 1;
135
+ display: none;
136
+ padding: 1em;
137
+ margin-top: -6px;
138
+ background-color: #fff;
139
+ box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.25);
140
+ color: #4f4f4f;
141
+
142
+ .filterInputText {
143
+ padding: 6px;
144
+ border: 0.5px solid #c4c4c4;
145
+ margin-bottom: 0.7em;
146
+ border-radius: 0;
147
+ font-size: 14px;
148
+ }
149
+
150
+ .filter-inputs {
151
+ overflow: auto;
152
+ min-width: 200px;
153
+ max-width: 400px;
154
+ max-height: 200px;
155
+
156
+ &::-webkit-scrollbar {
157
+ width: 8px;
158
+ height: 0.3rem !important;
159
+ }
160
+
161
+ &::-webkit-scrollbar-track {
162
+ background-color: #d9d9d9;
163
+ border-radius: 10px;
164
+ }
165
+
166
+ &::-webkit-scrollbar-thumb {
167
+ background: #004b7f;
168
+ border-radius: 10px;
169
+ }
170
+
171
+ .filter-input {
172
+ display: flex;
173
+ align-items: center;
174
+ justify-content: flex-start;
175
+ cursor: pointer;
176
+ font-size: 14px;
177
+
178
+ span {
179
+ padding-right: 5px;
180
+ }
181
+
182
+ input {
183
+ margin-right: 8px;
184
+ cursor: pointer;
185
+ }
186
+ }
187
+ }
188
+ }
189
+ }
190
+
191
+ h4 {
192
+ position: relative;
193
+ padding: 10px;
194
+ border-bottom: 1px solid #d8d8d8;
195
+ margin-bottom: 0 !important;
196
+ background-color: #005c96;
197
+ color: #fff;
198
+ cursor: pointer;
199
+ font-size: 14px;
200
+ }
201
+ }
@@ -0,0 +1,144 @@
1
+ export function centerAndResetMapZoom({ map, ol }) {
2
+ map.getView().animate({
3
+ zoom: 4,
4
+ duration: 1000,
5
+ center: ol.proj.transform([10, 49], 'EPSG:4326', 'EPSG:3857'),
6
+ });
7
+ }
8
+
9
+ export function scrollToElement(elementId) {
10
+ const element = document.getElementById(elementId);
11
+ element.scrollIntoView({
12
+ behavior: 'smooth',
13
+ });
14
+ }
15
+
16
+ export function getExtentOfFeatures({ features, ol }) {
17
+ const points = features.map((f) => f.getGeometry().flatCoordinates);
18
+ const point = new ol.geom.MultiPoint(points);
19
+ return point.getExtent();
20
+ }
21
+
22
+ export function zoomMapToFeatures({ map, features, threshold = 500, ol }) {
23
+ const extent = getExtentOfFeatures({ features, ol });
24
+ let extentBuffer = (extent[3] - extent[1] + extent[2] - extent[0]) / 4;
25
+ extentBuffer = extentBuffer < threshold ? threshold : extentBuffer;
26
+ const paddedExtent = ol.extent.buffer(extent, extentBuffer);
27
+ map.getView().fit(paddedExtent, { ...map.getSize(), duration: 1000 });
28
+ }
29
+
30
+ export function getFeatures({ cases, ol }) {
31
+ const Feature = ol.ol.Feature;
32
+
33
+ return cases.map((c, index) => {
34
+ const {
35
+ geometry: { coordinates },
36
+ } = c;
37
+ const point = new Feature(
38
+ new ol.geom.Point(ol.proj.fromLonLat(coordinates)),
39
+ );
40
+ point.setId(index);
41
+ point.setProperties(
42
+ {
43
+ title: c.properties.title,
44
+ image: c.properties.image,
45
+ nwrm_type: c.properties.nwrm_type,
46
+ measures_implemented: c.properties.measures,
47
+ typology_of_measures: c.properties.typology_of_measures,
48
+ description: c.properties.description,
49
+ index: index,
50
+ path: c.properties.path,
51
+ color: c.properties.nwrm_type === 'Light' ? '#50B0A4' : '#0083E0',
52
+ },
53
+ false,
54
+ );
55
+ return point;
56
+ });
57
+ }
58
+
59
+ export function filterCases(cases, activeFilters, caseStudiesIds, searchInput) {
60
+ const data = cases.filter((_case) => {
61
+ let flag_searchInput = false;
62
+ let flag_implemented = false;
63
+ let flag_typology_of_measures = false;
64
+ let flag_case = caseStudiesIds
65
+ ? caseStudiesIds.includes(_case.properties.url.split('/').pop())
66
+ : true;
67
+
68
+ if (!searchInput) {
69
+ flag_searchInput = true;
70
+ } else {
71
+ if (_case.properties.title.toLowerCase().match(searchInput)) {
72
+ flag_searchInput = true;
73
+ } else if (
74
+ _case.properties.description.toLowerCase().match(searchInput)
75
+ ) {
76
+ flag_searchInput = true;
77
+ }
78
+ }
79
+
80
+ if (!activeFilters.measures_implemented.length) {
81
+ flag_implemented = true;
82
+ } else {
83
+ let measures_implemented = _case.properties.measures?.map((item) => {
84
+ return item['id'].toString();
85
+ });
86
+
87
+ activeFilters.measures_implemented.forEach((filter) => {
88
+ if (measures_implemented?.includes(filter)) flag_implemented = true;
89
+ });
90
+ }
91
+
92
+ if (!activeFilters.typology_of_measures.length) {
93
+ flag_typology_of_measures = true;
94
+ } else {
95
+ let typology_of_measures = _case.properties.typology_of_measures?.map(
96
+ (item) => {
97
+ return item.toString();
98
+ },
99
+ );
100
+
101
+ activeFilters.typology_of_measures.forEach((filter) => {
102
+ if (typology_of_measures?.includes(filter))
103
+ flag_typology_of_measures = true;
104
+ });
105
+ }
106
+
107
+ return flag_case &&
108
+ flag_implemented &&
109
+ flag_typology_of_measures &&
110
+ flag_searchInput
111
+ ? _case
112
+ : false;
113
+ });
114
+
115
+ return data;
116
+ }
117
+
118
+ export function getFilters(cases) {
119
+ let _filters = {
120
+ measures_implemented: {},
121
+ typology_of_measures: {},
122
+ };
123
+
124
+ for (let key of Object.keys(cases)) {
125
+ const _case = cases[key];
126
+ let measures_implemented = _case.properties.measures;
127
+ measures_implemented.map((item) => {
128
+ if (!_filters.measures_implemented.hasOwnProperty(item['id'])) {
129
+ _filters.measures_implemented[item['id']] = item['title'];
130
+ }
131
+ return [];
132
+ });
133
+
134
+ let typology_of_measures = _case.properties.typology_of_measures;
135
+ typology_of_measures.map((item) => {
136
+ if (!_filters.typology_of_measures.hasOwnProperty(item)) {
137
+ _filters.typology_of_measures[item] = item;
138
+ }
139
+ return [];
140
+ });
141
+ }
142
+
143
+ return _filters;
144
+ }