@eeacms/volto-cca-policy 0.3.18 → 0.3.20

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 CHANGED
@@ -4,6 +4,26 @@ 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
+ ### [0.3.20](https://github.com/eea/volto-cca-policy/compare/0.3.19...0.3.20) - 24 March 2025
8
+
9
+ #### :rocket: New Features
10
+
11
+ - feat: refs #285888 make case study header click open image carousel [laszlocseh - [`9bdf161`](https://github.com/eea/volto-cca-policy/commit/9bdf1615b0120cb22be342c4cb4396c4a81c39dc)]
12
+
13
+ ### [0.3.19](https://github.com/eea/volto-cca-policy/compare/0.3.18...0.3.19) - 21 March 2025
14
+
15
+ #### :bug: Bug Fixes
16
+
17
+ - fix: stylelint [kreafox - [`1337dee`](https://github.com/eea/volto-cca-policy/commit/1337dee1acd7f239c605c89536ddd4915c89409b)]
18
+ - fix: stylelint [kreafox - [`bae43eb`](https://github.com/eea/volto-cca-policy/commit/bae43ebbba20085f04a37741962ce93e6a16b006)]
19
+ - fix: stylelint [kreafox - [`118510b`](https://github.com/eea/volto-cca-policy/commit/118510be22b732779c4090143e0ffb27c7e6d3ed)]
20
+ - fix: stylelint [kreafox - [`22d0850`](https://github.com/eea/volto-cca-policy/commit/22d08500f566acceaf8f1cf80f4f720f988cf085)]
21
+ - fix: stylelint [kreafox - [`54efc0b`](https://github.com/eea/volto-cca-policy/commit/54efc0b7048d81071ae1f8fff85faad9b7aa646d)]
22
+ - fix: ast navigation for AdaptationSupportTool [laszlocseh - [`94a58dc`](https://github.com/eea/volto-cca-policy/commit/94a58dc30c7b5339a814c714c1e982bea8e08727)]
23
+
24
+ #### :hammer_and_wrench: Others
25
+
26
+ - Tweaks to functionality of case study explorer [Tiberiu Ichim - [`e7cad8a`](https://github.com/eea/volto-cca-policy/commit/e7cad8aa932373b255c875f14f59a18ef3aa51c0)]
7
27
  ### [0.3.18](https://github.com/eea/volto-cca-policy/compare/0.3.17...0.3.18) - 21 March 2025
8
28
 
9
29
  #### :rocket: New Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-cca-policy",
3
- "version": "0.3.18",
3
+ "version": "0.3.20",
4
4
  "description": "@eeacms/volto-cca-policy: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -1,9 +1,19 @@
1
1
  import React from 'react';
2
2
  import { FormattedMessage } from 'react-intl';
3
+ import { Icon } from 'semantic-ui-react';
3
4
 
4
- export default function FeatureDisplay({ feature }) {
5
+ export default function FeatureDisplay({ feature, onClose }) {
5
6
  return feature ? (
6
7
  <div id="csepopup">
8
+ <div
9
+ className="close"
10
+ role="button"
11
+ onClick={onClose}
12
+ tabIndex={-1}
13
+ onKeyDown={onClose}
14
+ >
15
+ <Icon className="ri-close-circle-line" />
16
+ </div>
7
17
  <p>
8
18
  <strong>
9
19
  <a className="dbitem" href={feature.url} target="_blank">
@@ -121,15 +121,6 @@ export default function FeatureInteraction({
121
121
 
122
122
  function handleClick(evt) {
123
123
  if (evt.originalEvent.target.tagName === 'A') return;
124
- if (selectedFeature) {
125
- onFeatureSelect(null);
126
-
127
- const view = map.getView();
128
- view.animate({
129
- ...mapCenter,
130
- duration: 1000,
131
- });
132
- }
133
124
  }
134
125
 
135
126
  function handlePointerMove(e) {
@@ -158,6 +149,20 @@ export default function FeatureInteraction({
158
149
  clusterCirclesLayer,
159
150
  ]);
160
151
 
152
+ function onClosePopup(evt) {
153
+ evt.preventDefault();
154
+
155
+ if (selectedFeature) {
156
+ onFeatureSelect(null);
157
+
158
+ const view = map.getView();
159
+ view.animate({
160
+ ...mapCenter,
161
+ duration: 2000,
162
+ });
163
+ }
164
+ }
165
+
161
166
  return isClient ? (
162
167
  <div
163
168
  id="popup-overlay"
@@ -169,7 +174,9 @@ export default function FeatureInteraction({
169
174
  visibility: selectedFeature ? 'visible' : 'hidden',
170
175
  }}
171
176
  >
172
- {selectedFeature ? <FeatureDisplay feature={selectedFeature} /> : null}
177
+ {selectedFeature ? (
178
+ <FeatureDisplay feature={selectedFeature} onClose={onClosePopup} />
179
+ ) : null}
173
180
  </div>
174
181
  ) : null;
175
182
  }
@@ -6,6 +6,15 @@
6
6
  border-bottom: 6px solid #005c96;
7
7
  background-color: white;
8
8
 
9
+ .close {
10
+ position: relative;
11
+ top: -8px;
12
+ width: 20px;
13
+ height: 20px;
14
+ cursor: pointer;
15
+ float: right;
16
+ }
17
+
9
18
  a.dbitem {
10
19
  font-size: 14px;
11
20
  text-decoration: none;
@@ -10,7 +10,7 @@ function getStyle(size, haveAdaptecca) {
10
10
  size === 1
11
11
  ? new ol.style.Style({
12
12
  image: new ol.style.Circle({
13
- radius: 5,
13
+ radius: 7,
14
14
  stroke: new ol.style.Stroke({
15
15
  color: '#fff',
16
16
  }),
@@ -29,7 +29,8 @@ const ASTNavigation = (props) => {
29
29
  rootPath,
30
30
  {
31
31
  'path.depth': 1,
32
- portal_type: ['collective.cover.content'],
32
+ portal_type: ['Folder'],
33
+ object_provides: 'eea.climateadapt.interfaces.ICover',
33
34
  review_state: 'published',
34
35
  b_size: 100,
35
36
  },
@@ -10,10 +10,27 @@ import './styles.less';
10
10
  const Slider = loadable(() => import('react-slick'));
11
11
 
12
12
  const ImageGallery = (props) => {
13
- const { items = [] } = props;
13
+ const {
14
+ items = [],
15
+ propOpen,
16
+ setPropOpen,
17
+ propSlideIndex,
18
+ setPropSlideIndex,
19
+ } = props;
20
+ // if state is managed from an external component then use the external state
21
+ // else use the local one
22
+ const [localOpen, setLocalOpen] = React.useState(false);
23
+ const open = propOpen === undefined ? localOpen : propOpen;
24
+ const setOpen = propOpen === undefined ? setLocalOpen : setPropOpen;
25
+
26
+ // if state is managed from an external component then use the external state
27
+ // else use the local one
28
+ const [localSlideIndex, setLocalSlideIndex] = React.useState(0);
29
+ const slideIndex =
30
+ propSlideIndex === undefined ? localSlideIndex : propSlideIndex;
31
+ const setSlideIndex =
32
+ propSlideIndex === undefined ? setLocalSlideIndex : setPropSlideIndex;
14
33
 
15
- const [open, setOpen] = React.useState(false);
16
- const [slideIndex, setSlideIndex] = React.useState(0);
17
34
  const [updateCount, setUpdateCount] = React.useState(0);
18
35
  const sliderRef = React.useRef(null);
19
36
 
@@ -32,7 +49,7 @@ const ImageGallery = (props) => {
32
49
  useTransform: false,
33
50
  initialSlide: slideIndex,
34
51
  }),
35
- [slideIndex, updateCount],
52
+ [slideIndex, setSlideIndex, updateCount],
36
53
  );
37
54
 
38
55
  const handleClick = () => {
@@ -222,11 +222,24 @@ export const sectionID = (title) => findSection(title)?.section || title;
222
222
  const PhotoGallery = ({ content }) => {
223
223
  const { cca_gallery } = content;
224
224
 
225
+ const [open, setOpen] = React.useState(false);
226
+ const [slideIndex, setSlideIndex] = React.useState(0);
227
+
228
+ const handleTitleClick = () => {
229
+ setSlideIndex(0);
230
+ setOpen(true);
231
+ };
225
232
  return (
226
233
  <>
227
234
  {cca_gallery && cca_gallery.length > 0 && (
228
235
  <div className="case-study-gallery">
229
- <div className="gallery-title">
236
+ <div
237
+ className="gallery-title"
238
+ tabIndex={0}
239
+ role="button"
240
+ onClick={handleTitleClick}
241
+ onKeyDown={handleTitleClick}
242
+ >
230
243
  <span>
231
244
  <FormattedMessage
232
245
  id="Case Study illustrations"
@@ -236,7 +249,13 @@ const PhotoGallery = ({ content }) => {
236
249
  <span> ({cca_gallery.length}) </span>
237
250
  <Icon className="ri-image-fill" />
238
251
  </div>
239
- <ImageGallery items={cca_gallery} />
252
+ <ImageGallery
253
+ items={cca_gallery}
254
+ propOpen={open}
255
+ setPropOpen={setOpen}
256
+ propSlideIndex={slideIndex}
257
+ setPropSlideIndex={setSlideIndex}
258
+ />
240
259
  </div>
241
260
  )}
242
261
  </>