@eeacms/volto-cca-policy 0.1.36 → 0.1.38

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,13 @@ 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.1.38](https://github.com/eea/volto-cca-policy/compare/0.1.37...0.1.38) - 21 August 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Add readme [Tiberiu Ichim - [`10d78c6`](https://github.com/eea/volto-cca-policy/commit/10d78c65336a3f5d38d2843910eae40b47aa8d98)]
12
+ ### [0.1.37](https://github.com/eea/volto-cca-policy/compare/0.1.36...0.1.37) - 14 August 2023
13
+
7
14
  ### [0.1.36](https://github.com/eea/volto-cca-policy/compare/0.1.35...0.1.36) - 11 August 2023
8
15
 
9
16
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-cca-policy",
3
- "version": "0.1.36",
3
+ "version": "0.1.38",
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",
@@ -31,6 +31,34 @@ function removeTrailingSlash(path) {
31
31
  return path.replace(/\/+$/, '');
32
32
  }
33
33
 
34
+ /**
35
+ * Logo component class.
36
+ * @function Logo
37
+ * @param {Object} intl Intl object
38
+ * @returns {string} Markup of the component.
39
+ */
40
+ const DirectLinkLogo = ({
41
+ src,
42
+ invertedSrc,
43
+ id,
44
+ url,
45
+ alt,
46
+ title,
47
+ inverted,
48
+ }) => {
49
+ return (
50
+ <a href={url} title={title} className={'logo'}>
51
+ <Image
52
+ src={inverted ? invertedSrc : src}
53
+ alt={alt}
54
+ title={title}
55
+ className="eea-logo"
56
+ id={id}
57
+ />
58
+ </a>
59
+ );
60
+ };
61
+
34
62
  /**
35
63
  * EEA Specific Header component.
36
64
  */
@@ -219,7 +247,7 @@ const EEAHeader = ({ pathname, token, items, history, subsite }) => {
219
247
  subsite.title
220
248
  )}
221
249
  <div className="subsite-logo">
222
- <Logo
250
+ <DirectLinkLogo
223
251
  src={isHomePageInverse ? logoWhite : logo}
224
252
  title={eea.websiteTitle}
225
253
  alt={eea.organisationName}
@@ -0,0 +1 @@
1
+ Fix for https://github.com/plone/volto/pull/5106
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Login container.
3
+ * @module components/theme/Sitemap/Sitemap
4
+ */
5
+
6
+ import React, { Component } from 'react';
7
+ import PropTypes from 'prop-types';
8
+ import { compose } from 'redux';
9
+ import { connect } from 'react-redux';
10
+ import { asyncConnect } from '@plone/volto/helpers';
11
+ import { defineMessages, injectIntl } from 'react-intl';
12
+ import { Container } from 'semantic-ui-react';
13
+ import { Helmet, toBackendLang } from '@plone/volto/helpers';
14
+ import { Link } from 'react-router-dom';
15
+ import config from '@plone/volto/registry';
16
+
17
+ import { getNavigation } from '@plone/volto/actions';
18
+
19
+ const messages = defineMessages({
20
+ Sitemap: {
21
+ id: 'Sitemap',
22
+ defaultMessage: 'Sitemap',
23
+ },
24
+ });
25
+
26
+ export function getSitemapPath(pathname = '', lang) {
27
+ const prefix = pathname.replace(/\/sitemap$/gm, '').replace(/^\//, '');
28
+ const path = prefix || lang || '';
29
+ return path;
30
+ }
31
+
32
+ /**
33
+ * Sitemap class.
34
+ * @class Sitemap
35
+ * @extends Component
36
+ */
37
+ class Sitemap extends Component {
38
+ /**
39
+ * Property types.
40
+ * @property {Object} propTypes Property types.
41
+ * @static
42
+ */
43
+ static propTypes = {
44
+ getNavigation: PropTypes.func.isRequired,
45
+ };
46
+
47
+ componentDidMount() {
48
+ const { settings } = config;
49
+
50
+ const lang = settings.isMultilingual
51
+ ? `${toBackendLang(this.props.lang)}`
52
+ : null;
53
+
54
+ const path = getSitemapPath(this.props.location.pathname, lang);
55
+ this.props.getNavigation(path, 4);
56
+ }
57
+
58
+ /**
59
+ * Render method.
60
+ * @method render
61
+ * @returns {string} Markup for the component.
62
+ */
63
+
64
+ renderItems = (items) => {
65
+ return (
66
+ <ul>
67
+ {items.map((item) => (
68
+ <li
69
+ key={item.url}
70
+ className={item.items?.length > 0 ? 'with-children' : ''}
71
+ >
72
+ <Link to={item.url}>{item.title}</Link>
73
+ {item.items && this.renderItems(item.items)}
74
+ </li>
75
+ ))}
76
+ </ul>
77
+ );
78
+ };
79
+ render() {
80
+ const { items } = this.props;
81
+ return (
82
+ <div id="page-sitemap">
83
+ <Helmet title={this.props.intl.formatMessage(messages.Sitemap)} />
84
+ <Container className="view-wrapper">
85
+ <h1>{this.props.intl.formatMessage(messages.Sitemap)} </h1>
86
+ {items && this.renderItems(items)}
87
+ </Container>
88
+ </div>
89
+ );
90
+ }
91
+ }
92
+
93
+ export const __test__ = compose(
94
+ injectIntl,
95
+ connect(
96
+ (state) => ({
97
+ items: state.navigation.items,
98
+ lang: state.intl.locale,
99
+ }),
100
+ { getNavigation },
101
+ ),
102
+ )(Sitemap);
103
+
104
+ export default compose(
105
+ injectIntl,
106
+ connect(
107
+ (state) => ({
108
+ items: state.navigation.items,
109
+ lang: state.intl.locale,
110
+ }),
111
+ { getNavigation },
112
+ ),
113
+ asyncConnect([
114
+ {
115
+ key: 'navigation',
116
+ promise: ({ location, store: { dispatch, getState } }) => {
117
+ if (!__SERVER__) return;
118
+ const { settings } = config;
119
+
120
+ const path = getSitemapPath(
121
+ location.pathname,
122
+ settings.isMultilingual
123
+ ? toBackendLang(getState().intl.locale)
124
+ : null,
125
+ );
126
+
127
+ return dispatch(getNavigation(path, 4));
128
+ },
129
+ },
130
+ ]),
131
+ )(Sitemap);