Skip to content

Commit

Permalink
Improvments on site blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
razvanMiu committed May 4, 2021
1 parent 04cc6ff commit 6a57feb
Show file tree
Hide file tree
Showing 33 changed files with 538 additions and 446 deletions.
3 changes: 3 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
"@eeacms/volto-grid-block": [
"addons/volto-grid-block/src"
],
"@eeacms/volto-tableau": [
"addons/volto-tableau/src"
],
"@eeacms/volto-tabs-block": [
"addons/volto-tabs-block/src"
]
Expand Down
7 changes: 7 additions & 0 deletions mrs.developer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@
"package": "@eeacms/volto-grid-block",
"develop": true
},
"volto-tableau": {
"url": "https://github.com/eea/volto-tableau.git",
"path": "src",
"package": "@eeacms/volto-tableau",
"branch": "master",
"develop": true
},
"volto-tabs-block": {
"url": "https://github.com/eea/volto-tabs-block.git",
"path": "src",
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"volto-datablocks",
"volto-embed",
"volto-addons",
"@eeacms/volto-tableau",
"@eeacms/volto-block-style",
"@eeacms/volto-tabs-block"
],
Expand All @@ -66,6 +67,7 @@
"react-iframe": "^1.8.0",
"react-tooltip": "^4.2.9",
"react-visibility-sensor": "^5.1.1",
"tableau-api-js": "github:eea/tableau-api-js#1.1.0",
"volto-slate": "github:eea/volto-slate#2.4.0"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ const ReportingYears = (props) => {
>
<div>
<span className="floating-icon" data-tip={'Something'}>
<Icon name={infoSVG} size={20} color="#fff" />
<Icon name={infoSVG} size="20px" color="#fff" />
</span>
<p className="lighter">Last report was submitted on:</p>
<p className="bold">{getDate(packages[0])}</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const components = {
{components.bold(bold, text)}
{tooltip && tooltipText ? (
<span data-tip={tooltip && tooltipText ? tooltipText : false}>
<Icon name={infoSVG} size={20} color={color} />
<Icon name={infoSVG} size="20px" color={color} />
</span>
) : (
''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default ({ children, data = {}, block, onShow, ...rest }) => {
className="floating-icon mr-1"
data-tip={dataprotection.privacy_statement}
>
<Icon name={infoSVG} size={20} color="#D63D27" />
<Icon name={infoSVG} size="20px" color="#D63D27" />
</span>
) : (
''
Expand Down
15 changes: 5 additions & 10 deletions src/components/manage/Blocks/DiscodataOpenlayersMapBlock/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const OpenlayersMapView = (props) => {
const siteTerm =
filterSource !== 'query_params'
? props.discodata_query.search.siteTerm || null
: props.discodata_query.search[queryParams?.siteName?.param] || null;
: props.query.siteName || null;

useEffect(() => {
if (__CLIENT__ && document) {
Expand Down Expand Up @@ -363,7 +363,8 @@ const OpenlayersMapView = (props) => {
},
// Reporting year
reportingYear: {
sql: `(Site_reporting_year IN (:options))`,
sql: `(Site_reporting_year = :options)`,
type: 'multiple',
},
// Plant type
plantTypes: {
Expand Down Expand Up @@ -416,13 +417,7 @@ const OpenlayersMapView = (props) => {
where.sql = null;
}
} else {
if (id === 'reportingYear' && options) {
where.sql = options
? where.sql.replace(/:options/g, options).replace(/'/g, '')
: null;
} else {
where.sql = options ? where.sql.replace(/:options/g, options) : null;
}
where.sql = options ? where.sql.replace(/:options/g, options) : null;
}
if (!where.sql) delete sitesSourceQuery.whereStatements[id];
});
Expand Down Expand Up @@ -1441,7 +1436,7 @@ const OpenlayersMapView = (props) => {
export default compose(
connect(
(state, props) => ({
query: state.router.location.search,
query: qs.parse(state.router.location.search.replace('?', '')),
content:
state.prefetch?.[state.router.location.pathname] || state.content.data,
discodata_query: state.discodata_query,
Expand Down
7 changes: 3 additions & 4 deletions src/components/manage/Blocks/Iframe/Edit.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react';
import React, { useState } from 'react';
import { connect } from 'react-redux';
import { compose } from 'redux';
import _uniqueId from 'lodash/uniqueId';
Expand Down Expand Up @@ -151,18 +151,17 @@ const Edit = (props) => {
schema: getSchema({ ...props, providerUrl: config.settings.providerUrl }),
id: _uniqueId('block_'),
});
// useEffect(() => {

// }, [discodata_query, flags]);
return (
<div>
<View {...props} id={state.id} mode="edit" />

<RenderFields
schema={state.schema}
{...props}
title="Iframe"
noValueKey={true}
/>
<View {...props} id={state.id} mode="edit" />
</div>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/manage/Blocks/Iframe/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ const View = ({ content, ...props }) => {
<div className="header-tooltip">
<h3 className={cx('blue', titleClassName)}>{title}</h3>
<span className="floating-icon" data-tip={'This is a tooltip'}>
<Icon name={infoSVG} size={20} color="#D63D27" />
<Icon name={infoSVG} size="20px" color="#D63D27" />
</span>
</div>
) : title ? (
Expand Down
4 changes: 2 additions & 2 deletions src/components/manage/Blocks/SiteBlocks/BatConclusions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const View = (props) => {
content="Number of individual conclusions that indicate which techniques or combinations of techniques are BAT for achieving a specific environmental objective"
trigger={
<div className="popup-svg">
<Icon name={infoSVG} size={20} color="#D63D27" />
<Icon name={infoSVG} size="20px" color="#D63D27" />
</div>
}
/>
Expand Down Expand Up @@ -86,7 +86,7 @@ const View = (props) => {
? downSVG
: rightSVG
}
size={20}
size="20px"
color="#D63D27"
onClick={() => {
if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const CompetentAuthority = (props) => {
content="Authority, body or bodies responsible for regulating the facility and reporting the associated E-PRTR data, as designated by the reporting country"
trigger={
<div className="popup-svg">
<Icon name={infoSVG} size={20} color="#ed776a" />
<Icon name={infoSVG} size="20px" color="#ed776a" />
</div>
}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import { compose } from 'redux';
import { connect } from 'react-redux';
import { setQueryParam, deleteQueryParam } from 'volto-datablocks/actions';
import CompetentAuthority from '../CompetentAuthority';
import { getDate } from '../helpers';
import qs from 'querystring';
Expand All @@ -19,7 +18,7 @@ const getAllIndexes = (arr, val) => {
const View = (props) => {
const [facilities, setFacilities] = React.useState([]);
const { provider_data = {} } = props;
const query = { ...props.query, ...props.discodata_query.search };
const query = { ...props.query };
const siteReportingYear = parseInt(query.siteReportingYear || '');

const competentAuthority = facilities
Expand Down Expand Up @@ -74,14 +73,7 @@ const View = (props) => {
};

export default compose(
connect(
(state, props) => ({
query: qs.parse(state.router.location.search.replace('?', '')),
discodata_query: state.discodata_query,
}),
{
setQueryParam,
deleteQueryParam,
},
),
connect((state, props) => ({
query: qs.parse(state.router.location.search.replace('?', '')),
})),
)(View);
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import '../style.css';
const View = (props) => {
const [lcp, setLcp] = React.useState({});
const { provider_data = {} } = props;
const query = { ...props.query, ...props.discodata_query.search };
const query = { ...props.query };
const { lcpInspireId = null } = query;
const siteReportingYear = parseInt(query.siteReportingYear || '');
const index = provider_data?.euregReportingYear?.indexOf(siteReportingYear);
Expand Down Expand Up @@ -72,6 +72,5 @@ const View = (props) => {
export default compose(
connect((state, props) => ({
query: qs.parse(state.router.location.search.replace('?', '')),
discodata_query: state.discodata_query,
})),
)(View);
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import { compose } from 'redux';
import { connect } from 'react-redux';
import { setQueryParam, deleteQueryParam } from 'volto-datablocks/actions';
import CompetentAuthority from '../CompetentAuthority';
import { getDate, getLonLat } from '../helpers';
import { Grid } from 'semantic-ui-react';
Expand All @@ -21,7 +20,7 @@ const View = (props) => {
const [siteDetails, setSiteDetails] = React.useState({});
const [facilities, setFacilities] = React.useState([]);
const { provider_data = {} } = props;
const query = { ...props.query, ...props.discodata_query.search };
const query = { ...props.query };
const siteReportingYear = parseInt(query.siteReportingYear || '');

const facilityList = [
Expand Down Expand Up @@ -135,14 +134,7 @@ const View = (props) => {
};

export default compose(
connect(
(state, props) => ({
query: qs.parse(state.router.location.search.replace('?', '')),
discodata_query: state.discodata_query,
}),
{
setQueryParam,
deleteQueryParam,
},
),
connect((state, props) => ({
query: qs.parse(state.router.location.search.replace('?', '')),
})),
)(View);
24 changes: 6 additions & 18 deletions src/components/manage/Blocks/SiteBlocks/Header/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react';
import { compose } from 'redux';
import { connect } from 'react-redux';
import { Grid, Dropdown } from 'semantic-ui-react';
import { setQueryParam, deleteQueryParam } from 'volto-datablocks/actions';
import qs from 'querystring';
import './style.css';

Expand All @@ -14,13 +13,14 @@ const getQueryString = (query) => {
const View = (props) => {
const [siteHeader, setSiteHeader] = React.useState({});
const { provider_data = {} } = props;
const query = { ...props.query, ...props.discodata_query.search };
const query = { ...props.query };
const siteReportingYear = parseInt(query.siteReportingYear || '');
const index = provider_data?.euregReportingYear?.indexOf(siteReportingYear);

const reportingYears = provider_data.euregReportingYear?.length
const reportingYears = provider_data?.euregReportingYear?.length
? provider_data.euregReportingYear
.filter((year) => year)
.sort()
.map((year) => ({
key: year,
value: year,
Expand Down Expand Up @@ -131,11 +131,6 @@ const View = (props) => {
ignoreScrollBehavior: true,
},
});
props.setQueryParam({
queryParam: {
siteReportingYear: data.value,
},
});
}}
placeholder={'Select'}
options={reportingYears}
Expand All @@ -153,14 +148,7 @@ const View = (props) => {
};

export default compose(
connect(
(state, props) => ({
query: qs.parse(state.router.location.search.replace('?', '')),
discodata_query: state.discodata_query,
}),
{
setQueryParam,
deleteQueryParam,
},
),
connect((state, props) => ({
query: qs.parse(state.router.location.search.replace('?', '')),
})),
)(View);
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const PermitingAuthority = (props) => {
content="Authority, body or bodies responsible for issuing a permit to a given facility"
trigger={
<div className="popup-svg">
<Icon name={infoSVG} size={20} color="#D63D27" />
<Icon name={infoSVG} size="20px" color="#D63D27" />
</div>
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const View = (props) => {
const [batConclusions, setBatConclusions] = React.useState({});
const [installationsNth, setInstallationsNth] = React.useState({});
const { provider_data = {} } = props;
const query = { ...props.query, ...props.discodata_query.search };
const query = { ...props.query };
const siteReportingYear = parseInt(query.siteReportingYear || '');

React.useEffect(() => {
Expand Down Expand Up @@ -87,6 +87,5 @@ const View = (props) => {
export default compose(
connect((state, props) => ({
query: qs.parse(state.router.location.search.replace('?', '')),
discodata_query: state.discodata_query,
})),
)(View);

This file was deleted.

Loading

0 comments on commit 6a57feb

Please sign in to comment.