@eeacms/volto-clms-theme 1.1.25 → 1.1.27

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,19 @@ 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.27](https://github.com/eea/volto-clms-theme/compare/1.1.26...1.1.27) - 14 July 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - bump dependency [Mikel Larreategi - [`2dea8b0`](https://github.com/eea/volto-clms-theme/commit/2dea8b0cebc6cbd954d4c3ed9bd111f306e5cc08)]
12
+ ### [1.1.26](https://github.com/eea/volto-clms-theme/compare/1.1.25...1.1.26) - 14 July 2023
13
+
14
+ #### :hammer_and_wrench: Others
15
+
16
+ - add a popover referencing the cart icon when new items are added to the cart [ionlizarazu - [`79a4ede`](https://github.com/eea/volto-clms-theme/commit/79a4ede01bce272c1cd97a1944720c2498819247)]
17
+ - remove toast when an element is added to the cart [ionlizarazu - [`7b43119`](https://github.com/eea/volto-clms-theme/commit/7b43119ae68397c5057247662ca88e11260df51c)]
18
+ - return statement for useEffect in CLMSDownloadCartView [ionlizarazu - [`4e9c523`](https://github.com/eea/volto-clms-theme/commit/4e9c523e15e62c0b914b8d02e2d8fc7440e77db3)]
19
+ - add aproximation to new cart item popup [ionlizarazu - [`a322db3`](https://github.com/eea/volto-clms-theme/commit/a322db3fe1d146e841630280f5df4054948f2049)]
7
20
  ### [1.1.25](https://github.com/eea/volto-clms-theme/compare/1.1.24...1.1.25) - 12 July 2023
8
21
 
9
22
  #### :hammer_and_wrench: Others
@@ -47,6 +60,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
47
60
 
48
61
  - remove NUTS text for area naming in the cart [ionlizarazu - [`062e0a3`](https://github.com/eea/volto-clms-theme/commit/062e0a375f5352bc13c18ff7ec33fad4bcc59f2f)]
49
62
  - dependencies [ionlizarazu - [`405ef96`](https://github.com/eea/volto-clms-theme/commit/405ef96090fe7bd4af73a49d3285a92fad712e3b)]
63
+ - yarn.lock [ionlizarazu - [`7132119`](https://github.com/eea/volto-clms-theme/commit/71321195c4dd4fceed67f2f0872f3e24bba61c17)]
50
64
  - volto-blocks-grid module mapping [ionlizarazu - [`4fec3ca`](https://github.com/eea/volto-clms-theme/commit/4fec3cabc437322ad92ed90d682250bd123ccaaf)]
51
65
  - volto-blocks-grid v7.0.2 [ionlizarazu - [`2557e60`](https://github.com/eea/volto-clms-theme/commit/2557e6039d3cea33ca0bd11a0a3ef4764c611f78)]
52
66
  - remove styling from teaser block [ionlizarazu - [`879e684`](https://github.com/eea/volto-clms-theme/commit/879e684057c88f52f60f0fa54cbaa155c7d14688)]
@@ -134,6 +148,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
134
148
 
135
149
  #### :house: Internal changes
136
150
 
151
+ - chore: [JENKINS] Remove alpha testing version [valentinab25 - [`b4cbf65`](https://github.com/eea/volto-clms-theme/commit/b4cbf6557fbc67f7fc4cea5aa2cb19804f3d7e3c)]
137
152
 
138
153
  #### :hammer_and_wrench: Others
139
154
 
@@ -1332,6 +1347,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1332
1347
  #### :hammer_and_wrench: Others
1333
1348
 
1334
1349
  - related products and datasets added to news and meeting views and login-plone route created [Unai - [`5704a1a`](https://github.com/eea/volto-clms-theme/commit/5704a1a766148746162b60efaf232ea90dc20cf4)]
1350
+ - Revert "[JENKINS] Use eeacms/plone-backend and Volto alpha version- Refs #151967" [Mikel Larreategi - [`46eb694`](https://github.com/eea/volto-clms-theme/commit/46eb69415280a3c982405299135027ae4221426a)]
1335
1351
  - sort items according to the lowercased label and put those with special meaning at the end [Mikel Larreategi - [`6410abe`](https://github.com/eea/volto-clms-theme/commit/6410abe096f60dcad54dced2026c9df9b7946d68)]
1336
1352
  - lint fix [Unai - [`1264a7a`](https://github.com/eea/volto-clms-theme/commit/1264a7adfe8d679fea1bd821ad087add20f4271d)]
1337
1353
  - footer newsletter subscription change, global search maxLength change from 8000 to 200 and /login design change [Unai - [`a09d24a`](https://github.com/eea/volto-clms-theme/commit/a09d24adbb6fa053fb2a2cc0071506b906593b42)]
@@ -1482,6 +1498,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1482
1498
  - search block new features [ionlizarazu - [`8e814cb`](https://github.com/eea/volto-clms-theme/commit/8e814cbd359782540c21fe37b37ef146d331f0d6)]
1483
1499
  - language selector cookie management [ionlizarazu - [`1385ac9`](https://github.com/eea/volto-clms-theme/commit/1385ac95795702206d3623ba6e780faa43a89e0a)]
1484
1500
  - toolbar cookie management [ionlizarazu - [`5c23200`](https://github.com/eea/volto-clms-theme/commit/5c23200790b20e1d4f1bc966463c37bf4c808f47)]
1501
+ - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`0316a0d`](https://github.com/eea/volto-clms-theme/commit/0316a0d8b6fb0fa14af13002415f3c95d9f8ede3)]
1485
1502
  ### [1.0.84](https://github.com/eea/volto-clms-theme/compare/1.0.83...1.0.84) - 18 March 2022
1486
1503
 
1487
1504
  #### :hammer_and_wrench: Others
@@ -2386,11 +2403,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
2386
2403
  #### :hammer_and_wrench: Others
2387
2404
 
2388
2405
  - replace @collective/volto-dropdownmenu with volto-dropdownmenu [ionlizarazu - [`07f004f`](https://github.com/eea/volto-clms-theme/commit/07f004fe0219e403fb51bc045c83d34f3b981f76)]
2406
+ - yarn.lock [ionlizarazu - [`fe1ca04`](https://github.com/eea/volto-clms-theme/commit/fe1ca04889d29fe7b653db4c69af2751b84b8a1a)]
2389
2407
  - add NODE_ENV parameter [ionlizarazu - [`101f27c`](https://github.com/eea/volto-clms-theme/commit/101f27c25b8fbd192e1b11865e95cf5ffee08c1b)]
2390
2408
  - upgrade volto-dropdownmenu version [ionlizarazu - [`2081855`](https://github.com/eea/volto-clms-theme/commit/2081855301f4c708776e0dbab39db143cee00dbc)]
2391
2409
  - HomeSearch block missing url behaviour [ionlizarazu - [`d20a378`](https://github.com/eea/volto-clms-theme/commit/d20a378ce3f254b8343692348f314bf281974542)]
2392
2410
  - babel configuration [ionlizarazu - [`203ea2d`](https://github.com/eea/volto-clms-theme/commit/203ea2de07f99ca3403e4ca220ca74d7ce69b61d)]
2393
2411
  - prettier [ionlizarazu - [`e79e26b`](https://github.com/eea/volto-clms-theme/commit/e79e26bf2fa40ba7b4eb53a24dabd87928221c28)]
2412
+ - add yarn lock [ionlizarazu - [`e1ab28b`](https://github.com/eea/volto-clms-theme/commit/e1ab28b060d5a74431c368b0de82a68dabce1eab)]
2394
2413
  - Jenkinsfile cypress test [ionlizarazu - [`b385d65`](https://github.com/eea/volto-clms-theme/commit/b385d65986f717c60f8c434a08fc11b829d08eb4)]
2395
2414
  - cypress [ionlizarazu - [`a243cf0`](https://github.com/eea/volto-clms-theme/commit/a243cf0182fa3dd113c16ff495c71e310252d83b)]
2396
2415
  - some fixes [ionlizarazu - [`046279b`](https://github.com/eea/volto-clms-theme/commit/046279b9d05bea8a64eca03eed493e02621534c9)]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.1.25",
3
+ "version": "1.1.27",
4
4
  "description": "volto-clms-theme: Volto theme for CLMS site",
5
5
  "main": "src/index.js",
6
6
  "author": "CodeSyntax for the European Environment Agency",
@@ -37,7 +37,7 @@
37
37
  "dependencies": {
38
38
  "@eeacms/volto-accordion-block": "7.0.0",
39
39
  "@eeacms/volto-arcgis-block": "*",
40
- "@eeacms/volto-clms-utils": "0.1.8",
40
+ "@eeacms/volto-clms-utils": "0.1.9",
41
41
  "@eeacms/volto-columns-block": "6.0.2",
42
42
  "@eeacms/volto-embed": "5.0.1",
43
43
  "@eeacms/volto-metadata-block": "5.0.1",
@@ -44,6 +44,7 @@ const CLMSDownloadCartView = (props) => {
44
44
  useEffect(() => {
45
45
  dispatch(getProjections());
46
46
  dispatch(getFormatConversionTable());
47
+ return () => {};
47
48
  }, [dispatch]);
48
49
 
49
50
  useEffect(() => {
@@ -57,9 +58,7 @@ const CLMSDownloadCartView = (props) => {
57
58
  );
58
59
 
59
60
  // returned function will be called on component unmount
60
- return () => {
61
- dispatch(getExtraBreadcrumbItems([]));
62
- };
61
+ return () => {};
63
62
  // eslint-disable-next-line react-hooks/exhaustive-deps
64
63
  }, [props.location.pathname]);
65
64
 
@@ -86,6 +85,7 @@ const CLMSDownloadCartView = (props) => {
86
85
  if (localsessionNutsIDList.length > 0) {
87
86
  dispatch(getNutsNames(localsessionNutsIDList));
88
87
  }
88
+ return () => {};
89
89
  // eslint-disable-next-line react-hooks/exhaustive-deps
90
90
  }, [cart, dispatch]);
91
91
 
@@ -1,7 +1,6 @@
1
1
  import React, { useState } from 'react';
2
2
  import { defineMessages, useIntl } from 'react-intl';
3
3
  import { useSelector } from 'react-redux';
4
- import { toast } from 'react-toastify';
5
4
  import {
6
5
  Button,
7
6
  Checkbox,
@@ -10,7 +9,7 @@ import {
10
9
  Segment,
11
10
  } from 'semantic-ui-react';
12
11
 
13
- import { Icon, Toast } from '@plone/volto/components';
12
+ import { Icon } from '@plone/volto/components';
14
13
  import clearSVG from '@plone/volto/icons/clear.svg';
15
14
  import paginationLeftSVG from '@plone/volto/icons/left-key.svg';
16
15
  import paginationRightSVG from '@plone/volto/icons/right-key.svg';
@@ -211,15 +210,7 @@ function CclDownloadTable(props) {
211
210
  file: item.file,
212
211
  unique_id: item.unique_id,
213
212
  }));
214
- await addCartItem(selectedCartItems).then(() => {
215
- toast.success(
216
- <Toast
217
- success
218
- title={intl.formatMessage(messages.success)}
219
- content={intl.formatMessage(messages.added_to_cart)}
220
- />,
221
- );
222
- });
213
+ await addCartItem(selectedCartItems);
223
214
  };
224
215
 
225
216
  const clearSelection = () => {
@@ -6,9 +6,12 @@
6
6
  */
7
7
 
8
8
  import { FormattedMessage, injectIntl } from 'react-intl';
9
- import { Logo, Navigation, SearchWidget } from '@plone/volto/components';
10
- import React, { Component, useEffect } from 'react';
9
+ import { Logo, Navigation, SearchWidget, Icon } from '@plone/volto/components';
10
+ import React, { Component, useEffect, useRef, useState } from 'react';
11
11
  import { connect, useDispatch, useSelector } from 'react-redux';
12
+ import { Popup, Segment, Divider, Message } from 'semantic-ui-react';
13
+ import CclButton from '@eeacms/volto-clms-theme/components/CclButton/CclButton';
14
+ import clearSVG from '@plone/volto/icons/clear.svg';
12
15
 
13
16
  import { BodyClass } from '@plone/volto/helpers';
14
17
  // IMPORT isnt nedded until translations are created
@@ -24,23 +27,87 @@ import { getUser } from '@plone/volto/actions';
24
27
  import jwtDecode from 'jwt-decode';
25
28
 
26
29
  const CartIconCounter = (props) => {
27
- const cart = useSelector((state) => state.cart_items.items);
30
+ const cartState = useSelector((state) => state.cart_items);
31
+ const cartState_ref = useRef(cartState);
32
+ const cart_icon_ref = React.useRef();
28
33
  const intl = useSelector((state) => state.intl);
29
34
  const user_id = useSelector((state) => state.users.user.id);
35
+ const [showPopup, setshowPopup] = useState(false);
36
+ const [cartDiff, setCartDiff] = useState(0);
30
37
  const dispatch = useDispatch();
31
38
  useEffect(() => {
32
39
  dispatch(getCartItems(user_id));
33
40
  // eslint-disable-next-line react-hooks/exhaustive-deps
34
41
  }, [user_id]);
42
+ useEffect(() => {
43
+ if (
44
+ cartState_ref.current.set.loading &&
45
+ cartState.set.loaded &&
46
+ cartState.items.length >= cartState_ref.current.items.length
47
+ ) {
48
+ setCartDiff(cartState.items.length - cartState_ref.current.items.length);
49
+ window.scrollTo({
50
+ top: 0,
51
+ left: 0,
52
+ behavior: 'smooth',
53
+ });
54
+ !showPopup && setTimeout(() => setshowPopup(true), 900);
55
+ setTimeout(() => setshowPopup(false), 11000);
56
+ }
57
+ cartState_ref.current = cartState;
58
+ // eslint-disable-next-line react-hooks/exhaustive-deps
59
+ }, [cartState]);
35
60
  return (
36
- cart && (
37
- <Link to={`/${intl.locale}/cart`} className="header-login-link">
38
- <FontAwesomeIcon
39
- icon={['fas', 'shopping-cart']}
40
- style={{ marginRight: '0.25rem', maxWidth: '1.5rem' }}
41
- />
42
- <strong>{cart?.length}</strong>
43
- </Link>
61
+ cartState.items && (
62
+ <>
63
+ <Popup
64
+ context={cart_icon_ref}
65
+ open={showPopup}
66
+ position="bottom center"
67
+ >
68
+ <Segment
69
+ attached="top"
70
+ style={{ padding: 0, display: 'flex', justifyContent: 'flex-end' }}
71
+ >
72
+ <Icon
73
+ onClick={() => setshowPopup(false)}
74
+ name={clearSVG}
75
+ size={20}
76
+ style={{ cursor: 'pointer' }}
77
+ />
78
+ </Segment>
79
+ <Divider horizontal style={{ margin: 0 }}>
80
+ My cart
81
+ </Divider>
82
+ {cartDiff > 0 ? (
83
+ <Message positive>
84
+ You added <strong>{cartDiff} new items</strong> to the cart
85
+ </Message>
86
+ ) : (
87
+ <Message warning>
88
+ The items you tried to add were already added
89
+ </Message>
90
+ )}
91
+ <CclButton
92
+ mode="filled"
93
+ to={`/${intl.locale}/cart`}
94
+ style={{ width: '100%' }}
95
+ >
96
+ Go to cart
97
+ </CclButton>
98
+ </Popup>
99
+ <Link
100
+ to={`/${intl.locale}/cart`}
101
+ className="header-login-link"
102
+ ref={cart_icon_ref}
103
+ >
104
+ <FontAwesomeIcon
105
+ icon={['fas', 'shopping-cart']}
106
+ style={{ marginRight: '0.25rem', maxWidth: '1.5rem' }}
107
+ />
108
+ <strong>{cartState?.items?.length}</strong>
109
+ </Link>
110
+ </>
44
111
  )
45
112
  );
46
113
  };
@@ -263,7 +330,7 @@ class Header extends Component {
263
330
  <li className="header-vertical-line">
264
331
  <div>|</div>
265
332
  </li>
266
- {(this.props.user.id && (
333
+ {(this.props.user.id && this.state.mobileMenuOpen && (
267
334
  <>
268
335
  <li className="header-dropdown">
269
336
  <HeaderDropdown user={this.props.user} />