@eeacms/volto-clms-theme 1.1.83 → 1.1.85

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,21 @@ 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.85](https://github.com/eea/volto-clms-theme/compare/1.1.84...1.1.85) - 27 November 2023
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix: volto-form-block button fix [Unai - [`d08af22`](https://github.com/eea/volto-clms-theme/commit/d08af222ec9ea1e21a703dfa74b4bf4c1c03bd63)]
12
+
13
+ ### [1.1.84](https://github.com/eea/volto-clms-theme/compare/1.1.83...1.1.84) - 27 November 2023
14
+
15
+ #### :bug: Bug Fixes
16
+
17
+ - fix: logout cache fix [Unai - [`9da13b1`](https://github.com/eea/volto-clms-theme/commit/9da13b1a94ab442d81c9c142c0f34016caca0ac4)]
18
+
19
+ #### :hammer_and_wrench: Others
20
+
21
+ - form button style fix [Unai - [`e9f335c`](https://github.com/eea/volto-clms-theme/commit/e9f335c3183e7356aba43dd091ef83b38846c73c)]
7
22
  ### [1.1.83](https://github.com/eea/volto-clms-theme/compare/1.1.82...1.1.83) - 24 November 2023
8
23
 
9
24
  #### :bug: Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.1.83",
3
+ "version": "1.1.85",
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",
@@ -1,64 +1,36 @@
1
- import { Component } from 'react';
2
- import { connect } from 'react-redux';
3
-
4
- import { logout, purgeMessages } from '@plone/volto/actions';
5
-
6
- import PropTypes from 'prop-types';
1
+ import { useEffect, useMemo } from 'react';
2
+ import { useDispatch, useSelector, shallowEqual } from 'react-redux';
3
+ import { useHistory } from 'react-router-dom';
7
4
  import qs from 'query-string';
5
+ import { logout, purgeMessages } from '@plone/volto/actions';
8
6
 
9
- /**
10
- * Login container.
11
- * @module components/theme/Logout/Logout
12
- */
13
-
14
- /**
15
- * Logout class.
16
- * @class Logout
17
- * @extends Component
18
- */
19
- class CclLogout extends Component {
20
- /**
21
- * Property types.
22
- * @property {Object} propTypes Property types.
23
- * @static
24
- */
25
- static propTypes = {
26
- logout: PropTypes.func.isRequired,
27
- purgeMessages: PropTypes.func.isRequired,
28
- query: PropTypes.shape({
29
- return_url: PropTypes.string,
30
- }),
31
- };
32
-
33
- /**
34
- * Default properties.
35
- * @property {Object} defaultProps Default properties.
36
- * @static
37
- */
38
- static defaultProps = {
39
- query: null,
40
- };
41
-
42
- componentDidMount() {
43
- // eslint-disable-next-line no-restricted-globals
44
- this.props.logout();
45
- window.location.href = '/';
46
- this.props.purgeMessages();
47
- }
48
-
49
- /**
50
- * Render method.
51
- * @method render
52
- * @returns {string} Markup for the component.
53
- */
54
- render() {
55
- return '';
56
- }
57
- }
58
-
59
- export default connect(
60
- (state, props) => ({
61
- query: qs.parse(props.location.search),
62
- }),
63
- { logout, purgeMessages },
64
- )(CclLogout);
7
+ const Logout = ({ location }) => {
8
+ const token = useSelector((state) => state.userSession.token, shallowEqual);
9
+ const history = useHistory();
10
+ const dispatch = useDispatch();
11
+
12
+ const returnUrl = useMemo(
13
+ () =>
14
+ qs.parse(location.search).return_url ||
15
+ location.pathname
16
+ .replace(/\/login\/?$/, '')
17
+ .replace(/\/logout\/?$/, '') ||
18
+ '/',
19
+ [location],
20
+ );
21
+
22
+ useEffect(() => {
23
+ dispatch(logout());
24
+ dispatch(purgeMessages());
25
+ }, [dispatch]);
26
+
27
+ useEffect(() => {
28
+ if (!token) {
29
+ window.location.href = '/';
30
+ }
31
+ }, [history, returnUrl, token]);
32
+
33
+ return '';
34
+ };
35
+
36
+ export default Logout;
@@ -14,6 +14,7 @@ import config from '@plone/volto/registry';
14
14
 
15
15
  /* Style */
16
16
  import 'volto-form-block/components/FormView.css';
17
+ // import CclButton from '@eeacms/volto-clms-theme/components/CclButton/CclButton';
17
18
 
18
19
  const messages = defineMessages({
19
20
  default_submit_label: {
@@ -21,12 +21,14 @@
21
21
  }
22
22
 
23
23
  .ccl-button.ccl-button-green {
24
+ border: 1px solid transparent !important;
24
25
  background-color: @clmsGreen;
26
+ border-radius: 0 !important;
25
27
  color: white;
26
28
  }
27
29
 
28
30
  .ccl-button.ccl-button-green:hover {
29
- border-color: @clmsGreen;
31
+ border-color: @clmsGreen !important;
30
32
  background-color: white;
31
33
  color: @clmsGreen;
32
34
  }