@eeacms/volto-clms-theme 1.0.49 → 1.0.50

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,8 +4,17 @@ 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.0.50](https://github.com/eea/volto-clms-theme/compare/1.0.49...1.0.50)
8
+
9
+ - cart icon with 0 items [`477f1ef`](https://github.com/eea/volto-clms-theme/commit/477f1efa39d6d5e4adede1b3c4f15e2b524dbcf5)
10
+ - add routing to dataset view [`e65a730`](https://github.com/eea/volto-clms-theme/commit/e65a7304fc338b3262b7f9dad9b5c5029391f3c1)
11
+ - add option without routing [`9675773`](https://github.com/eea/volto-clms-theme/commit/9675773a9531a98cee7f9735b09ebc6c3cfcd6fe)
12
+
7
13
  #### [1.0.49](https://github.com/eea/volto-clms-theme/compare/1.0.48...1.0.49)
8
14
 
15
+ > 17 December 2021
16
+
17
+ - DataSet Metadata view [`#157`](https://github.com/eea/volto-clms-theme/pull/157)
9
18
  - labels and conformity pass [`59be2fd`](https://github.com/eea/volto-clms-theme/commit/59be2fd5034fdfed211c4e0b0872504432e254e9)
10
19
  - image [`47cc7dc`](https://github.com/eea/volto-clms-theme/commit/47cc7dc37974848f2d90cdf6a035970620489cf8)
11
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.0.49",
3
+ "version": "1.0.50",
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",
@@ -190,7 +190,7 @@ const CLMSDatasetDetailView = ({ content, token }) => {
190
190
  })}
191
191
  </Segment.Group>
192
192
  )}
193
- <CclTabs>
193
+ <CclTabs routing={true}>
194
194
  <div tabTitle="General Info">{DataSetInfoContent(content)}</div>
195
195
  <div tabTitle="Metadata">{MetadataContent(content)}</div>
196
196
 
@@ -4,12 +4,11 @@ import React from 'react';
4
4
  import cx from 'classnames';
5
5
 
6
6
  function CclTab(props) {
7
- let { activeTab, tabTitle, onClick, tabId } = props;
7
+ let { activeTab, tabTitle, onClick, tabId, routing } = props;
8
8
 
9
9
  function onTabClick() {
10
10
  onClick(tabId);
11
11
  }
12
-
13
12
  return (
14
13
  <div
15
14
  className={cx('card', activeTab === tabId && 'active')}
@@ -19,7 +18,11 @@ function CclTab(props) {
19
18
  role="button"
20
19
  id={tabId}
21
20
  >
22
- <NavLink to={'#' + tabId}>{tabTitle}</NavLink>
21
+ {routing ? (
22
+ <NavLink to={'#' + tabId}>{tabTitle}</NavLink>
23
+ ) : (
24
+ <NavLink to={'#'}>{tabTitle}</NavLink>
25
+ )}
23
26
  </div>
24
27
  );
25
28
  }
@@ -21,24 +21,29 @@ import PropTypes from 'prop-types';
21
21
  *
22
22
  */
23
23
  const CclTabs = (props) => {
24
- let { children } = props;
25
- let [activeTab, setActiveTab] = useState(props.children[0].props.tabId || '');
24
+ let { children, routing = false } = props;
25
+ let [activeTab, setActiveTab] = useState(
26
+ props.children[0].props.tabId ||
27
+ props.children[0].props.tabTitle.replace(' ', ''),
28
+ );
26
29
 
27
30
  function onClickTabItem(tab) {
28
31
  setActiveTab(tab);
29
32
  }
30
33
  React.useEffect(() => {
31
34
  const hash = window.location.hash.substring(1) || '';
32
- if (hash) {
33
- setActiveTab(hash);
34
- } else {
35
- setActiveTab(
36
- children
37
- .filter((item) => !!item.props.tabTitle)[0]
38
- .props?.tabTitle?.replace(' ', ''),
39
- );
35
+ if (routing) {
36
+ if (hash) {
37
+ setActiveTab(hash);
38
+ } else {
39
+ setActiveTab(
40
+ children
41
+ .filter((item) => !!item.props.tabTitle)[0]
42
+ .props?.tabTitle?.replace(' ', ''),
43
+ );
44
+ }
40
45
  }
41
- }, [children]);
46
+ }, [children, routing]);
42
47
 
43
48
  return (
44
49
  <div className="ccl-container-flex">
@@ -52,6 +57,7 @@ const CclTabs = (props) => {
52
57
  <CclTab
53
58
  activeTab={activeTab}
54
59
  key={key}
60
+ routing={routing}
55
61
  tabId={tabTitle.replace(' ', '')}
56
62
  tabTitle={tabTitle}
57
63
  onClick={onClickTabItem}
@@ -5,33 +5,32 @@
5
5
  * @module components/theme/Header/Header
6
6
  */
7
7
 
8
- import React, { Component, useEffect } from 'react';
9
- import PropTypes from 'prop-types';
10
- import { connect, useSelector, useDispatch } from 'react-redux';
8
+ import '@eeacms/volto-clms-theme/../theme/clms/css/header.css';
11
9
 
10
+ import { FormattedMessage, injectIntl } from 'react-intl';
12
11
  import { Logo, Navigation, SearchWidget } from '@plone/volto/components';
13
- import jwtDecode from 'jwt-decode';
14
- import { getUser } from '@plone/volto/actions';
15
- import { compose } from 'redux';
12
+ import React, { Component, useEffect } from 'react';
13
+ import { connect, useDispatch, useSelector } from 'react-redux';
16
14
 
17
15
  import { BodyClass } from '@plone/volto/helpers';
18
-
19
16
  import CclLanguageSelector from '@eeacms/volto-clms-theme/components/CclLanguageSelector/CclLanguageSelector';
17
+ import CclLoginModal from '@eeacms/volto-clms-theme/components/CclLoginModal/CclLoginModal';
20
18
  import CclTopMainMenu from '@eeacms/volto-clms-theme/components/CclTopMainMenu/CclTopMainMenu';
21
-
22
- import { FormattedMessage, injectIntl } from 'react-intl';
23
19
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
20
+ import { Link } from 'react-router-dom';
21
+ import PropTypes from 'prop-types';
22
+ import { compose } from 'redux';
24
23
  // import { CART_SESSION_KEY } from '@eeacms/volto-clms-theme/utils/useCartState';
25
24
  import { getCartItems } from '@eeacms/volto-clms-utils/actions';
26
- import '@eeacms/volto-clms-theme/../theme/clms/css/header.css';
27
- import { Link } from 'react-router-dom';
28
- import CclLoginModal from '@eeacms/volto-clms-theme/components/CclLoginModal/CclLoginModal';
25
+ import { getUser } from '@plone/volto/actions';
26
+ import jwtDecode from 'jwt-decode';
27
+
29
28
  // import useCartState from '@eeacms/volto-clms-theme/utils/useCartState';
30
29
 
31
30
  const CartIconCounter = (props) => {
32
31
  const { cart_items, users, intl } = useSelector((state) => state);
33
32
 
34
- const cart = cart_items.items;
33
+ const cart = cart_items.items || [];
35
34
  const user_id = users.user.id;
36
35
 
37
36
  const dispatch = useDispatch();
@@ -39,7 +38,6 @@ const CartIconCounter = (props) => {
39
38
  dispatch(getCartItems(user_id));
40
39
  }, [user_id, dispatch]);
41
40
  return (
42
- cart?.length !== 0 &&
43
41
  cart && (
44
42
  <>
45
43
  <span>
@@ -248,6 +246,7 @@ class Header extends Component {
248
246
  {(this.props.user.id && (
249
247
  <>
250
248
  <li>
249
+ <CartIconCounter />
251
250
  <Link
252
251
  to={`/${this.props.locale}/profile`}
253
252
  className="header-login-link"
@@ -280,6 +279,8 @@ class Header extends Component {
280
279
  </>
281
280
  )) || (
282
281
  <li>
282
+ <CartIconCounter />
283
+
283
284
  <Link
284
285
  to={`/${this.props.locale}/login`}
285
286
  className="header-login-link"