Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Commit

Permalink
add theme packages, lint:fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nileshgulia1 committed Aug 24, 2021
1 parent 5ef7c4d commit 87e437f
Show file tree
Hide file tree
Showing 20 changed files with 52 additions and 98 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
"url": "git@github.com:eea/volto-forests-theme.git"
},
"dependencies": {
"@blueprintjs/core": "^3.30.0",
"@blueprintjs/icons": "^3.19.0",
"@eeacms/volto-plotlycharts": "*",
"@eeacms/volto-addons-forest": "0.1.1",
"raven-js": "3.27.2",
Expand All @@ -25,7 +27,7 @@
"react-lazy-load-image-component": "^1.5.0",
"react-stickynode": "^2.1.1",
"react-toastify": "^5.3.2",
"volto-slate": "2.8.3",
"volto-slate": "2.9.1",
"webpack-bundle-analyzer": "^3.6.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
* Footer,
* };
*/
export CountryView from '~/components/theme/CountryView/CountryView';
export CountryView from './theme/CountryView/CountryView';
1 change: 1 addition & 0 deletions src/components/manage/Blocks/NavigationBlock/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const View = ({ content, ...props }) => {
Object.keys(pagesProperties).map((page) => pagesProperties[page]) || [];
setPages(newPages);
setNavigationItems([...(props.navigation?.items || []), ...newPages]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [props.navigation, data.pages?.value]);

if (navigationItems.length < 2 && props.mode !== 'edit') return null;
Expand Down
2 changes: 1 addition & 1 deletion src/components/manage/Widgets/ObjectListInlineWidget.jsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
4 changes: 1 addition & 3 deletions src/components/theme/CatalogueViews/AppHead.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +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() {
Expand Down
14 changes: 1 addition & 13 deletions src/components/theme/CatalogueViews/AppHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,9 @@ import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { compose } from 'redux';
import { asyncConnect } from 'redux-connect';
import { Segment, Container } from 'semantic-ui-react';
import { renderRoutes } from 'react-router-config';
import { Slide, ToastContainer, toast } from 'react-toastify';
import loadable from '@loadable/component';

import Error from '@plone/volto/error';

import {
Icon,
Messages,
Footer,
Header,
OutdatedBrowser,
AppExtras,
} from '@plone/volto/components';
import { Header } from '@plone/volto/components';
import { BodyClass, getBaseUrl, getView } from '@plone/volto/helpers';
import {
getContent,
Expand Down
49 changes: 17 additions & 32 deletions src/components/theme/CountryPageView/CountryPageView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
// Legend,
} from 'recharts';

import { Helmet } from '@plone/volto/helpers';
import { Container, Image } from 'semantic-ui-react';
import { map } from 'lodash';
import { connect } from 'react-redux';
Expand All @@ -35,21 +34,6 @@ import {
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',
};

const mapDispatchToProps = {
// setFolderHeader,
setFolderTabs,
Expand Down Expand Up @@ -172,13 +156,13 @@ 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;
// 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('/');
pathArr.length = 3;
Expand All @@ -200,15 +184,15 @@ 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);
}
*/
}
// {
// /*if (!this.tabs) {
// const pathArr = this.props.location.pathname.split('/');
// pathArr.length = 3;
// const path = pathArr.join('/');
// this.props.getParentFolderData(path);
// }
// */
// }

return hasBlocksData(content) ? (
<div id="page-document" className="ui wrapper">
Expand Down Expand Up @@ -369,6 +353,7 @@ class CountryPageView extends Component {
<div className="column map-container">
<div className="map-wrapper">
<iframe
title="eea-maps"
src="https://maps.eea.europa.eu/CopernicusViewer/?webmap=f9a8ae48d60a49f1bd9b16dba0f2c5fe&extent=-20.0,30.0,44.0,66.0&zoom=true"
width="100%"
height="490"
Expand Down
8 changes: 1 addition & 7 deletions src/components/theme/HomepageView/HomepageView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { injectIntl } from 'react-intl';
import qs from 'query-string';
import config from '@plone/volto/registry';
import { Helmet } from '@plone/volto/helpers';
import { Link } from 'react-router-dom';

import { Comments, Tags, Toolbar } from '@plone/volto/components';
import { listActions, getContent } from '@plone/volto/actions';
Expand All @@ -21,13 +20,8 @@ import {
getBaseUrl,
getLayoutFieldname,
} from '@plone/volto/helpers';
import BasicForestIMG from '@eeacms/volto-forests-theme/components/theme/HomepageView/images/1.jpg';
import ForestCarbonIMG from '@eeacms/volto-forests-theme/components/theme/HomepageView/images/2.jpg';
import ForestIMG from '@eeacms/volto-forests-theme/components/theme/HomepageView/images/3.jpg';
import NatureIMG from '@eeacms/volto-forests-theme/components/theme/HomepageView/images/4.jpg';
import ForestHealthIMG from '@eeacms/volto-forests-theme/components/theme/HomepageView/images/5.jpg';

import MosaicView from 'volto-mosaic/components/theme/View';
//import MosaicView from 'volto-mosaic/components/theme/View';

/**
* View container class.
Expand Down
1 change: 1 addition & 0 deletions src/components/theme/HomepageView/scrap.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable */
<div className="country-report-section">
<div className="ui stackable two column grid">
<div className="column">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { defineMessages, injectIntl } from 'react-intl';
import { Popup } from 'semantic-ui-react';
import { Icon } from '@plone/volto/components';
import zoomSVG from '@plone/volto/icons/zoom.svg';
import Person from './person.svg';

import { connect } from 'react-redux';

const messages = defineMessages({
Expand Down Expand Up @@ -188,7 +188,7 @@ class MobileSearchWidget extends Component {
}

export default compose(
connect(state => ({
connect((state) => ({
token: state.userSession.token,
})),
withRouter,
Expand Down
17 changes: 1 addition & 16 deletions src/components/theme/MosaicView/MosaicView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class MosaicView extends Component {
super(props);

let content = props.content;
console.log('content', content);
const blocksLayoutFieldname = getBlocksLayoutFieldname(content);

let layout = content[blocksLayoutFieldname].layout;
Expand All @@ -57,37 +56,24 @@ class MosaicView extends Component {
currentNode: layout,
};
}

console.log('This.state in constructor', this.state, content);
}

createNode = () => {
// this.onAddBlock('text', 0);
console.log('Called createNode');
};

onChange = (currentNode) => {
this.setState({ currentNode });
};

onRelease = (currentNode) => {
console.log('Mosaic.onRelease():', currentNode);
};
onRelease = (currentNode) => {};

renderBlock(blockid) {
const content = this.props.content;
const blocksFieldname = getBlocksFieldname(content);
const availableBlocks = content[blocksFieldname];
const blocktype = availableBlocks[blockid]['@type'];

console.log(
'Rendering block:',
blockid,
blocktype,
blocksFieldname,
content,
);

let Block = null;
Block = config.blocks.defaultBlocksViewMap[blocktype];

Expand All @@ -106,7 +92,6 @@ class MosaicView extends Component {

render() {
const content = this.props.content;
console.log('This.state in render: ', this.state);

const blocksLayoutFieldname = getBlocksLayoutFieldname(content);
const height = content[blocksLayoutFieldname].layout_height || 500;
Expand Down
8 changes: 4 additions & 4 deletions src/components/theme/NewsView/NewsItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ const NewsItem = ({ item }) => {
return `${da} ${mo} ${ye} ${hh}:${mm} ${tz}`;
};

const itemPath = (urlString) => {
const url = new URL(urlString);
return url.pathname.replace('/fise', '');
};
// const itemPath = (urlString) => {
// const url = new URL(urlString);
// return url.pathname.replace('/fise', '');
// };
return (
<article id="page-document" key={item.id}>
<Link
Expand Down
1 change: 1 addition & 0 deletions src/components/theme/NewsView/NewsView.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable */
import React, { useState, useEffect } from 'react';
import { useDispatch } from 'react-redux';
import { matchPath } from 'react-router';
Expand Down
2 changes: 0 additions & 2 deletions src/components/theme/RefreshView/RefreshView.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React, { useState } from 'react';

const RefreshView = () => {
if (__SERVER__) {
return '';
Expand Down
2 changes: 1 addition & 1 deletion src/components/theme/SiteMap/SiteMap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { asyncConnect } from 'redux-connect';
import { Link } from 'react-router-dom';

import { getBaseUrl } from '@plone/volto/helpers';
import { getNavigation } from '@plone/volto/actions';

import { getNavSiteMap } from '@eeacms/volto-forests-theme/actions';

/**
Expand Down
1 change: 1 addition & 0 deletions src/components/theme/View/RedirectView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const RedirectView = (props) => {
if (redirect) {
history.push(getBasePath(redirectPage));
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [redirect]);

if (mounted && !redirect && !props.navigation.loading) {
Expand Down
10 changes: 5 additions & 5 deletions src/components/theme/Viewlets/ForestMetadata.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import { Portal } from 'react-portal';
import { Label, Grid } from 'semantic-ui-react';

const ForestMetadata = props => {
const ForestMetadata = (props) => {
const {
nuts_level,
resource_type,
Expand All @@ -30,7 +30,7 @@ const ForestMetadata = props => {
<div id="forest-metadata-resource_type">
<h5>NUTS Level</h5>
<div>
{nuts_level.map(el => (
{nuts_level.map((el) => (
<Label key={el.token}>{el.title}</Label>
))}
</div>
Expand All @@ -41,7 +41,7 @@ const ForestMetadata = props => {
<div id="forest-metadata-geo-coverage">
<h5>Geo coverage</h5>
<div>
{geo_coverage.map(el => (
{geo_coverage.map((el) => (
<Label key={el.token}>{el.title}</Label>
))}
</div>
Expand All @@ -52,7 +52,7 @@ const ForestMetadata = props => {
<div id="forest-metadata-topics">
<h5>Topics</h5>
<div>
{topics.map(el => (
{topics.map((el) => (
<Label key={el}>{el}</Label>
))}
</div>
Expand All @@ -63,7 +63,7 @@ const ForestMetadata = props => {
<div id="forest-metadata-keywords">
<h5>Keywords</h5>
<div>
{keywords.map(el => (
{keywords.map((el) => (
<Label key={el}>{el}</Label>
))}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ const messages = defineMessages({
},
});

const getChildPath = (parent, child) => {
if (!parent && child) return child.url === '' ? '/' : child.url;
if (!child) return parent.url === '' ? '/' : parent.url;
if (!parent) return '/';
if (parent.title === 'Countries' && child.items?.length > 0)
return child.items[0].url === '' ? '/' : child.items[0].url;
return child.url === '' ? '/' : child.url;
};
// const getChildPath = (parent, child) => {
// if (!parent && child) return child.url === '' ? '/' : child.url;
// if (!child) return parent.url === '' ? '/' : parent.url;
// if (!parent) return '/';
// if (parent.title === 'Countries' && child.items?.length > 0)
// return child.items[0].url === '' ? '/' : child.items[0].url;
// return child.url === '' ? '/' : child.url;
// };

/**
* Navigation container class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { FormattedMessage } from 'react-intl';
import { Portal } from 'react-portal';
import { Container, Pagination } from 'semantic-ui-react';
import qs from 'query-string';
import moment from 'moment';
//import moment from 'moment';
import { isArray, isObject } from 'lodash';
import config from '@plone/volto/registry';
import { Helmet } from '@plone/volto/helpers';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Component, Fragment } from 'react';
import React, { Component } from 'react';
import { Portal } from 'react-portal';
import { Route } from 'react-router-dom';
/**
Expand Down

0 comments on commit 87e437f

Please sign in to comment.