@eeacms/volto-bise-policy 1.3.10 → 1.3.12
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 +36 -29
- package/package.json +2 -1
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyCard.jsx +404 -0
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyCard.test.jsx +366 -0
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyExplorerView.jsx +193 -93
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyExplorerView.test.jsx +205 -58
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyMap.jsx +329 -178
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyMap.test.jsx +243 -123
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyMapLazy.jsx +61 -0
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyMapLazy.test.jsx +89 -0
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyResults.jsx +128 -0
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyResults.test.jsx +160 -0
- package/src/components/manage/Blocks/CaseStudyExplorer/FacetPopover.jsx +180 -0
- package/src/components/manage/Blocks/CaseStudyExplorer/FacetPopover.test.jsx +125 -0
- package/src/components/manage/Blocks/CaseStudyExplorer/FilterPanel.jsx +171 -0
- package/src/components/manage/Blocks/CaseStudyExplorer/FilterPanel.test.jsx +181 -0
- package/src/components/manage/Blocks/CaseStudyExplorer/Pagination.jsx +81 -0
- package/src/components/manage/Blocks/CaseStudyExplorer/filters.js +350 -0
- package/src/components/manage/Blocks/CaseStudyExplorer/filters.test.js +399 -0
- package/src/components/manage/Blocks/CaseStudyExplorer/hooks.js +28 -4
- package/src/components/manage/Blocks/CaseStudyExplorer/hooks.test.js +73 -0
- package/src/components/manage/Blocks/CaseStudyExplorer/messages.js +138 -0
- package/src/components/manage/Blocks/CaseStudyExplorer/styles.less +1157 -317
- package/src/components/manage/Blocks/CaseStudyExplorer/testUtils.js +44 -46
- package/src/components/manage/Blocks/CaseStudyExplorer/utils.js +68 -184
- package/src/components/manage/Blocks/CaseStudyExplorer/utils.test.js +91 -158
- package/src/index.js +39 -0
- package/src/openlayers.js +51 -0
- package/theme/globals/natura2000.less +54 -10
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyFilters.jsx +0 -383
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyFilters.test.jsx +0 -90
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyListing.jsx +0 -342
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyListing.test.jsx +0 -196
- package/src/components/manage/Blocks/CaseStudyExplorer/FeatureDisplay.jsx +0 -24
- package/src/components/manage/Blocks/CaseStudyExplorer/FeatureDisplay.test.jsx +0 -49
- package/src/components/manage/Blocks/CaseStudyExplorer/FeatureInteraction.jsx +0 -100
- package/src/components/manage/Blocks/CaseStudyExplorer/FeatureInteraction.test.jsx +0 -189
- package/src/components/manage/Blocks/CaseStudyExplorer/InfoOverlay.jsx +0 -111
- package/src/components/manage/Blocks/CaseStudyExplorer/InfoOverlay.test.jsx +0 -159
- package/src/components/manage/Blocks/CaseStudyExplorer/styles.less_old +0 -201
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,42 @@ 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.3.12](https://github.com/eea/volto-bise-policy/compare/1.3.11...1.3.12) - 5 November 2026
|
|
8
|
+
|
|
9
|
+
#### :rocket: New Features
|
|
10
|
+
|
|
11
|
+
- feat(CaseStudyMap): add selection highlight and title popup [laszlocseh - [`52c3d89`](https://github.com/eea/volto-bise-policy/commit/52c3d894f3da4ecf741ddf0fd9333298cca23187)]
|
|
12
|
+
- feat(CaseStudyExplorer): jump to the page of a case study selected on the map [laszlocseh - [`9c2fd56`](https://github.com/eea/volto-bise-policy/commit/9c2fd5660348bcace5aa4150082a3184ec8c0363)]
|
|
13
|
+
- feat(CaseStudyExplorer): add dynamic ecosystem chip overflow popup [laszlocseh - [`feb69e2`](https://github.com/eea/volto-bise-policy/commit/feb69e24a5cd1330e6fc7f78aaa64d38ca94c47f)]
|
|
14
|
+
|
|
15
|
+
#### :bug: Bug Fixes
|
|
16
|
+
|
|
17
|
+
- fix(CaseStudyExplorer): replace useId with a custom hook [laszlocseh - [`45fbbd0`](https://github.com/eea/volto-bise-policy/commit/45fbbd08c9f7be705d86cc37eda505b4a5ca6667)]
|
|
18
|
+
- fix(CaseStudyExplorer): remove media placeholder and adjust map marker size [laszlocseh - [`59a037f`](https://github.com/eea/volto-bise-policy/commit/59a037f718efb17975acd2b7bd084411af17513c)]
|
|
19
|
+
- fix(CaseStudyExplorer): hide pagination when there are no results [laszlocseh - [`2f07403`](https://github.com/eea/volto-bise-policy/commit/2f074037c98a181f5a40f7dc7832f41104660191)]
|
|
20
|
+
- fix: es lint [laszlocseh - [`f226bb7`](https://github.com/eea/volto-bise-policy/commit/f226bb740cad4d83615cd8eca22c091fdeff112c)]
|
|
21
|
+
|
|
22
|
+
#### :nail_care: Enhancements
|
|
23
|
+
|
|
24
|
+
- change(CaseStudyExplorer): update filters, design [laszlocseh - [`470a068`](https://github.com/eea/volto-bise-policy/commit/470a068a352e4388d131eb58cfadcf42e94bde87)]
|
|
25
|
+
|
|
26
|
+
#### :house: Internal changes
|
|
27
|
+
|
|
28
|
+
- style: Automated code fix [eea-jenkins - [`30fc35a`](https://github.com/eea/volto-bise-policy/commit/30fc35a061321bc19679f98adb74030c16a85c41)]
|
|
29
|
+
- style(CaseStudyExplorer): remove duplicate attribute [laszlocseh - [`538b42e`](https://github.com/eea/volto-bise-policy/commit/538b42e3e1c01544a865f778c6cd60582a14a1c4)]
|
|
30
|
+
- style: Automated code fix [eea-jenkins - [`0e2b827`](https://github.com/eea/volto-bise-policy/commit/0e2b8274a79aa0e1acab7725b293a69a3a595a37)]
|
|
31
|
+
- style: Automated code fix [eea-jenkins - [`c2f8597`](https://github.com/eea/volto-bise-policy/commit/c2f8597a3d54d8be36a6e34c6e9a8cbbfae33064)]
|
|
32
|
+
|
|
33
|
+
#### :hammer_and_wrench: Others
|
|
34
|
+
|
|
35
|
+
- test(CaseStudyExplorer): fix hooks.test.js [laszlocseh - [`c6d1c03`](https://github.com/eea/volto-bise-policy/commit/c6d1c039593072c1eaef56cb9d642699d61b1b84)]
|
|
36
|
+
- test(CaseStudyExplorer): update test expectations for UI changes [laszlocseh - [`43e2f34`](https://github.com/eea/volto-bise-policy/commit/43e2f349f724a7d6957f01fe8863da1f57740660)]
|
|
37
|
+
### [1.3.11](https://github.com/eea/volto-bise-policy/compare/1.3.10...1.3.11) - 29 October 2026
|
|
38
|
+
|
|
39
|
+
#### :house: Internal changes
|
|
40
|
+
|
|
41
|
+
- style(natura2000): add habitat section styles [laszlocseh - [`f816db5`](https://github.com/eea/volto-bise-policy/commit/f816db5c2dc08ea8cb9c24f6e6c97f91468d676d)]
|
|
42
|
+
|
|
7
43
|
### [1.3.10](https://github.com/eea/volto-bise-policy/compare/1.3.9...1.3.10) - 21 September 2026
|
|
8
44
|
|
|
9
45
|
#### :rocket: New Features
|
|
@@ -107,10 +143,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
107
143
|
- enable attributions for osm [Claudia Ifrim - [`de583af`](https://github.com/eea/volto-bise-policy/commit/de583af4eff7c7a3a91a9845eb372e2bfa86fec1)]
|
|
108
144
|
### [1.3.3](https://github.com/eea/volto-bise-policy/compare/1.3.2...1.3.3) - 9 July 2026
|
|
109
145
|
|
|
110
|
-
#### :house: Internal changes
|
|
111
|
-
|
|
112
|
-
- chore: [JENKINSFILE] sanitize sonarqube command [valentinab25 - [`8e2dc1a`](https://github.com/eea/volto-bise-policy/commit/8e2dc1a14f3230f197f009a76bf87587724b6e3a)]
|
|
113
|
-
|
|
114
146
|
#### :hammer_and_wrench: Others
|
|
115
147
|
|
|
116
148
|
- test: pin Chromium version 149 to work with Cypress [valentinab25 - [`5841387`](https://github.com/eea/volto-bise-policy/commit/5841387ae59380ee15af8c82a4df81c4767e1b7c)]
|
|
@@ -136,7 +168,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
136
168
|
|
|
137
169
|
#### :hammer_and_wrench: Others
|
|
138
170
|
|
|
139
|
-
- update jenkinsfile [nileshgulia1 - [`84315d2`](https://github.com/eea/volto-bise-policy/commit/84315d29e36427a50fcc1a939c9e650b69bd81f2)]
|
|
140
171
|
- fix sonarqube [nileshgulia1 - [`2da4f19`](https://github.com/eea/volto-bise-policy/commit/2da4f1921027093a95d9011ef3ff8d2977fc0dcc)]
|
|
141
172
|
- fix duplicated code [nileshgulia1 - [`91cdb7a`](https://github.com/eea/volto-bise-policy/commit/91cdb7ad2221506a15ed988e28c7e918b07bcbbf)]
|
|
142
173
|
- fix slashmenu styles on content box [nileshgulia1 - [`13765ad`](https://github.com/eea/volto-bise-policy/commit/13765ad26acc9af1f1066b164b4c58393b902c01)]
|
|
@@ -162,7 +193,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
162
193
|
|
|
163
194
|
#### :hammer_and_wrench: Others
|
|
164
195
|
|
|
165
|
-
- update jenkinsfile [nileshgulia1 - [`84315d2`](https://github.com/eea/volto-bise-policy/commit/84315d29e36427a50fcc1a939c9e650b69bd81f2)]
|
|
166
196
|
- fix sonarqube [nileshgulia1 - [`2da4f19`](https://github.com/eea/volto-bise-policy/commit/2da4f1921027093a95d9011ef3ff8d2977fc0dcc)]
|
|
167
197
|
- fix duplicated code [nileshgulia1 - [`91cdb7a`](https://github.com/eea/volto-bise-policy/commit/91cdb7ad2221506a15ed988e28c7e918b07bcbbf)]
|
|
168
198
|
- fix slashmenu styles on content box [nileshgulia1 - [`13765ad`](https://github.com/eea/volto-bise-policy/commit/13765ad26acc9af1f1066b164b4c58393b902c01)]
|
|
@@ -211,11 +241,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
211
241
|
- Remove z-index styles from header and toolbar [dobri1408 - [`4fc001e`](https://github.com/eea/volto-bise-policy/commit/4fc001e8e0336540b08b685eed42060fd9ca4190)]
|
|
212
242
|
### [1.2.39](https://github.com/eea/volto-bise-policy/compare/1.2.38...1.2.39) - 24 February 2026
|
|
213
243
|
|
|
214
|
-
#### :house: Internal changes
|
|
215
|
-
|
|
216
|
-
- chore: [JENKINSFILE] add package version in sonarqube [valentinab25 - [`4c2d75b`](https://github.com/eea/volto-bise-policy/commit/4c2d75bbf6dca47929c6613749169b40ed483985)]
|
|
217
|
-
- chore: [JENKINSFILE] use sonarqube branches [EEA Jenkins - [`f99c622`](https://github.com/eea/volto-bise-policy/commit/f99c622726cfd711704f50218a2f1fe833974ec3)]
|
|
218
|
-
|
|
219
244
|
#### :hammer_and_wrench: Others
|
|
220
245
|
|
|
221
246
|
- add eea brand colors [Dobricean Ioan Dorian - [`ba09f05`](https://github.com/eea/volto-bise-policy/commit/ba09f05dc50952cccd9e3acb8ee2938600b20f9f)]
|
|
@@ -477,7 +502,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
477
502
|
- chore: customize root theme to use volto-spotlight - refs #259794 [ana-oprea - [`347f96e`](https://github.com/eea/volto-bise-policy/commit/347f96e335139f9656abd34c308c531b05de85e7)]
|
|
478
503
|
- chore: change the theme and alias to volto-spotlight and add volto-spotlight to package.json - refs #259794 [ana-oprea - [`52732a1`](https://github.com/eea/volto-bise-policy/commit/52732a17b3247a04ffae0a3f5118e173afa98157)]
|
|
479
504
|
- chore: change theme to eea-volto-theme, change config.alias - refs #259794 [ana-oprea - [`c2d08ea`](https://github.com/eea/volto-bise-policy/commit/c2d08ea08a7f0e5f6f7d32149e60ea3f3e901923)]
|
|
480
|
-
- chore: [JENKINS] Refactor automated testing [valentinab25 - [`a3c9488`](https://github.com/eea/volto-bise-policy/commit/a3c9488c5d09ba97fe5976675524d436080a2460)]
|
|
481
505
|
- chore: husky, lint-staged use fixed versions [valentinab25 - [`fddc30f`](https://github.com/eea/volto-bise-policy/commit/fddc30f11a1d8ec290edaca2d924282f5e113bc6)]
|
|
482
506
|
- chore:volto 16 in tests, update docs, fix stylelint overrides [valentinab25 - [`005ce74`](https://github.com/eea/volto-bise-policy/commit/005ce742dbd014fde27e417059251233365766dd)]
|
|
483
507
|
|
|
@@ -487,23 +511,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
487
511
|
- fix tests [Claudia Ifrim - [`a8fc12f`](https://github.com/eea/volto-bise-policy/commit/a8fc12fbf962289c1aac42f4b54352bb585af735)]
|
|
488
512
|
- test: in cypress don't wait for breadcrumbs [ana-oprea - [`89e3810`](https://github.com/eea/volto-bise-policy/commit/89e38104e6f8292cdbf2b948f7fe4b7dc064bcef)]
|
|
489
513
|
- Replace norefferer with noopener for links that open in new tab [David Ichim - [`ef3781a`](https://github.com/eea/volto-bise-policy/commit/ef3781ac7368bf8f497082aaee0c63538c0760da)]
|
|
490
|
-
- test: Update jest,Jenkinsfile,lint to volto-addons-template PR30 [valentinab25 - [`c1277ba`](https://github.com/eea/volto-bise-policy/commit/c1277bacf840ee9feccbfd6a2c85f0b25a9a9125)]
|
|
491
|
-
- test: Update jest,Jenkinsfile,lint to volto-addons-template PR30 [valentinab25 - [`c944153`](https://github.com/eea/volto-bise-policy/commit/c944153710fd53c5d48863cf363464273e25f52e)]
|
|
492
|
-
- test: Update jest,Jenkinsfile,lint to volto-addons-template PR30 [valentinab25 - [`d648d52`](https://github.com/eea/volto-bise-policy/commit/d648d525a2fc5076577fe0f75ff9782bf0d1d4e9)]
|
|
493
|
-
- test: [JENKINS] fix jest config, fail with logs on coverage [valentinab25 - [`2a7affe`](https://github.com/eea/volto-bise-policy/commit/2a7affe33d737704bdba117c4a5c8c6748ef7a47)]
|
|
494
|
-
- test: [JENKINS] fix jest config, fail with logs on coverage [valentinab25 - [`5929642`](https://github.com/eea/volto-bise-policy/commit/59296420105d0e8c1f1547aa0cd17a019e478c2b)]
|
|
495
|
-
- test: [JENKINS] fix jest config, fail with logs on coverage [valentinab25 - [`b1142f1`](https://github.com/eea/volto-bise-policy/commit/b1142f1da3667a9f56720f65bebce897a5dd8005)]
|
|
496
514
|
- test: cypress should not wait for navigation, actions, types - refs #259794 [ana-oprea - [`188637c`](https://github.com/eea/volto-bise-policy/commit/188637c78a0cae71b5ee48022507d559dfaceb3e)]
|
|
497
|
-
- test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`fa4e473`](https://github.com/eea/volto-bise-policy/commit/fa4e473018386ec3f09d7300d655c8cccdc19a0e)]
|
|
498
|
-
- test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`1d9135b`](https://github.com/eea/volto-bise-policy/commit/1d9135bb878b3c7a1b828085b99b9d27d78ce60e)]
|
|
499
515
|
- remove cypress tests as it doesn t work on bise [Dobricean Ioan Dorian - [`ba7e2de`](https://github.com/eea/volto-bise-policy/commit/ba7e2defea2dcfd01537c3abb41fa9515ff0a3e3)]
|
|
500
516
|
- add mega menu layout settings as #259794 said [dobri1408 - [`b9a3683`](https://github.com/eea/volto-bise-policy/commit/b9a3683e7d85f8c88ad8feac975c47c434f62c4a)]
|
|
501
|
-
- test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`9181908`](https://github.com/eea/volto-bise-policy/commit/9181908c7f4b51bdf83a34f8c7f25827de9b1cc6)]
|
|
502
|
-
- test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`099d796`](https://github.com/eea/volto-bise-policy/commit/099d79669471e6924bf1e0bc51a79d54379c3a1a)]
|
|
503
|
-
- test: [JENKINS] Improve cypress time [valentinab25 - [`6d5d8e2`](https://github.com/eea/volto-bise-policy/commit/6d5d8e29b04ddb92628245570055067ca3dcbb6c)]
|
|
504
517
|
- test: fix comment [valentinab25 - [`4f27d5a`](https://github.com/eea/volto-bise-policy/commit/4f27d5af2e8895c7af4f1157521ca42682b96e23)]
|
|
505
518
|
- test: EN locales, pre-commit fix, feature PRs checks Refs #257193 [valentinab25 - [`4c2fcb0`](https://github.com/eea/volto-bise-policy/commit/4c2fcb01065e1ef962317ba7be788fd1df079618)]
|
|
506
|
-
- test: Update Makefile and docker-compose to align it with Jenkinsfile [valentinab25 - [`89afaa1`](https://github.com/eea/volto-bise-policy/commit/89afaa15892930452027ef8c8593fc6d193cda70)]
|
|
507
519
|
### [1.2.7](https://github.com/eea/volto-bise-policy/compare/1.2.6...1.2.7) - 9 August 2023
|
|
508
520
|
|
|
509
521
|
#### :house: Documentation changes
|
|
@@ -624,10 +636,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
624
636
|
|
|
625
637
|
- feat(package.json): add @eeacms/volto-block-toc addon to addons list [Miu Razvan - [`ba5d5e6`](https://github.com/eea/volto-bise-policy/commit/ba5d5e6931b5ec324f6aa8c6b735e17963e71db2)]
|
|
626
638
|
|
|
627
|
-
#### :house: Internal changes
|
|
628
|
-
|
|
629
|
-
- chore(Jenkinsfile): remove VOLTO variable value [Miu Razvan - [`2c64b0d`](https://github.com/eea/volto-bise-policy/commit/2c64b0d534f670a5a8300927b10c398a3dba05ae)]
|
|
630
|
-
|
|
631
639
|
#### :hammer_and_wrench: Others
|
|
632
640
|
|
|
633
641
|
- update [Miu Razvan - [`639f91a`](https://github.com/eea/volto-bise-policy/commit/639f91a3830640e0d9062b136dd8184027d288f7)]
|
|
@@ -645,7 +653,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
645
653
|
- Add missing dependencies [Miu Razvan - [`3712bf8`](https://github.com/eea/volto-bise-policy/commit/3712bf85fc537fa5448d80242fed56b26e33855b)]
|
|
646
654
|
- Prepare 1.0.0 release [Miu Razvan - [`fbb707d`](https://github.com/eea/volto-bise-policy/commit/fbb707d01afe6642a223e2fb3e88abb677de241e)]
|
|
647
655
|
- Update [Miu Razvan - [`487a390`](https://github.com/eea/volto-bise-policy/commit/487a3900f707d88a40d435d88ff6072f1eb9698f)]
|
|
648
|
-
- Fix Jenkinsfile [Miu Razvan - [`96f92cc`](https://github.com/eea/volto-bise-policy/commit/96f92cc4f14b066ced8ec1c6e48a782780f10d80)]
|
|
649
656
|
- Rename to volto-bise-policy [Miu Razvan - [`045b4aa`](https://github.com/eea/volto-bise-policy/commit/045b4aa61164c51db36db40fee1151d31829b9fa)]
|
|
650
657
|
### 0.1.0 - 7 December 2022
|
|
651
658
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-bise-policy",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.12",
|
|
4
4
|
"description": "@eeacms/volto-bise-policy: Volto add-on",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"@plone-collective/volto-authomatic": "2.0.1",
|
|
36
36
|
"dompurify": "^3.3.1",
|
|
37
37
|
"esri-loader": "3.7.0",
|
|
38
|
+
"ol": "6.6.x",
|
|
38
39
|
"plotly.js": "^2.28.0",
|
|
39
40
|
"querystring": "0.2.1",
|
|
40
41
|
"react-plotly.js": "2.6.0"
|
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import cx from 'classnames';
|
|
4
|
+
import Image from '@plone/volto/components/theme/Image/Image';
|
|
5
|
+
|
|
6
|
+
import messages from './messages';
|
|
7
|
+
import {
|
|
8
|
+
asValues,
|
|
9
|
+
// getArticleInfo,
|
|
10
|
+
getFacetValues,
|
|
11
|
+
valueLabel,
|
|
12
|
+
} from './filters';
|
|
13
|
+
import { getStatusColor, visibleChipCount } from './utils';
|
|
14
|
+
|
|
15
|
+
/** Rows of chips a card shows before collapsing the rest into "+N". */
|
|
16
|
+
const ECOSYSTEM_ROWS = 2;
|
|
17
|
+
const CHIP_GAP_FALLBACK = 8;
|
|
18
|
+
let nextPanelId = 0;
|
|
19
|
+
|
|
20
|
+
// Volto may run on React versions that do not yet provide useId. Keep IDs
|
|
21
|
+
// stable for the lifetime of a component instance without relying on that API.
|
|
22
|
+
function usePanelId() {
|
|
23
|
+
const id = React.useRef(null);
|
|
24
|
+
if (id.current === null) id.current = `cse-panel-${++nextPanelId}`;
|
|
25
|
+
return id.current;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Measure before the browser paints where possible, without warning on the
|
|
29
|
+
// server-rendered first pass.
|
|
30
|
+
const useIsomorphicLayoutEffect =
|
|
31
|
+
typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect;
|
|
32
|
+
|
|
33
|
+
// const STATUS_LABELS = {
|
|
34
|
+
// planned: messages.statusPlanned,
|
|
35
|
+
// ongoing: messages.statusOngoing,
|
|
36
|
+
// completed: messages.statusCompleted,
|
|
37
|
+
// };
|
|
38
|
+
|
|
39
|
+
function StatusBadge({ status }) {
|
|
40
|
+
// const intl = useIntl();
|
|
41
|
+
// const label = STATUS_LABELS[status];
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<span className="cse-card-status">
|
|
45
|
+
<span
|
|
46
|
+
className="cse-card-status-dot"
|
|
47
|
+
style={{ backgroundColor: getStatusColor(status) }}
|
|
48
|
+
aria-hidden="true"
|
|
49
|
+
/>
|
|
50
|
+
{/* <span className="cse-card-status-label">
|
|
51
|
+
{label ? intl.formatMessage(label) : status}
|
|
52
|
+
</span> */}
|
|
53
|
+
</span>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Ecosystem chips, wrapped over at most two rows. How many fit depends on the
|
|
59
|
+
* card width, so the full list is mirrored into a hidden, absolutely
|
|
60
|
+
* positioned list that is measured with real layout; the chips that overflow
|
|
61
|
+
* two rows collapse into a "+N" trigger that opens a popup listing exactly the
|
|
62
|
+
* hidden values.
|
|
63
|
+
*
|
|
64
|
+
* Without a layout engine (jsdom, SSR) nothing can be measured, so every chip
|
|
65
|
+
* is rendered and no trigger appears.
|
|
66
|
+
*/
|
|
67
|
+
function EcosystemChips({ ecosystems }) {
|
|
68
|
+
const intl = useIntl();
|
|
69
|
+
const [visibleCount, setVisibleCount] = React.useState(ecosystems.length);
|
|
70
|
+
const [open, setOpen] = React.useState(false);
|
|
71
|
+
const measureRef = React.useRef(null);
|
|
72
|
+
const triggerRef = React.useRef(null);
|
|
73
|
+
const panelRef = React.useRef(null);
|
|
74
|
+
const panelId = usePanelId();
|
|
75
|
+
|
|
76
|
+
const measure = React.useCallback(() => {
|
|
77
|
+
const list = measureRef.current;
|
|
78
|
+
if (!list) return;
|
|
79
|
+
|
|
80
|
+
const chips = Array.from(list.querySelectorAll('.cse-card-chip'));
|
|
81
|
+
const width = list.clientWidth;
|
|
82
|
+
|
|
83
|
+
// `visibility: hidden` boxes still measure, but jsdom reports 0 for all of
|
|
84
|
+
// them: keep every chip visible instead of guessing.
|
|
85
|
+
if (!width) {
|
|
86
|
+
setVisibleCount(ecosystems.length);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const gap =
|
|
91
|
+
parseFloat(window.getComputedStyle(list).columnGap) || CHIP_GAP_FALLBACK;
|
|
92
|
+
const tops = chips.map((chip) => chip.offsetTop);
|
|
93
|
+
const rows = [...new Set(tops)].sort((a, b) => a - b);
|
|
94
|
+
const moreChip = list.querySelector('.cse-card-chip-more-measure');
|
|
95
|
+
|
|
96
|
+
setVisibleCount(
|
|
97
|
+
visibleChipCount(
|
|
98
|
+
chips.map((chip, index) => ({
|
|
99
|
+
row: rows.indexOf(tops[index]),
|
|
100
|
+
right: chip.offsetLeft + chip.offsetWidth,
|
|
101
|
+
})),
|
|
102
|
+
{
|
|
103
|
+
rows: ECOSYSTEM_ROWS,
|
|
104
|
+
gap,
|
|
105
|
+
moreWidth: moreChip?.offsetWidth || 0,
|
|
106
|
+
width,
|
|
107
|
+
},
|
|
108
|
+
),
|
|
109
|
+
);
|
|
110
|
+
}, [ecosystems.length]);
|
|
111
|
+
|
|
112
|
+
useIsomorphicLayoutEffect(() => {
|
|
113
|
+
measure();
|
|
114
|
+
|
|
115
|
+
if (typeof ResizeObserver === 'undefined') return undefined;
|
|
116
|
+
const observer = new ResizeObserver(measure);
|
|
117
|
+
if (measureRef.current) observer.observe(measureRef.current);
|
|
118
|
+
|
|
119
|
+
return () => observer.disconnect();
|
|
120
|
+
}, [measure]);
|
|
121
|
+
|
|
122
|
+
React.useEffect(() => {
|
|
123
|
+
if (!open) return undefined;
|
|
124
|
+
|
|
125
|
+
const onDocumentClick = (event) => {
|
|
126
|
+
if (!panelRef.current?.parentElement?.contains(event.target)) {
|
|
127
|
+
setOpen(false);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
const onKeyDown = (event) => {
|
|
131
|
+
if (event.key !== 'Escape') return;
|
|
132
|
+
setOpen(false);
|
|
133
|
+
triggerRef.current?.focus();
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
document.addEventListener('click', onDocumentClick);
|
|
137
|
+
document.addEventListener('keydown', onKeyDown);
|
|
138
|
+
panelRef.current?.focus();
|
|
139
|
+
|
|
140
|
+
return () => {
|
|
141
|
+
document.removeEventListener('click', onDocumentClick);
|
|
142
|
+
document.removeEventListener('keydown', onKeyDown);
|
|
143
|
+
};
|
|
144
|
+
}, [open]);
|
|
145
|
+
|
|
146
|
+
if (!ecosystems.length) return null;
|
|
147
|
+
|
|
148
|
+
const shown = Math.min(visibleCount, ecosystems.length);
|
|
149
|
+
const hidden = ecosystems.length - shown;
|
|
150
|
+
|
|
151
|
+
return (
|
|
152
|
+
<div className="cse-card-ecosystems-wrap">
|
|
153
|
+
<ul className="cse-card-ecosystems">
|
|
154
|
+
{ecosystems.slice(0, shown).map((ecosystem, index) => (
|
|
155
|
+
<li className="cse-card-chip" key={`${ecosystem}-${index}`}>
|
|
156
|
+
{ecosystem}
|
|
157
|
+
</li>
|
|
158
|
+
))}
|
|
159
|
+
{hidden > 0 ? (
|
|
160
|
+
<li className="cse-card-chip cse-card-chip-more">
|
|
161
|
+
<button
|
|
162
|
+
type="button"
|
|
163
|
+
ref={triggerRef}
|
|
164
|
+
className="cse-card-chip-more-trigger"
|
|
165
|
+
aria-expanded={open}
|
|
166
|
+
aria-controls={panelId}
|
|
167
|
+
aria-haspopup="dialog"
|
|
168
|
+
onClick={() => setOpen((wasOpen) => !wasOpen)}
|
|
169
|
+
>
|
|
170
|
+
{intl.formatMessage(messages.moreEcosystems, { count: hidden })}
|
|
171
|
+
<span className="cse-visually-hidden">
|
|
172
|
+
{' '}
|
|
173
|
+
{intl.formatMessage(messages.hiddenEcosystems)}
|
|
174
|
+
</span>
|
|
175
|
+
</button>
|
|
176
|
+
</li>
|
|
177
|
+
) : null}
|
|
178
|
+
</ul>
|
|
179
|
+
|
|
180
|
+
{hidden > 0 && open ? (
|
|
181
|
+
<div
|
|
182
|
+
ref={panelRef}
|
|
183
|
+
id={panelId}
|
|
184
|
+
className="cse-card-ecosystems-panel"
|
|
185
|
+
role="dialog"
|
|
186
|
+
aria-label={intl.formatMessage(messages.hiddenEcosystems)}
|
|
187
|
+
tabIndex={-1}
|
|
188
|
+
>
|
|
189
|
+
<ul className="cse-card-ecosystems cse-card-ecosystems-panel-list">
|
|
190
|
+
{ecosystems.slice(shown).map((ecosystem, index) => (
|
|
191
|
+
<li className="cse-card-chip" key={`${ecosystem}-${index}`}>
|
|
192
|
+
{ecosystem}
|
|
193
|
+
</li>
|
|
194
|
+
))}
|
|
195
|
+
</ul>
|
|
196
|
+
</div>
|
|
197
|
+
) : null}
|
|
198
|
+
|
|
199
|
+
<ul
|
|
200
|
+
ref={measureRef}
|
|
201
|
+
className="cse-card-ecosystems cse-card-ecosystems-measure"
|
|
202
|
+
aria-hidden="true"
|
|
203
|
+
>
|
|
204
|
+
{ecosystems.map((ecosystem, index) => (
|
|
205
|
+
<li className="cse-card-chip" key={`${ecosystem}-${index}`}>
|
|
206
|
+
{ecosystem}
|
|
207
|
+
</li>
|
|
208
|
+
))}
|
|
209
|
+
<li className="cse-card-chip cse-card-chip-more-measure">
|
|
210
|
+
{intl.formatMessage(messages.moreEcosystems, {
|
|
211
|
+
count: ecosystems.length,
|
|
212
|
+
})}
|
|
213
|
+
</li>
|
|
214
|
+
</ul>
|
|
215
|
+
</div>
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Related measures, collapsed behind a full-width disclosure bar. The bar
|
|
221
|
+
* owns the count; the panel stays mounted so its height can animate, and is
|
|
222
|
+
* `inert` while collapsed so its links stay out of the tab order. Nothing is
|
|
223
|
+
* rendered at all for a case study without measures.
|
|
224
|
+
*/
|
|
225
|
+
function RelatedMeasures({ measures }) {
|
|
226
|
+
const intl = useIntl();
|
|
227
|
+
const panelId = usePanelId();
|
|
228
|
+
const [open, setOpen] = React.useState(false);
|
|
229
|
+
|
|
230
|
+
if (!measures.length) return null;
|
|
231
|
+
|
|
232
|
+
return (
|
|
233
|
+
<div className="cse-card-measures">
|
|
234
|
+
<button
|
|
235
|
+
type="button"
|
|
236
|
+
className="cse-card-measures-toggle"
|
|
237
|
+
aria-expanded={open}
|
|
238
|
+
aria-controls={panelId}
|
|
239
|
+
onClick={() => setOpen((value) => !value)}
|
|
240
|
+
>
|
|
241
|
+
<span className="cse-card-measures-count">
|
|
242
|
+
{intl.formatNumber(measures.length)}
|
|
243
|
+
</span>
|
|
244
|
+
<span className="cse-card-measures-title">
|
|
245
|
+
{intl.formatMessage(messages.relatedMeasures)}
|
|
246
|
+
</span>
|
|
247
|
+
<span className="cse-card-measures-chevron">
|
|
248
|
+
<i className="icon ri-arrow-down-s-line" aria-hidden="true" />
|
|
249
|
+
</span>
|
|
250
|
+
</button>
|
|
251
|
+
<div
|
|
252
|
+
id={panelId}
|
|
253
|
+
className="cse-card-measures-panel"
|
|
254
|
+
data-open={open ? 'true' : 'false'}
|
|
255
|
+
inert={open ? undefined : ''}
|
|
256
|
+
>
|
|
257
|
+
<div className="cse-card-measures-panel-inner">
|
|
258
|
+
<ul className="cse-card-measures-list">
|
|
259
|
+
{measures.map((measure) => (
|
|
260
|
+
<li key={measure.id || measure.path || measure.title}>
|
|
261
|
+
<a
|
|
262
|
+
className="cse-card-measure-link"
|
|
263
|
+
href={measure.path}
|
|
264
|
+
title={measure.title}
|
|
265
|
+
>
|
|
266
|
+
<i className="icon ri-file-list-3-line" aria-hidden="true" />
|
|
267
|
+
<span className="cse-card-measure-title">
|
|
268
|
+
{measure.title}
|
|
269
|
+
</span>
|
|
270
|
+
<i
|
|
271
|
+
className="icon ri-arrow-right-s-line"
|
|
272
|
+
aria-hidden="true"
|
|
273
|
+
/>
|
|
274
|
+
</a>
|
|
275
|
+
</li>
|
|
276
|
+
))}
|
|
277
|
+
</ul>
|
|
278
|
+
</div>
|
|
279
|
+
</div>
|
|
280
|
+
</div>
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* One result, laid out as image | main content, with a full-width related
|
|
286
|
+
* measures disclosure bar underneath. The title, the image and the footer's
|
|
287
|
+
* corner icon are all "open in a new tab" affordances; selecting a card (from
|
|
288
|
+
* a map pin) only highlights it, while "Show on map" is the reverse link to
|
|
289
|
+
* the map. Once the card is the selected one, that same button reads "Reset
|
|
290
|
+
* map" and clears the selection again.
|
|
291
|
+
*/
|
|
292
|
+
function CaseStudyCard({ item, selected = false, onShowOnMap, onResetMap }) {
|
|
293
|
+
const intl = useIntl();
|
|
294
|
+
const properties = React.useMemo(() => item?.properties || {}, [item]);
|
|
295
|
+
// const { directives } = React.useMemo(
|
|
296
|
+
// () => getArticleInfo(properties),
|
|
297
|
+
// [properties],
|
|
298
|
+
// );
|
|
299
|
+
const ecosystems = React.useMemo(
|
|
300
|
+
() => getFacetValues(properties, 'ecosystem').map(valueLabel),
|
|
301
|
+
[properties],
|
|
302
|
+
);
|
|
303
|
+
const measures = React.useMemo(
|
|
304
|
+
() => asValues(properties.measures),
|
|
305
|
+
[properties],
|
|
306
|
+
);
|
|
307
|
+
|
|
308
|
+
return (
|
|
309
|
+
<article
|
|
310
|
+
className={cx('cse-card', {
|
|
311
|
+
selected,
|
|
312
|
+
'cse-card-no-media': !properties.image,
|
|
313
|
+
})}
|
|
314
|
+
id={`cse-card-${encodeURIComponent(properties.path || '')}`}
|
|
315
|
+
data-selected={selected ? 'true' : undefined}
|
|
316
|
+
>
|
|
317
|
+
{properties.image ? (
|
|
318
|
+
<a
|
|
319
|
+
className="cse-card-media"
|
|
320
|
+
href={properties.path}
|
|
321
|
+
tabIndex={-1}
|
|
322
|
+
aria-hidden="true"
|
|
323
|
+
>
|
|
324
|
+
<Image src={properties.image} alt="" loading="lazy" />
|
|
325
|
+
</a>
|
|
326
|
+
) : null}
|
|
327
|
+
|
|
328
|
+
<div className="cse-card-content">
|
|
329
|
+
<div className="cse-card-head">
|
|
330
|
+
<h3 className="cse-card-title">
|
|
331
|
+
<StatusBadge status={properties.current_status} />
|
|
332
|
+
<a
|
|
333
|
+
href={properties.path}
|
|
334
|
+
target="_blank"
|
|
335
|
+
rel="noopener noreferrer"
|
|
336
|
+
title={properties.title}
|
|
337
|
+
>
|
|
338
|
+
{properties.title}
|
|
339
|
+
<span className="cse-visually-hidden">
|
|
340
|
+
{' '}
|
|
341
|
+
{intl.formatMessage(messages.opensInNewTab)}
|
|
342
|
+
</span>
|
|
343
|
+
</a>
|
|
344
|
+
</h3>
|
|
345
|
+
<a
|
|
346
|
+
className="cse-card-open"
|
|
347
|
+
href={properties.path}
|
|
348
|
+
target="_blank"
|
|
349
|
+
rel="noopener noreferrer"
|
|
350
|
+
aria-label={intl.formatMessage(messages.openCaseStudy)}
|
|
351
|
+
title={intl.formatMessage(messages.openCaseStudy)}
|
|
352
|
+
>
|
|
353
|
+
<i className="icon ri-external-link-line" aria-hidden="true" />
|
|
354
|
+
<span className="cse-visually-hidden">
|
|
355
|
+
{intl.formatMessage(messages.opensInNewTab)}
|
|
356
|
+
</span>
|
|
357
|
+
</a>
|
|
358
|
+
</div>
|
|
359
|
+
|
|
360
|
+
<div className="cse-card-meta">
|
|
361
|
+
<StatusBadge status={properties.current_status} />
|
|
362
|
+
{/* {directives.length ? (
|
|
363
|
+
<>
|
|
364
|
+
<span className="cse-card-separator" aria-hidden="true">
|
|
365
|
+
·
|
|
366
|
+
</span>
|
|
367
|
+
<span className="cse-card-directives">
|
|
368
|
+
{directives.map((directive) => (
|
|
369
|
+
<span className="cse-card-chip" key={directive}>
|
|
370
|
+
{directive}
|
|
371
|
+
</span>
|
|
372
|
+
))}
|
|
373
|
+
</span>
|
|
374
|
+
</>
|
|
375
|
+
) : null} */}
|
|
376
|
+
<button
|
|
377
|
+
type="button"
|
|
378
|
+
className="cse-card-show-on-map"
|
|
379
|
+
onClick={() =>
|
|
380
|
+
selected ? onResetMap?.(item) : onShowOnMap?.(item)
|
|
381
|
+
}
|
|
382
|
+
>
|
|
383
|
+
<i
|
|
384
|
+
className={cx(
|
|
385
|
+
'icon',
|
|
386
|
+
selected ? 'ri-map-2-line' : 'ri-map-pin-line',
|
|
387
|
+
)}
|
|
388
|
+
aria-hidden="true"
|
|
389
|
+
/>
|
|
390
|
+
{intl.formatMessage(
|
|
391
|
+
selected ? messages.resetMap : messages.showOnMap,
|
|
392
|
+
)}
|
|
393
|
+
</button>
|
|
394
|
+
</div>
|
|
395
|
+
|
|
396
|
+
<EcosystemChips ecosystems={ecosystems} />
|
|
397
|
+
</div>
|
|
398
|
+
|
|
399
|
+
<RelatedMeasures measures={measures} />
|
|
400
|
+
</article>
|
|
401
|
+
);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
export default React.memo(CaseStudyCard);
|