From fff222fe8b8423e1d48cc9be5e390b06248f6fb9 Mon Sep 17 00:00:00 2001 From: Mihai Macaneata Date: Thu, 14 May 2020 12:26:18 +0300 Subject: [PATCH] enable mosaic, fix childview errors --- src/components/theme/View/TabsChildView.jsx | 48 ++++++++++----------- src/components/theme/View/TabsView.jsx | 42 ++++++++++-------- src/config.js | 2 +- theme/site/globals/site.overrides | 4 ++ 4 files changed, 53 insertions(+), 43 deletions(-) diff --git a/src/components/theme/View/TabsChildView.jsx b/src/components/theme/View/TabsChildView.jsx index a270d118..947516e2 100644 --- a/src/components/theme/View/TabsChildView.jsx +++ b/src/components/theme/View/TabsChildView.jsx @@ -72,12 +72,14 @@ class DefaultView extends Component { // } computeFolderTabs = siblings => { - const tabsItems = siblings && siblings.items.map(i => { - return { - url: flattenToAppURL(i.url), - title: i.name, - }; - }); + const tabsItems = + siblings && + siblings.items?.map(i => { + return { + url: flattenToAppURL(i.url), + title: i.name, + }; + }); return tabsItems; }; @@ -87,13 +89,12 @@ class DefaultView extends Component { const blocksFieldname = getBlocksFieldname(content); const blocksLayoutFieldname = getBlocksLayoutFieldname(content); const tabs = this.computeFolderTabs(content['@components'].siblings); - const sectionTabs = this.props.sectionTabs?.items - console.log('sectionTabs in child', sectionTabs) + const sectionTabs = this.props.sectionTabs?.items; + console.log('sectionTabs in child', sectionTabs); return ( hasBlocksData(content) && (
-
@@ -115,8 +116,8 @@ class DefaultView extends Component { ))} ) : ( - '' - )} + '' + )}
{tabs && tabs.length ? ( @@ -136,15 +137,15 @@ class DefaultView extends Component { ))} ) : ( - '' - )} + '' + )}
{map(content[blocksLayoutFieldname].items, block => { const Block = blocks.blocksConfig[ - (content[blocksFieldname]?.[block]?.['@type']) + (content[blocksFieldname]?.[block]?.['@type']) ]?.['view'] || null; return Block !== null ? ( ) : ( -
- {intl.formatMessage(messages.unknownBlock, { - block: content[blocksFieldname]?.[block]?.['@type'], - })} -
- ); +
+ {intl.formatMessage(messages.unknownBlock, { + block: content[blocksFieldname]?.[block]?.['@type'], + })} +
+ ); })}
- ) - ) + ); } } @@ -176,6 +176,6 @@ export default compose( pathname: props.location.pathname, content: state.prefetch?.[state.router.location.pathname] || state.content.data, - sectionTabs: state.section_tabs + sectionTabs: state.section_tabs, })), -)(DefaultView); \ No newline at end of file +)(DefaultView); diff --git a/src/components/theme/View/TabsView.jsx b/src/components/theme/View/TabsView.jsx index 2220d520..b0bbc3bd 100644 --- a/src/components/theme/View/TabsView.jsx +++ b/src/components/theme/View/TabsView.jsx @@ -76,14 +76,16 @@ class DefaultView extends Component { // } computeFolderTabs = siblings => { - const tabsItems = siblings && siblings.items.map(i => { - return { - url: flattenToAppURL(i.url), - title: i.name, - }; - }); - console.log('--------------', this.props.pathname) - if(this.props.pathname && this.props.pathname.split('/').length === 3) { + const tabsItems = + siblings && + siblings.items?.map(i => { + return { + url: flattenToAppURL(i.url), + title: i.name, + }; + }); + console.log('--------------', this.props.pathname); + if (this.props.pathname && this.props.pathname.split('/').length === 3) { this.props.setSectionTabs(tabsItems); } return tabsItems; @@ -96,18 +98,19 @@ class DefaultView extends Component { const blocksLayoutFieldname = getBlocksLayoutFieldname(content); const tabs = this.computeFolderTabs(content['@components'].siblings); const mainItem = content.items[0]; - const mainUrl = mainItem && mainItem['@id'] && flattenToAppURL(mainItem['@id']); + const mainUrl = + mainItem && mainItem['@id'] && flattenToAppURL(mainItem['@id']); console.log('mainitem,mainurl', mainItem, mainUrl); - let redirect = false + let redirect = false; if (__CLIENT__ && mainUrl && window) { - redirect = true + redirect = true; } return ( hasBlocksData(content) && (
{/* */} {tabs && tabs.length && redirect ? ( - + ) : ( '' )} @@ -140,9 +143,12 @@ class DefaultView extends Component { export default compose( injectIntl, - connect((state, props) => ({ - pathname: props.location.pathname, - content: - state.prefetch?.[state.router.location.pathname] || state.content.data, - }),mapDispatchToProps), -)(DefaultView); \ No newline at end of file + connect( + (state, props) => ({ + pathname: props.location.pathname, + content: + state.prefetch?.[state.router.location.pathname] || state.content.data, + }), + mapDispatchToProps, + ), +)(DefaultView); diff --git a/src/config.js b/src/config.js index b3550387..e1a7e306 100644 --- a/src/config.js +++ b/src/config.js @@ -23,7 +23,7 @@ const config = [ installTableau, plotlyConfig, // ckeditorConfig, - // mosaicConfig, + mosaicConfig, blocksConfig, dataBlocksConfig, installEPRTR, diff --git a/theme/site/globals/site.overrides b/theme/site/globals/site.overrides index d51bd4c3..18c439cd 100644 --- a/theme/site/globals/site.overrides +++ b/theme/site/globals/site.overrides @@ -654,4 +654,8 @@ p { padding: 15px 50px; flex-grow: unset !important; } +} + +.mosaic-modal { + transform: none!important; } \ No newline at end of file