@eeacms/volto-clms-theme 1.1.24 → 1.1.26

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,11 +4,24 @@ 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.24](https://github.com/eea/volto-clms-theme/compare/1.1.23...1.1.24) - 12 July 2023
7
+ ### [1.1.26](https://github.com/eea/volto-clms-theme/compare/1.1.25...1.1.26) - 13 July 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - 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)]
12
+ - remove toast when an element is added to the cart [ionlizarazu - [`7b43119`](https://github.com/eea/volto-clms-theme/commit/7b43119ae68397c5057247662ca88e11260df51c)]
13
+ - return statement for useEffect in CLMSDownloadCartView [ionlizarazu - [`4e9c523`](https://github.com/eea/volto-clms-theme/commit/4e9c523e15e62c0b914b8d02e2d8fc7440e77db3)]
14
+ - add aproximation to new cart item popup [ionlizarazu - [`a322db3`](https://github.com/eea/volto-clms-theme/commit/a322db3fe1d146e841630280f5df4054948f2049)]
15
+ ### [1.1.25](https://github.com/eea/volto-clms-theme/compare/1.1.24...1.1.25) - 12 July 2023
8
16
 
9
17
  #### :hammer_and_wrench: Others
10
18
 
11
- - render accordions inside the dataset [Mikel Larreategi - [`8d284da`](https://github.com/eea/volto-clms-theme/commit/8d284da2592e3888e7d81a311f22d1f5eb190e7f)]
19
+ - fix removing the last cart item [ionlizarazu - [`ae79754`](https://github.com/eea/volto-clms-theme/commit/ae79754fc5618ec759d3264f0d3e7f373cb2b276)]
20
+ - add cart pagination location reference [ionlizarazu - [`d1c0813`](https://github.com/eea/volto-clms-theme/commit/d1c08138854044a3a6d18351cbdbc38bdb04d506)]
21
+ - change accordion id [Mikel Larreategi - [`0aa3ad3`](https://github.com/eea/volto-clms-theme/commit/0aa3ad3722cc406a7d3f37855865d5e41f517b9e)]
22
+ - change sorting [Mikel Larreategi - [`abb6a67`](https://github.com/eea/volto-clms-theme/commit/abb6a677b1da7a65337b8088a8e1d989ae026673)]
23
+ ### [1.1.24](https://github.com/eea/volto-clms-theme/compare/1.1.23...1.1.24) - 12 July 2023
24
+
12
25
  ### [1.1.23](https://github.com/eea/volto-clms-theme/compare/1.1.22...1.1.23) - 12 July 2023
13
26
 
14
27
  ### [1.1.22](https://github.com/eea/volto-clms-theme/compare/1.1.21...1.1.22) - 10 July 2023
@@ -42,7 +55,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
42
55
 
43
56
  - remove NUTS text for area naming in the cart [ionlizarazu - [`062e0a3`](https://github.com/eea/volto-clms-theme/commit/062e0a375f5352bc13c18ff7ec33fad4bcc59f2f)]
44
57
  - dependencies [ionlizarazu - [`405ef96`](https://github.com/eea/volto-clms-theme/commit/405ef96090fe7bd4af73a49d3285a92fad712e3b)]
45
- - yarn.lock [ionlizarazu - [`7132119`](https://github.com/eea/volto-clms-theme/commit/71321195c4dd4fceed67f2f0872f3e24bba61c17)]
46
58
  - volto-blocks-grid module mapping [ionlizarazu - [`4fec3ca`](https://github.com/eea/volto-clms-theme/commit/4fec3cabc437322ad92ed90d682250bd123ccaaf)]
47
59
  - volto-blocks-grid v7.0.2 [ionlizarazu - [`2557e60`](https://github.com/eea/volto-clms-theme/commit/2557e6039d3cea33ca0bd11a0a3ef4764c611f78)]
48
60
  - remove styling from teaser block [ionlizarazu - [`879e684`](https://github.com/eea/volto-clms-theme/commit/879e684057c88f52f60f0fa54cbaa155c7d14688)]
@@ -130,7 +142,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
130
142
 
131
143
  #### :house: Internal changes
132
144
 
133
- - chore: [JENKINS] Remove alpha testing version [valentinab25 - [`b4cbf65`](https://github.com/eea/volto-clms-theme/commit/b4cbf6557fbc67f7fc4cea5aa2cb19804f3d7e3c)]
134
145
 
135
146
  #### :hammer_and_wrench: Others
136
147
 
@@ -1329,7 +1340,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1329
1340
  #### :hammer_and_wrench: Others
1330
1341
 
1331
1342
  - 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)]
1332
- - Revert "[JENKINS] Use eeacms/plone-backend and Volto alpha version- Refs #151967" [Mikel Larreategi - [`46eb694`](https://github.com/eea/volto-clms-theme/commit/46eb69415280a3c982405299135027ae4221426a)]
1333
1343
  - 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)]
1334
1344
  - lint fix [Unai - [`1264a7a`](https://github.com/eea/volto-clms-theme/commit/1264a7adfe8d679fea1bd821ad087add20f4271d)]
1335
1345
  - 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)]
@@ -1480,7 +1490,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1480
1490
  - search block new features [ionlizarazu - [`8e814cb`](https://github.com/eea/volto-clms-theme/commit/8e814cbd359782540c21fe37b37ef146d331f0d6)]
1481
1491
  - language selector cookie management [ionlizarazu - [`1385ac9`](https://github.com/eea/volto-clms-theme/commit/1385ac95795702206d3623ba6e780faa43a89e0a)]
1482
1492
  - toolbar cookie management [ionlizarazu - [`5c23200`](https://github.com/eea/volto-clms-theme/commit/5c23200790b20e1d4f1bc966463c37bf4c808f47)]
1483
- - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`0316a0d`](https://github.com/eea/volto-clms-theme/commit/0316a0d8b6fb0fa14af13002415f3c95d9f8ede3)]
1484
1493
  ### [1.0.84](https://github.com/eea/volto-clms-theme/compare/1.0.83...1.0.84) - 18 March 2022
1485
1494
 
1486
1495
  #### :hammer_and_wrench: Others
@@ -2385,13 +2394,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
2385
2394
  #### :hammer_and_wrench: Others
2386
2395
 
2387
2396
  - replace @collective/volto-dropdownmenu with volto-dropdownmenu [ionlizarazu - [`07f004f`](https://github.com/eea/volto-clms-theme/commit/07f004fe0219e403fb51bc045c83d34f3b981f76)]
2388
- - yarn.lock [ionlizarazu - [`fe1ca04`](https://github.com/eea/volto-clms-theme/commit/fe1ca04889d29fe7b653db4c69af2751b84b8a1a)]
2389
2397
  - add NODE_ENV parameter [ionlizarazu - [`101f27c`](https://github.com/eea/volto-clms-theme/commit/101f27c25b8fbd192e1b11865e95cf5ffee08c1b)]
2390
2398
  - upgrade volto-dropdownmenu version [ionlizarazu - [`2081855`](https://github.com/eea/volto-clms-theme/commit/2081855301f4c708776e0dbab39db143cee00dbc)]
2391
2399
  - HomeSearch block missing url behaviour [ionlizarazu - [`d20a378`](https://github.com/eea/volto-clms-theme/commit/d20a378ce3f254b8343692348f314bf281974542)]
2392
2400
  - babel configuration [ionlizarazu - [`203ea2d`](https://github.com/eea/volto-clms-theme/commit/203ea2de07f99ca3403e4ca220ca74d7ce69b61d)]
2393
2401
  - prettier [ionlizarazu - [`e79e26b`](https://github.com/eea/volto-clms-theme/commit/e79e26bf2fa40ba7b4eb53a24dabd87928221c28)]
2394
- - add yarn lock [ionlizarazu - [`e1ab28b`](https://github.com/eea/volto-clms-theme/commit/e1ab28b060d5a74431c368b0de82a68dabce1eab)]
2395
2402
  - Jenkinsfile cypress test [ionlizarazu - [`b385d65`](https://github.com/eea/volto-clms-theme/commit/b385d65986f717c60f8c434a08fc11b829d08eb4)]
2396
2403
  - cypress [ionlizarazu - [`a243cf0`](https://github.com/eea/volto-clms-theme/commit/a243cf0182fa3dd113c16ff495c71e310252d83b)]
2397
2404
  - 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.24",
3
+ "version": "1.1.26",
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",
@@ -47,6 +47,7 @@ const DataSetInfoContent = (props) => {
47
47
  path: location.pathname,
48
48
  b_size: 99999,
49
49
  metadata_fields: ['blocks', 'blocks_layout'],
50
+ sort_on: 'getObjPositionInParent',
50
51
  },
51
52
  'accordions',
52
53
  ),
@@ -291,10 +292,10 @@ const DataSetInfoContent = (props) => {
291
292
  <Accordion fluid styled>
292
293
  <Accordion.Title
293
294
  as={'h2'}
294
- onClick={() => handleClick({ index: 1 })}
295
+ onClick={() => handleClick({ index: 98 })}
295
296
  className={'accordion-title align-arrow-right'}
296
297
  >
297
- {activeIndex.includes(1) ? (
298
+ {activeIndex.includes(98) ? (
298
299
  <Icon
299
300
  name={iconName(data, titleIcons.opened)}
300
301
  size="24px"
@@ -307,7 +308,7 @@ const DataSetInfoContent = (props) => {
307
308
  )}
308
309
  <span>Technical documents</span>
309
310
  </Accordion.Title>
310
- <Accordion.Content active={activeIndex.includes(1)}>
311
+ <Accordion.Content active={activeIndex.includes(98)}>
311
312
  <AnimateHeight
312
313
  animateOpacity
313
314
  duration={500}
@@ -80,15 +80,13 @@ const CLMSCartContent = (props) => {
80
80
  // eslint-disable-next-line react-hooks/exhaustive-deps
81
81
  }, [post_download_in_progress]);
82
82
 
83
- const use_p = useFilteredPagination(cartItems);
83
+ const use_p = useFilteredPagination(cartItems, 10, 'cart');
84
84
  const p_f = use_p.functions;
85
85
  const p_data = use_p.data;
86
86
  const { pagination, currentPage, paginationSize, dataList } = p_data;
87
87
 
88
88
  useEffect(() => {
89
- if (cartItems.length > 0) {
90
- p_f.setOriginalDataList(cartItems);
91
- }
89
+ p_f.setOriginalDataList(cartItems);
92
90
  }, [cartItems]);
93
91
  useEffect(() => {
94
92
  const array_ids =
@@ -455,6 +453,12 @@ const CLMSCartContent = (props) => {
455
453
  <button
456
454
  onClick={() => {
457
455
  removeCartItem(item.unique_id);
456
+ if (
457
+ pagination.length === 1 &&
458
+ currentPage > 1
459
+ ) {
460
+ p_f.setCurrentPage(currentPage - 1);
461
+ }
458
462
  }}
459
463
  style={{
460
464
  backgroundColor: 'transparent',
@@ -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} />