Skip to content

Commit

Permalink
Merge pull request #22 from eea/develop
Browse files Browse the repository at this point in the history
Develop rename eprtr to industry
  • Loading branch information
alecghica authored Oct 14, 2021
2 parents 2f597a3 + 6e9a1fa commit c82b864
Show file tree
Hide file tree
Showing 29 changed files with 37,026 additions and 938 deletions.
978 changes: 512 additions & 466 deletions CHANGELOG.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ pipeline {
agent any

environment {
GIT_NAME="eprtr_frontend"
GIT_NAME="industry-frontend"
NAMESPACE = "@eeacms"
registry = "eeacms/eprtr-frontend"
template = "templates/volto-eprtr"
template = "templates/volto-industry"
RANCHER_STACKID = "1st1851"
RANCHER_ENVID = "1a332957"
dockerImage = ''
Expand Down
9 changes: 1 addition & 8 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
{
"compilerOptions": {
"paths": {
"volto-datablocks": [
"addons/volto-datablocks/src"
],
"@eeacms/volto-datablocks": [
"addons/volto-datablocks/src"
]
},
"paths": {},
"baseUrl": "src"
}
}
2 changes: 1 addition & 1 deletion locales/de.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion locales/it.json

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion mrs.developer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
"branch": "develop",
"path": "src",
"package": "@eeacms/volto-datablocks",
"develop": true
"develop": false
},
"volto-matomo": {
"url": "https://github.com/eea/volto-matomo.git",
"branch": "develop",
"path": "src",
"package": "@eeacms/volto-matomo",
"develop": false
}
}
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@eeacms/eprtr_frontend",
"name": "@eeacms/industry-frontend",
"description": "Volto-based frontend server and SPA for the Industrial Emissions Portal website (former EPRTR) industry.eea.europa.eu",
"license": "MIT",
"version": "2.3.0",
"version": "2.5.0",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
"homepage": "https://github.com/eea/eprtr_frontend",
"homepage": "https://github.com/eea/industry-frontend",
"keywords": [
"volto-addon",
"volto-block",
Expand Down Expand Up @@ -41,28 +41,29 @@
"@eeacms/volto-grid-block",
"@eeacms/volto-datablocks",
"@eeacms/volto-embed",
"volto-addons",
"@eeacms/volto-openlayers-map",
"@eeacms/volto-tableau"
"@eeacms/volto-tableau",
"@eeacms/volto-matomo"
],
"dependencies": {
"@eeacms/volto-datablocks": "2.0.13",
"@eeacms/volto-eea-kitkat": "4.0.1",
"@eeacms/volto-embed": "2.0.4",
"@eeacms/volto-eea-kitkat": "4.0.2",
"@eeacms/volto-embed": "2.0.7",
"@eeacms/volto-grid-block": "github:eea/volto-grid-block#centurion",
"@eeacms/volto-matomo": "github:eea/volto-matomo#develop",
"@eeacms/volto-openlayers-map": "0.1.2",
"@eeacms/volto-tableau": "1.2.3",
"@material/react-linear-progress": "^0.15.0",
"@plone/volto": "13.15.1",
"axios": "^0.21.1",
"dompurify": "2.3.3",
"jsonp": "^0.2.1",
"performant-array-to-tree": "^1.7.1",
"react-highlight-words": "^0.16.0",
"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-addons": "github:eea/volto-addons#master"
"tableau-api-js": "github:eea/tableau-api-js#1.1.0"
},
"devDependencies": {
"eslint-plugin-prettier": "3.1.3",
Expand Down
50 changes: 50 additions & 0 deletions src/components/manage/Blocks/ExpendableList/Edit.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import React, { useState, useEffect } from 'react';
import { connect } from 'react-redux';
import { compose } from 'redux';
import _uniqueId from 'lodash/uniqueId';
import InlineForm from '@plone/volto/components/manage/Form/InlineForm';
import { SidebarPortal } from '@plone/volto/components';
import View from './ViewEdit';
import config from '@plone/volto/registry';
import { makeSchema } from './schema';

const Edit = (props) => {
const [state, setState] = useState({
schema: makeSchema({ ...props, providerUrl: config.settings.providerUrl }),
id: _uniqueId('block_'),
});
useEffect(() => {
setState({
...state,
schema: makeSchema({
...props,
}),
});
/* eslint-disable-next-line */
}, [props.data.isExpandable]);
return (
<div>
<SidebarPortal selected={props.selected}>
<InlineForm
schema={state.schema}
title={state.schema.title}
onChangeField={(field, data) => {
props.onChangeBlock(props.block, {
...(props.data || {}),
[field]: data,
});
}}
formData={props.data || {}}
block={props.block}
/>
</SidebarPortal>
<View {...props} id={state.id} mode="edit" />
</div>
);
};

export default compose(
connect((state, props) => ({
pathname: state.router.location.pathname,
})),
)(Edit);
73 changes: 73 additions & 0 deletions src/components/manage/Blocks/ExpendableList/View.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/* REACT */
import React, { useState } from 'react';
import { compose } from 'redux';
import { connect } from 'react-redux';
import { Icon } from '@plone/volto/components';
import DOMPurify from 'dompurify';
import move from 'lodash-move';
import cx from 'classnames';
import dragSVG from '@plone/volto/icons/drag.svg';
import './style.css';
const View = ({ content, ...props }) => {
const [state, setState] = useState({
activeItem: '',
});
const isExpandable = props.data?.isExpandable;
const listItemTitleClassname = props.data?.listItemTitleClassname;
const listItemDescriptionClassname = props.data?.listItemDescriptionClassname;
const listClassname = props.data?.listClassname;
const items = props.data?.items || [];
const ordered = props.data?.ordered;

return (
<div className={cx('expandable-list', listClassname)}>
{props.mode === 'edit' && !items.length ? <p>Expandable list</p> : ''}
{items
? Object.entries(items).map(([key, value], index) => (
<div className="list-item" key={`list-item-${key}`}>
<button
className={cx(
'list-item-title',
listItemTitleClassname ? listItemTitleClassname : '',
isExpandable ? 'expandable' : 'no-expandable',
)}
onClick={() => {
if (isExpandable && state.activeItem === key) {
setState({ ...state, activeItem: '' });
} else if (isExpandable) {
setState({ ...state, activeItem: key });
}
}}
>
<span className="count">{ordered ? `${index + 1}. ` : ''}</span>
<span>{value.title}</span>
</button>
<div
className={cx(
'list-item-description',
listItemDescriptionClassname
? listItemDescriptionClassname
: '',
isExpandable
? state.activeItem === key
? 'show'
: 'hide'
: '',
)}
dangerouslySetInnerHTML={{
__html: DOMPurify.sanitize(value.description),
}}
/>
</div>
))
: ''}
</div>
);
};

export default compose(
connect((state, props) => ({
content:
state.prefetch?.[state.router.location.pathname] || state.content.data,
})),
)(View);
133 changes: 133 additions & 0 deletions src/components/manage/Blocks/ExpendableList/ViewEdit.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
/* REACT */
import React, { useState } from 'react';
import { compose } from 'redux';
import { connect } from 'react-redux';
import { Icon } from '@plone/volto/components';
import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
import DOMPurify from 'dompurify';
import move from 'lodash-move';
import cx from 'classnames';
import dragSVG from '@plone/volto/icons/drag.svg';
import './style.css';
const View = ({ content, ...props }) => {
const [state, setState] = useState({
activeItem: '',
});
const isExpandable = props.data?.isExpandable;
const listItemTitleClassname = props.data?.listItemTitleClassname;
const listItemDescriptionClassname = props.data?.listItemDescriptionClassname;
const listClassname = props.data?.listClassname;
const items = props.data?.items || [];
const ordered = props.data?.ordered;

const onDragEnd = (result) => {
const { source, destination } = result;
if (!destination) {
return;
}
if (source.droppableId === destination.droppableId) {
props.onChangeBlock(props.block, {
...props.data,
items: move(props.data.items, source.index, destination.index),
});
} else {
// WIP
}
};

return (
<div className={cx('expandable-list', listClassname)}>
{props.mode === 'edit' && !items.length ? <p>Expandable list</p> : ''}
{items ? (
<DragDropContext onDragEnd={onDragEnd}>
<Droppable droppableId="list-item">
{(providedDroppable) => (
<>
<div ref={providedDroppable.innerRef}>
{Object.entries(items).map(([key, value], index) => (
<Draggable key={key} draggableId={key} index={index}>
{(providedItem) => (
<div
ref={providedItem.innerRef}
{...providedItem.draggableProps}
>
<div
style={{
position: 'relative',
height: '100%',
}}
>
<div
style={{
visibility: 'visible',
display: 'inline-block',
}}
{...providedItem.dragHandleProps}
className="drag handle wrapper"
>
<Icon name={dragSVG} size="18px" />
</div>
<div className="list-item" key={`list-item-${key}`}>
<button
className={cx(
'list-item-title',
listItemTitleClassname
? listItemTitleClassname
: '',
isExpandable ? 'expandable' : 'no-expandable',
)}
onClick={() => {
if (
isExpandable &&
state.activeItem === key
) {
setState({ ...state, activeItem: '' });
} else if (isExpandable) {
setState({ ...state, activeItem: key });
}
}}
>
{ordered ? `${index + 1}. ` : ''}
{value.title}
</button>
<div
className={cx(
'list-item-description',
listItemDescriptionClassname
? listItemDescriptionClassname
: '',
isExpandable
? state.activeItem === key
? 'show'
: 'hide'
: '',
)}
dangerouslySetInnerHTML={{
__html: DOMPurify.sanitize(value.description),
}}
/>
</div>
</div>
</div>
)}
</Draggable>
))}
</div>
{providedDroppable.placeholder}
</>
)}
</Droppable>
</DragDropContext>
) : (
''
)}
</div>
);
};

export default compose(
connect((state, props) => ({
content:
state.prefetch?.[state.router.location.pathname] || state.content.data,
})),
)(View);
Loading

0 comments on commit c82b864

Please sign in to comment.