@eeacms/volto-eea-website-theme 3.4.0 → 3.5.1

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,39 @@ 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
+ ### [3.5.1](https://github.com/eea/volto-eea-website-theme/compare/3.5.0...3.5.1) - 19 December 2024
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix: download link when download is enabled on CTA block rfs#281622 [nileshgulia1 - [`1e111c7`](https://github.com/eea/volto-eea-website-theme/commit/1e111c77cd0b9ec8303d1571fafb6efab3f5e848)]
12
+
13
+ #### :house: Internal changes
14
+
15
+ - chore: package.json [Alin Voinea - [`1956de1`](https://github.com/eea/volto-eea-website-theme/commit/1956de189d6ef12a9117dca335c214131615e98d)]
16
+
17
+ #### :hammer_and_wrench: Others
18
+
19
+ - Update UniversalLink.jsx [Nilesh - [`1358d69`](https://github.com/eea/volto-eea-website-theme/commit/1358d6939493f48a26acb67fbdeacc98ade4c6d8)]
20
+ - fix only append @@download if internalUrl [nileshgulia1 - [`12e70bc`](https://github.com/eea/volto-eea-website-theme/commit/12e70bc79f7660589b1a84c933c56c6dac4e8da2)]
21
+ ### [3.5.0](https://github.com/eea/volto-eea-website-theme/compare/3.4.0...3.5.0) - 16 December 2024
22
+
23
+ #### :rocket: New Features
24
+
25
+ - feat(report-navigation): add download icon and ensure file is downloaded directly [David Ichim - [`fa653c2`](https://github.com/eea/volto-eea-website-theme/commit/fa653c288988248218877a7ea66a7fe63bb59b09)]
26
+
27
+ #### :bug: Bug Fixes
28
+
29
+ - fix(UniversaLink): added option to open in new tab when isDisplayFile is true refs#281635 [laszlocseh - [`6e65ded`](https://github.com/eea/volto-eea-website-theme/commit/6e65dedef15e395156380318bdd19bc3812aba44)]
30
+ - fix(report-navigation): check if page has children before rendering it as a detail [David Ichim - [`35aabb3`](https://github.com/eea/volto-eea-website-theme/commit/35aabb31ef1619ff60695228373a9b1e08c248d6)]
31
+ - fix(context-navigation): error on layout page when types was an object [David Ichim - [`d06f7ab`](https://github.com/eea/volto-eea-website-theme/commit/d06f7ab641fafad0cfdf1c69381dc1e44696e008)]
32
+
33
+ #### :house: Internal changes
34
+
35
+ - style: Automated code fix [eea-jenkins - [`fabc331`](https://github.com/eea/volto-eea-website-theme/commit/fabc331a5ae2048c695ae7be57d45d47f0744e84)]
36
+
37
+ #### :hammer_and_wrench: Others
38
+
39
+ - bump package version [David Ichim - [`fb11d4c`](https://github.com/eea/volto-eea-website-theme/commit/fb11d4c5a48aadbde7fef65f5e5fa07dd451d58c)]
7
40
  ### [3.4.0](https://github.com/eea/volto-eea-website-theme/compare/3.3.0...3.4.0) - 11 December 2024
8
41
 
9
42
  #### :bug: Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-website-theme",
3
- "version": "3.4.0",
3
+ "version": "3.5.1",
4
4
  "description": "@eeacms/volto-eea-website-theme: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -20,8 +20,12 @@ const ContextNavigationFillEdit = (props) => {
20
20
  (state) => state.types?.types || [],
21
21
  shallowEqual,
22
22
  );
23
+
23
24
  const availableTypes = React.useMemo(
24
- () => contentTypes?.map((type) => [type.id, type.title || type.name]),
25
+ () =>
26
+ Array.isArray(contentTypes)
27
+ ? contentTypes.map((type) => [type.id, type.title || type.name])
28
+ : [],
25
29
  [contentTypes],
26
30
  );
27
31
 
@@ -1,14 +1,15 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
- import { Link as RouterLink } from 'react-router-dom';
4
3
  import cx from 'classnames';
5
4
  import { compose } from 'redux';
6
5
  import { withRouter } from 'react-router';
7
6
 
8
7
  import { flattenToAppURL } from '@plone/volto/helpers';
9
- import { UniversalLink, MaybeWrap } from '@plone/volto/components';
8
+ import { UniversalLink, MaybeWrap, Icon } from '@plone/volto/components';
10
9
  import { withContentNavigation } from '@plone/volto/components/theme/Navigation/withContentNavigation';
11
10
 
11
+ import downloadSVG from '@plone/volto/icons/download.svg';
12
+
12
13
  /**
13
14
  * Handles click on summary links and closes parent details elements
14
15
  * @param {Event} e - Click event
@@ -37,7 +38,8 @@ function renderNode(node, parentLevel) {
37
38
  const hasChildItems = node.items?.length;
38
39
  const nodeType = node.type;
39
40
  const isDocument = nodeType === 'document';
40
- let wrapWithDetails = isDocument && level > 2;
41
+ const isFile = nodeType === 'file';
42
+ let wrapWithDetails = isDocument && level > 2 && hasChildItems;
41
43
  return (
42
44
  <li
43
45
  key={node['@id']}
@@ -48,34 +50,28 @@ function renderNode(node, parentLevel) {
48
50
  as="details"
49
51
  className="context-navigation-detail"
50
52
  >
51
- {nodeType !== 'link' ? (
52
- <MaybeWrap
53
- condition={wrapWithDetails}
54
- as="summary"
55
- className="context-navigation-summary"
53
+ <MaybeWrap
54
+ condition={wrapWithDetails}
55
+ as="summary"
56
+ className="context-navigation-summary"
57
+ >
58
+ <UniversalLink
59
+ href={flattenToAppURL(node.href)}
60
+ download={isFile}
61
+ tabIndex={wrapWithDetails ? '-1' : 0}
62
+ title={node.description}
63
+ className={cx(`list-link contenttype-${nodeType}`, {
64
+ in_path: node.is_in_path,
65
+ })}
66
+ onClick={(e) =>
67
+ wrapWithDetails && handleSummaryClick(e, wrapWithDetails)
68
+ }
56
69
  >
57
- <RouterLink
58
- to={flattenToAppURL(node.href)}
59
- tabIndex={wrapWithDetails ? '-1' : 0}
60
- title={node.description}
61
- className={cx(`list-link contenttype-${nodeType}`, {
62
- in_path: node.is_in_path,
63
- })}
64
- onClick={(e) =>
65
- wrapWithDetails && handleSummaryClick(e, wrapWithDetails)
66
- }
67
- >
68
- {node.title}
69
- {nodeType === 'file' && node.getObjSize
70
- ? ' [' + node.getObjSize + ']'
71
- : ''}
72
- </RouterLink>
73
- </MaybeWrap>
74
- ) : (
75
- <UniversalLink href={flattenToAppURL(node.href)}>
70
+ {isFile && <Icon name={downloadSVG} size="16px" />}
76
71
  {node.title}
72
+ {isFile && node.getObjSize ? ' [' + node.getObjSize + ']' : ''}
77
73
  </UniversalLink>
78
- )}
74
+ </MaybeWrap>
79
75
  {(hasChildItems && (
80
76
  <ul className="list">
81
77
  {node.items.map((node) => renderNode(node, level))}
@@ -99,9 +95,9 @@ export function ReportNavigation(props) {
99
95
  <nav className="context-navigation report-navigation">
100
96
  {navigation.title ? (
101
97
  <div className="context-navigation-header">
102
- <RouterLink to={flattenToAppURL(navigation.url || '')}>
98
+ <UniversalLink href={flattenToAppURL(navigation.url || '')}>
103
99
  {navigation.title}
104
- </RouterLink>
100
+ </UniversalLink>
105
101
  </div>
106
102
  ) : (
107
103
  ''
@@ -67,6 +67,10 @@ const UniversalLink = ({
67
67
  }
68
68
  }
69
69
 
70
+ if (download && isInternalURL(url)) {
71
+ url = url.includes('/@@download/file') ? url : `${url}/@@download/file`;
72
+ }
73
+
70
74
  const isExternal = !isInternalURL(url);
71
75
  const isDownload =
72
76
  (!isExternal && url && url.includes('@@download')) || download;
@@ -127,6 +131,7 @@ const UniversalLink = ({
127
131
  <a
128
132
  href={flattenToAppURL(url)}
129
133
  title={title}
134
+ target={!(openLinkInNewTab === false) ? '_blank' : null}
130
135
  rel="noopener"
131
136
  className={className}
132
137
  {...props}