@eeacms/volto-marine-policy 2.0.1 → 2.0.3

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,51 @@ 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.0.3](https://github.com/eea/volto-marine-policy/compare/2.0.2...2.0.3) - 4 March 2025
8
+
9
+ #### :rocket: Dependency updates
10
+
11
+ - Release @eeacms/volto-searchlib@2.0.12 - resolutions [EEA Jenkins - [`51b3ca7`](https://github.com/eea/volto-marine-policy/commit/51b3ca7af1d677b3dc67b1b6fa5f9e7db78a208c)]
12
+ - Release @eeacms/volto-searchlib@2.0.11 - resolutions [EEA Jenkins - [`1aa9711`](https://github.com/eea/volto-marine-policy/commit/1aa9711cb195bdd7423fe54b253b5d424960c56d)]
13
+ - Release @eeacms/volto-searchlib@2.0.10 - resolutions [EEA Jenkins - [`7e3fe5e`](https://github.com/eea/volto-marine-policy/commit/7e3fe5ea86d612f42cafbb9c606ba15e0fc23028)]
14
+ - Release @eeacms/volto-searchlib@2.0.9 - resolutions [EEA Jenkins - [`0e1f63c`](https://github.com/eea/volto-marine-policy/commit/0e1f63ce5e86a13a3acc0e077e9017217d312fcc)]
15
+ - Release @eeacms/volto-searchlib@2.0.8 - resolutions [EEA Jenkins - [`7af5f35`](https://github.com/eea/volto-marine-policy/commit/7af5f3553c17ed36118650dccdc6b79257da70c0)]
16
+ - Release @eeacms/volto-searchlib@2.0.7 - resolutions [EEA Jenkins - [`30e012b`](https://github.com/eea/volto-marine-policy/commit/30e012be79c60009bab799748070a480936aa9c7)]
17
+ - Release @eeacms/volto-searchlib@2.0.6 - resolutions [EEA Jenkins - [`7a3fee8`](https://github.com/eea/volto-marine-policy/commit/7a3fee8819208e8119b9c0721c4b8494b95f0659)]
18
+ - Release @eeacms/volto-searchlib@2.0.5 - resolutions [EEA Jenkins - [`8e46c87`](https://github.com/eea/volto-marine-policy/commit/8e46c873917ef730279661eee54032dc365f1452)]
19
+ - Release @eeacms/volto-searchlib@2.0.4 - resolutions [EEA Jenkins - [`2f5fc8f`](https://github.com/eea/volto-marine-policy/commit/2f5fc8f5bd514dc0d31f6c5e4800ea1ad18f90bd)]
20
+
21
+ #### :bug: Bug Fixes
22
+
23
+ - fix(print): more CSS fixes - refs #284607 [kreafox - [`75e5ecc`](https://github.com/eea/volto-marine-policy/commit/75e5eccd7cc83a10913476aca14f669b9635721b)]
24
+ - fix(print): more CSS fixes - refs #284607 [kreafox - [`e5b4439`](https://github.com/eea/volto-marine-policy/commit/e5b4439b8181df1ee4b6b4dc57301bc437f3beba)]
25
+ - fix(print): Fix print styling issues [kreafox - [`3269aa4`](https://github.com/eea/volto-marine-policy/commit/3269aa40f8279411bcceedf884ae2ec18137b20a)]
26
+
27
+ #### :house: Internal changes
28
+
29
+ - style: Automated code fix [eea-jenkins - [`96efaf0`](https://github.com/eea/volto-marine-policy/commit/96efaf0e8bccd19cd14b34fe2aa4b6facf53ed41)]
30
+ - style: Automated code fix [eea-jenkins - [`8b70571`](https://github.com/eea/volto-marine-policy/commit/8b7057105084b1f26838065e7f9262da204b6999)]
31
+
32
+ #### :hammer_and_wrench: Others
33
+
34
+ - test: remove DatabaseItemView.test.jsx [laszlocseh - [`ddd177b`](https://github.com/eea/volto-marine-policy/commit/ddd177b0af0bbd235570d721e4e3e627ca870380)]
35
+ - test: remove DatabaseItemView.test.jsx [laszlocseh - [`85b142a`](https://github.com/eea/volto-marine-policy/commit/85b142ae46636df23f635add8b227a22656de508)]
36
+ - test: remove DatabaseItemView.test.jsx [laszlocseh - [`fa65b1e`](https://github.com/eea/volto-marine-policy/commit/fa65b1ebd8d53cf791d6d53c97888a75d73f71b8)]
37
+ - test: fix DatabaseItemView.test.jsx [laszlocseh - [`0fee8a6`](https://github.com/eea/volto-marine-policy/commit/0fee8a616aa7f5024e9bc9a5e6d716a137979006)]
38
+ - test: added DatabaseItemView.test.jsx to increase coverage [laszlocseh - [`111d218`](https://github.com/eea/volto-marine-policy/commit/111d218796ff4beac06b84a34b04fdacc7296093)]
39
+ - remove ContextNavigation block, moved to separate addon [laszlocseh - [`deb9bef`](https://github.com/eea/volto-marine-policy/commit/deb9bef04d394537f7201c6df6f3cdb3769d4639)]
40
+ - Update dependencies [kreafox - [`ac359b6`](https://github.com/eea/volto-marine-policy/commit/ac359b6711be1ddf1a8b9cd31fdba1ef54806212)]
41
+ ### [2.0.2](https://github.com/eea/volto-marine-policy/compare/2.0.1...2.0.2) - 8 November 2024
42
+
43
+ #### :rocket: Dependency updates
44
+
45
+ - Release @eeacms/volto-searchlib@2.0.3 - resolutions [EEA Jenkins - [`0878ef3`](https://github.com/eea/volto-marine-policy/commit/0878ef3c784e9ab3da9f991b68a8e2fc01ab76a4)]
46
+ - Release @eeacms/volto-searchlib@2.0.2 - resolutions [EEA Jenkins - [`c4788f8`](https://github.com/eea/volto-marine-policy/commit/c4788f8bd5b63f658263002e3746304720fa943b)]
47
+
48
+ #### :house: Internal changes
49
+
50
+ - style: remove .documentFirstHeading border-bottom [laszlocseh - [`8aec7be`](https://github.com/eea/volto-marine-policy/commit/8aec7be7c82617e698eb160d0c2434df7f363d73)]
51
+
7
52
  ### [2.0.1](https://github.com/eea/volto-marine-policy/compare/2.0.0...2.0.1) - 26 July 2024
8
53
 
9
54
  #### :bug: Bug Fixes
@@ -41,10 +41,10 @@ module.exports = {
41
41
  },
42
42
  coverageThreshold: {
43
43
  global: {
44
- branches: 5,
45
- functions: 5,
46
- lines: 5,
47
- statements: 5,
44
+ branches: 4,
45
+ functions: 4,
46
+ lines: 4,
47
+ statements: 4,
48
48
  },
49
49
  },
50
50
  ...(process.env.JEST_USE_SETUP === 'ON' && {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-marine-policy",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "@eeacms/volto-marine-policy: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -26,23 +26,22 @@
26
26
  "resolutions": {
27
27
  "react-countup/countup.js": "2.5.0",
28
28
  "d3-array": "^2.12.1",
29
- "@eeacms/volto-searchlib": "1.0.0",
30
29
  "@eeacms/countup": "^2.0.6",
31
30
  "@elastic/search-ui": "1.21.2"
32
31
  },
33
32
  "dependencies": {
34
33
  "@eeacms/volto-eea-design-system": "*",
35
- "@eeacms/volto-eea-website-theme": "^2.1.2",
36
- "@eeacms/volto-searchlib": "^2.0.2",
37
- "@eeacms/volto-embed": "^10.0.2",
38
- "@eeacms/volto-globalsearch": "^2.0.0",
39
- "@eeacms/volto-tabs-block": "^8.0.0",
34
+ "@eeacms/volto-eea-website-theme": "*",
35
+ "@eeacms/volto-embed": "*",
36
+ "@eeacms/volto-globalsearch": "2.0.8",
37
+ "@eeacms/volto-searchlib": "2.0.12",
38
+ "@eeacms/volto-tabs-block": "*",
40
39
  "axios": "0.25.0",
40
+ "d3-array": "^2.12.1",
41
41
  "jquery": "3.6.0",
42
42
  "razzle-plugin-scss": "^4.2.18",
43
43
  "react-lazy-load-image-component": "^1.4.0",
44
44
  "react-slick": "^0.24.0",
45
- "d3-array": "^2.12.1",
46
45
  "slick-carousel": "^1.8.1"
47
46
  },
48
47
  "devDependencies": {
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import { BodyClass } from '@plone/volto/helpers';
3
2
  import {
4
3
  ItemMetadataSnippet,
package/src/index.js CHANGED
@@ -14,7 +14,6 @@ import installMsfdDataExplorerBlock from './components/Blocks/MsfdDataExplorerBl
14
14
  import { breadcrumb, localnavigation } from './reducers';
15
15
  import customBlockTemplates from '@eeacms/volto-marine-policy/components/Blocks/CustomBlockTemplates/customBlockTemplates';
16
16
  import TextAlignWidget from './components/Widgets/TextAlign';
17
- import installContextNavigation from './components/Blocks/ContextNavigation';
18
17
  import './slate-styles.less';
19
18
 
20
19
  import installSearchEngine from './search';
@@ -127,12 +126,12 @@ const applyConfig = (config) => {
127
126
  };
128
127
 
129
128
  // on home contextNavigation should return false
130
- config.blocks.blocksConfig.contextNavigation = {
131
- ...config.blocks.blocksConfig.contextNavigation,
132
- blockHasValue: (data) => {
133
- return data.pathname !== '/';
134
- },
135
- };
129
+ // config.blocks.blocksConfig.contextNavigation = {
130
+ // ...config.blocks.blocksConfig.contextNavigation,
131
+ // blockHasValue: (data) => {
132
+ // return data.pathname !== '/';
133
+ // },
134
+ // };
136
135
  config.blocks.blocksConfig.listing = {
137
136
  ...config.blocks.blocksConfig.listing,
138
137
  variations: [
@@ -269,9 +268,6 @@ const applyConfig = (config) => {
269
268
 
270
269
  config.settings.openExternalLinkInNewTab = true;
271
270
 
272
- if (config.blocks.blocksConfig.contextNavigation)
273
- config.blocks.blocksConfig.contextNavigation.restricted = false;
274
-
275
271
  config.settings.pluggableStyles = [
276
272
  ...(config.settings.pluggableStyles || []),
277
273
  {
@@ -516,11 +512,10 @@ const applyConfig = (config) => {
516
512
  const [installLinkEditor] = makeInlineElementPlugin(opts);
517
513
  config = installLinkEditor(config);
518
514
 
519
- const final = [
520
- installMsfdDataExplorerBlock,
521
- installSearchEngine,
522
- installContextNavigation,
523
- ].reduce((acc, apply) => apply(acc), config);
515
+ const final = [installMsfdDataExplorerBlock, installSearchEngine].reduce(
516
+ (acc, apply) => apply(acc),
517
+ config,
518
+ );
524
519
 
525
520
  return final;
526
521
  };
@@ -0,0 +1,64 @@
1
+ @media print {
2
+ a {
3
+ word-break: break-word;
4
+ }
5
+
6
+ .logo {
7
+ margin-left: 0 !important;
8
+ }
9
+
10
+ .block.call-to-action,
11
+ .block.context-navigation {
12
+ display: none;
13
+ }
14
+
15
+ .content-box-inner {
16
+ padding: 25px !important;
17
+
18
+ .column-blocks-wrapper {
19
+ margin-bottom: 0;
20
+ }
21
+ }
22
+
23
+ [class~='container'] > [class*='styled-'] {
24
+ margin-top: 0.5rem;
25
+ margin-bottom: 0.5rem;
26
+ }
27
+
28
+ .ui.section.divider {
29
+ margin-top: 0.5rem;
30
+ margin-bottom: 0.5rem;
31
+ }
32
+
33
+ .ui.grid > .row > [class*='twelve wide'].column,
34
+ .ui.grid > .column.row > [class*='twelve wide'].column,
35
+ .ui.grid > [class*='twelve wide'].column,
36
+ .ui.column.grid > [class*='twelve wide'].column {
37
+ padding: 0 25px !important;
38
+ }
39
+
40
+ .visualization,
41
+ .content-box-inner,
42
+ .embed-map,
43
+ .embed-tableau,
44
+ .embed-map-visualization,
45
+ .embed-visualization {
46
+ break-inside: avoid;
47
+ }
48
+ }
49
+
50
+ @media print and (min-width: 600px) {
51
+ .columns-view {
52
+ .ui.grid > .row > [class*='four wide computer'].column,
53
+ .ui.grid > .column.row > [class*='four wide computer'].column,
54
+ .ui.grid > [class*='four wide computer'].column,
55
+ .ui.column.grid > [class*='four wide computer'].column {
56
+ width: @fourWide !important;
57
+ }
58
+ }
59
+ }
60
+
61
+ @page {
62
+ margin-top: 15mm;
63
+ margin-bottom: 15mm;
64
+ }
@@ -2,6 +2,16 @@
2
2
  Global Overrides
3
3
  *******************************/
4
4
 
5
+ @import '../extras/print';
6
+
7
+ .documentFirstHeading {
8
+ border-bottom: none !important;
9
+
10
+ &::before {
11
+ border-bottom: none !important;
12
+ }
13
+ }
14
+
5
15
  #page-document > blockquote {
6
16
  margin-right: revert !important;
7
17
  margin-left: revert !important;
@@ -191,7 +201,9 @@ body.view-viewview .full {
191
201
  }
192
202
  }
193
203
 
194
- body.view-viewview.has-toolbar-collapsed:not(.has-sidebar):not(.has-sidebar-collapsed) {
204
+ body.view-viewview.has-toolbar-collapsed:not(.has-sidebar):not(
205
+ .has-sidebar-collapsed
206
+ ) {
195
207
  .full > div {
196
208
  width: calc(100% - @collapsedToolbarWidth) !important;
197
209
  }
@@ -224,7 +236,9 @@ body.view-viewview .full {
224
236
 
225
237
  @media screen and (max-width: @largestMobileScreen) {
226
238
  body.view-viewview.has-toolbar:not(.has-sidebar):not(.has-sidebar-collapsed),
227
- body.view-viewview.has-toolbar-collapsed:not(.has-sidebar):not(.has-sidebar-collapsed) {
239
+ body.view-viewview.has-toolbar-collapsed:not(.has-sidebar):not(
240
+ .has-sidebar-collapsed
241
+ ) {
228
242
  .full > div {
229
243
  width: 100% !important;
230
244
  }
@@ -364,8 +378,8 @@ body.custom-page-header .breadcrumbs {
364
378
  }
365
379
 
366
380
  @media only screen and (max-height: @tabletBreakpoint) {
367
- #toolbar .toolbar-content.show {
381
+ #toolbar .toolbar-content.show {
368
382
  max-height: 700px !important;
369
383
  z-index: 5;
384
+ }
370
385
  }
371
- }
@@ -1,6 +1,7 @@
1
1
  /*******************************
2
2
  Site Settings
3
3
  *******************************/
4
+
4
5
  @import '../extras/mixins';
5
6
 
6
7
  /*-------------------
@@ -1,85 +0,0 @@
1
- import React from 'react';
2
- import { Accordion as SemanticAccordion, Icon } from 'semantic-ui-react';
3
- import AccordionContent from './AccordionContent';
4
- import { useHistory } from 'react-router-dom';
5
-
6
- const Accordion = (props) => {
7
- const { items = {}, curent_location, activeMenu, data = {} } = props;
8
- const [currentIndex, setIndex] = React.useState(activeMenu ?? 0);
9
- const [showChildren, setShowChildren] = React.useState(false);
10
- const history = useHistory();
11
-
12
- const handleClick = (e, item) => {
13
- let itemUrl = '/' + item['@id'].split('/').slice(3).join('/');
14
- history.push(itemUrl);
15
- };
16
-
17
- const handleIconClick = (e, index) => {
18
- e.stopPropagation();
19
- const newIndex = currentIndex === index ? -1 : index;
20
- setIndex(newIndex);
21
- };
22
-
23
- return (
24
- <>
25
- <div className="context-navigation-header">{data?.title}</div>
26
- {items.map((item, index) => {
27
- const { id } = item;
28
- const active = currentIndex === index;
29
-
30
- return (
31
- <SemanticAccordion id={id} key={index} className="secondary">
32
- <SemanticAccordion.Title
33
- role="button"
34
- tabIndex={0}
35
- active={activeMenu === index}
36
- aria-expanded={activeMenu === index}
37
- index={index}
38
- onClick={(e) => {
39
- handleClick(e, item);
40
- }}
41
- onKeyDown={(e) => {
42
- if (e.keyCode === 13 || e.keyCode === 32) {
43
- e.preventDefault();
44
- handleClick(e, item);
45
- }
46
- }}
47
- >
48
- <span className="item-title">{item.title}</span>
49
- {active && showChildren ? (
50
- <Icon
51
- className="ri-arrow-up-s-line"
52
- onClick={(e) => {
53
- handleIconClick(e, index);
54
- }}
55
- />
56
- ) : showChildren ? (
57
- <Icon
58
- className="ri-arrow-down-s-line"
59
- onClick={(e) => {
60
- handleIconClick(e, index);
61
- }}
62
- />
63
- ) : null}
64
- </SemanticAccordion.Title>
65
- <SemanticAccordion.Content active={active && showChildren}>
66
- <AccordionContent
67
- curent_location={curent_location}
68
- key={index}
69
- main={{
70
- title: item.title,
71
- href: item['@id'],
72
- url: item.url,
73
- }}
74
- data={data}
75
- setShowChildren={setShowChildren}
76
- />
77
- </SemanticAccordion.Content>
78
- </SemanticAccordion>
79
- );
80
- })}
81
- </>
82
- );
83
- };
84
-
85
- export default Accordion;
@@ -1,106 +0,0 @@
1
- import React from 'react';
2
- import { MemoryRouter } from 'react-router-dom';
3
- import configureStore from 'redux-mock-store';
4
- import { render, fireEvent, waitFor, screen } from '@testing-library/react';
5
- import '@testing-library/jest-dom/extend-expect';
6
- import { Provider } from 'react-intl-redux';
7
- import Accordion from './Accordion';
8
-
9
- const mockStore = configureStore();
10
-
11
- describe('RASTAccordion', () => {
12
- let store;
13
- let data;
14
-
15
- beforeEach(() => {
16
- store = mockStore({
17
- userSession: { token: '1234' },
18
- intl: {
19
- locale: 'en',
20
- messages: {},
21
- },
22
- content: {
23
- subrequests: {},
24
- },
25
- });
26
-
27
- data = {
28
- items: [
29
- {
30
- id: 'item1',
31
- title: 'Item 1',
32
- '@id': '/item1',
33
- '@type': 'Folder',
34
- href: '/item1-href',
35
- },
36
- {
37
- id: 'item2',
38
- title: 'Item 2',
39
- '@id': '/item2',
40
- '@type': 'Folder',
41
- href: '/item2-href',
42
- },
43
- ],
44
- activeMenu: 1,
45
- curent_location: '/item1-href',
46
- data: { title: "Accordion's Title" },
47
- };
48
- });
49
-
50
- it('renders the component with initial data', () => {
51
- const { getByText } = render(
52
- <Provider store={store}>
53
- <MemoryRouter>
54
- <Accordion {...data} />
55
- </MemoryRouter>
56
- </Provider>,
57
- );
58
-
59
- expect(getByText('Item 1')).toBeInTheDocument();
60
- expect(getByText('Item 2')).toBeInTheDocument();
61
- });
62
-
63
- it('navigates to correct path on item click', () => {
64
- const { getByText, history } = render(
65
- <Provider store={store}>
66
- <MemoryRouter>
67
- <Accordion {...data} />
68
- </MemoryRouter>
69
- </Provider>,
70
- );
71
-
72
- fireEvent.click(getByText('Item 1'));
73
- waitFor(() => expect(history.location.pathname).toBe('/item1'));
74
- });
75
-
76
- it('clicks on accordion items', () => {
77
- const { container } = render(
78
- <Provider store={store}>
79
- <MemoryRouter>
80
- <Accordion {...data} />
81
- </MemoryRouter>
82
- </Provider>,
83
- );
84
-
85
- screen.debug();
86
-
87
- // check that item1 is expanded by default
88
- expect(container.querySelector('#item2 .active.title')).toBeInTheDocument();
89
-
90
- const item1 = container.querySelector('#item1');
91
- fireEvent.click(item1);
92
- });
93
-
94
- it('responds to keyboard events', () => {
95
- const { getByText } = render(
96
- <Provider store={store}>
97
- <MemoryRouter>
98
- <Accordion {...data} />
99
- </MemoryRouter>
100
- </Provider>,
101
- );
102
-
103
- fireEvent.keyDown(getByText('Item 1'), { keyCode: 13 }); // Enter key
104
- waitFor(() => expect(getByText('Content of Item 1')).toBeVisible());
105
- });
106
- });
@@ -1,66 +0,0 @@
1
- import React from 'react';
2
- import { List } from 'semantic-ui-react';
3
- import { Link } from 'react-router-dom';
4
- import { compose } from 'redux';
5
- import { flattenToAppURL, getBaseUrl } from '@plone/volto/helpers';
6
- import { useChildren } from './View';
7
-
8
- const AccordionContent = (props) => {
9
- const {
10
- main,
11
- curent_location,
12
- data: { types = [] },
13
- setShowChildren,
14
- } = props;
15
- const location = main.url;
16
-
17
- // React.useEffect(() => {
18
- // const action = getContent(location, null, location);
19
- // dispatch(action);
20
- // }, [location, dispatch]);
21
-
22
- // items = useSelector(
23
- // (state) => state.content?.subrequests?.[location]?.data?.items || [],
24
- // );
25
- const items = useChildren(location);
26
-
27
- React.useEffect(() => {
28
- const filteredItems = items.filter((item) =>
29
- types.length ? types.includes(item['@type']) : item,
30
- );
31
- if (filteredItems.length) setShowChildren(true);
32
- }, [items, setShowChildren, types]);
33
-
34
- return (
35
- <div className="dataset-content">
36
- <div>
37
- {items.length
38
- ? items
39
- .filter((item) =>
40
- types.length ? types.includes(item['@type']) : item,
41
- )
42
- .map((item) => (
43
- <List.Item
44
- key={item.id}
45
- className={`${
46
- item['@id'].endsWith(curent_location.pathname)
47
- ? 'active'
48
- : ''
49
- }`}
50
- >
51
- <List.Content>
52
- <div className="dataset-item">
53
- <Link to={flattenToAppURL(getBaseUrl(item['@id']))}>
54
- {item.title}
55
- </Link>
56
- </div>
57
- </List.Content>
58
- </List.Item>
59
- ))
60
- : null}
61
- </div>
62
- </div>
63
- );
64
- };
65
-
66
- export default compose()(AccordionContent);
@@ -1,41 +0,0 @@
1
- import React from 'react';
2
- import { compose } from 'redux';
3
-
4
- import Accordion from './Accordion';
5
- import { useLocation } from 'react-router-dom';
6
-
7
- /**
8
- * A navigation slot implementation, similar to the classic Plone navigation
9
- * portlet. It uses the same API, so the options are similar to
10
- * INavigationPortlet
11
- */
12
- export function ContextNavigationComponent(props) {
13
- const { items, data } = props;
14
- let activeMenu = null;
15
-
16
- const curent_location = useLocation();
17
- for (let i = 0; i < items.length; i++) {
18
- let itemUrl = '/' + items[i]['@id'].split('/').slice(3).join('/');
19
- items[i].is_active = false;
20
- if (curent_location.pathname.includes(itemUrl)) {
21
- activeMenu = i;
22
- items[i].is_active = true;
23
- }
24
- }
25
-
26
- return (
27
- <>
28
- {items.length ? (
29
- <Accordion
30
- items={items}
31
- curent_location={curent_location}
32
- activeMenu={activeMenu}
33
- data={data}
34
- />
35
- ) : null}
36
- </>
37
- );
38
- }
39
-
40
- // withContentNavigation
41
- export default compose()(ContextNavigationComponent);
@@ -1,41 +0,0 @@
1
- import React from 'react';
2
- import { useSelector } from 'react-redux';
3
- import { SidebarPortal } from '@plone/volto/components';
4
- import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
5
-
6
- import View from './View';
7
- import schema from './schema';
8
-
9
- export default function Edit(props) {
10
- const {
11
- block,
12
- data = {},
13
- onChangeBlock,
14
- selected,
15
- id,
16
- formData = {},
17
- } = props;
18
- const contentTypes = useSelector((state) => state?.types.types);
19
- const blockSchema = schema({ formData, data, contentTypes });
20
-
21
- return (
22
- <div>
23
- <View data={data} id={id} mode="edit" />
24
- <SidebarPortal selected={selected}>
25
- <BlockDataForm
26
- block={block}
27
- title={blockSchema.title}
28
- schema={blockSchema}
29
- onChangeField={(id, value) => {
30
- onChangeBlock(block, {
31
- ...data,
32
- [id]: value,
33
- });
34
- }}
35
- onChangeBlock={onChangeBlock}
36
- formData={data}
37
- />
38
- </SidebarPortal>
39
- </div>
40
- );
41
- }
@@ -1,71 +0,0 @@
1
- import React from 'react';
2
- import { render } from '@testing-library/react';
3
- import { Provider } from 'react-intl-redux';
4
- import configureStore from 'redux-mock-store';
5
- import ContextNavigationEdit from './Edit';
6
- import { Router } from 'react-router-dom';
7
- import { createMemoryHistory } from 'history';
8
- import '@testing-library/jest-dom/extend-expect';
9
-
10
- const mockStore = configureStore();
11
-
12
- jest.mock('@plone/volto/components', () => ({
13
- SidebarPortal: ({ children }) => (
14
- <div>
15
- <div>SidebarPortal</div>
16
- {children}
17
- </div>
18
- ),
19
- }));
20
-
21
- jest.mock('@plone/volto/components/manage/Form/BlockDataForm', () => {
22
- return {
23
- __esModule: true,
24
- default: ({ params }) => {
25
- return <div>BlockDataForm {params}</div>;
26
- },
27
- };
28
- });
29
-
30
- const store = mockStore({
31
- userSession: { token: '1234' },
32
- intl: {
33
- locale: 'en',
34
- messages: {},
35
- },
36
- content: {
37
- subrequests: {},
38
- },
39
- types: {
40
- types: [],
41
- },
42
- });
43
-
44
- describe('ContextNavigationEdit', () => {
45
- it('renders corectly', () => {
46
- const history = createMemoryHistory();
47
- const { getByText } = render(
48
- <Provider store={store}>
49
- <Router history={history}>
50
- <ContextNavigationEdit />
51
- </Router>
52
- </Provider>,
53
- );
54
-
55
- expect(getByText('SidebarPortal')).toBeInTheDocument();
56
- });
57
-
58
- it('renders corectly', () => {
59
- const history = createMemoryHistory();
60
- const { getByText } = render(
61
- <Provider store={store}>
62
- <Router history={history}>
63
- <ContextNavigationEdit selected={true} onChangeBlock={() => {}} />
64
- </Router>
65
- </Provider>,
66
- );
67
-
68
- // expect(getByText('InlineForm')).toBeInTheDocument();
69
- expect(getByText('SidebarPortal')).toBeInTheDocument();
70
- });
71
- });
@@ -1,42 +0,0 @@
1
- import React from 'react';
2
- import './styles.less';
3
- import ContextNavigation from './ContextNavigation';
4
- import { useDispatch, useSelector } from 'react-redux';
5
- import { getContent } from '@plone/volto/actions';
6
-
7
- export function useChildren(location) {
8
- const dispatch = useDispatch();
9
- React.useEffect(() => {
10
- const action = getContent(location, null, location);
11
- dispatch(action);
12
- }, [location, dispatch]);
13
-
14
- const items = useSelector(
15
- (state) => state.content.subrequests?.[location]?.data?.items || [],
16
- );
17
- return items;
18
- }
19
-
20
- export default function View(props) {
21
- const { data } = props;
22
- let root_path = data?.root_path;
23
- if (typeof root_path === 'undefined') {
24
- root_path = '/';
25
- }
26
- let items = useChildren(root_path);
27
- if (root_path === '/') {
28
- items = [];
29
- }
30
-
31
- return (
32
- <div className="block rast-block">
33
- <ContextNavigation
34
- items={items}
35
- location={{
36
- pathname: root_path,
37
- }}
38
- data={data}
39
- />
40
- </div>
41
- );
42
- }
@@ -1,71 +0,0 @@
1
- import React from 'react';
2
- import { render } from '@testing-library/react';
3
- import ContextNavigationView from './View';
4
- import { Router } from 'react-router-dom';
5
- import { Provider } from 'react-intl-redux';
6
- import configureStore from 'redux-mock-store';
7
- import { createMemoryHistory } from 'history';
8
- import '@testing-library/jest-dom/extend-expect';
9
-
10
- const mockStore = configureStore();
11
-
12
- const store = mockStore({
13
- userSession: { token: '1234' },
14
- intl: {
15
- locale: 'en',
16
- messages: {},
17
- },
18
- content: {
19
- subrequests: {},
20
- },
21
- types: {
22
- types: {},
23
- },
24
- });
25
-
26
- jest.mock(
27
- '@eeacms/volto-marine-policy/components/Blocks/ContextNavigation/ContextNavigation',
28
- () => {
29
- return {
30
- __esModule: true,
31
- default: ({ params }) => {
32
- return <div>ContextNavigation {params}</div>;
33
- },
34
- };
35
- },
36
- );
37
-
38
- describe('ContextNavigationView', () => {
39
- let history;
40
- beforeEach(() => {
41
- history = createMemoryHistory();
42
- });
43
-
44
- it('renders corectly', () => {
45
- const { container } = render(
46
- <Provider store={store}>
47
- <Router history={history}>
48
- <ContextNavigationView />
49
- </Router>
50
- </Provider>,
51
- );
52
-
53
- expect(container.firstChild).toHaveTextContent('ContextNavigation');
54
- });
55
-
56
- it('renders corectly', () => {
57
- const { container } = render(
58
- <Provider store={store}>
59
- <Router history={history}>
60
- <ContextNavigationView
61
- data={{
62
- navProps: { root_path: 'https://localhost:3000/test' },
63
- root_node: [{ '@id': 'root_node' }],
64
- }}
65
- />
66
- </Router>
67
- </Provider>,
68
- );
69
- expect(container.firstChild).toHaveTextContent('ContextNavigation');
70
- });
71
- });
@@ -1,25 +0,0 @@
1
- import zoomSVG from '@plone/volto/icons/zoom.svg';
2
- import Edit from './Edit';
3
- import View from './View';
4
-
5
- export default function installBlock(config) {
6
- const blocksConfig = config.blocks.blocksConfig;
7
-
8
- blocksConfig.contextNavigation = {
9
- id: 'contextNavigation',
10
- title: 'Context Navigation',
11
- icon: zoomSVG,
12
- group: 'site',
13
- view: View,
14
- edit: Edit,
15
- sidebarTab: 1,
16
- security: {
17
- addPermission: [],
18
- view: [],
19
- },
20
- variations: [],
21
- restricted: false,
22
- };
23
-
24
- return config;
25
- }
@@ -1,43 +0,0 @@
1
- const fields = ['root_path', 'title', 'types'];
2
-
3
- const schema = ({ contentTypes }) => {
4
- const availableTypes = contentTypes.map((type) => [
5
- type.id,
6
- type.title || type.name,
7
- ]);
8
- return {
9
- title: 'RAST',
10
-
11
- fieldsets: [
12
- {
13
- id: 'default',
14
- title: 'Default',
15
- fields,
16
- },
17
- ],
18
-
19
- properties: {
20
- root_path: {
21
- title: 'Rooth path',
22
- type: 'string',
23
- description:
24
- 'Ex: /en/knowledge-and-data/regional-adaptation-support-tool',
25
- required: true,
26
- noValueOption: false,
27
- },
28
- title: {
29
- title: 'Title',
30
- },
31
- types: {
32
- title: 'Display content types',
33
- description: 'Choose content types displayed as children',
34
- choices: availableTypes,
35
- isMulti: true,
36
- },
37
- },
38
-
39
- required: [],
40
- };
41
- };
42
-
43
- export default schema;
@@ -1,65 +0,0 @@
1
- @type: 'extra';
2
- @element: 'custom';
3
-
4
- @import (multiple, reference, optional) '../../theme.config';
5
-
6
- .rast-block {
7
- a rect.circle:hover {
8
- fill: #183 !important;
9
- }
10
-
11
- .ui.accordion[class*='ary'] > .active.title,
12
- .ui.accordion[class*='ary'].inverted > .title,
13
- .ui.accordion[class*='ary'].inverted > .icon,
14
- .ui.accordion[class*='ary'] > .filter {
15
- --text-color-secondary: #ffffff;
16
- --text-color-hover: #0079cf;
17
- --text-color: #0079cf;
18
- border-bottom: 0.0625rem solid #e6e7e8;
19
- font-weight: bold;
20
- }
21
-
22
- .ui.accordion[class*='ary'] > .title,
23
- .ui.accordion[class*='ary'].inverted > .title,
24
- .ui.accordion[class*='ary'].inverted > .icon,
25
- .ui.accordion[class*='ary'] > .filter {
26
- color: var(--text-color);
27
- font-weight: bold;
28
-
29
- .icon {
30
- color: var(--text-color);
31
- }
32
- }
33
-
34
- .ui.accordion .content.active {
35
- --bg-color: #ffffff;
36
- border-bottom: 0.0625rem solid #e6e7e8;
37
-
38
- .item > .content {
39
- &:hover {
40
- background: #f9f9f9;
41
-
42
- a {
43
- color: var(--text-color-hover, #0079cf);
44
- }
45
- }
46
- }
47
-
48
- a {
49
- color: var(--text-color);
50
- }
51
- }
52
-
53
- a rect.circle {
54
- pointer-events: all !important;
55
- }
56
-
57
- svg,
58
- svg * {
59
- pointer-events: none;
60
- }
61
-
62
- .item.active a {
63
- font-weight: bold;
64
- }
65
- }