From c6b6c04269c3cba3be764ade14f3d13dd8e49fcd Mon Sep 17 00:00:00 2001 From: nileshgulia1 Date: Wed, 5 Jan 2022 14:53:07 +0530 Subject: [PATCH] volto 14 compatibility --- package.json | 8 +- .../theme/CatalogueViews/AppHeader.jsx | 24 +- .../theme/CountryPageView/CountryPageView.jsx | 481 ------------------ .../volto/actions/content/content.js | 44 ++ .../volto/helpers/Html/Html.jsx | 131 ++++- 5 files changed, 158 insertions(+), 530 deletions(-) delete mode 100644 src/components/theme/CountryPageView/CountryPageView.jsx diff --git a/package.json b/package.json index 87edfe7..4e3433e 100644 --- a/package.json +++ b/package.json @@ -23,20 +23,14 @@ "@eeacms/volto-matomo" ], "dependencies": { - "@blueprintjs/core": "^3.30.0", - "@blueprintjs/icons": "^3.19.0", "@eeacms/volto-plotlycharts": "*", "@eeacms/volto-addons-forest": "*", "@eeacms/volto-datablocks": "2.0.16", "@eeacms/volto-matomo": "*", - "raven-js": "3.27.2", - "recharts": "2.1.6", "react-highlight-words": "^0.16.0", "react-image-gallery": "1.2.7", "react-lazy-load-image-component": "^1.5.0", - "react-stickynode": "^2.1.1", - "react-toastify": "^5.3.2", - "webpack-bundle-analyzer": "^3.6.0" + "react-stickynode": "^2.1.1" }, "devDependencies": { "@cypress/code-coverage": "^3.9.5", diff --git a/src/components/theme/CatalogueViews/AppHeader.jsx b/src/components/theme/CatalogueViews/AppHeader.jsx index 6d74a3d..3875a98 100644 --- a/src/components/theme/CatalogueViews/AppHeader.jsx +++ b/src/components/theme/CatalogueViews/AppHeader.jsx @@ -8,7 +8,6 @@ import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { compose } from 'redux'; import { asyncConnect } from 'redux-connect'; -import loadable from '@loadable/component'; import { Header } from '@plone/volto/components'; import { BodyClass, getBaseUrl, getView } from '@plone/volto/helpers'; @@ -25,6 +24,7 @@ import { } from '@eeacms/volto-forests-theme/actions'; import { getPortlets } from '@eeacms/volto-addons-forest/actions'; import config from '@plone/volto/registry'; +import * as Sentry from '@sentry/browser'; class App extends Component { static propTypes = { @@ -41,21 +41,6 @@ class App extends Component { errorInfo: null, }; - /** - * ComponentDidMount - * @method ComponentDidMount - * @param {string} error The error - * @param {string} info The info - * @returns {undefined} - */ - componentDidMount() { - // this.props.getDefaultHeaderImage(); - if (__CLIENT__ && process.env.SENTRY_DSN) { - const Raven = loadable(() => import('raven-js')); - - Raven.config(process.env.SENTRY_DSN).install(); - } - } // shouldComponentUpdate(nextProps, nextState) { // if (nextProps.loadingContent.loading || nextProps.search.loading) { // console.log('dont load'); @@ -89,9 +74,10 @@ class App extends Component { */ componentDidCatch(error, info) { this.setState({ hasError: true, error, errorInfo: info }); - if (__CLIENT__ && process.env.SENTRY_DSN) { - const Raven = loadable(() => import('raven-js')); - Raven.captureException(error, { extra: info }); + if (__CLIENT__) { + if (window?.env?.RAZZLE_SENTRY_DSN || __SENTRY__?.SENTRY_DSN) { + Sentry.captureException(error); + } } } diff --git a/src/components/theme/CountryPageView/CountryPageView.jsx b/src/components/theme/CountryPageView/CountryPageView.jsx deleted file mode 100644 index c7ea967..0000000 --- a/src/components/theme/CountryPageView/CountryPageView.jsx +++ /dev/null @@ -1,481 +0,0 @@ -/* eslint-disable jsx-a11y/anchor-is-valid */ -import React, { Component } from 'react'; -import PropTypes from 'prop-types'; - -import { - ResponsiveContainer, - BarChart, - Area, - AreaChart, - Bar, - XAxis, - YAxis, - CartesianGrid, - Tooltip, - // Legend, -} from 'recharts'; - -import { Container, Image } from 'semantic-ui-react'; -import { map } from 'lodash'; -import { connect } from 'react-redux'; -// import { Link } from 'react-router-dom'; - -import { - // setFolderHeader, - setFolderTabs, - getParentFolderData, -} from '@eeacms/volto-forests-theme/actions'; - -import config from '@plone/volto/registry'; - -import { - getBlocksFieldname, - getBlocksLayoutFieldname, - hasBlocksData, -} from '@plone/volto/helpers'; - -const mapDispatchToProps = { - // setFolderHeader, - setFolderTabs, - getParentFolderData, -}; - -const data = [ - { name: '01', uv: 31, Species: 9 }, - { name: '04', uv: 22, Species: 18 }, - { name: '07', uv: 2, Species: 38 }, - { name: '10', uv: 24, Species: 16 }, - { name: '18', uv: 21, Species: 19 }, -]; - -const coverage = [ - { name: '01', uv: 5, pv: 8, amt: 12 }, - { name: '04', uv: 7, pv: 13, amt: 3 }, - { name: '07', uv: 6, pv: 15, amt: 19 }, - { name: '10', uv: 3, pv: 12, amt: 8 }, - { name: '18', uv: 5, pv: 15, amt: 9 }, -]; - -class StackedBarChart extends Component { - render() { - return ( - - - - - - - - - - ); - } -} - -class AreaBarChart extends Component { - render() { - return ( - - - - - - - - - - - - ); - } -} - -class CountryPageView extends Component { - static propTypes = { - tabs: PropTypes.array, - content: PropTypes.shape({ - title: PropTypes.string, - description: PropTypes.string, - items: PropTypes.arrayOf( - PropTypes.shape({ - title: PropTypes.string, - description: PropTypes.string, - url: PropTypes.string, - image: PropTypes.object, - image_caption: PropTypes.string, - '@type': PropTypes.string, - }), - ), - }).isRequired, - }; - constructor(props) { - super(props); - this.state = {}; - } - - componentDidMount() { - // this.props.setFolderHeader({ inCountryFolder: true }); - } - - componentWillUnmount() { - // this.props.setFolderHeader({ inCountryFolder: false }); - } - - componentWillReceiveProps(nextProps) { - if ( - JSON.stringify(nextProps.parent) !== JSON.stringify(this.props.parent) - ) { - // this.props.setFolderHeader({ title, description, url, inCountryFolder }); - const pathArr = nextProps.location.pathname.split('/'); - pathArr.length = 3; - const path = pathArr.join('/'); - const tabsItems = nextProps.parent.items - .map((i) => { - return { - url: `${path}/${i.id}`, - title: i.title, - '@type': i['@type'], - }; - }) - .filter((i) => i.title !== 'folder_info'); - this.props.setFolderTabs(tabsItems); - } - } - - render() { - const content = this.props.content; - const blocksFieldname = getBlocksFieldname(content); - const blocksLayoutFieldname = getBlocksLayoutFieldname(content); - - return hasBlocksData(content) ? ( -
- {/*this.tabs && this.tabs.length ? ( -
- {this.tabs.map(tab, index => ( - - {tab.title} - - ))} -
- ) : ( - '' - )*/} - -
-
- Summary - Forest basic information - Forest biodiversity and nature - Forest and climate - Forest bioeconomy - Forest condition -
- -
-
-
-
-
-

Biodiversity and nature

-

- Forests are intimately linked to Romania's cultural, - economic, social and historical development. The country - is located in the continental temperate region, with a - varied relief ranging from seaside to mountain. -

-
-
- -
-
-
-
-
-
Tree species lost
-
-
12
-
- species threatened by extinction -
-
-
-
- Conifer - 8 species -
-
- Broadleaved - 4 species -
-
-

Integer magna nunc, scelerisque in lacinia nec.

-
- - From 2001 to 2018, Romania lost 336kha of tree cover. - -
-
- -
-
-
-
-
-
- -
-
-
-
-
-
Species Coverage
-
- Vestibulum eget est ac lorem dapibus lacinia. - Integer magna nunc, scelerisque in lacinia nec, - laoreet non augue. Nunc quis pharetra magna, in - convallis ligula. -
-
- - From 2001 to 2018, Romania lost 336kha of tree cover. - -
-
- -
-
-
-
-
-
- -
-
-
-
Forest coverage
-
-
26%
-
- of Romania's land surface 6.2 Mha -
-
-
-
- 94% publicy owned -
-
- 6% private -
-
- 2017 tree cover extent -
-
- -
-
-
Forest deadwood volume
-
-
8
-
- m3/ha
standing deadwood volume -
-
-
-
- Conifer - 94 species -
-
Broadleaved
-
- See all countries -
-
-
-
- -
-
-