@eeacms/volto-eea-website-theme 2.2.2 → 2.3.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,11 +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
- ### [2.2.2](https://github.com/eea/volto-eea-website-theme/compare/2.2.1...2.2.2) - 29 August 2024
7
+ ### [2.3.0](https://github.com/eea/volto-eea-website-theme/compare/2.2.2...2.3.0) - 9 September 2024
8
8
 
9
- #### :bug: Bug Fixes
9
+ #### :house: Internal changes
10
+
11
+ - style: Automated code fix [eea-jenkins - [`df350bf`](https://github.com/eea/volto-eea-website-theme/commit/df350bfff7b6e0ca4227a29d4fd6108293a55b04)]
10
12
 
11
- - fix: Handle footer button action when on informatiion-system page [Alin Voinea - [`2100779`](https://github.com/eea/volto-eea-website-theme/commit/210077975e1e32858959785098231dac08fb8619)]
13
+ #### :hammer_and_wrench: Others
14
+
15
+ - Bump package.json version to 2.3.0 [ichim-david - [`c81b67e`](https://github.com/eea/volto-eea-website-theme/commit/c81b67e70a826af43b3876d531778c4320f64add)]
16
+ - fix conflicts with develop [Teodor - [`801f4fc`](https://github.com/eea/volto-eea-website-theme/commit/801f4fc45fb9a3e985a7351bb8998dcb53e8fa19)]
17
+ - update both widgets and tests [Teodor - [`8d295f7`](https://github.com/eea/volto-eea-website-theme/commit/8d295f7bb736b48c02ad0aa1ea1f6071752ecf1c)]
18
+ - code cleanup [Teodor - [`8e27f48`](https://github.com/eea/volto-eea-website-theme/commit/8e27f48c6fde1f66e76d01e03e7001c620c4c585)]
19
+ - update test and add DateWidget in config too [Teodor - [`f14f9e4`](https://github.com/eea/volto-eea-website-theme/commit/f14f9e44c3779e40cf8d7bcc42efc5768a919250)]
20
+ - Fix test [Tiberiu Ichim - [`42012c6`](https://github.com/eea/volto-eea-website-theme/commit/42012c6bce80d0d6f13ae9d2a9c0deea8fa19eb0)]
21
+ - remake snapshots and fix import [Teodor - [`5bb47d6`](https://github.com/eea/volto-eea-website-theme/commit/5bb47d6e7bdb0cad7f1fd4c7055c7d8f7b06d9e6)]
22
+ - Fix test [Tiberiu Ichim - [`f73cf32`](https://github.com/eea/volto-eea-website-theme/commit/f73cf32ae50cd768d56a991d7c9177e89ae53599)]
23
+ - add test for the widget [Teodor - [`543c5bc`](https://github.com/eea/volto-eea-website-theme/commit/543c5bcf1246953e06ee79c5b559d0ba9e3307cf)]
24
+ - use formatDate from Volto [Teodor - [`24114b3`](https://github.com/eea/volto-eea-website-theme/commit/24114b3dac79418293d271bff06afd8d985d380d)]
25
+ ### [2.2.2](https://github.com/eea/volto-eea-website-theme/compare/2.2.1...2.2.2) - 29 August 2024
12
26
 
13
27
  ### [2.2.1](https://github.com/eea/volto-eea-website-theme/compare/2.2.0...2.2.1) - 28 August 2024
14
28
 
@@ -52,7 +66,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
52
66
  - Refs #269520 - other_organisation test [Tripon Eugen - [`7558b27`](https://github.com/eea/volto-eea-website-theme/commit/7558b27a9d1cd6d3480a32b296c7325c796006c9)]
53
67
  - Refs #269520 - other_organisation token widget edit mode [Tripon Eugen - [`b6df127`](https://github.com/eea/volto-eea-website-theme/commit/b6df127bd91b6f55dda8f468e1107037d43752ff)]
54
68
  - Refs #269520 - other_organisation token widget [Tripon Eugen - [`6fd7543`](https://github.com/eea/volto-eea-website-theme/commit/6fd7543894bd2c593a1729116befd95c82ea3c8f)]
55
- - Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`cbc36c7`](https://github.com/eea/volto-eea-website-theme/commit/cbc36c74dfcd5f7cb1013a4c673d9c02e0023766)]
56
69
  ### [2.1.1](https://github.com/eea/volto-eea-website-theme/compare/2.1.0...2.1.1) - 28 May 2024
57
70
 
58
71
  #### :bug: Bug Fixes
@@ -125,7 +138,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
125
138
 
126
139
  #### :hammer_and_wrench: Others
127
140
 
128
- - Add Sonarqube tag using insitu-frontend addons list [EEA Jenkins - [`adc6730`](https://github.com/eea/volto-eea-website-theme/commit/adc6730e21a37afb865b842182624401de6a29f5)]
129
141
  ### [1.33.1](https://github.com/eea/volto-eea-website-theme/compare/1.33.0...1.33.1) - 4 April 2024
130
142
 
131
143
  #### :bug: Bug Fixes
@@ -259,8 +271,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
259
271
 
260
272
  - bump version [Razvan - [`721e939`](https://github.com/eea/volto-eea-website-theme/commit/721e939d12e324b459ebfa78a2e656ee7142a3d6)]
261
273
  - merge master into this branch [Razvan - [`586c8f9`](https://github.com/eea/volto-eea-website-theme/commit/586c8f910bac55a043bd8dda60e9444bd2ae1663)]
262
- - Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`fd90044`](https://github.com/eea/volto-eea-website-theme/commit/fd9004442a9d1d465f7601ecdefe3e23c61e6a9c)]
263
- - Add Sonarqube tag using insitu-frontend addons list [EEA Jenkins - [`4bc3dd3`](https://github.com/eea/volto-eea-website-theme/commit/4bc3dd3ae412a66befd04b5b80fab3716c929240)]
264
274
  - test: Update jest,Jenkinsfile,lint to volto-addons-template PR30 [valentinab25 - [`c4dbd28`](https://github.com/eea/volto-eea-website-theme/commit/c4dbd289358205bc2d849aab7edb11ccf3b89cee)]
265
275
  - fix tests [Razvan - [`042330b`](https://github.com/eea/volto-eea-website-theme/commit/042330bc97d32ffe7ba769b4f2453f71cffed706)]
266
276
  - remove RemoveSchema logic [Razvan - [`08d10f8`](https://github.com/eea/volto-eea-website-theme/commit/08d10f8bf6f75478260e4e4c66d7316ba87b907a)]
@@ -355,11 +365,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
355
365
  - test: Add real image to cypress test [Alin Voinea - [`4ff591a`](https://github.com/eea/volto-eea-website-theme/commit/4ff591ae3318c9588b4e2114582c0fa6cfdf31ae)]
356
366
  - test: Add cypress tests for Image block styling position and align [Alin Voinea - [`7341ef7`](https://github.com/eea/volto-eea-website-theme/commit/7341ef7b92714fc0cc3ab0c31c39033e7b3e19e7)]
357
367
  - 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)]
358
- - test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`6a3be30`](https://github.com/eea/volto-eea-website-theme/commit/6a3be3092589411af7808a235f76de5222fd3868)]
359
- - test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`c3978f2`](https://github.com/eea/volto-eea-website-theme/commit/c3978f23375ef066e9fd6f6c2e34ba6c1c058f69)]
360
- - test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`f672779`](https://github.com/eea/volto-eea-website-theme/commit/f672779e845bec9240ccc901e9f53ec80c5a1819)]
361
- - test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`ae5d8e3`](https://github.com/eea/volto-eea-website-theme/commit/ae5d8e3f4e04dc2808d47ce2ee886e1b23b528da)]
362
- - test: [JENKINS] Improve cypress time [valentinab25 - [`170ff0c`](https://github.com/eea/volto-eea-website-theme/commit/170ff0c8e3b30e69479bdf1117e811fea94f1027)]
363
368
  ### [1.23.0](https://github.com/eea/volto-eea-website-theme/compare/1.22.1...1.23.0) - 2 November 2023
364
369
 
365
370
  #### :rocket: New Features
@@ -372,7 +377,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
372
377
 
373
378
  #### :house: Internal changes
374
379
 
375
- - chore: [JENKINS] Refactor automated testing [valentinab25 - [`f28fce3`](https://github.com/eea/volto-eea-website-theme/commit/f28fce3d1eb815f95fb9aa40de42b10b7e8e30c5)]
376
380
  - chore: husky, lint-staged use fixed versions [valentinab25 - [`6d15088`](https://github.com/eea/volto-eea-website-theme/commit/6d150886c5aeb2ca0b569270486e60f7cc274e2c)]
377
381
  - chore:volto 16 in tests, update docs, fix stylelint overrides [valentinab25 - [`20c0323`](https://github.com/eea/volto-eea-website-theme/commit/20c032380b33c0077c869a05136f93e2fb68e5d4)]
378
382
 
@@ -558,7 +562,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
558
562
 
559
563
  #### :house: Internal changes
560
564
 
561
- - chore: [JENKINS] Deprecate circularity website [valentinab25 - [`370dcbf`](https://github.com/eea/volto-eea-website-theme/commit/370dcbfbf1a8135ce7b1b3b271b004552a631837)]
562
565
 
563
566
  #### :hammer_and_wrench: Others
564
567
 
@@ -714,7 +717,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
714
717
 
715
718
  #### :hammer_and_wrench: Others
716
719
 
717
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`6c5e2f8`](https://github.com/eea/volto-eea-website-theme/commit/6c5e2f80456e2061d9e9c15fd0a0b91b9ac70568)]
718
720
  ### [1.9.1](https://github.com/eea/volto-eea-website-theme/compare/1.9.0...1.9.1) - 28 February 2023
719
721
 
720
722
  #### :bug: Bug Fixes
@@ -861,7 +863,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
861
863
 
862
864
  - For some reasons types is a string [Alin Voinea - [`3769a09`](https://github.com/eea/volto-eea-website-theme/commit/3769a0981181d5b633f3498daebbe96be8b4b833)]
863
865
  - Fix(redirect): o.filter - refs #157627 [Alin Voinea - [`deb23da`](https://github.com/eea/volto-eea-website-theme/commit/deb23da846444cc96539697fd798429ae0abe89e)]
864
- - Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`f1fffc5`](https://github.com/eea/volto-eea-website-theme/commit/f1fffc5db96725440863d545580b4e76cce4b796)]
865
866
  ### [1.5.0](https://github.com/eea/volto-eea-website-theme/compare/1.4.2...1.5.0) - 9 January 2023
866
867
 
867
868
  #### :hammer_and_wrench: Others
@@ -895,7 +896,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
895
896
 
896
897
  - Release 1.4.0 [Alin Voinea - [`bd42a0d`](https://github.com/eea/volto-eea-website-theme/commit/bd42a0d26e928cac5d99933194755da3db06b341)]
897
898
  - bump version to use as volto-eea-design-system [David Ichim - [`f4be047`](https://github.com/eea/volto-eea-website-theme/commit/f4be047328b46399b03b612d378b18aaf82e7dc1)]
898
- - Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`9b7cfef`](https://github.com/eea/volto-eea-website-theme/commit/9b7cfefb4d34fc1c948015e491feb370f9795bd8)]
899
899
  - test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`df252a9`](https://github.com/eea/volto-eea-website-theme/commit/df252a9bfed0bb86cadf53c59dd1603b1e2cd822)]
900
900
  ### [1.3.2](https://github.com/eea/volto-eea-website-theme/compare/1.3.1...1.3.2) - 16 December 2022
901
901
 
@@ -905,7 +905,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
905
905
 
906
906
  #### :hammer_and_wrench: Others
907
907
 
908
- - Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`a43c658`](https://github.com/eea/volto-eea-website-theme/commit/a43c658a7920c8df95e763b9a637f38ce77eba2c)]
909
908
  - Better razzle.config [Tiberiu Ichim - [`81dbf48`](https://github.com/eea/volto-eea-website-theme/commit/81dbf48815fb27facb4f82c9b764540fdf188b2e)]
910
909
  - Better razzle.config [Tiberiu Ichim - [`7bc9da2`](https://github.com/eea/volto-eea-website-theme/commit/7bc9da2cd837ab62a95cd29979cdd9b0055b7d67)]
911
910
  ### [1.3.1](https://github.com/eea/volto-eea-website-theme/compare/1.3.0...1.3.1) - 28 November 2022
@@ -916,7 +915,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
916
915
 
917
916
  #### :hammer_and_wrench: Others
918
917
 
919
- - yarn 3 [Alin Voinea - [`ea7a709`](https://github.com/eea/volto-eea-website-theme/commit/ea7a7094945312776e9b6f44e371178603e92139)]
920
918
  ### [1.3.0](https://github.com/eea/volto-eea-website-theme/compare/1.2.0...1.3.0) - 22 November 2022
921
919
 
922
920
  #### :rocket: New Features
@@ -957,7 +955,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
957
955
  - Add subsite class to body [Tiberiu Ichim - [`74d700f`](https://github.com/eea/volto-eea-website-theme/commit/74d700fbfd6249a8604762a7e4e49cce857db0f3)]
958
956
  - Add subsite info to header [Tiberiu Ichim - [`47daf8b`](https://github.com/eea/volto-eea-website-theme/commit/47daf8bb6374a1222040626b19d4154df7ba1b83)]
959
957
  - fix eslint [Miu Razvan - [`eb8d0a7`](https://github.com/eea/volto-eea-website-theme/commit/eb8d0a790bc70c0aae256c6ff35f63c4885f338e)]
960
- - Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`cc578a4`](https://github.com/eea/volto-eea-website-theme/commit/cc578a413b205a8e61e091fab3a88f94cedefc89)]
961
958
  ### [1.1.0](https://github.com/eea/volto-eea-website-theme/compare/1.0.0...1.1.0) - 28 October 2022
962
959
 
963
960
  #### :nail_care: Enhancements
@@ -1005,7 +1002,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1005
1002
 
1006
1003
  #### :hammer_and_wrench: Others
1007
1004
 
1008
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`33b56ac`](https://github.com/eea/volto-eea-website-theme/commit/33b56acb13fbaf0c5b79e8fc6e13c4b699c79c90)]
1009
1005
  ### [0.7.3](https://github.com/eea/volto-eea-website-theme/compare/0.7.2...0.7.3) - 22 September 2022
1010
1006
 
1011
1007
  #### :hammer_and_wrench: Others
@@ -1273,7 +1269,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1273
1269
  - Header refactor, add custom logo #5 [ichim-david - [`4950235`](https://github.com/eea/volto-eea-website-theme/commit/49502358105437cfeac3b144e6d301cb59aa2346)]
1274
1270
  - Update footer.config with new publication card component [ichim-david - [`2e38e9a`](https://github.com/eea/volto-eea-website-theme/commit/2e38e9a417f835009d60c80d4eb4b30229f55e45)]
1275
1271
  - 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)]
1276
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`da8ceb6`](https://github.com/eea/volto-eea-website-theme/commit/da8ceb68ea68bfbc9504e48ccd4d68277f11ab9a)]
1277
1272
  - use breadcrumbs from eea-design-system [nileshgulia1 - [`db2f9e9`](https://github.com/eea/volto-eea-website-theme/commit/db2f9e9a4327420a3cce9a9903cd88549b129eab)]
1278
1273
  - Update theme.config [ichim-david - [`8eca4f4`](https://github.com/eea/volto-eea-website-theme/commit/8eca4f40397a4aeca6d39029c92db78968d37064)]
1279
1274
  - Added keyContent component to theme.config [ichim-david - [`d86f202`](https://github.com/eea/volto-eea-website-theme/commit/d86f202d0274d839487a88b51cae9a0e899beb23)]
@@ -1315,5 +1310,4 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1315
1310
 
1316
1311
  #### :hammer_and_wrench: Others
1317
1312
 
1318
- - yarn bootstrap [Alin Voinea - [`6995e9e`](https://github.com/eea/volto-eea-website-theme/commit/6995e9e091f21fdbbdffa8a44fc0e2c626f6d46a)]
1319
1313
  - Initial commit [Alin Voinea - [`6a9c03a`](https://github.com/eea/volto-eea-website-theme/commit/6a9c03a7cebe71ca87e82cf58c42904063e9d8d3)]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-website-theme",
3
- "version": "2.2.2",
3
+ "version": "2.3.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",
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import cx from 'classnames';
3
+ import { useSelector } from 'react-redux';
4
+ import { toBackendLang } from '@plone/volto/helpers';
5
+ import { formatDate } from '@plone/volto/helpers/Utils/Date';
6
+ import config from '@plone/volto/registry';
7
+
8
+ export const DateWidget = ({ value, children, className }) => {
9
+ const lang = useSelector((state) => state.intl.locale);
10
+ const backendLang = toBackendLang(lang);
11
+ const locale =
12
+ backendLang === 'en' ? config.settings.dateLocale : backendLang;
13
+ const formatOptions = {
14
+ date: value,
15
+ format: {
16
+ year: 'numeric',
17
+ month: 'short',
18
+ day: '2-digit',
19
+ },
20
+ locale,
21
+ };
22
+
23
+ return value ? (
24
+ <span className={cx(className, 'date', 'widget')}>
25
+ {children
26
+ ? children(formatDate(formatOptions))
27
+ : formatDate(formatOptions)}
28
+ </span>
29
+ ) : (
30
+ ''
31
+ );
32
+ };
@@ -0,0 +1,67 @@
1
+ import React from 'react';
2
+ import renderer from 'react-test-renderer';
3
+ import { DateWidget } from './DateWidget';
4
+ import { Provider } from 'react-intl-redux';
5
+ import configureStore from 'redux-mock-store';
6
+ import thunk from 'redux-thunk';
7
+
8
+ const mockStore = configureStore([thunk]);
9
+
10
+ const store = mockStore({
11
+ intl: {
12
+ locale: 'en-gb',
13
+ messages: {},
14
+ },
15
+ });
16
+
17
+ describe('DateWidget', () => {
18
+ it('renders an empty date view widget component', () => {
19
+ const component = renderer.create(
20
+ <Provider store={store}>
21
+ <DateWidget />
22
+ </Provider>,
23
+ );
24
+ const json = component.toJSON();
25
+ expect(json).toMatchSnapshot();
26
+ });
27
+
28
+ it('renders a date view widget component', () => {
29
+ const component = renderer.create(
30
+ <Provider store={store}>
31
+ <DateWidget className="metadata" value="2020-08-04T09:00:00" />
32
+ </Provider>,
33
+ );
34
+ const json = component.toJSON();
35
+ expect(json).toMatchSnapshot();
36
+ });
37
+
38
+ it('renders a date view widget component with custom format', () => {
39
+ const component = renderer.create(
40
+ <Provider store={store}>
41
+ <DateWidget
42
+ className="metadata"
43
+ value="2020-08-04T09:00:00"
44
+ format={{
45
+ year: 'numeric',
46
+ month: 'short',
47
+ day: '2-digit',
48
+ }}
49
+ />
50
+ </Provider>,
51
+ );
52
+ const json = component.toJSON();
53
+ expect(json).toMatchSnapshot();
54
+ });
55
+
56
+ it('renders a date view widget component with children', () => {
57
+ const component = renderer.create(
58
+ <Provider store={store}>
59
+ <DateWidget className="metadata" value="2020-08-04T09:00:00">
60
+ {(child) => <strong>{child}</strong>}
61
+ </DateWidget>
62
+ </Provider>,
63
+ );
64
+ const json = component.toJSON();
65
+ expect(json).toMatchSnapshot();
66
+ });
67
+ });
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ import cx from 'classnames';
3
+ import { useSelector } from 'react-redux';
4
+ import { toBackendLang } from '@plone/volto/helpers';
5
+ import { formatDate } from '@plone/volto/helpers/Utils/Date';
6
+ import config from '@plone/volto/registry';
7
+
8
+ export const DatetimeWidget = ({ value, children, className }) => {
9
+ const lang = useSelector((state) => state.intl.locale);
10
+ const backendLang = toBackendLang(lang);
11
+ const locale =
12
+ backendLang === 'en' ? config.settings.dateLocale : backendLang;
13
+ const formatOptions = {
14
+ date: value,
15
+ format: {
16
+ year: 'numeric',
17
+ month: 'short',
18
+ day: '2-digit',
19
+ hour: '2-digit',
20
+ minute: '2-digit',
21
+ },
22
+ locale,
23
+ includeTime: true,
24
+ formatToParts: true,
25
+ };
26
+
27
+ let formattedParts = formatDate(formatOptions);
28
+
29
+ const formattedDate = formattedParts
30
+ .map((part) => {
31
+ if (part.type === 'literal' && part.value === ', ') {
32
+ return ' ';
33
+ }
34
+ return part.value;
35
+ })
36
+ .join('');
37
+
38
+ return value ? (
39
+ <span className={cx(className, 'datetime', 'widget')}>
40
+ {children ? children(formattedDate) : formattedDate}
41
+ </span>
42
+ ) : (
43
+ ''
44
+ );
45
+ };
@@ -0,0 +1,63 @@
1
+ import React from 'react';
2
+ import renderer from 'react-test-renderer';
3
+ import { DatetimeWidget } from './DatetimeWidget';
4
+ import { Provider } from 'react-intl-redux';
5
+ import configureStore from 'redux-mock-store';
6
+ import thunk from 'redux-thunk';
7
+
8
+ const mockStore = configureStore([thunk]);
9
+
10
+ const store = mockStore({
11
+ intl: {
12
+ locale: 'en-gb',
13
+ messages: {},
14
+ },
15
+ });
16
+
17
+ describe('DatetimeWidget', () => {
18
+ it('renders an empty datetime view widget component', () => {
19
+ const component = renderer.create(
20
+ <Provider store={store}>
21
+ <DatetimeWidget />
22
+ </Provider>,
23
+ );
24
+ const json = component.toJSON();
25
+ expect(json).toMatchSnapshot();
26
+ });
27
+
28
+ it('renders a datetime view widget component with a date and time', () => {
29
+ const component = renderer.create(
30
+ <Provider store={store}>
31
+ <DatetimeWidget className="metadata" value="2024-09-05T15:34:00" />
32
+ </Provider>,
33
+ );
34
+ const json = component.toJSON();
35
+ expect(json).toMatchSnapshot();
36
+ });
37
+
38
+ it('renders a datetime view widget component with children formatting', () => {
39
+ const component = renderer.create(
40
+ <Provider store={store}>
41
+ <DatetimeWidget className="metadata" value="2024-09-05T15:34:00">
42
+ {(formattedDate) => <strong>{formattedDate}</strong>}
43
+ </DatetimeWidget>
44
+ </Provider>,
45
+ );
46
+ const json = component.toJSON();
47
+ expect(json).toMatchSnapshot();
48
+ });
49
+
50
+ it('removes the comma in the formatted date and shows correct time', () => {
51
+ const component = renderer.create(
52
+ <Provider store={store}>
53
+ <DatetimeWidget className="metadata" value="2024-09-05T15:34:00" />
54
+ </Provider>,
55
+ );
56
+ const json = component.toJSON();
57
+ expect(json).toMatchSnapshot();
58
+
59
+ const instance = component.root;
60
+ const span = instance.findByType('span');
61
+ expect(span.props.children).toContain('05 Sept 2024 15:34');
62
+ });
63
+ });
package/src/index.js CHANGED
@@ -1,3 +1,11 @@
1
+ import React from 'react';
2
+ import { v4 as uuid } from 'uuid';
3
+ import { Icon } from '@plone/volto/components';
4
+ import { default as TokenWidgetEdit } from '@plone/volto/components/manage/Widgets/TokenWidget';
5
+ import SelectAutoCompleteWidget from '@plone/volto/components/manage/Widgets/SelectAutoComplete';
6
+ import { serializeNodesToText } from '@plone/volto-slate/editor/render';
7
+ import { nanoid } from '@plone/volto-slate/utils';
8
+
1
9
  import InpageNavigation from '@eeacms/volto-eea-design-system/ui/InpageNavigation/InpageNavigation';
2
10
  import CustomCSS from '@eeacms/volto-eea-website-theme/components/theme/CustomCSS/CustomCSS';
3
11
  import DraftBackground from '@eeacms/volto-eea-website-theme/components/theme/DraftBackground/DraftBackground';
@@ -6,11 +14,10 @@ import HomePageView from '@eeacms/volto-eea-website-theme/components/theme/Homep
6
14
  import NotFound from '@eeacms/volto-eea-website-theme/components/theme/NotFound/NotFound';
7
15
  import { TokenWidget } from '@eeacms/volto-eea-website-theme/components/theme/Widgets/TokenWidget';
8
16
  import { TopicsWidget } from '@eeacms/volto-eea-website-theme/components/theme/Widgets/TopicsWidget';
17
+ import { DateWidget } from '@eeacms/volto-eea-website-theme/components/theme/Widgets/DateWidget';
18
+ import { DatetimeWidget } from '@eeacms/volto-eea-website-theme/components/theme/Widgets/DatetimeWidget';
9
19
  import CreatableSelectWidget from '@eeacms/volto-eea-website-theme/components/theme/Widgets/CreatableSelectWidget';
10
20
 
11
- import { Icon } from '@plone/volto/components';
12
- import { default as TokenWidgetEdit } from '@plone/volto/components/manage/Widgets/TokenWidget';
13
- import { serializeNodesToText } from '@plone/volto-slate/editor/render';
14
21
  import Tag from '@eeacms/volto-eea-design-system/ui/Tag/Tag';
15
22
 
16
23
  import {
@@ -30,11 +37,8 @@ import okMiddleware from './middleware/ok';
30
37
  import voltoCustomMiddleware from './middleware/voltoCustom';
31
38
  import installSlate from './slate';
32
39
  import { print } from './reducers';
33
- import { nanoid } from '@plone/volto-slate/utils';
34
- import { v4 as uuid } from 'uuid';
35
40
 
36
41
  import * as eea from './config';
37
- import React from 'react';
38
42
 
39
43
  const restrictedBlocks = ['imagesGrid', 'teaser', 'dataFigure', 'plotly_chart'];
40
44
 
@@ -330,11 +334,17 @@ const applyConfig = (config) => {
330
334
  }
331
335
 
332
336
  // Custom Widgets
333
- config.widgets.id.other_organisations = TokenWidgetEdit;
337
+ // config.widgets.id.other_organisations = TokenWidgetEdit;
338
+ config.widgets.vocabulary['eea.coremetadata.other_organisations'] =
339
+ TokenWidgetEdit;
340
+ config.widgets.views.widget.datetime = DatetimeWidget;
341
+ config.widgets.views.widget.date = DateWidget;
334
342
  config.widgets.views.id.topics = TopicsWidget;
335
343
  config.widgets.views.id.subjects = TokenWidget;
336
344
  config.widgets.views.widget.tags = TokenWidget;
337
345
  config.widgets.widget.creatable_select = CreatableSelectWidget;
346
+ config.widgets.vocabulary['plone.app.vocabularies.Users'] =
347
+ SelectAutoCompleteWidget;
338
348
 
339
349
  // /voltoCustom.css express-middleware
340
350
  // /ok express-middleware - see also: https://github.com/plone/volto/pull/4432
package/src/index.test.js CHANGED
@@ -92,6 +92,7 @@ describe('applyConfig', () => {
92
92
  },
93
93
  },
94
94
  widget: {},
95
+ vocabulary: {},
95
96
  id: {},
96
97
  },
97
98
  settings: {
@@ -247,6 +248,7 @@ describe('applyConfig', () => {
247
248
  },
248
249
  widget: {},
249
250
  id: {},
251
+ vocabulary: {},
250
252
  },
251
253
  settings: {
252
254
  eea: {},