Skip to content

Commit

Permalink
enable mosaic, fix childview errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mihai-macaneata committed May 14, 2020
1 parent 507f2af commit fff222f
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 43 deletions.
48 changes: 24 additions & 24 deletions src/components/theme/View/TabsChildView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand All @@ -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) && (
<div className="ui wrapper">

<div className="glossary-search search">
<SearchWidget pathname={this.props.pathname} />
</div>
Expand All @@ -115,8 +116,8 @@ class DefaultView extends Component {
))}
</nav>
) : (
''
)}
''
)}
<div className="widthSidebar">
<div className="page-document-sidebar">
{tabs && tabs.length ? (
Expand All @@ -136,15 +137,15 @@ class DefaultView extends Component {
))}
</nav>
) : (
''
)}
''
)}
</div>
<div id="page-document" className="hasSidebar">
<Helmet title={content.title} />
{map(content[blocksLayoutFieldname].items, block => {
const Block =
blocks.blocksConfig[
(content[blocksFieldname]?.[block]?.['@type'])
(content[blocksFieldname]?.[block]?.['@type'])
]?.['view'] || null;
return Block !== null ? (
<Block
Expand All @@ -154,19 +155,18 @@ class DefaultView extends Component {
data={content[blocksFieldname][block]}
/>
) : (
<div key={`blocktype-${block}`}>
{intl.formatMessage(messages.unknownBlock, {
block: content[blocksFieldname]?.[block]?.['@type'],
})}
</div>
);
<div key={`blocktype-${block}`}>
{intl.formatMessage(messages.unknownBlock, {
block: content[blocksFieldname]?.[block]?.['@type'],
})}
</div>
);
})}
</div>
</div>
</div>

)
)
);
}
}

Expand All @@ -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);
)(DefaultView);
42 changes: 24 additions & 18 deletions src/components/theme/View/TabsView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) && (
<div id="page-document" className="ui wrapper">
{/* <button onClick={() => this.props.setSectionTabs(tabs)}>asd</button> */}
{tabs && tabs.length && redirect ? (
<Redirect to={{ pathname: mainUrl }} />
<Redirect to={{ pathname: mainUrl }} />
) : (
''
)}
Expand Down Expand Up @@ -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);
connect(
(state, props) => ({
pathname: props.location.pathname,
content:
state.prefetch?.[state.router.location.pathname] || state.content.data,
}),
mapDispatchToProps,
),
)(DefaultView);
2 changes: 1 addition & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const config = [
installTableau,
plotlyConfig,
// ckeditorConfig,
// mosaicConfig,
mosaicConfig,
blocksConfig,
dataBlocksConfig,
installEPRTR,
Expand Down
4 changes: 4 additions & 0 deletions theme/site/globals/site.overrides
Original file line number Diff line number Diff line change
Expand Up @@ -654,4 +654,8 @@ p {
padding: 15px 50px;
flex-grow: unset !important;
}
}

.mosaic-modal {
transform: none!important;
}

0 comments on commit fff222f

Please sign in to comment.