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

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,25 @@ 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.0](https://github.com/eea/volto-eea-website-theme/compare/3.4.0...3.5.0) - 16 December 2024
8
+
9
+ #### :rocket: New Features
10
+
11
+ - 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)]
12
+
13
+ #### :bug: Bug Fixes
14
+
15
+ - 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)]
16
+ - 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)]
17
+ - 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)]
18
+
19
+ #### :house: Internal changes
20
+
21
+ - style: Automated code fix [eea-jenkins - [`fabc331`](https://github.com/eea/volto-eea-website-theme/commit/fabc331a5ae2048c695ae7be57d45d47f0744e84)]
22
+
23
+ #### :hammer_and_wrench: Others
24
+
25
+ - bump package version [David Ichim - [`fb11d4c`](https://github.com/eea/volto-eea-website-theme/commit/fb11d4c5a48aadbde7fef65f5e5fa07dd451d58c)]
7
26
  ### [3.4.0](https://github.com/eea/volto-eea-website-theme/compare/3.3.0...3.4.0) - 11 December 2024
8
27
 
9
28
  #### :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.0",
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",
@@ -82,4 +82,4 @@
82
82
  "cypress:open": "make cypress-open",
83
83
  "prepare": "husky install"
84
84
  }
85
- }
85
+ }
@@ -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
  ''
@@ -127,6 +127,7 @@ const UniversalLink = ({
127
127
  <a
128
128
  href={flattenToAppURL(url)}
129
129
  title={title}
130
+ target={!(openLinkInNewTab === false) ? '_blank' : null}
130
131
  rel="noopener"
131
132
  className={className}
132
133
  {...props}