From 7bd7408525d4f0f1e2872c2177ff5846c8ede434 Mon Sep 17 00:00:00 2001 From: nileshgulia1 Date: Wed, 3 Nov 2021 13:26:20 +0530 Subject: [PATCH] lint:fix --- package.json | 1 + src/actions/index.js | 14 +- src/components/index.js | 2 +- .../manage/Blocks/NavigationBlock/View.jsx | 1 + .../manage/Widgets/ObjectListInlineWidget.jsx | 2 +- .../theme/CatalogueViews/AppHead.jsx | 5 +- .../theme/CatalogueViews/AppHeader.jsx | 58 +- .../theme/CountryPageView/CountryPageView.jsx | 91 +- .../theme/CountryView/CountryView.jsx | 48 +- .../theme/Header/HeaderNavigation.jsx | 1 + .../theme/Header/HomepageSlider.jsx | 22 +- .../theme/HomepageView/HomepageView.jsx | 76 +- src/components/theme/HomepageView/scrap.jsx | 48 - .../MobileSearchWidget/MobileSearchWidget.jsx | 3 +- .../theme/MosaicView/MosaicView.jsx | 198 ----- src/components/theme/NewsView/NewsItem.jsx | 57 +- src/components/theme/NewsView/README.md | 8 +- .../theme/RefreshView/RefreshView.jsx | 2 - src/components/theme/SiteMap/SiteMap.jsx | 23 +- src/components/theme/View/RedirectView.jsx | 17 +- .../theme/Viewlets/ForestMetadata.jsx | 10 +- src/customizations/README.md | 2 +- .../volto/components/theme/App/App.jsx | 103 +-- .../volto/components/theme/Footer/Footer.jsx | 74 +- .../volto/components/theme/Header/Header.jsx | 63 +- .../volto/components/theme/Logo/Logo.jsx | 2 - .../theme/Navigation/Navigation.jsx | 131 ++- .../theme/Unauthorized/Unauthorized.jsx | 2 +- .../components/theme/View/ListingView.jsx | 66 +- src/index.js | 2 +- src/plugins/index.js | 5 +- src/reducers/current_version.js | 2 +- src/reducers/default_header_image.js | 6 +- src/reducers/folder_header.js | 4 +- src/reducers/folder_tabs.js | 2 +- src/reducers/frontpage_slides.js | 4 +- src/reducers/index.js | 18 +- src/reducers/localnavigation.js | 2 +- src/reducers/parent_folder_data.js | 2 +- src/reducers/set_folder_header.js | 2 +- .../imagecards/carousel.overrides | 496 +++++------ theme/site/collections/breadcrumb.overrides | 31 +- theme/site/collections/form.overrides | 5 +- theme/site/collections/grid.overrides | 24 +- theme/site/collections/menu.overrides | 822 +++++++++--------- theme/site/collections/table.overrides | 15 +- theme/site/elements/button.overrides | 13 +- theme/site/elements/container.overrides | 113 +-- theme/site/elements/input.overrides | 33 +- theme/site/elements/list.overrides | 1 + theme/site/elements/segment.overrides | 2 +- theme/site/elements/step.overrides | 2 +- theme/site/extras/custom.overrides | 14 +- theme/site/extras/main.overrides | 16 +- theme/site/globals/reset.overrides | 7 +- theme/site/globals/site.overrides | 695 ++++++++------- theme/site/modules/dropdown.overrides | 2 +- theme/site/modules/rating.overrides | 2 +- 58 files changed, 1568 insertions(+), 1904 deletions(-) delete mode 100644 src/components/theme/HomepageView/scrap.jsx delete mode 100644 src/components/theme/MosaicView/MosaicView.jsx diff --git a/package.json b/package.json index 63e8ef0..7b2feb0 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "@eeacms/volto-plotlycharts": "*", "@eeacms/volto-addons-forest": "0.1.1", "raven-js": "3.27.2", + "recharts": "2.1.6", "react-highlight-words": "^0.16.0", "react-image-gallery": "1.0.8", "react-lazy-load-image-component": "^1.5.0", diff --git a/src/actions/index.js b/src/actions/index.js index 0841b52..6fefa9e 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -8,7 +8,7 @@ import { GET_CHART_DATA_FROM_VISUALIZATION, GET_NAVSITEMAP, SET_CURRENT_VERSION, -} from "@eeacms/volto-forests-theme/constants/ActionTypes"; +} from '@eeacms/volto-forests-theme/constants/ActionTypes'; export function setCurrentVersion(payload) { return { @@ -21,7 +21,7 @@ export function getFrontpageSlides() { return { type: GET_FRONTPAGESLIDES, request: { - op: "get", + op: 'get', path: `/frontpage_slides?fullobjects`, }, }; @@ -31,7 +31,7 @@ export function getDefaultHeaderImage() { return { type: GET_DEFAULT_HEADER_IMAGE, request: { - op: "get", + op: 'get', path: `/default_header_image?fullobjects`, }, }; @@ -41,7 +41,7 @@ export function getLocalnavigation(folder) { return { type: GET_LOCALNAVIGATION, request: { - op: "get", + op: 'get', path: `${folder}/@localnavigation`, }, }; @@ -75,7 +75,7 @@ export function getParentFolderData(url) { return { type: GET_PARENT_FOLDER_DATA, request: { - op: "get", + op: 'get', path: `/${url}?fullobjects`, }, }; @@ -95,7 +95,7 @@ export function getChartDataFromVisualization(path) { return { type: GET_CHART_DATA_FROM_VISUALIZATION, request: { - op: "get", + op: 'get', path, }, }; @@ -106,7 +106,7 @@ export function getNavSiteMap(url, depth) { return { type: GET_NAVSITEMAP, request: { - op: "get", + op: 'get', path: `${url}/@navigation?expand.navigation.depth=${depth || 3}`, }, }; diff --git a/src/components/index.js b/src/components/index.js index f22f931..2cb79a0 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -8,4 +8,4 @@ * Footer, * }; */ -export CountryView from "@eeacms/volto-forests-theme/components/theme/CountryView/CountryView"; +export CountryView from '@eeacms/volto-forests-theme/components/theme/CountryView/CountryView'; diff --git a/src/components/manage/Blocks/NavigationBlock/View.jsx b/src/components/manage/Blocks/NavigationBlock/View.jsx index 8d55cdc..566418f 100644 --- a/src/components/manage/Blocks/NavigationBlock/View.jsx +++ b/src/components/manage/Blocks/NavigationBlock/View.jsx @@ -52,6 +52,7 @@ const View = ({ content, ...props }) => { if (width && width > 600) { setIsMobile(false); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [props.navigation, data.pages?.value]); const isFixed = props.fixedTabs; diff --git a/src/components/manage/Widgets/ObjectListInlineWidget.jsx b/src/components/manage/Widgets/ObjectListInlineWidget.jsx index 2d42a72..5d6646f 100644 --- a/src/components/manage/Widgets/ObjectListInlineWidget.jsx +++ b/src/components/manage/Widgets/ObjectListInlineWidget.jsx @@ -1,4 +1,4 @@ -import { Accordion, Button, Segment, Modal, Grid } from 'semantic-ui-react'; +import { Accordion, Button, Segment, Modal } from 'semantic-ui-react'; import React, { useState } from 'react'; import { Icon as VoltoIcon, FormFieldWrapper } from '@plone/volto/components'; diff --git a/src/components/theme/CatalogueViews/AppHead.jsx b/src/components/theme/CatalogueViews/AppHead.jsx index a22a08b..d1dea93 100644 --- a/src/components/theme/CatalogueViews/AppHead.jsx +++ b/src/components/theme/CatalogueViews/AppHead.jsx @@ -3,10 +3,7 @@ * @module components/theme/App/App */ -import React, { Component } from 'react'; - -import { Footer } from '@plone/volto/components'; - +import { Component } from 'react'; class App extends Component { render() { return ''; diff --git a/src/components/theme/CatalogueViews/AppHeader.jsx b/src/components/theme/CatalogueViews/AppHeader.jsx index 2d20e5b..fac83d3 100644 --- a/src/components/theme/CatalogueViews/AppHeader.jsx +++ b/src/components/theme/CatalogueViews/AppHeader.jsx @@ -3,27 +3,27 @@ * @module components/theme/App/App */ -import React, { Component, Fragment } from "react"; -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 React, { Component, Fragment } from 'react'; +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"; +import { Header } from '@plone/volto/components'; +import { BodyClass, getBaseUrl, getView } from '@plone/volto/helpers'; import { getContent, getNavigation, getTypes, getWorkflow, purgeMessages, -} from "@plone/volto/actions"; +} from '@plone/volto/actions'; import { getFrontpageSlides, getDefaultHeaderImage, -} from "@eeacms/volto-forests-theme/actions"; -import { getPortlets } from "@eeacms/volto-addons-forest/actions"; +} from '@eeacms/volto-forests-theme/actions'; +import { getPortlets } from '@eeacms/volto-addons-forest/actions'; class App extends Component { static propTypes = { @@ -50,7 +50,7 @@ class App extends Component { componentDidMount() { // this.props.getDefaultHeaderImage(); if (__CLIENT__ && process.env.SENTRY_DSN) { - const Raven = loadable(() => import("raven-js")); + const Raven = loadable(() => import('raven-js')); Raven.config(process.env.SENTRY_DSN).install(); } @@ -89,7 +89,7 @@ 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")); + const Raven = loadable(() => import('raven-js')); Raven.captureException(error, { extra: info }); } } @@ -122,68 +122,68 @@ class App extends Component { export const __test__ = connect( (state, props) => ({ pathname: props.location.pathname }), - { purgeMessages } + { purgeMessages }, )(App); export default compose( asyncConnect([ { - key: "content", + key: 'content', promise: ({ location, store: { dispatch } }) => dispatch(getContent(getBaseUrl(location.pathname))), }, { - key: "frontpage_slides", + key: 'frontpage_slides', promise: ({ store: { dispatch } }) => __SERVER__ && dispatch(getFrontpageSlides()), }, { - key: "defaultHeaderImage", + key: 'defaultHeaderImage', promise: ({ store: { dispatch } }) => __SERVER__ && dispatch(getDefaultHeaderImage()), }, { - key: "navigation", + key: 'navigation', promise: ({ location, store: { dispatch } }) => __SERVER__ && dispatch(getNavigation(getBaseUrl(location.pathname))), }, { - key: "types", + key: 'types', promise: ({ location, store: { dispatch } }) => __SERVER__ && dispatch(getTypes(getBaseUrl(location.pathname))), }, { - key: "workflow", + key: 'workflow', promise: ({ location, store: { dispatch } }) => __SERVER__ && dispatch(getWorkflow(getBaseUrl(location.pathname))), }, { - key: "portlets", + key: 'portlets', promise: ({ location, store: { dispatch } }) => __SERVER__ && dispatch(getPortlets(getBaseUrl(location.pathname))), }, { - key: "portlets_left", + key: 'portlets_left', promise: ({ location, store: { dispatch } }) => __SERVER__ && dispatch( - getPortlets(getBaseUrl(location.pathname), "plone.leftcolumn") + getPortlets(getBaseUrl(location.pathname), 'plone.leftcolumn'), ), }, { - key: "portlets_right", + key: 'portlets_right', promise: ({ location, store: { dispatch } }) => __SERVER__ && dispatch( - getPortlets(getBaseUrl(location.pathname), "plone.rightcolumn") + getPortlets(getBaseUrl(location.pathname), 'plone.rightcolumn'), ), }, { - key: "portlets_footer", + key: 'portlets_footer', promise: ({ location, store: { dispatch } }) => __SERVER__ && dispatch( - getPortlets(getBaseUrl(location.pathname), "plone.footerportlets") + getPortlets(getBaseUrl(location.pathname), 'plone.footerportlets'), ), }, ]), @@ -200,6 +200,6 @@ export default compose( // loadingContent: state.content?.get, // search: state.search, }), - { purgeMessages } - ) + { purgeMessages }, + ), )(App); diff --git a/src/components/theme/CountryPageView/CountryPageView.jsx b/src/components/theme/CountryPageView/CountryPageView.jsx index 0820dd4..c7ea967 100644 --- a/src/components/theme/CountryPageView/CountryPageView.jsx +++ b/src/components/theme/CountryPageView/CountryPageView.jsx @@ -1,6 +1,6 @@ /* eslint-disable jsx-a11y/anchor-is-valid */ -import React, { Component } from "react"; -import PropTypes from "prop-types"; +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; import { ResponsiveContainer, @@ -13,42 +13,26 @@ import { CartesianGrid, Tooltip, // Legend, -} from "recharts"; +} from 'recharts'; -import { Helmet } from "@plone/volto/helpers"; -import { Container, Image } from "semantic-ui-react"; -import { map } from "lodash"; -import { connect } from "react-redux"; +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"; +} from '@eeacms/volto-forests-theme/actions'; -import config from "@plone/volto/registry"; +import config from '@plone/volto/registry'; import { getBlocksFieldname, getBlocksLayoutFieldname, hasBlocksData, -} from "@plone/volto/helpers"; - -const numberToWord = { - 1: "one", - 2: "two", - 3: "three", - 4: "four", - 5: "five", - 6: "six", - 7: "seven", - 8: "eight", - 9: "nine", - 10: "ten", - 11: "eleven", - 12: "twelve", -}; +} from '@plone/volto/helpers'; const mapDispatchToProps = { // setFolderHeader, @@ -57,19 +41,19 @@ const mapDispatchToProps = { }; 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 }, + { 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 }, + { 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 { @@ -150,8 +134,8 @@ class CountryPageView extends Component { url: PropTypes.string, image: PropTypes.object, image_caption: PropTypes.string, - "@type": PropTypes.string, - }) + '@type': PropTypes.string, + }), ), }).isRequired, }; @@ -172,26 +156,19 @@ class CountryPageView extends Component { if ( JSON.stringify(nextProps.parent) !== JSON.stringify(this.props.parent) ) { - const title = nextProps.parent.title; - const description = nextProps.parent.description; - const image = - nextProps.parent.items && - nextProps.parent.items.find((c) => c["@type"] === "Image"); - const url = image && image.image.download; - const inCountryFolder = true; // this.props.setFolderHeader({ title, description, url, inCountryFolder }); - const pathArr = nextProps.location.pathname.split("/"); + const pathArr = nextProps.location.pathname.split('/'); pathArr.length = 3; - const path = pathArr.join("/"); + const path = pathArr.join('/'); const tabsItems = nextProps.parent.items .map((i) => { return { url: `${path}/${i.id}`, title: i.title, - "@type": i["@type"], + '@type': i['@type'], }; }) - .filter((i) => i.title !== "folder_info"); + .filter((i) => i.title !== 'folder_info'); this.props.setFolderTabs(tabsItems); } } @@ -200,15 +177,6 @@ class CountryPageView extends Component { const content = this.props.content; const blocksFieldname = getBlocksFieldname(content); const blocksLayoutFieldname = getBlocksLayoutFieldname(content); - { - /*if (!this.tabs) { - const pathArr = this.props.location.pathname.split('/'); - pathArr.length = 3; - const path = pathArr.join('/'); - this.props.getParentFolderData(path); - } - */ - } return hasBlocksData(content) ? (
@@ -369,6 +337,7 @@ class CountryPageView extends Component {