Skip to content

Commit

Permalink
Merge pull request #263 from eea/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
avoinea authored Sep 13, 2024
2 parents 3794c3c + 1112a54 commit 711b485
Show file tree
Hide file tree
Showing 10 changed files with 302 additions and 31 deletions.
40 changes: 17 additions & 23 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +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).

### [2.2.2](https://github.com/eea/volto-eea-website-theme/compare/2.2.1...2.2.2) - 29 August 2024
### [2.3.0](https://github.com/eea/volto-eea-website-theme/compare/2.2.2...2.3.0) - 9 September 2024

#### :bug: Bug Fixes
#### :house: Internal changes

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

- fix: Handle footer button action when on informatiion-system page [Alin Voinea - [`2100779`](https://github.com/eea/volto-eea-website-theme/commit/210077975e1e32858959785098231dac08fb8619)]
#### :hammer_and_wrench: Others

- Bump package.json version to 2.3.0 [ichim-david - [`c81b67e`](https://github.com/eea/volto-eea-website-theme/commit/c81b67e70a826af43b3876d531778c4320f64add)]
- fix conflicts with develop [Teodor - [`801f4fc`](https://github.com/eea/volto-eea-website-theme/commit/801f4fc45fb9a3e985a7351bb8998dcb53e8fa19)]
- update both widgets and tests [Teodor - [`8d295f7`](https://github.com/eea/volto-eea-website-theme/commit/8d295f7bb736b48c02ad0aa1ea1f6071752ecf1c)]
- code cleanup [Teodor - [`8e27f48`](https://github.com/eea/volto-eea-website-theme/commit/8e27f48c6fde1f66e76d01e03e7001c620c4c585)]
- update test and add DateWidget in config too [Teodor - [`f14f9e4`](https://github.com/eea/volto-eea-website-theme/commit/f14f9e44c3779e40cf8d7bcc42efc5768a919250)]
- Fix test [Tiberiu Ichim - [`42012c6`](https://github.com/eea/volto-eea-website-theme/commit/42012c6bce80d0d6f13ae9d2a9c0deea8fa19eb0)]
- remake snapshots and fix import [Teodor - [`5bb47d6`](https://github.com/eea/volto-eea-website-theme/commit/5bb47d6e7bdb0cad7f1fd4c7055c7d8f7b06d9e6)]
- Fix test [Tiberiu Ichim - [`f73cf32`](https://github.com/eea/volto-eea-website-theme/commit/f73cf32ae50cd768d56a991d7c9177e89ae53599)]
- add test for the widget [Teodor - [`543c5bc`](https://github.com/eea/volto-eea-website-theme/commit/543c5bcf1246953e06ee79c5b559d0ba9e3307cf)]
- use formatDate from Volto [Teodor - [`24114b3`](https://github.com/eea/volto-eea-website-theme/commit/24114b3dac79418293d271bff06afd8d985d380d)]
### [2.2.2](https://github.com/eea/volto-eea-website-theme/compare/2.2.1...2.2.2) - 29 August 2024

### [2.2.1](https://github.com/eea/volto-eea-website-theme/compare/2.2.0...2.2.1) - 28 August 2024

Expand Down Expand Up @@ -52,7 +66,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- Refs #269520 - other_organisation test [Tripon Eugen - [`7558b27`](https://github.com/eea/volto-eea-website-theme/commit/7558b27a9d1cd6d3480a32b296c7325c796006c9)]
- Refs #269520 - other_organisation token widget edit mode [Tripon Eugen - [`b6df127`](https://github.com/eea/volto-eea-website-theme/commit/b6df127bd91b6f55dda8f468e1107037d43752ff)]
- Refs #269520 - other_organisation token widget [Tripon Eugen - [`6fd7543`](https://github.com/eea/volto-eea-website-theme/commit/6fd7543894bd2c593a1729116befd95c82ea3c8f)]
- Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`cbc36c7`](https://github.com/eea/volto-eea-website-theme/commit/cbc36c74dfcd5f7cb1013a4c673d9c02e0023766)]
### [2.1.1](https://github.com/eea/volto-eea-website-theme/compare/2.1.0...2.1.1) - 28 May 2024

#### :bug: Bug Fixes
Expand Down Expand Up @@ -125,7 +138,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### :hammer_and_wrench: Others

- Add Sonarqube tag using insitu-frontend addons list [EEA Jenkins - [`adc6730`](https://github.com/eea/volto-eea-website-theme/commit/adc6730e21a37afb865b842182624401de6a29f5)]
### [1.33.1](https://github.com/eea/volto-eea-website-theme/compare/1.33.0...1.33.1) - 4 April 2024

#### :bug: Bug Fixes
Expand Down Expand Up @@ -259,8 +271,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

- bump version [Razvan - [`721e939`](https://github.com/eea/volto-eea-website-theme/commit/721e939d12e324b459ebfa78a2e656ee7142a3d6)]
- merge master into this branch [Razvan - [`586c8f9`](https://github.com/eea/volto-eea-website-theme/commit/586c8f910bac55a043bd8dda60e9444bd2ae1663)]
- Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`fd90044`](https://github.com/eea/volto-eea-website-theme/commit/fd9004442a9d1d465f7601ecdefe3e23c61e6a9c)]
- Add Sonarqube tag using insitu-frontend addons list [EEA Jenkins - [`4bc3dd3`](https://github.com/eea/volto-eea-website-theme/commit/4bc3dd3ae412a66befd04b5b80fab3716c929240)]
- test: Update jest,Jenkinsfile,lint to volto-addons-template PR30 [valentinab25 - [`c4dbd28`](https://github.com/eea/volto-eea-website-theme/commit/c4dbd289358205bc2d849aab7edb11ccf3b89cee)]
- fix tests [Razvan - [`042330b`](https://github.com/eea/volto-eea-website-theme/commit/042330bc97d32ffe7ba769b4f2453f71cffed706)]
- remove RemoveSchema logic [Razvan - [`08d10f8`](https://github.com/eea/volto-eea-website-theme/commit/08d10f8bf6f75478260e4e4c66d7316ba87b907a)]
Expand Down Expand Up @@ -355,11 +365,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- test: Add real image to cypress test [Alin Voinea - [`4ff591a`](https://github.com/eea/volto-eea-website-theme/commit/4ff591ae3318c9588b4e2114582c0fa6cfdf31ae)]
- test: Add cypress tests for Image block styling position and align [Alin Voinea - [`7341ef7`](https://github.com/eea/volto-eea-website-theme/commit/7341ef7b92714fc0cc3ab0c31c39033e7b3e19e7)]
- Revert "change(tests): commented out rss test since title block config is missing" [Alin Voinea - [`fb61191`](https://github.com/eea/volto-eea-website-theme/commit/fb611918d6ca380b89b594f283dcf9f685a4b294)]
- test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`6a3be30`](https://github.com/eea/volto-eea-website-theme/commit/6a3be3092589411af7808a235f76de5222fd3868)]
- test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`c3978f2`](https://github.com/eea/volto-eea-website-theme/commit/c3978f23375ef066e9fd6f6c2e34ba6c1c058f69)]
- test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`f672779`](https://github.com/eea/volto-eea-website-theme/commit/f672779e845bec9240ccc901e9f53ec80c5a1819)]
- test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`ae5d8e3`](https://github.com/eea/volto-eea-website-theme/commit/ae5d8e3f4e04dc2808d47ce2ee886e1b23b528da)]
- test: [JENKINS] Improve cypress time [valentinab25 - [`170ff0c`](https://github.com/eea/volto-eea-website-theme/commit/170ff0c8e3b30e69479bdf1117e811fea94f1027)]
### [1.23.0](https://github.com/eea/volto-eea-website-theme/compare/1.22.1...1.23.0) - 2 November 2023

#### :rocket: New Features
Expand All @@ -372,7 +377,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### :house: Internal changes

- chore: [JENKINS] Refactor automated testing [valentinab25 - [`f28fce3`](https://github.com/eea/volto-eea-website-theme/commit/f28fce3d1eb815f95fb9aa40de42b10b7e8e30c5)]
- chore: husky, lint-staged use fixed versions [valentinab25 - [`6d15088`](https://github.com/eea/volto-eea-website-theme/commit/6d150886c5aeb2ca0b569270486e60f7cc274e2c)]
- chore:volto 16 in tests, update docs, fix stylelint overrides [valentinab25 - [`20c0323`](https://github.com/eea/volto-eea-website-theme/commit/20c032380b33c0077c869a05136f93e2fb68e5d4)]

Expand Down Expand Up @@ -558,7 +562,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### :house: Internal changes

- chore: [JENKINS] Deprecate circularity website [valentinab25 - [`370dcbf`](https://github.com/eea/volto-eea-website-theme/commit/370dcbfbf1a8135ce7b1b3b271b004552a631837)]

#### :hammer_and_wrench: Others

Expand Down Expand Up @@ -714,7 +717,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### :hammer_and_wrench: Others

- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`6c5e2f8`](https://github.com/eea/volto-eea-website-theme/commit/6c5e2f80456e2061d9e9c15fd0a0b91b9ac70568)]
### [1.9.1](https://github.com/eea/volto-eea-website-theme/compare/1.9.0...1.9.1) - 28 February 2023

#### :bug: Bug Fixes
Expand Down Expand Up @@ -861,7 +863,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

- For some reasons types is a string [Alin Voinea - [`3769a09`](https://github.com/eea/volto-eea-website-theme/commit/3769a0981181d5b633f3498daebbe96be8b4b833)]
- Fix(redirect): o.filter - refs #157627 [Alin Voinea - [`deb23da`](https://github.com/eea/volto-eea-website-theme/commit/deb23da846444cc96539697fd798429ae0abe89e)]
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`f1fffc5`](https://github.com/eea/volto-eea-website-theme/commit/f1fffc5db96725440863d545580b4e76cce4b796)]
### [1.5.0](https://github.com/eea/volto-eea-website-theme/compare/1.4.2...1.5.0) - 9 January 2023

#### :hammer_and_wrench: Others
Expand Down Expand Up @@ -895,7 +896,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

- Release 1.4.0 [Alin Voinea - [`bd42a0d`](https://github.com/eea/volto-eea-website-theme/commit/bd42a0d26e928cac5d99933194755da3db06b341)]
- bump version to use as volto-eea-design-system [David Ichim - [`f4be047`](https://github.com/eea/volto-eea-website-theme/commit/f4be047328b46399b03b612d378b18aaf82e7dc1)]
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`9b7cfef`](https://github.com/eea/volto-eea-website-theme/commit/9b7cfefb4d34fc1c948015e491feb370f9795bd8)]
- test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`df252a9`](https://github.com/eea/volto-eea-website-theme/commit/df252a9bfed0bb86cadf53c59dd1603b1e2cd822)]
### [1.3.2](https://github.com/eea/volto-eea-website-theme/compare/1.3.1...1.3.2) - 16 December 2022

Expand All @@ -905,7 +905,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### :hammer_and_wrench: Others

- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`a43c658`](https://github.com/eea/volto-eea-website-theme/commit/a43c658a7920c8df95e763b9a637f38ce77eba2c)]
- Better razzle.config [Tiberiu Ichim - [`81dbf48`](https://github.com/eea/volto-eea-website-theme/commit/81dbf48815fb27facb4f82c9b764540fdf188b2e)]
- Better razzle.config [Tiberiu Ichim - [`7bc9da2`](https://github.com/eea/volto-eea-website-theme/commit/7bc9da2cd837ab62a95cd29979cdd9b0055b7d67)]
### [1.3.1](https://github.com/eea/volto-eea-website-theme/compare/1.3.0...1.3.1) - 28 November 2022
Expand All @@ -916,7 +915,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### :hammer_and_wrench: Others

- yarn 3 [Alin Voinea - [`ea7a709`](https://github.com/eea/volto-eea-website-theme/commit/ea7a7094945312776e9b6f44e371178603e92139)]
### [1.3.0](https://github.com/eea/volto-eea-website-theme/compare/1.2.0...1.3.0) - 22 November 2022

#### :rocket: New Features
Expand Down Expand Up @@ -957,7 +955,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- Add subsite class to body [Tiberiu Ichim - [`74d700f`](https://github.com/eea/volto-eea-website-theme/commit/74d700fbfd6249a8604762a7e4e49cce857db0f3)]
- Add subsite info to header [Tiberiu Ichim - [`47daf8b`](https://github.com/eea/volto-eea-website-theme/commit/47daf8bb6374a1222040626b19d4154df7ba1b83)]
- fix eslint [Miu Razvan - [`eb8d0a7`](https://github.com/eea/volto-eea-website-theme/commit/eb8d0a790bc70c0aae256c6ff35f63c4885f338e)]
- Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`cc578a4`](https://github.com/eea/volto-eea-website-theme/commit/cc578a413b205a8e61e091fab3a88f94cedefc89)]
### [1.1.0](https://github.com/eea/volto-eea-website-theme/compare/1.0.0...1.1.0) - 28 October 2022

#### :nail_care: Enhancements
Expand Down Expand Up @@ -1005,7 +1002,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### :hammer_and_wrench: Others

- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`33b56ac`](https://github.com/eea/volto-eea-website-theme/commit/33b56acb13fbaf0c5b79e8fc6e13c4b699c79c90)]
### [0.7.3](https://github.com/eea/volto-eea-website-theme/compare/0.7.2...0.7.3) - 22 September 2022

#### :hammer_and_wrench: Others
Expand Down Expand Up @@ -1273,7 +1269,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- Header refactor, add custom logo #5 [ichim-david - [`4950235`](https://github.com/eea/volto-eea-website-theme/commit/49502358105437cfeac3b144e6d301cb59aa2346)]
- Update footer.config with new publication card component [ichim-david - [`2e38e9a`](https://github.com/eea/volto-eea-website-theme/commit/2e38e9a417f835009d60c80d4eb4b30229f55e45)]
- feature(breadcrumbs): implement eea-design-system breadcrumb as Volto component #32 #7 [ichim-david - [`181af41`](https://github.com/eea/volto-eea-website-theme/commit/181af4125ce2b9ddac56dab4723cb11c26633221)]
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`da8ceb6`](https://github.com/eea/volto-eea-website-theme/commit/da8ceb68ea68bfbc9504e48ccd4d68277f11ab9a)]
- use breadcrumbs from eea-design-system [nileshgulia1 - [`db2f9e9`](https://github.com/eea/volto-eea-website-theme/commit/db2f9e9a4327420a3cce9a9903cd88549b129eab)]
- Update theme.config [ichim-david - [`8eca4f4`](https://github.com/eea/volto-eea-website-theme/commit/8eca4f40397a4aeca6d39029c92db78968d37064)]
- Added keyContent component to theme.config [ichim-david - [`d86f202`](https://github.com/eea/volto-eea-website-theme/commit/d86f202d0274d839487a88b51cae9a0e899beb23)]
Expand Down Expand Up @@ -1315,5 +1310,4 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### :hammer_and_wrench: Others

- yarn bootstrap [Alin Voinea - [`6995e9e`](https://github.com/eea/volto-eea-website-theme/commit/6995e9e091f21fdbbdffa8a44fc0e2c626f6d46a)]
- Initial commit [Alin Voinea - [`6a9c03a`](https://github.com/eea/volto-eea-website-theme/commit/6a9c03a7cebe71ca87e82cf58c42904063e9d8d3)]
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-eea-website-theme",
"version": "2.2.2",
"version": "2.3.0",
"description": "@eeacms/volto-eea-website-theme: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
32 changes: 32 additions & 0 deletions src/components/theme/Widgets/DateWidget.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from 'react';
import cx from 'classnames';
import { useSelector } from 'react-redux';
import { toBackendLang } from '@plone/volto/helpers';
import { formatDate } from '@plone/volto/helpers/Utils/Date';
import config from '@plone/volto/registry';

export const DateWidget = ({ value, children, className }) => {
const lang = useSelector((state) => state.intl.locale);
const backendLang = toBackendLang(lang);
const locale =
backendLang === 'en' ? config.settings.dateLocale : backendLang;
const formatOptions = {
date: value,
format: {
year: 'numeric',
month: 'short',
day: '2-digit',
},
locale,
};

return value ? (
<span className={cx(className, 'date', 'widget')}>
{children
? children(formatDate(formatOptions))
: formatDate(formatOptions)}
</span>
) : (
''
);
};
67 changes: 67 additions & 0 deletions src/components/theme/Widgets/DateWidget.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import React from 'react';
import renderer from 'react-test-renderer';
import { DateWidget } from './DateWidget';
import { Provider } from 'react-intl-redux';
import configureStore from 'redux-mock-store';
import thunk from 'redux-thunk';

const mockStore = configureStore([thunk]);

const store = mockStore({
intl: {
locale: 'en-gb',
messages: {},
},
});

describe('DateWidget', () => {
it('renders an empty date view widget component', () => {
const component = renderer.create(
<Provider store={store}>
<DateWidget />
</Provider>,
);
const json = component.toJSON();
expect(json).toMatchSnapshot();
});

it('renders a date view widget component', () => {
const component = renderer.create(
<Provider store={store}>
<DateWidget className="metadata" value="2020-08-04T09:00:00" />
</Provider>,
);
const json = component.toJSON();
expect(json).toMatchSnapshot();
});

it('renders a date view widget component with custom format', () => {
const component = renderer.create(
<Provider store={store}>
<DateWidget
className="metadata"
value="2020-08-04T09:00:00"
format={{
year: 'numeric',
month: 'short',
day: '2-digit',
}}
/>
</Provider>,
);
const json = component.toJSON();
expect(json).toMatchSnapshot();
});

it('renders a date view widget component with children', () => {
const component = renderer.create(
<Provider store={store}>
<DateWidget className="metadata" value="2020-08-04T09:00:00">
{(child) => <strong>{child}</strong>}
</DateWidget>
</Provider>,
);
const json = component.toJSON();
expect(json).toMatchSnapshot();
});
});
45 changes: 45 additions & 0 deletions src/components/theme/Widgets/DatetimeWidget.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React from 'react';
import cx from 'classnames';
import { useSelector } from 'react-redux';
import { toBackendLang } from '@plone/volto/helpers';
import { formatDate } from '@plone/volto/helpers/Utils/Date';
import config from '@plone/volto/registry';

export const DatetimeWidget = ({ value, children, className }) => {
const lang = useSelector((state) => state.intl.locale);
const backendLang = toBackendLang(lang);
const locale =
backendLang === 'en' ? config.settings.dateLocale : backendLang;
const formatOptions = {
date: value,
format: {
year: 'numeric',
month: 'short',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
},
locale,
includeTime: true,
formatToParts: true,
};

let formattedParts = formatDate(formatOptions);

const formattedDate = formattedParts
.map((part) => {
if (part.type === 'literal' && part.value === ', ') {
return ' ';
}
return part.value;
})
.join('');

return value ? (
<span className={cx(className, 'datetime', 'widget')}>
{children ? children(formattedDate) : formattedDate}
</span>
) : (
''
);
};
63 changes: 63 additions & 0 deletions src/components/theme/Widgets/DatetimeWidget.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import React from 'react';
import renderer from 'react-test-renderer';
import { DatetimeWidget } from './DatetimeWidget';
import { Provider } from 'react-intl-redux';
import configureStore from 'redux-mock-store';
import thunk from 'redux-thunk';

const mockStore = configureStore([thunk]);

const store = mockStore({
intl: {
locale: 'en-gb',
messages: {},
},
});

describe('DatetimeWidget', () => {
it('renders an empty datetime view widget component', () => {
const component = renderer.create(
<Provider store={store}>
<DatetimeWidget />
</Provider>,
);
const json = component.toJSON();
expect(json).toMatchSnapshot();
});

it('renders a datetime view widget component with a date and time', () => {
const component = renderer.create(
<Provider store={store}>
<DatetimeWidget className="metadata" value="2024-09-05T15:34:00" />
</Provider>,
);
const json = component.toJSON();
expect(json).toMatchSnapshot();
});

it('renders a datetime view widget component with children formatting', () => {
const component = renderer.create(
<Provider store={store}>
<DatetimeWidget className="metadata" value="2024-09-05T15:34:00">
{(formattedDate) => <strong>{formattedDate}</strong>}
</DatetimeWidget>
</Provider>,
);
const json = component.toJSON();
expect(json).toMatchSnapshot();
});

it('removes the comma in the formatted date and shows correct time', () => {
const component = renderer.create(
<Provider store={store}>
<DatetimeWidget className="metadata" value="2024-09-05T15:34:00" />
</Provider>,
);
const json = component.toJSON();
expect(json).toMatchSnapshot();

const instance = component.root;
const span = instance.findByType('span');
expect(span.props.children).toContain('05 Sept 2024 15:34');
});
});
Loading

0 comments on commit 711b485

Please sign in to comment.