@eeacms/volto-clms-theme 1.1.177 → 1.1.179

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.
Files changed (23) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/package.json +1 -1
  3. package/src/components/Blocks/CclButtonBlock/CclButtonBlockEdit.test.jsx +34 -51
  4. package/src/components/Blocks/CclContextNavigationBlock/CclContextNavigationBlockEdit.test.jsx +0 -4
  5. package/src/components/Blocks/CclContextNavigationBlock/CclContextNavigationBlockView.test.jsx +8 -11
  6. package/src/components/Blocks/CclFAQBlock/CclFAQBlockEdit.jsx +1 -1
  7. package/src/components/Blocks/CclFAQBlock/CclFAQBlockView.jsx +112 -118
  8. package/src/components/Blocks/CustomTemplates/VoltoListingBlock/CclListingCards.test.jsx +62 -119
  9. package/src/components/CLMSDatasetDetailView/BoundingBoxComponent.test.jsx +5 -9
  10. package/src/components/CLMSDatasetDetailView/CLMSDatasetDetailView.test.jsx +3 -1
  11. package/src/components/CLMSDatasetDetailView/ContactComponent.test.jsx +11 -14
  12. package/src/components/CLMSDatasetDetailView/DistributionInfoComponent.test.jsx +5 -8
  13. package/src/components/CLMSDownloadCartView/Fields/TimeseriesPicker.jsx +6 -2
  14. package/src/components/CartIconCounter/CartIconCounter.test.jsx +0 -3
  15. package/src/components/CclCard/CclCard.test.jsx +10 -6
  16. package/src/components/CclExpandableFilter/CclExpandableFilter.test.jsx +23 -34
  17. package/src/components/CclLanguageSelector/CclLanguageSelector.test.jsx +22 -25
  18. package/src/components/CclModal/CclModal.test.js +45 -59
  19. package/src/components/CclTab/CclTab.test.jsx +19 -11
  20. package/src/components/CclTab/CclTabs.jsx +2 -2
  21. package/src/index.js +6 -0
  22. package/src/components/Blocks/CclButtonBlock/__snapshots__/CclButtonBlockEdit.test.jsx.snap +0 -27
  23. package/src/components/Blocks/CclContextNavigationBlock/__snapshots__/CclContextNavigationBlockView.test.jsx.snap +0 -3
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
+ ### [1.1.179](https://github.com/eea/volto-clms-theme/compare/1.1.178...1.1.179) - 26 August 2024
8
+
9
+ #### :house: Internal changes
10
+
11
+ - style: Automated code fix [eea-jenkins - [`c668e51`](https://github.com/eea/volto-clms-theme/commit/c668e51c7592ed244b8fa486e785ced43ca5cb5f)]
12
+
13
+ #### :hammer_and_wrench: Others
14
+
15
+ - Code cleanup [Tiberiu Ichim - [`4b3d00f`](https://github.com/eea/volto-clms-theme/commit/4b3d00fa7e02a422a7be14e95c2ddc23f07a60cf)]
16
+ - Fix parenting [Tiberiu Ichim - [`bf536b8`](https://github.com/eea/volto-clms-theme/commit/bf536b85715471db0f373315a8bca84cbde2aec1)]
17
+ - Expand context navigation on /en/faq [Tiberiu Ichim - [`37b8eb1`](https://github.com/eea/volto-clms-theme/commit/37b8eb129651e781e0ced8c79237bdf7b0bb55e1)]
18
+ - WIP [Tiberiu Ichim - [`dbf9e58`](https://github.com/eea/volto-clms-theme/commit/dbf9e58a74442005933356e875965ad8f6dd9cd0)]
19
+ - Rewrite for lisibility [Tiberiu Ichim - [`e8c8a20`](https://github.com/eea/volto-clms-theme/commit/e8c8a2037a81832ae901892120e74c11757ebf55)]
20
+ - Rewrite for lisibility [Tiberiu Ichim - [`9fe7896`](https://github.com/eea/volto-clms-theme/commit/9fe78963411c231cbf8271a29209d51c5b7c4345)]
21
+ ### [1.1.178](https://github.com/eea/volto-clms-theme/compare/1.1.177...1.1.178) - 26 August 2024
22
+
23
+ #### :house: Internal changes
24
+
25
+ - style: Automated code fix [eea-jenkins - [`d4de906`](https://github.com/eea/volto-clms-theme/commit/d4de906dce029f4b12382c624d399a93b5cea458)]
26
+ - style: Automated code fix [eea-jenkins - [`3cdad9f`](https://github.com/eea/volto-clms-theme/commit/3cdad9f14e176ff8b1bd2f60ae73f074cddcae6d)]
27
+
28
+ #### :hammer_and_wrench: Others
29
+
30
+ - More test fixes [Tiberiu Ichim - [`6d0ee04`](https://github.com/eea/volto-clms-theme/commit/6d0ee04c08b40c1630db96f4e3265873a3e674d5)]
31
+ - Fix one test [Tiberiu Ichim - [`7a63d96`](https://github.com/eea/volto-clms-theme/commit/7a63d9613a439b880eb340b1bd44aef46bb2817f)]
32
+ - Refs #273992 - Fix BoundingBoxComponent.test.jsx. [GhitaB - [`e84220f`](https://github.com/eea/volto-clms-theme/commit/e84220f0bea3105a9ee218f17f3a70e180abdea6)]
33
+ - Refs #273992 - Fix DistributionInfoComponent.test.jsx. [GhitaB - [`f96ef4f`](https://github.com/eea/volto-clms-theme/commit/f96ef4f43a06314e3089123afcd97403671638fa)]
34
+ - Refs #273992 - Fix CclExpandableFilter.test.jsx - fix eslint. [GhitaB - [`92efa96`](https://github.com/eea/volto-clms-theme/commit/92efa9610539aba1cd0ba421e9e33b90a042dfee)]
35
+ - Refs #273992 - Fix CclExpandableFilter.test.jsx. [GhitaB - [`65e6b83`](https://github.com/eea/volto-clms-theme/commit/65e6b830c4c7242f1220a88cb1901e789f0dbfec)]
36
+ - Refs #273992 - Fix ContactComponent.test.jsx. [GhitaB - [`d695b38`](https://github.com/eea/volto-clms-theme/commit/d695b38a82ef4a9a87302295de06f9beda5083f7)]
37
+ - Refs #273992 - Fix CartIconCounter.test.jsx. [GhitaB - [`1f191e5`](https://github.com/eea/volto-clms-theme/commit/1f191e552ad85f9d8c0ab942c64fd39813c55cf1)]
38
+ - Refs #273992 - Fix CartIconCounter.test.jsx. [GhitaB - [`20984cc`](https://github.com/eea/volto-clms-theme/commit/20984ccfe404038500ecdaf7866f2512d1358469)]
39
+ - Refs #273992 - Fix CclCard.test.jsx. [GhitaB - [`706c490`](https://github.com/eea/volto-clms-theme/commit/706c490efac2b7c3c56d1a404c7d102288c979f3)]
40
+ - Refs #273992 - CclContextNavigationBlockView.test.jsx - Enzyme -> RTL. [GhitaB - [`e091a63`](https://github.com/eea/volto-clms-theme/commit/e091a631b0b79ccb1ef05a3375e566e34520964e)]
41
+ - Refs #273992 - CclContextNavigationBlockView.test.jsx - Enzyme -> RTL. [GhitaB - [`aba30b9`](https://github.com/eea/volto-clms-theme/commit/aba30b9d7cceba6dd8e9ad0e5313ccc143ea0615)]
42
+ - Refs #273992 - CclContextNavigationBlockView.test.jsx - Enzyme -> RTL. [GhitaB - [`6e88a6e`](https://github.com/eea/volto-clms-theme/commit/6e88a6ef2205401def8120ce4feab7f120ad2733)]
43
+ - Refs #273992 - CclButtonBlockEdit.test.jsx - Enzyme -> RTL - remove obsolete snapshot. [GhitaB - [`c5d917d`](https://github.com/eea/volto-clms-theme/commit/c5d917d72242e7a4dff16a9a0d001c7210ab5f8f)]
44
+ - Refs #273992 - CclButtonBlockEdit.test.jsx - Enzyme -> RTL. [GhitaB - [`dd3ebb3`](https://github.com/eea/volto-clms-theme/commit/dd3ebb3f9f6db8635d316016ceba627161d072b8)]
45
+ - Refs #273992 - CclButtonBlockEdit.test.jsx - Enzyme -> RTL. [GhitaB - [`1c31699`](https://github.com/eea/volto-clms-theme/commit/1c3169940832127cb1cd76b52bd7b2482174ff96)]
46
+ - Refs #273992 - CclModal.test.jsx - Enzyme -> RTL. [GhitaB - [`bab4c3e`](https://github.com/eea/volto-clms-theme/commit/bab4c3ea43321e5447366a2712053544cb204a4f)]
47
+ - Refs #273992 - CclModal.test.jsx - Enzyme -> RTL. [GhitaB - [`97b5078`](https://github.com/eea/volto-clms-theme/commit/97b507870639e0725f7d936edda26897efe5d54d)]
48
+ - Refs #273992 - CclModal.test.jsx - Enzyme -> RTL. [GhitaB - [`b2f064e`](https://github.com/eea/volto-clms-theme/commit/b2f064ec64f7beaf313b13891f78d58c302c547f)]
49
+ - Refs #273992 - CclListingCards.test.jsx - Enzyme -> RTL. [GhitaB - [`ca6ac5f`](https://github.com/eea/volto-clms-theme/commit/ca6ac5f1e56ce01154e1969969142f6432d6f5db)]
50
+ - Refs #273992 - CclListingCards.test.jsx - Enzyme -> RTL. [GhitaB - [`68364ab`](https://github.com/eea/volto-clms-theme/commit/68364ab9110a8d3a8a38ae99d67ae8c47b25aeba)]
51
+ - Refs #273992 - Update README.md (retry tests) [Ghiță Bizău - [`323a348`](https://github.com/eea/volto-clms-theme/commit/323a348092275af300784271ae44997b6b0f39ab)]
7
52
  ### [1.1.177](https://github.com/eea/volto-clms-theme/compare/1.1.176...1.1.177) - 8 August 2024
8
53
 
9
54
  ### [1.1.176](https://github.com/eea/volto-clms-theme/compare/1.1.175...1.1.176) - 8 August 2024
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.1.177",
3
+ "version": "1.1.179",
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",
@@ -1,16 +1,9 @@
1
- import Enzyme, { mount } from 'enzyme';
2
-
3
- import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
4
1
  import CclButtonBlockEdit from './CclButtonBlockEdit';
5
2
  import { MemoryRouter } from 'react-router-dom';
6
3
  import { Provider } from 'react-intl-redux';
7
4
  import React from 'react';
8
5
  import configureStore from 'redux-mock-store';
9
- import renderer from 'react-test-renderer';
10
-
11
- Enzyme.configure({ adapter: new Adapter() });
12
-
13
- global.__SERVER__ = true; // eslint-disable-line no-underscore-dangle
6
+ import { render, fireEvent } from '@testing-library/react';
14
7
 
15
8
  const mockStore = configureStore();
16
9
 
@@ -26,6 +19,7 @@ describe('CclButtonBlockEdit', () => {
26
19
  messages: {},
27
20
  },
28
21
  });
22
+
29
23
  const data = {
30
24
  href: 'https://www.google.com',
31
25
  disabled: false,
@@ -33,29 +27,26 @@ describe('CclButtonBlockEdit', () => {
33
27
  download: false,
34
28
  };
35
29
 
36
- // const component = shallow(
37
- const component = mount(
30
+ const { container } = render(
38
31
  <Provider store={store}>
39
32
  <MemoryRouter>
40
33
  <CclButtonBlockEdit
41
34
  data={data}
42
35
  selected={false}
43
36
  block="1234"
44
- onChangeBlock={() => {
45
- return 'test';
46
- }}
47
- setSidebarTab={() => {
48
- return 'test';
49
- }}
37
+ onChangeBlock={() => 'test'}
38
+ setSidebarTab={() => 'test'}
50
39
  />
51
40
  </MemoryRouter>
52
41
  </Provider>,
53
42
  );
54
- const legend = component.find('.ccl-block-editor-header legend');
55
- legend.simulate('click');
56
- expect(legend).toBeDefined();
43
+
44
+ const legend = container.querySelector('.ccl-block-editor-header legend');
45
+ fireEvent.click(legend);
46
+ expect(legend).not.toBeNull();
57
47
  });
58
- it('renders an CclButtonBlockEdit block component', () => {
48
+
49
+ it('renders a CclButtonBlockEdit block component', () => {
59
50
  const store = mockStore({
60
51
  content: {
61
52
  create: {},
@@ -66,38 +57,34 @@ describe('CclButtonBlockEdit', () => {
66
57
  messages: {},
67
58
  },
68
59
  });
60
+
69
61
  const data = {
70
62
  href: ['https://www.google.com', 'https://www.google.com'],
71
63
  disabled: true,
72
64
  };
73
- const component = renderer.create(
65
+
66
+ const { container } = render(
74
67
  <Provider store={store}>
75
68
  <MemoryRouter>
76
69
  <CclButtonBlockEdit
77
70
  data={data}
78
71
  selected={false}
79
72
  block="1234"
80
- onChangeBlock={() => {
81
- return 'test';
82
- }}
83
- onSelectBlock={() => {
84
- return 'test';
85
- }}
86
- onChangeField={() => {
87
- return 'test';
88
- }}
89
- setSidebarTab={() => {
90
- return 'test';
91
- }}
73
+ onChangeBlock={() => 'test'}
74
+ onSelectBlock={() => 'test'}
75
+ onChangeField={() => 'test'}
76
+ setSidebarTab={() => 'test'}
92
77
  />
93
78
  </MemoryRouter>
94
79
  </Provider>,
95
80
  );
96
81
 
97
- const json = component.toJSON();
98
- expect(json).toMatchSnapshot();
82
+ const button = container.querySelector('.ccl-button.ccl-button--default');
83
+ expect(button).not.toBeNull();
84
+ expect(button.getAttribute('href')).toBe('/');
85
+ expect(button.classList.contains('ccl-button--default')).toBe(true);
99
86
  });
100
- //jest test for CclButtonBlockEdit onChangeBlock statement
87
+
101
88
  it('CclButtonBlockEdit onChangeBlock', () => {
102
89
  const store = mockStore({
103
90
  content: {
@@ -109,34 +96,30 @@ describe('CclButtonBlockEdit', () => {
109
96
  messages: {},
110
97
  },
111
98
  });
99
+
112
100
  const data = {
113
101
  href: ['https://www.google.com', 'https://www.google.com'],
114
102
  disabled: true,
115
103
  };
116
- const component = mount(
104
+
105
+ const { container } = render(
117
106
  <Provider store={store}>
118
107
  <MemoryRouter>
119
108
  <CclButtonBlockEdit
120
109
  data={data}
121
110
  selected={false}
122
111
  block="1234"
123
- onChangeBlock={() => {
124
- return 'test';
125
- }}
126
- onSelectBlock={() => {
127
- return 'test';
128
- }}
129
- onChangeField={() => {
130
- return 'test';
131
- }}
132
- setSidebarTab={() => {
133
- return 'test';
134
- }}
112
+ onChangeBlock={() => 'test'}
113
+ onSelectBlock={() => 'test'}
114
+ onChangeField={() => 'test'}
115
+ setSidebarTab={() => 'test'}
135
116
  />
136
117
  </MemoryRouter>
137
118
  </Provider>,
138
119
  );
139
- const legend = component.find('.ccl-block-editor-header');
140
- legend.simulate('click');
120
+
121
+ const legend = container.querySelector('.ccl-block-editor-header legend');
122
+ fireEvent.click(legend);
123
+ expect(legend).not.toBeNull();
141
124
  });
142
125
  });
@@ -4,10 +4,6 @@ import configureStore from 'redux-mock-store';
4
4
  import { Provider } from 'react-intl-redux';
5
5
  import CclContextNavigationBlockEdit from './CclContextNavigationBlockEdit';
6
6
  import { MemoryRouter } from 'react-router-dom';
7
- import Enzyme from 'enzyme';
8
- import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
9
-
10
- Enzyme.configure({ adapter: new Adapter() });
11
7
 
12
8
  global.__SERVER__ = true; // eslint-disable-line no-underscore-dangle
13
9
 
@@ -1,20 +1,14 @@
1
1
  import React from 'react';
2
- import renderer from 'react-test-renderer';
2
+ import { render } from '@testing-library/react';
3
3
  import configureStore from 'redux-mock-store';
4
4
  import { Provider } from 'react-intl-redux';
5
5
  import CclContextNavigationBlockView from './CclContextNavigationBlockView';
6
6
  import { MemoryRouter } from 'react-router-dom';
7
- import Enzyme from 'enzyme';
8
- import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
9
-
10
- Enzyme.configure({ adapter: new Adapter() });
11
-
12
- global.__SERVER__ = true; // eslint-disable-line no-underscore-dangle
13
7
 
14
8
  const mockStore = configureStore();
15
9
 
16
10
  describe('CclContextNavigationBlockView', () => {
17
- it('Check context navigation view', () => {
11
+ it('renders CclContextNavigationBlockView correctly', () => {
18
12
  const store = mockStore({
19
13
  content: {
20
14
  create: {},
@@ -27,7 +21,7 @@ describe('CclContextNavigationBlockView', () => {
27
21
  });
28
22
  const pathname = '/example';
29
23
 
30
- const ContextNavigationBlockView = renderer.create(
24
+ const { container } = render(
31
25
  <Provider store={store}>
32
26
  <MemoryRouter>
33
27
  <CclContextNavigationBlockView pathname={pathname}>
@@ -36,7 +30,10 @@ describe('CclContextNavigationBlockView', () => {
36
30
  </MemoryRouter>
37
31
  </Provider>,
38
32
  );
39
- const json = ContextNavigationBlockView.toJSON();
40
- expect(json).toMatchSnapshot();
33
+
34
+ const contextNavigationBlock = container.querySelector(
35
+ '.ccl-context-navigation-block',
36
+ );
37
+ expect(contextNavigationBlock).toBeNull();
41
38
  });
42
39
  });
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import CclFAQBlockView from './CclFAQBlockView';
3
3
 
4
4
  const CclFAQBlockEdit = (props) => {
5
- return <CclFAQBlockView props={props} isEditMode={true} />;
5
+ return <CclFAQBlockView {...props} isEditMode={true} />;
6
6
  };
7
7
 
8
8
  export default CclFAQBlockEdit;
@@ -1,3 +1,4 @@
1
+ import cx from 'classnames';
1
2
  import React, { useState } from 'react';
2
3
  import AnimateHeight from 'react-animate-height';
3
4
  import { useDispatch, useSelector } from 'react-redux';
@@ -6,18 +7,46 @@ import { Accordion, Segment } from 'semantic-ui-react';
6
7
  import { getContextNavigation } from '@plone/volto/actions';
7
8
  import { Icon, UniversalLink } from '@plone/volto/components';
8
9
  import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
9
- import { hasBlocksData } from '@plone/volto/helpers';
10
+ import { hasBlocksData, getBaseUrl } from '@plone/volto/helpers';
11
+
12
+ import { CclTabs } from '@eeacms/volto-clms-theme/components/CclTab';
13
+
10
14
  import penSVG from '@plone/volto/icons/pen.svg';
11
15
  import config from '@plone/volto/registry';
12
- import { CclTabs } from '@eeacms/volto-clms-theme/components/CclTab';
13
- // import { StringToHTML } from '@eeacms/volto-clms-theme/components/CclUtils';
16
+
17
+ const flattenCN = (cn_items) =>
18
+ cn_items.reduce(
19
+ (acc, curr) => [
20
+ ...acc,
21
+ curr,
22
+ ...curr.items
23
+ .filter((i) => i.type === 'document')
24
+ .map((item) => ({ ...item, isSubtab: true })),
25
+ ],
26
+ [],
27
+ );
28
+
29
+ // this is just to highlight that the way CclTabs is working is misleading
30
+ // It reads random properties from <div> children, which is unexpected
31
+ function Tab(props) {
32
+ return <div {...props} />;
33
+ }
14
34
 
15
35
  const CclFAQBlockView = (props) => {
16
- const { isEditMode } = props;
36
+ const { isEditMode, content } = props;
37
+ const pathname = getBaseUrl(props.pathname || props.path);
38
+ const cn_key = `${pathname}/@contextnavigation`;
39
+
40
+ // this are the accordions that are opened
41
+ const [activeIndex, setActiveIndex] = useState([]);
42
+
17
43
  const dispatch = useDispatch();
18
- const path = useSelector((state) => state.router.location.pathname);
19
- const contextNavigation = useSelector((state) => state.contextNavigation);
20
- const cn_key = `${path.replace('/edit', '')}/@contextnavigation`;
44
+ const contextNavigationItems = useSelector(
45
+ (state) =>
46
+ state.contextNavigation?.[cn_key]?.data?.items ||
47
+ content['@components']?.['contextnavigation']?.items,
48
+ );
49
+
21
50
  const handleClick = ({ index }) => {
22
51
  const newIndex =
23
52
  activeIndex.indexOf(index) === -1
@@ -27,128 +56,93 @@ const CclFAQBlockView = (props) => {
27
56
  setActiveIndex(newIndex);
28
57
  };
29
58
 
30
- const flattenCN = (cn_items) => {
31
- return cn_items.reduce((prev, curr) => {
32
- prev.push(curr);
33
- if (curr.items.filter((i) => i.type === 'document').length > 0) {
34
- curr.items
35
- .filter((i) => i.type === 'document')
36
- .forEach((i_i) => prev.push({ ...i_i, isSubtab: true }));
37
- }
38
- return prev;
39
- }, []);
40
- };
41
59
  const flatCN = flattenCN(
42
- contextNavigation?.[cn_key]?.data?.items
43
- ? contextNavigation?.[cn_key]?.data?.items.filter(
44
- (i) => i.type === 'document',
45
- )
46
- : [],
60
+ contextNavigationItems?.filter((i) => i.type === 'document') || [],
47
61
  );
48
- const [activeIndex, setActiveIndex] = useState([]);
62
+
49
63
  React.useEffect(() => {
50
- dispatch(getContextNavigation(path.replace('/edit', '')));
51
- }, [path, dispatch]);
64
+ isEditMode && dispatch(getContextNavigation(pathname));
65
+ }, [pathname, dispatch, isEditMode]);
66
+
52
67
  React.useEffect(() => {
53
- let indexes = [];
54
- // eslint-disable-next-line no-unused-expressions
55
- contextNavigation?.[cn_key]?.data?.items &&
56
- contextNavigation?.[cn_key]?.data?.items.forEach((i) => {
57
- if (i.items.length > 0) {
58
- indexes.push(i.items[0].normalized_id);
59
- }
60
- if (i.type === 'document') {
61
- i.items.forEach((i_i) => {
62
- if (i_i.items.length > 0) {
63
- indexes.push(i_i.items[0].normalized_id);
64
- }
65
- });
66
- }
67
- });
68
+ let indexes = (contextNavigationItems || []).reduce(
69
+ (acc, cur) => [
70
+ ...acc,
71
+ ...(cur.items?.length ? [cur.items[0].normalized_id] : []),
72
+ ...cur.items
73
+ ?.map((item) => item.items?.[0]?.normalized_id)
74
+ .filter((id) => !!id),
75
+ ],
76
+ [],
77
+ );
68
78
  setActiveIndex(indexes);
69
- // eslint-disable-next-line react-hooks/exhaustive-deps
70
- }, [contextNavigation?.[cn_key]?.data?.items]);
79
+ }, [contextNavigationItems]);
71
80
 
72
81
  const titleIcons = config.blocks?.blocksConfig?.accordion?.titleIcons;
73
82
 
74
83
  return (
75
84
  <div id="faq-listing" className="ccl-container tab-container">
76
- {contextNavigation?.[cn_key]?.loaded ? (
77
- contextNavigation?.[cn_key]?.data?.items?.length > 0 && (
78
- <CclTabs routing={true}>
79
- {flatCN
80
- .filter((cn) => cn.type === 'document')
81
- .map((cn, key) => (
82
- <div
83
- key={key}
84
- tabTitle={cn.title}
85
- className={
86
- cn.isSubtab
87
- ? 'subcard'
88
- : cn.items.filter((i) => i.type === 'document').length > 0
89
- }
90
- parent={
91
- cn.items.filter((i) => i.type === 'document').length > 0
92
- }
93
- >
94
- <div className="accordion-block">
95
- {cn.items
96
- .filter((item) => item.type === 'faq')
97
- .map((item, item_key) => {
98
- return (
99
- <Accordion fluid styled key={item_key}>
100
- <Accordion.Title
101
- as={'h2'}
102
- onClick={() =>
103
- handleClick({ index: item.normalized_id })
104
- }
105
- className={'accordion-title align-arrow-right'}
106
- >
107
- {activeIndex.includes(item.normalized_id) ? (
108
- <Icon name={titleIcons.opened.rightPosition} />
109
- ) : (
110
- <Icon name={titleIcons.closed.rightPosition} />
111
- )}
112
- {isEditMode && (
113
- <UniversalLink
114
- openLinkInNewTab={true}
115
- href={`${item['@id']}/edit`}
116
- >
117
- <Icon
118
- name={penSVG}
119
- className="circled"
120
- title={'Edit'}
121
- />
122
- </UniversalLink>
123
- )}
124
- <span>{item.title}</span>
125
- </Accordion.Title>
126
- <Accordion.Content
127
- active={activeIndex.includes(item.normalized_id)}
128
- >
129
- <AnimateHeight
130
- animateOpacity
131
- duration={500}
132
- height={'auto'}
133
- >
134
- {/* <StringToHTML
135
- string={item.text ? item.text.data : ''}
136
- /> */}
137
- {hasBlocksData(item) && (
138
- <RenderBlocks content={item} />
139
- )}
140
- </AnimateHeight>
141
- </Accordion.Content>
142
- </Accordion>
143
- );
144
- })}
145
- </div>
146
- </div>
147
- ))}
148
- </CclTabs>
149
- )
85
+ {contextNavigationItems?.length > 0 ? (
86
+ <CclTabs routing={true}>
87
+ {flatCN.map((cn, key) => (
88
+ <Tab
89
+ key={key}
90
+ tabTitle={cn.title}
91
+ className={cx({ subcard: cn.isSubtab })}
92
+ isParent={!!cn.items.filter((i) => i.type === 'document').length}
93
+ >
94
+ <div className="accordion-block">
95
+ {cn.items
96
+ .filter((item) => item.type === 'faq')
97
+ .map((item, item_key) => (
98
+ <Accordion fluid styled key={item_key}>
99
+ <Accordion.Title
100
+ as={'h2'}
101
+ onClick={() =>
102
+ handleClick({ index: item.normalized_id })
103
+ }
104
+ className={'accordion-title align-arrow-right'}
105
+ >
106
+ {activeIndex.includes(item.normalized_id) ? (
107
+ <Icon name={titleIcons.opened.rightPosition} />
108
+ ) : (
109
+ <Icon name={titleIcons.closed.rightPosition} />
110
+ )}
111
+ {isEditMode && (
112
+ <UniversalLink
113
+ openLinkInNewTab={true}
114
+ href={`${item['@id']}/edit`}
115
+ >
116
+ <Icon
117
+ name={penSVG}
118
+ className="circled"
119
+ title={'Edit'}
120
+ />
121
+ </UniversalLink>
122
+ )}
123
+ <span>{item.title}</span>
124
+ </Accordion.Title>
125
+ <Accordion.Content
126
+ active={activeIndex.includes(item.normalized_id)}
127
+ >
128
+ <AnimateHeight
129
+ animateOpacity
130
+ duration={500}
131
+ height={'auto'}
132
+ >
133
+ {hasBlocksData(item) && (
134
+ <RenderBlocks content={item} />
135
+ )}
136
+ </AnimateHeight>
137
+ </Accordion.Content>
138
+ </Accordion>
139
+ ))}
140
+ </div>
141
+ </Tab>
142
+ ))}
143
+ </CclTabs>
150
144
  ) : (
151
- <Segment loading={contextNavigation?.[cn_key]?.loading}></Segment>
145
+ <Segment loading={true}></Segment>
152
146
  )}
153
147
  </div>
154
148
  );