@eeacms/volto-eea-website-theme 1.24.3 → 1.26.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,15 +4,33 @@ 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.26.0](https://github.com/eea/volto-eea-website-theme/compare/1.25.0...1.26.0) - 13 December 2023
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix: remove schema if content type is not the same as for the schema [Miu Razvan - [`0056fa9`](https://github.com/eea/volto-eea-website-theme/commit/0056fa9d68efb7d2f118c9767d756efbfb100f21)]
12
+
13
+ #### :hammer_and_wrench: Others
14
+
15
+ - bump version [Miu Razvan - [`69ee513`](https://github.com/eea/volto-eea-website-theme/commit/69ee51378cf6f5dddab0d5c54c3f5e4942756562)]
16
+ - fix tests [Miu Razvan - [`aa3d5c9`](https://github.com/eea/volto-eea-website-theme/commit/aa3d5c9aee1a49f7cdeb760c074f66029504c4de)]
17
+ - clean up [Miu Razvan - [`2a3f3dc`](https://github.com/eea/volto-eea-website-theme/commit/2a3f3dc14203b5641ee325256503527d550e9c5b)]
18
+ ### [1.25.0](https://github.com/eea/volto-eea-website-theme/compare/1.24.3...1.25.0) - 13 December 2023
19
+
20
+ #### :house: Documentation changes
21
+
22
+ - docs: Update Sidbar customizations README [Alin Voinea - [`7a39ac0`](https://github.com/eea/volto-eea-website-theme/commit/7a39ac0b74aaa0e8f4d0d77d7b6718f297979228)]
23
+ - docs: Add Sidebar customizations README [Alin Voinea - [`dd220bd`](https://github.com/eea/volto-eea-website-theme/commit/dd220bd4b977320860392a7637b441a41354936d)]
24
+
25
+ #### :hammer_and_wrench: Others
26
+
27
+ - Release 1.25.0 [Alin Voinea - [`ed2083b`](https://github.com/eea/volto-eea-website-theme/commit/ed2083b6dc1150c6d030f988fbfd94103777844e)]
7
28
  ### [1.24.3](https://github.com/eea/volto-eea-website-theme/compare/1.24.2...1.24.3) - 5 December 2023
8
29
 
9
30
  #### :rocket: New Features
10
31
 
11
32
  - feat: modify the password reset page - refs #259024 [ana-oprea - [`966e441`](https://github.com/eea/volto-eea-website-theme/commit/966e44163b43f8d41535617f0bb491210465751e)]
12
33
 
13
- #### :hammer_and_wrench: Others
14
-
15
- - Update Twitter logo in Share to section. [Ghiță Bizău - [`b9c7426`](https://github.com/eea/volto-eea-website-theme/commit/b9c7426cc29cf1a981603219cec9c780cd43973b)]
16
34
  ### [1.24.2](https://github.com/eea/volto-eea-website-theme/compare/1.24.1...1.24.2) - 4 December 2023
17
35
 
18
36
  #### :bug: Bug Fixes
package/README.md CHANGED
@@ -25,6 +25,10 @@ EEA Website [Volto](https://github.com/plone/volto) Theme
25
25
  See [Docusaurus](https://eea.github.io/).
26
26
  See [Storybook](https://eea.github.io/eea-storybook/).
27
27
 
28
+ ## Volto customizations
29
+
30
+ - `volto/components/manage/Sidebar/SidebarPopup` -> https://github.com/plone/volto/pull/5520
31
+
28
32
  ## Getting started
29
33
 
30
34
  ### Try volto-eea-website-theme with Docker
@@ -46,25 +50,25 @@ Go to http://localhost:3000
46
50
 
47
51
  1. Start Volto frontend
48
52
 
49
- * If you already have a volto project, just update `package.json`:
53
+ - If you already have a volto project, just update `package.json`:
50
54
 
51
- ```JSON
52
- "addons": [
53
- "@eeacms/volto-eea-website-theme"
54
- ],
55
+ ```JSON
56
+ "addons": [
57
+ "@eeacms/volto-eea-website-theme"
58
+ ],
55
59
 
56
- "dependencies": {
57
- "@eeacms/volto-eea-website-theme": "*"
58
- }
59
- ```
60
+ "dependencies": {
61
+ "@eeacms/volto-eea-website-theme": "*"
62
+ }
63
+ ```
60
64
 
61
- * If not, create one:
65
+ - If not, create one:
62
66
 
63
- ```
64
- npm install -g yo @plone/generator-volto
65
- yo @plone/volto my-volto-project --canary --addon @eeacms/volto-eea-website-theme
66
- cd my-volto-project
67
- ```
67
+ ```
68
+ npm install -g yo @plone/generator-volto
69
+ yo @plone/volto my-volto-project --canary --addon @eeacms/volto-eea-website-theme
70
+ cd my-volto-project
71
+ ```
68
72
 
69
73
  1. Install new add-ons and restart Volto:
70
74
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-website-theme",
3
- "version": "1.24.3",
3
+ "version": "1.26.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 @@
1
+ export * from './schema';
@@ -0,0 +1,5 @@
1
+ export function removeSchema() {
2
+ return {
3
+ type: 'REMOVE_SCHEMA',
4
+ };
5
+ }
@@ -0,0 +1,24 @@
1
+ import { useEffect } from 'react';
2
+ import { connect } from 'react-redux';
3
+ import { removeSchema } from '@eeacms/volto-eea-website-theme/actions';
4
+
5
+ function RemoveSchema({ removeSchema, content, schema }) {
6
+ useEffect(() => {
7
+ if (
8
+ schema.schema &&
9
+ (!content || (content && schema.contentType !== content['@type']))
10
+ ) {
11
+ removeSchema();
12
+ }
13
+ }, [removeSchema, content, schema]);
14
+
15
+ return null;
16
+ }
17
+
18
+ export default connect(
19
+ (state) => ({
20
+ content: state.content.data,
21
+ schema: state.schema,
22
+ }),
23
+ { removeSchema },
24
+ )(RemoveSchema);
@@ -0,0 +1,9 @@
1
+ ## SidebarPopup
2
+
3
+ - https://github.com/plone/volto/pull/5520/files
4
+ - refs #257682
5
+
6
+ ## ObjectBrowserNav
7
+
8
+ - Allow previewing images when selecting them with the file picker
9
+ - refs #152099
@@ -0,0 +1,82 @@
1
+ // Check this https://github.com/plone/volto/pull/5520
2
+ import React from 'react';
3
+ import { Portal } from 'react-portal';
4
+ import { CSSTransition } from 'react-transition-group';
5
+ import PropTypes from 'prop-types';
6
+ import { doesNodeContainClick } from 'semantic-ui-react/dist/commonjs/lib';
7
+
8
+ const DEFAULT_TIMEOUT = 500;
9
+
10
+ const SidebarPopup = (props) => {
11
+ const { children, open, onClose, overlay } = props;
12
+
13
+ const asideElement = React.useRef();
14
+
15
+ const handleClickOutside = (e) => {
16
+ if (asideElement && doesNodeContainClick(asideElement.current, e)) return;
17
+ onClose();
18
+ };
19
+
20
+ React.useEffect(() => {
21
+ document.addEventListener('mousedown', handleClickOutside, false);
22
+ return () => {
23
+ document.removeEventListener('mousedown', handleClickOutside, false);
24
+ };
25
+ });
26
+
27
+ return (
28
+ <>
29
+ {overlay && (
30
+ <CSSTransition
31
+ in={open}
32
+ timeout={DEFAULT_TIMEOUT}
33
+ classNames="overlay-container"
34
+ unmountOnExit
35
+ >
36
+ <Portal node={document?.body}>
37
+ <div className="overlay-container"></div>
38
+ </Portal>
39
+ </CSSTransition>
40
+ )}
41
+ <CSSTransition
42
+ in={open}
43
+ timeout={DEFAULT_TIMEOUT}
44
+ classNames="sidebar-container"
45
+ unmountOnExit
46
+ >
47
+ <Portal>
48
+ <aside
49
+ id="test"
50
+ role="presentation"
51
+ onClick={(e) => {
52
+ e.stopPropagation();
53
+ }}
54
+ onKeyDown={(e) => {
55
+ e.stopPropagation();
56
+ }}
57
+ ref={asideElement}
58
+ key="sidebarpopup"
59
+ className="sidebar-container"
60
+ style={{ overflowY: 'auto' }}
61
+ >
62
+ {children}
63
+ </aside>
64
+ </Portal>
65
+ </CSSTransition>
66
+ </>
67
+ );
68
+ };
69
+
70
+ SidebarPopup.propTypes = {
71
+ open: PropTypes.bool,
72
+ onClose: PropTypes.func,
73
+ overlay: PropTypes.bool,
74
+ };
75
+
76
+ SidebarPopup.defaultProps = {
77
+ open: false,
78
+ onClose: () => {},
79
+ overlay: false,
80
+ };
81
+
82
+ export default SidebarPopup;
package/src/index.js CHANGED
@@ -26,6 +26,8 @@ import contentBoxSVG from './icons/content-box.svg';
26
26
  import okMiddleware from './middleware/ok';
27
27
  import voltoCustomMiddleware from './middleware/voltoCustom';
28
28
  import installSlate from './slate';
29
+ import installReducers from './reducers';
30
+ import installMiddlewares from './middleware';
29
31
 
30
32
  import * as eea from './config';
31
33
  import React from 'react';
@@ -493,7 +495,10 @@ const applyConfig = (config) => {
493
495
  });
494
496
 
495
497
  // Custom blocks: Title
496
- return [installCustomTitle].reduce((acc, apply) => apply(acc), config);
498
+ return [installCustomTitle, installMiddlewares, installReducers].reduce(
499
+ (acc, apply) => apply(acc),
500
+ config,
501
+ );
497
502
  };
498
503
 
499
504
  export default applyConfig;
package/src/index.test.js CHANGED
@@ -45,12 +45,17 @@ jest.mock(
45
45
  jest.mock('@plone/volto/components', () => ({
46
46
  Icon: 'MockedIcon',
47
47
  }));
48
+ jest.mock(
49
+ '@eeacms/volto-eea-website-theme/components/theme/AppExtras/RemoveSchema',
50
+ () => 'MockedRemoveSchema',
51
+ );
48
52
 
49
53
  global.__SERVER__ = true;
50
54
 
51
55
  describe('applyConfig', () => {
52
56
  it('should update the config settings with EEA specific settings', () => {
53
57
  const originalConfig = {
58
+ addonReducers: {},
54
59
  blocks: {
55
60
  blocksConfig: {
56
61
  title: {
@@ -139,6 +144,7 @@ describe('applyConfig', () => {
139
144
  { match: '', component: 'MockedDraftBackground' },
140
145
  { match: '', component: 'MockedSubsiteClass' },
141
146
  { match: '', component: BaseTag },
147
+ { match: '*', component: 'MockedRemoveSchema' },
142
148
  ]);
143
149
  expect(config.settings.available_colors).toEqual(eea.colors);
144
150
  expect(config.settings.hasLanguageDropdown).toBe(false);
@@ -183,6 +189,7 @@ describe('applyConfig', () => {
183
189
 
184
190
  it('should update the config settings with EEA specific settings', () => {
185
191
  const originalConfig = {
192
+ addonReducers: {},
186
193
  blocks: {
187
194
  blocksConfig: {
188
195
  title: {
@@ -296,6 +303,7 @@ describe('applyConfig', () => {
296
303
  { match: '', component: 'MockedDraftBackground' },
297
304
  { match: '', component: 'MockedSubsiteClass' },
298
305
  { match: '', component: BaseTag },
306
+ { match: '*', component: 'MockedRemoveSchema' },
299
307
  ]);
300
308
  expect(config.settings.available_colors).toEqual(eea.colors);
301
309
  expect(config.settings.hasLanguageDropdown).toBe(false);
@@ -0,0 +1,11 @@
1
+ export default function apiEnhencar(middlewares) {
2
+ return [
3
+ () => (next) => (action) => {
4
+ if (action.request) {
5
+ return next({ ...action, _request: action.request });
6
+ }
7
+ return next(action);
8
+ },
9
+ ...middlewares,
10
+ ];
11
+ }
@@ -0,0 +1,10 @@
1
+ import apiEnhancer from './apiEnhancer';
2
+
3
+ export default function applyConfig(config) {
4
+ config.settings.storeExtenders = [
5
+ ...(config.settings.storeExtenders || []),
6
+ apiEnhancer,
7
+ ];
8
+
9
+ return config;
10
+ }
@@ -0,0 +1,17 @@
1
+ import RemoveSchema from '@eeacms/volto-eea-website-theme/components/theme/AppExtras/RemoveSchema';
2
+
3
+ import schema from './schema';
4
+
5
+ export default function applyConfig(config) {
6
+ config.addonReducers.schema = schema;
7
+
8
+ config.settings.appExtras = [
9
+ ...(config.settings.appExtras || []),
10
+ {
11
+ match: '*',
12
+ component: RemoveSchema,
13
+ },
14
+ ];
15
+
16
+ return config;
17
+ }
@@ -0,0 +1,48 @@
1
+ import voltoSchema from '@plone/volto/reducers/schema/schema';
2
+
3
+ const initialState = {
4
+ contentUrl: null,
5
+ contentType: null,
6
+ error: null,
7
+ loaded: false,
8
+ loading: false,
9
+ schema: null,
10
+ post: {
11
+ loaded: false,
12
+ loading: false,
13
+ error: null,
14
+ },
15
+ update: {
16
+ loaded: false,
17
+ loading: false,
18
+ error: null,
19
+ },
20
+ put: {
21
+ loaded: false,
22
+ loading: false,
23
+ error: null,
24
+ },
25
+ };
26
+
27
+ export default function schema(state = initialState, action = {}) {
28
+ if (action.type === 'REMOVE_SCHEMA') {
29
+ return {
30
+ ...state,
31
+ error: null,
32
+ loading: false,
33
+ loaded: true,
34
+ schema: null,
35
+ };
36
+ }
37
+
38
+ if (action.type === 'GET_SCHEMA_SUCCESS') {
39
+ const [contentUrl, contentType] = action._request.path.split('/@types/');
40
+ return {
41
+ ...voltoSchema(state, action),
42
+ contentUrl,
43
+ contentType,
44
+ };
45
+ }
46
+
47
+ return voltoSchema(state, action);
48
+ }