Skip to content

Commit

Permalink
Merge pull request #9 from eea/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
kreafox authored Mar 16, 2023
2 parents ccfa269 + c39c38c commit 913b7cd
Show file tree
Hide file tree
Showing 18 changed files with 380 additions and 53 deletions.
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,35 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

### [0.1.8](https://github.com/eea/volto-cca-policy/compare/0.1.7...0.1.8) - 16 March 2023

#### :hammer_and_wrench: Others

- Update Jenkinsfile: use latest volto [kreafox - [`a1c7518`](https://github.com/eea/volto-cca-policy/commit/a1c7518b0b57e69be82ae3ef1f7cc3958263e6ba)]
- Fix URL [kreafox - [`7c52338`](https://github.com/eea/volto-cca-policy/commit/7c523387968005d20292c76a0e6854eca43c509b)]
- Fix header [kreafox - [`033a210`](https://github.com/eea/volto-cca-policy/commit/033a2106a89849eb43504706c0d12c2c12ac95fd)]
- Remove console.log [kreafox - [`4c87be2`](https://github.com/eea/volto-cca-policy/commit/4c87be2e3dc5a98c7e1ddba29496d965acac8ec0)]
- Fix Jenkins: use latest volto [kreafox - [`ba3ebdd`](https://github.com/eea/volto-cca-policy/commit/ba3ebdd28771644bdb9b396834d2dcaec225061b)]
- Volto version in jenkins [Tiberiu Ichim - [`0a762af`](https://github.com/eea/volto-cca-policy/commit/0a762afca070358442272661870ce0d9bbe7c7b4)]
- Login action [Tiberiu Ichim - [`2e6bf41`](https://github.com/eea/volto-cca-policy/commit/2e6bf418cc43e94924eb6cfab7ae38824ddab7cf)]
- Update RAST new path [kreafox - [`c4ae3ef`](https://github.com/eea/volto-cca-policy/commit/c4ae3ef3063d6f7a36eebdb84bbb9ab9f1f5a9fb)]
- Code cleanup [Tiberiu Ichim - [`9ad3a29`](https://github.com/eea/volto-cca-policy/commit/9ad3a2972081d4688559dbaf1a79df70c98231c2)]
- Fix undefined error [kreafox - [`d1e7700`](https://github.com/eea/volto-cca-policy/commit/d1e77006a53686d36fa26624d74e6a7c6340446a)]
- Change logo order [kreafox - [`9e94b4c`](https://github.com/eea/volto-cca-policy/commit/9e94b4c841163b8447fc05dc1117cfd5e52064bf)]
- Update footer [kreafox - [`3febad8`](https://github.com/eea/volto-cca-policy/commit/3febad89abcd2968a22143f8b43069ad08b3ead0)]
- Refs #160116 - C3SIndicatorView: WIP details. [GhitaB - [`9b8fbeb`](https://github.com/eea/volto-cca-policy/commit/9b8fbeb36998aa1b1b5d2d57c71ef893b47a5d31)]
- Refs #160116 - C3SIndicatorView: full column layout, add title and description. Clean unused section. [GhitaB - [`1d54160`](https://github.com/eea/volto-cca-policy/commit/1d541601cb7bca049b715737a0b8cda17428049b)]
- Refs #160116 - C3SIndicatorView: add view. [GhitaB - [`382f5cd`](https://github.com/eea/volto-cca-policy/commit/382f5cd306688f2bd898de2920edccca3acd854e)]
- Refs #160116 - IndicatorView: update definition, add missing trans macro regions. [GhitaB - [`d2b70e3`](https://github.com/eea/volto-cca-policy/commit/d2b70e3a25346636508fa8983ded03545ae3c2da)]
- WIP on sector map [Tiberiu Ichim - [`1ee8011`](https://github.com/eea/volto-cca-policy/commit/1ee801169880f8512d50f8e61e62368a30e42c9d)]
- WIP on sector map [Tiberiu Ichim - [`2468659`](https://github.com/eea/volto-cca-policy/commit/2468659862904f6c70ff8e9bfa0b9455ebcfd163)]
- init CaseStudyExplorer [tripon eugen - [`a6e050e`](https://github.com/eea/volto-cca-policy/commit/a6e050e37d285f961120ef34254bb993a1b0a66c)]
- Update topLevel for RAST [kreafox - [`adc7757`](https://github.com/eea/volto-cca-policy/commit/adc77572ab786c97a4b4a5785fea2be97c96bcc9)]
- Refs #160116 - IndicatorView: add contributor. [GhitaB - [`1774664`](https://github.com/eea/volto-cca-policy/commit/1774664c6f3917f2f7b850d871bc15056edd6a90)]
- Refs #160116 - IndicatorView: add share info. [GhitaB - [`76ba598`](https://github.com/eea/volto-cca-policy/commit/76ba598b37fad2d168e85a233b42173a9fb52dd8)]
- Refs #160116 - IndicatorView: update section titles. [GhitaB - [`3d4f835`](https://github.com/eea/volto-cca-policy/commit/3d4f8350e8729233f1a9c7635e0d2afdb941c303)]
- Refs #160116 - InformationPortalView: add source. [GhitaB - [`70c4526`](https://github.com/eea/volto-cca-policy/commit/70c45261620935867a02266e1330877315b85eda)]
- Make bottomLevel configurable [kreafox - [`360eeba`](https://github.com/eea/volto-cca-policy/commit/360eebab74dc75eb896d8f6c0ec397620b70fd17)]
### [0.1.7](https://github.com/eea/volto-cca-policy/compare/0.1.6...0.1.7) - 6 March 2023

#### :hammer_and_wrench: Others
Expand Down
12 changes: 6 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pipeline {
NAMESPACE = "@eeacms"
SONARQUBE_TAGS = "volto-cca-policy,climate-adapt.eea.europa.eu"
DEPENDENCIES = ""
VOLTO = "alpha"
VOLTO = ""
}

stages {
Expand Down Expand Up @@ -41,19 +41,19 @@ pipeline {

"ES lint": {
node(label: 'docker') {
sh '''docker run -i --rm --name="$BUILD_TAG-eslint" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci:alpha eslint'''
sh '''docker run -i --rm --name="$BUILD_TAG-eslint" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci eslint'''
}
},

"Style lint": {
node(label: 'docker') {
sh '''docker run -i --rm --name="$BUILD_TAG-stylelint" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci:alpha stylelint'''
sh '''docker run -i --rm --name="$BUILD_TAG-stylelint" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci stylelint'''
}
},

"Prettier": {
node(label: 'docker') {
sh '''docker run -i --rm --name="$BUILD_TAG-prettier" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci:alpha prettier'''
sh '''docker run -i --rm --name="$BUILD_TAG-prettier" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci prettier'''
}
}
)
Expand All @@ -77,8 +77,8 @@ pipeline {
node(label: 'docker') {
script {
try {
sh '''docker pull plone/volto-addon-ci:alpha'''
sh '''docker run -i --name="$BUILD_TAG-volto" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci:alpha'''
sh '''docker pull plone/volto-addon-ci'''
sh '''docker run -i --name="$BUILD_TAG-volto" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci'''
sh '''rm -rf xunit-reports'''
sh '''mkdir -p xunit-reports'''
sh '''docker cp $BUILD_TAG-volto:/opt/frontend/my-volto-project/coverage xunit-reports/'''
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-cca-policy",
"version": "0.1.7",
"version": "0.1.8",
"description": "@eeacms/volto-cca-policy: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import CaseStudyExplorerView from './CaseStudyExplorerView';

export default function CaseStudyExplorerEdit(props) {
return <CaseStudyExplorerView {...props} mode="edit" />;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import React from 'react';
import superagent from 'superagent';
import { addAppURL } from '@plone/volto/helpers';
import { Grid } from 'semantic-ui-react'; // Dropdown,
import { getVocabulary } from '@plone/volto/actions'; // , searchContent
//import ECDEIndicator from './ECDEIndicator';
import { useDispatch } from 'react-redux'; // , useSelector

// const cases_url =
// 'http://localhost:3000/en/mkh/case-studies-map-arcgis.json/@@download/file';
const cases_url = '@@case-studies-map.arcgis.json';
const IPCC = 'eea.climateadapt.aceitems_ipcc_category';

function useCases(url) {
const [cases, setCases] = React.useState([]);

React.useEffect(() => {
superagent
.get(cases_url)
.set('accept', 'json')
.then((resp) => {
const res = JSON.parse(resp.text);
setCases(res.features);
});
}, []);

return cases;
}

// function useFilters() {
// const [filters, setFilters] = React.useState([]);
// }

export default function CaseStudyExplorerView(props) {
// console.log(regions);
const cases = useCases(addAppURL(cases_url));

//const filters = useFilters();
const [filters, setFilters] = React.useState([]);
const dispatch = useDispatch();
// const ipcc_categories = useSelector(
// (state) => state.vocabularies?.[IPCC]?.items,
// );

React.useEffect(() => {
const action = getVocabulary({
vocabNameOrURL: IPCC,
});
dispatch(action);
}, [dispatch]);

React.useEffect(() => {
let _filters = { sectors: {}, impacts: {} };

// console.log('acis', typeof cases, cases[0], cases);
// console.log(Object.keys(cases));
for (var key of Object.keys(cases)) {
// console.log(key, cases[key]);
var _case = cases[key];
let sectorKeys = _case.properties.sectors.split(',');
let sectorNames = _case.properties.sectors_str.split(',');
for (var i = 0; i < sectorNames.length; i++) {
if (!_filters.sectors.hasOwnProperty(sectorKeys[i + 1])) {
_filters.sectors[sectorKeys[i + 1]] = sectorNames[i];
}
}
let impactKeys = _case.properties.impacts.split(',');
let impactNames = _case.properties.impacts_str.split(',');
for (i = 0; i < impactNames.length; i++) {
if (!_filters.impacts.hasOwnProperty(impactKeys[i + 1])) {
_filters.impacts[impactKeys[i + 1]] = impactNames[i];
}
}
}
setFilters(_filters);
}, [cases]);

// const [activeFilters, setActiveFilters] = React.useState({});
//
// console.log({ ipcc_categories, filters });

return (
<div>
<Grid columns="12">
<Grid.Column mobile={12} tablet={12} computer={10} className="col-left">
MAP HERE
</Grid.Column>
<Grid.Column mobile={12} tablet={12} computer={2} className="col-left">
{Object.entries(filters?.sectors || {}).map(
([value, label], index) => (
<div key={index}>
<input
value={value}
type="checkbox"
onChange={(e) => {
// const value =
// console.log(e.target.checked);
// setActiveFilters({...activeFilters, sector: [...activeFilters
}}
/>
<span>{label}</span>
</div>
),
)}
</Grid.Column>
</Grid>
</div>
);
}
16 changes: 16 additions & 0 deletions src/components/manage/Blocks/CaseStudyExplorer/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import worldSVG from '@plone/volto/icons/world.svg';
import CaseStudyExplorerEdit from './CaseStudyExplorerEdit';
import CaseStudyExplorerView from './CaseStudyExplorerView';

export default function installCaseStudyExplorerBlock(config) {
config.blocks.blocksConfig.caseStudyExplorer = {
id: 'caseStudyExplorer',
title: 'Case Study Explorer',
icon: worldSVG,
group: 'common',
edit: CaseStudyExplorerEdit,
view: CaseStudyExplorerView,
};

return config;
}
2 changes: 2 additions & 0 deletions src/components/manage/Blocks/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { compose } from 'redux';
import installMKHMap from './MKHMap';
import installECDEIndicatorsBlock from './ECDEIndicators';
import installCaseStudyExplorerBlock from './CaseStudyExplorer';

export default function installBlocks(config) {
config.blocks.blocksConfig.title.restricted = false;
return compose(
installMKHMap,
installECDEIndicatorsBlock,
installCaseStudyExplorerBlock,
//
)(config);
}
57 changes: 57 additions & 0 deletions src/components/theme/Views/C3SIndicatorView.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import React from 'react';
import {
HTMLField,
// ContentMetadata,
// LinksList,
// PublishedModifiedInfo,
// ShareInfo,
} from '@eeacms/volto-cca-policy/helpers';
import { Grid } from 'semantic-ui-react';
// import { Fragment } from 'react';

const Details = (props) => {
const showDetails = () => {
// console.log("WIP details");
};

return (
<a href="#details">
<button className="ui button primary" onClick={showDetails}>
Explore in detail
</button>
</a>
);
};

function C3SIndicatorView(props) {
const { content } = props;

return (
<div className="c3sindicator-view">
<div className="ui container">
<Grid columns="12">
<div className="row">
<Grid.Column
mobile={12}
tablet={12}
computer={12}
className="col-full"
>
<h1>{content.title}</h1>
<a href="/knowledge/european-climate-data-explorer/">
<button className="ui button primary">ECDE homepage</button>
</a>
<HTMLField
value={content.long_description}
className="long_description"
/>
<Details {...props} />
</Grid.Column>
</div>
</Grid>
</div>
</div>
);
}

export default C3SIndicatorView;
21 changes: 19 additions & 2 deletions src/components/theme/Views/IndicatorView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
ContentMetadata,
LinksList,
PublishedModifiedInfo,
ShareInfo,
} from '@eeacms/volto-cca-policy/helpers';
import { Grid } from 'semantic-ui-react';

Expand Down Expand Up @@ -32,12 +33,28 @@ function IndicatorView(props) {
<h4>Reference information</h4>

{content?.websites?.length > 0 && (
<LinksList title="Websites" value={content.websites} />
<LinksList title="Websites:" value={content.websites} />
)}

<h5>Source</h5>
<h5>Source:</h5>
<HTMLField value={content.source} />
{(content?.contributor_list?.length > 0 ||
content?.other_contributor?.length > 0) && (
<>
<h4>Contributor:</h4>
{content.contributor_list
.map((item) => (
<>
{item.title}
<br />
</>
))
.sort()}
{content.other_contributor}
</>
)}
<PublishedModifiedInfo {...props} />
<ShareInfo {...props} />
</Grid.Column>
<Grid.Column
mobile={12}
Expand Down
6 changes: 6 additions & 0 deletions src/components/theme/Views/InformationPortalView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ function InformationPortalView(props) {
<LinksList title="Websites:" value={content.websites} />
)}

{content?.source && (
<>
<h5>Source:</h5>
<HTMLField value={content.source} />
</>
)}
<PublishedModifiedInfo {...props} />
<ShareInfo {...props} />
</Grid.Column>
Expand Down
25 changes: 13 additions & 12 deletions src/customizations/volto/components/theme/Header/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import React from 'react';
import { Dropdown, Image } from 'semantic-ui-react';
import { connect, useDispatch, useSelector } from 'react-redux';

import { withRouter } from 'react-router-dom';
import { withRouter, Link } from 'react-router-dom';
import { UniversalLink } from '@plone/volto/components';
import {
getBaseUrl,
Expand Down Expand Up @@ -204,25 +204,26 @@ const EEAHeader = ({ pathname, token, items, history, subsite }) => {
transparency={isHomePageInverse ? true : false}
logo={
<div {...(isSubsite ? { className: 'logo-wrapper' } : {})}>
<Logo
src={isHomePageInverse ? logoWhite : logo}
title={eea.websiteTitle}
alt={eea.organisationName}
url={eea.logoTargetUrl}
/>

{!!subsite && subsite.title && (
<UniversalLink item={subsite} className="subsite-logo">
<>
{subsite.subsite_logo ? (
<Image
src={subsite.subsite_logo.scales.mini.download}
<Logo
src={subsite.subsite_logo?.scales.preview.download}
title={subsite.title}
alt={subsite.title}
url={flattenToAppURL(subsite['@id'])}
/>
) : (
subsite.title
)}
</UniversalLink>
</>
)}
<Link to={eea.logoTargetUrl} className="subsite-logo">
<Image
src={isHomePageInverse ? logoWhite : logo}
alt={eea.websiteTitle}
/>
</Link>
</div>
}
menuItems={items}
Expand Down
Loading

0 comments on commit 913b7cd

Please sign in to comment.