@eeacms/volto-clms-theme 1.1.212 → 1.1.214

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,17 @@ 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.214](https://github.com/eea/volto-clms-theme/compare/1.1.213...1.1.214) - 21 February 2025
8
+
9
+ ### [1.1.213](https://github.com/eea/volto-clms-theme/compare/1.1.212...1.1.213) - 20 February 2025
10
+
11
+ #### :bug: Bug Fixes
12
+
13
+ - fix: test [ana-oprea - [`223d5ad`](https://github.com/eea/volto-clms-theme/commit/223d5ad7b91c04c2db59b2541796c43771892247)]
14
+
15
+ #### :hammer_and_wrench: Others
16
+
17
+ - Refs #284562 - Show toolbar for Manager, Site Administrator, Editor, Reviewer, Contributor. Fix missing toolbar for editors. [GhitaB - [`d028514`](https://github.com/eea/volto-clms-theme/commit/d028514e10dcc027c685a97a72341cbf35669f40)]
7
18
  ### [1.1.212](https://github.com/eea/volto-clms-theme/compare/1.1.211...1.1.212) - 19 February 2025
8
19
 
9
20
  #### :rocket: New Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.1.212",
3
+ "version": "1.1.214",
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",
@@ -39,8 +39,22 @@ const FamilyCard = (props) => {
39
39
  href={hasLink ? url : null}
40
40
  to={hasLink ? url : null}
41
41
  className={'card-product-family'}
42
- onClick={() => onClickImage()}
43
- onKeyDown={() => onClickImage()}
42
+ onClick={() => {
43
+ onClickImage();
44
+ window.scrollTo({
45
+ top: 0,
46
+ left: 0,
47
+ behavior: 'smooth',
48
+ });
49
+ }}
50
+ onKeyDown={() => {
51
+ onClickImage();
52
+ window.scrollTo({
53
+ top: 0,
54
+ left: 0,
55
+ behavior: 'smooth',
56
+ });
57
+ }}
44
58
  >
45
59
  <div className="card-text">
46
60
  <div className="card-product-familiy-title">{card?.title}</div>
@@ -4,8 +4,9 @@ import cx from 'classnames';
4
4
  import { RenderBlocks } from '@plone/volto/components';
5
5
  import { slugify } from '../../utils';
6
6
  import './fontawesome';
7
- import { connect } from 'react-redux';
7
+ import { connect, useSelector } from 'react-redux';
8
8
  import { compose } from 'redux';
9
+ import { FormattedMessage } from 'react-intl';
9
10
 
10
11
  import { withScrollToTarget } from '@eeacms/volto-tabs-block/hocs';
11
12
 
@@ -194,9 +195,46 @@ const TabsComponent = ({
194
195
  };
195
196
 
196
197
  const CclProductTabsWithSubtabsView = (props) => {
198
+ const locale = useSelector((state) => state.intl.locale);
199
+ const ExtraComponent = () => (
200
+ <div className="left-menu-detail">
201
+ <div className="menu-detail-image">
202
+ {props.metadata?.image ? (
203
+ <img
204
+ src={props.metadata?.image?.scales?.preview?.download}
205
+ alt={props.metadata?.title || 'Product map preview'}
206
+ />
207
+ ) : (
208
+ <img
209
+ src="https://eu-copernicus.github.io/copernicus-component-library/assets/images/image_placeholder.jpg"
210
+ alt="Product map preview"
211
+ style={{ opacity: 0.5 }}
212
+ />
213
+ )}
214
+ </div>
215
+ {props.metadata?.show_in_mapviewer_link && (
216
+ <>
217
+ <div className="menu-detail-button">
218
+ <a
219
+ href={
220
+ '/' + locale + '/map-viewer?product=' + props.metadata['UID']
221
+ }
222
+ className="ccl-button ccl-button--default"
223
+ >
224
+ <FormattedMessage
225
+ id="View in the data viewer"
226
+ defaultMessage="View in the data viewer"
227
+ />
228
+ </a>
229
+ </div>
230
+ </>
231
+ )}
232
+ </div>
233
+ );
234
+
197
235
  return (
198
236
  <div className="ccl-container ccl-container-flex tab-container">
199
- <TabsComponent {...props} />
237
+ <TabsComponent {...props} ExtraComponent={ExtraComponent} />
200
238
  </div>
201
239
  );
202
240
  };
@@ -144,19 +144,10 @@ describe('CclProductTabsWithSubtabsView', () => {
144
144
  expect(screen.queryByText('Subtab 1')).not.toBeInTheDocument();
145
145
  });
146
146
 
147
- it('renders ExtraComponent when provided', () => {
148
- const ExtraComponent = () => (
149
- <div data-testid="extra-component">Extra Content</div>
150
- );
151
-
152
- renderWithRouter(
153
- <CclProductTabsWithSubtabsView
154
- {...defaultProps}
155
- ExtraComponent={ExtraComponent}
156
- />,
157
- );
147
+ it('renders ExtraComponent', () => {
148
+ renderWithRouter(<CclProductTabsWithSubtabsView {...defaultProps} />);
158
149
 
159
- expect(screen.getByTestId('extra-component')).toBeInTheDocument();
150
+ expect(screen.getByAltText('Product map preview')).toBeInTheDocument();
160
151
  });
161
152
 
162
153
  it('handles empty tabsList', () => {
@@ -27,12 +27,13 @@ export const TimeseriesPicker = (props) => {
27
27
  : null,
28
28
  );
29
29
  const [isOpen, setIsOpen] = useState(false);
30
+ const [datesApplied, setDatesApplied] = useState(false);
30
31
 
31
32
  const isValidDateRange = ({ start, end, limit }) => {
32
33
  /* Calculate if the difference in days is smaller than the allowed limit */
33
34
  const oneDay = 24 * 60 * 60 * 1000; // hours*minutes*seconds*milliseconds
34
35
  const diffDays = Math.round(Math.abs((start - end) / oneDay));
35
- return diffDays < limit;
36
+ return diffDays <= limit;
36
37
  };
37
38
  const dates_array = data_arrays?.map((e) => new Date(e));
38
39
  return (
@@ -61,7 +62,7 @@ export const TimeseriesPicker = (props) => {
61
62
  <Icon name={calendarSVG} size={25} />
62
63
  <br />
63
64
  <span>
64
- {item.TemporalFilter
65
+ {item.TemporalFilter && datesApplied
65
66
  ? `${cclDateFormat(
66
67
  item.TemporalFilter.StartDate,
67
68
  )}-${cclDateFormat(item.TemporalFilter.EndDate)}`
@@ -202,6 +203,7 @@ export const TimeseriesPicker = (props) => {
202
203
  StartDate: startValue,
203
204
  EndDate: endValue,
204
205
  });
206
+ setDatesApplied(true);
205
207
  setIsOpen(false);
206
208
  }}
207
209
  >
@@ -339,7 +339,18 @@ class Toolbar extends Component {
339
339
  });
340
340
  const { expanded } = this.state;
341
341
 
342
- if (this.props.roles && this.props.roles?.includes('Manager')) {
342
+ if (
343
+ this.props.roles &&
344
+ this.props.roles.some((role) =>
345
+ [
346
+ 'Manager',
347
+ 'Site Administrator',
348
+ 'Editor',
349
+ 'Reviewer',
350
+ 'Contributor',
351
+ ].includes(role),
352
+ )
353
+ ) {
343
354
  return (
344
355
  this.props.token && (
345
356
  <>