@eeacms/volto-cca-policy 0.2.2 → 0.2.4

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 (27) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +0 -58
  3. package/package.json +1 -1
  4. package/src/components/index.js +1 -0
  5. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyFilters.jsx +17 -1
  6. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyMap.jsx +9 -7
  7. package/src/components/manage/Blocks/CaseStudyExplorer/FeatureInteraction.jsx +2 -2
  8. package/src/components/manage/Blocks/CaseStudyExplorer/styles.less +22 -0
  9. package/src/components/manage/Blocks/CaseStudyExplorer/utils.js +2 -0
  10. package/src/components/manage/Blocks/CollectionStatistics/CollectionStatsView.jsx +1 -1
  11. package/src/components/manage/Blocks/RASTBlock/RASTMap.jsx +12 -4
  12. package/src/components/manage/Blocks/RelevantAceContent/RelevantAceContentView.jsx +38 -14
  13. package/src/components/manage/Blocks/RelevantAceContent/RelevantAceContentView.test.jsx +5 -0
  14. package/src/components/manage/Blocks/SearchAceContent/SearchAceContentView.jsx +1 -1
  15. package/src/components/theme/ASTNavigation/AST.svg +54 -0
  16. package/src/components/theme/ASTNavigation/ASTAccordion.jsx +152 -0
  17. package/src/components/theme/ASTNavigation/ASTAccordion.test.jsx +57 -0
  18. package/src/components/theme/ASTNavigation/ASTLogoMap.jsx +229 -0
  19. package/src/components/theme/ASTNavigation/ASTLogoMap.test.jsx +47 -0
  20. package/src/components/theme/ASTNavigation/ASTNavigation.jsx +75 -0
  21. package/src/components/theme/ASTNavigation/UAST.svg +107 -0
  22. package/src/components/theme/ASTNavigation/UASTLogoMap.jsx +442 -0
  23. package/src/components/theme/ASTNavigation/UASTLogoMap.test.jsx +46 -0
  24. package/src/components/theme/ASTNavigation/styles.less +46 -0
  25. package/src/components/theme/ASTNavigation/utils.js +31 -0
  26. package/src/customizations/volto/components/theme/View/DefaultView.jsx +53 -31
  27. package/src/index.js +11 -19
@@ -0,0 +1,31 @@
1
+ import { UniversalLink } from '@plone/volto/components';
2
+ import cx from 'classnames';
3
+
4
+ export const isAdaptationSupportToolURL = (url) => {
5
+ return url.indexOf('/knowledge/tools/adaptation-support-tool') > -1;
6
+ };
7
+
8
+ export const isUrbanAdaptationSupportToolURL = (url) => {
9
+ return url.indexOf('/knowledge/tools/urban-ast') > -1;
10
+ };
11
+
12
+ export const LinkWrap = ({ item, pathname, children }) => {
13
+ const substeps = item?.items || [];
14
+ const activeSubstep = substeps.some((obj) => obj['@id'] === pathname);
15
+ const activeStep = item ? pathname === item?.['@id'] : null;
16
+ const isActive = activeStep || activeSubstep;
17
+ return item ? (
18
+ <UniversalLink item={item}>
19
+ <g
20
+ className={cx('step-link', {
21
+ active: isActive,
22
+ })}
23
+ >
24
+ <title>{item.title}</title>
25
+ {children}
26
+ </g>
27
+ </UniversalLink>
28
+ ) : (
29
+ <g>{children}</g>
30
+ );
31
+ };
@@ -21,7 +21,10 @@ import { hasBlocksData, getBaseUrl } from '@plone/volto/helpers';
21
21
  import { useDispatch, useSelector } from 'react-redux';
22
22
  import { RenderBlocks } from '@plone/volto/components';
23
23
  import ContextNavigation from '@plone/volto/components/theme/Navigation/ContextNavigation';
24
- import { BannerTitle } from '@eeacms/volto-cca-policy/components';
24
+ import {
25
+ BannerTitle,
26
+ ASTNavigation,
27
+ } from '@eeacms/volto-cca-policy/components';
25
28
 
26
29
  import { isEqual } from 'lodash';
27
30
 
@@ -32,10 +35,12 @@ import { isEqual } from 'lodash';
32
35
  * @returns {string} Markup of the component.
33
36
  */
34
37
  const DefaultView = (props) => {
38
+ const dispatch = useDispatch();
39
+ const { widgets, settings } = config;
40
+ const { views } = widgets;
35
41
  const { content, location } = props;
42
+ const { astNavigations, contextNavigationLocations } = settings;
36
43
  const path = getBaseUrl(location?.pathname || '');
37
- const dispatch = useDispatch();
38
- const { views } = config.widgets;
39
44
  const contentSchema = useSelector((state) => state.schema?.schema);
40
45
  const fieldsetsToExclude = [
41
46
  'categorization',
@@ -67,9 +72,12 @@ const DefaultView = (props) => {
67
72
  const Container =
68
73
  config.getComponent({ name: 'Container' }).component || SemanticContainer;
69
74
 
70
- let currentNavigation = config.settings.contextNavigationLocations.find(
75
+ let currentNavigation = contextNavigationLocations.find(
71
76
  (element) => location.pathname.indexOf(element.rootPath) > -1,
72
77
  );
78
+ const astNavigation = astNavigations.find(
79
+ (nav) => location.pathname.indexOf(nav.root_path) > -1,
80
+ );
73
81
 
74
82
  const gridColumns =
75
83
  currentNavigation && currentNavigation?.columns
@@ -80,33 +88,47 @@ const DefaultView = (props) => {
80
88
  // If the content is not yet loaded, then do not show anything
81
89
  return contentLoaded ? (
82
90
  hasBlocksData(content) ? (
83
- currentNavigation ? (
84
- <Container id="page-document">
85
- <Grid>
86
- <Grid.Column width={12 - gridColumns}>
87
- <BannerTitle {...props} />
88
- <RenderBlocks {...props} path={path} />
89
- </Grid.Column>
90
- <Grid.Column width={gridColumns}>
91
- <ContextNavigation
92
- params={{
93
- name: currentNavigation.title,
94
- includeTop: false,
95
- // currentFolderOnly: true,
96
- topLevel: currentNavigation.topLevel,
97
- bottomLevel: currentNavigation.bottomLevel,
98
- rootPath: `${currentLang}/${currentNavigation.rootPath}`,
99
- }}
100
- />
101
- </Grid.Column>
102
- </Grid>
103
- </Container>
104
- ) : (
105
- <Container id="page-document">
106
- <BannerTitle {...props} />
107
- <RenderBlocks {...props} path={path} />
108
- </Container>
109
- )
91
+ <>
92
+ {currentNavigation ? (
93
+ <Container id="page-document">
94
+ <Grid>
95
+ <Grid.Column width={12 - gridColumns}>
96
+ <BannerTitle {...props} />
97
+ <RenderBlocks {...props} path={path} />
98
+ </Grid.Column>
99
+ <Grid.Column width={gridColumns}>
100
+ <ContextNavigation
101
+ params={{
102
+ name: currentNavigation.title,
103
+ includeTop: false,
104
+ // currentFolderOnly: true,
105
+ topLevel: currentNavigation.topLevel,
106
+ bottomLevel: currentNavigation.bottomLevel,
107
+ rootPath: `${currentLang}/${currentNavigation.rootPath}`,
108
+ }}
109
+ />
110
+ </Grid.Column>
111
+ </Grid>
112
+ </Container>
113
+ ) : astNavigation ? (
114
+ <Container id="page-document">
115
+ <Grid>
116
+ <Grid.Column mobile={12} tablet={12} computer={4}>
117
+ <ASTNavigation astNavigation={astNavigation} />
118
+ </Grid.Column>
119
+ <Grid.Column mobile={12} tablet={12} computer={8}>
120
+ <BannerTitle {...props} />
121
+ <RenderBlocks {...props} path={path} />
122
+ </Grid.Column>
123
+ </Grid>
124
+ </Container>
125
+ ) : (
126
+ <Container id="page-document">
127
+ <BannerTitle {...props} />
128
+ <RenderBlocks {...props} path={path} />
129
+ </Container>
130
+ )}
131
+ </>
110
132
  ) : (
111
133
  <Container id="page-document">
112
134
  {fieldsets?.map((fs) => {
package/src/index.js CHANGED
@@ -292,25 +292,6 @@ const applyConfig = (config) => {
292
292
  config.views.layoutViewsNamesMapping.view_cca_event = 'CCA Event View';
293
293
 
294
294
  config.settings.contextNavigationLocations = [
295
- // {
296
- // title: 'Regional Adaptation Support Tool',
297
- // columns: 4,
298
- // topLevel: 2,
299
- // bottomLevel: 0,
300
- // rootPath: '/mission/knowledge-and-data/regional-adaptation-support-tool',
301
- // },
302
- {
303
- title: 'UrbanAST',
304
- topLevel: 3,
305
- bottomLevel: 2,
306
- rootPath: 'knowledge/tools/urban-ast',
307
- },
308
- {
309
- title: 'Adaptation Suport Tool',
310
- topLevel: 3,
311
- bottomLevel: 2,
312
- rootPath: 'knowledge/tools/adaptation-support-tool',
313
- },
314
295
  {
315
296
  title: 'Adaptation',
316
297
  topLevel: 4,
@@ -332,6 +313,17 @@ const applyConfig = (config) => {
332
313
  },
333
314
  ];
334
315
 
316
+ config.settings.astNavigations = [
317
+ {
318
+ title: 'Urban adaptation support tool',
319
+ root_path: 'knowledge/tools/urban-ast',
320
+ },
321
+ {
322
+ title: 'Adaptation Suport Tool',
323
+ root_path: 'knowledge/tools/adaptation-support-tool',
324
+ },
325
+ ];
326
+
335
327
  const hideChildren = {
336
328
  hideChildrenFromNavigation: false,
337
329
  };