Skip to content

Commit

Permalink
Merge pull request #277 from eea/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
alecghica authored Dec 16, 2024
2 parents 5e0c608 + aeeea52 commit a9ab2e1
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 33 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

### [3.5.0](https://github.com/eea/volto-eea-website-theme/compare/3.4.0...3.5.0) - 16 December 2024

#### :rocket: New Features

- 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)]

#### :bug: Bug Fixes

- 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)]
- 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)]
- 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)]

#### :house: Internal changes

- style: Automated code fix [eea-jenkins - [`fabc331`](https://github.com/eea/volto-eea-website-theme/commit/fabc331a5ae2048c695ae7be57d45d47f0744e84)]

#### :hammer_and_wrench: Others

- bump package version [David Ichim - [`fb11d4c`](https://github.com/eea/volto-eea-website-theme/commit/fb11d4c5a48aadbde7fef65f5e5fa07dd451d58c)]
### [3.4.0](https://github.com/eea/volto-eea-website-theme/compare/3.3.0...3.4.0) - 11 December 2024

#### :bug: Bug Fixes
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-eea-website-theme",
"version": "3.4.0",
"version": "3.5.0",
"description": "@eeacms/volto-eea-website-theme: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down Expand Up @@ -82,4 +82,4 @@
"cypress:open": "make cypress-open",
"prepare": "husky install"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ const ContextNavigationFillEdit = (props) => {
(state) => state.types?.types || [],
shallowEqual,
);

const availableTypes = React.useMemo(
() => contentTypes?.map((type) => [type.id, type.title || type.name]),
() =>
Array.isArray(contentTypes)
? contentTypes.map((type) => [type.id, type.title || type.name])
: [],
[contentTypes],
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import PropTypes from 'prop-types';
import React from 'react';
import { Link as RouterLink } from 'react-router-dom';
import cx from 'classnames';
import { compose } from 'redux';
import { withRouter } from 'react-router';

import { flattenToAppURL } from '@plone/volto/helpers';
import { UniversalLink, MaybeWrap } from '@plone/volto/components';
import { UniversalLink, MaybeWrap, Icon } from '@plone/volto/components';
import { withContentNavigation } from '@plone/volto/components/theme/Navigation/withContentNavigation';

import downloadSVG from '@plone/volto/icons/download.svg';

/**
* Handles click on summary links and closes parent details elements
* @param {Event} e - Click event
Expand Down Expand Up @@ -37,7 +38,8 @@ function renderNode(node, parentLevel) {
const hasChildItems = node.items?.length;
const nodeType = node.type;
const isDocument = nodeType === 'document';
let wrapWithDetails = isDocument && level > 2;
const isFile = nodeType === 'file';
let wrapWithDetails = isDocument && level > 2 && hasChildItems;
return (
<li
key={node['@id']}
Expand All @@ -48,34 +50,28 @@ function renderNode(node, parentLevel) {
as="details"
className="context-navigation-detail"
>
{nodeType !== 'link' ? (
<MaybeWrap
condition={wrapWithDetails}
as="summary"
className="context-navigation-summary"
<MaybeWrap
condition={wrapWithDetails}
as="summary"
className="context-navigation-summary"
>
<UniversalLink
href={flattenToAppURL(node.href)}
download={isFile}
tabIndex={wrapWithDetails ? '-1' : 0}
title={node.description}
className={cx(`list-link contenttype-${nodeType}`, {
in_path: node.is_in_path,
})}
onClick={(e) =>
wrapWithDetails && handleSummaryClick(e, wrapWithDetails)
}
>
<RouterLink
to={flattenToAppURL(node.href)}
tabIndex={wrapWithDetails ? '-1' : 0}
title={node.description}
className={cx(`list-link contenttype-${nodeType}`, {
in_path: node.is_in_path,
})}
onClick={(e) =>
wrapWithDetails && handleSummaryClick(e, wrapWithDetails)
}
>
{node.title}
{nodeType === 'file' && node.getObjSize
? ' [' + node.getObjSize + ']'
: ''}
</RouterLink>
</MaybeWrap>
) : (
<UniversalLink href={flattenToAppURL(node.href)}>
{isFile && <Icon name={downloadSVG} size="16px" />}
{node.title}
{isFile && node.getObjSize ? ' [' + node.getObjSize + ']' : ''}
</UniversalLink>
)}
</MaybeWrap>
{(hasChildItems && (
<ul className="list">
{node.items.map((node) => renderNode(node, level))}
Expand All @@ -99,9 +95,9 @@ export function ReportNavigation(props) {
<nav className="context-navigation report-navigation">
{navigation.title ? (
<div className="context-navigation-header">
<RouterLink to={flattenToAppURL(navigation.url || '')}>
<UniversalLink href={flattenToAppURL(navigation.url || '')}>
{navigation.title}
</RouterLink>
</UniversalLink>
</div>
) : (
''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ const UniversalLink = ({
<a
href={flattenToAppURL(url)}
title={title}
target={!(openLinkInNewTab === false) ? '_blank' : null}
rel="noopener"
className={className}
{...props}
Expand Down

0 comments on commit a9ab2e1

Please sign in to comment.