Commit 682ff151 authored by Edu Trevisan's avatar Edu Trevisan

Merge branch 'small_changes' into 'development'

Dependencies upgrade

See merge request !38
parents fe400b27 ff70527d
/*
Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre
Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
This file is part of Portal-SMPPIR-React.
Portal-SMPPIR-React is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Portal-SMPPIR-React is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Portal-SMPPIR-React. If not, see <https://www.gnu.org/licenses/>.
*/
import React, { Component } from 'react';
import './Styles/YouthPresentation.css'
import { Store } from '../Store'
class YouthPresentation extends Component {
render() {
var contrastString = this.context.state.contrast;
return (
<div>
<h1>SOBRE JUVENTUDE</h1>
</div>
);
}
}
YouthPresentation.contextType = Store;
export default YouthPresentation;
......@@ -14,7 +14,7 @@
"react-materialize": "2.3.3",
"react-router": "^4.1.1",
"react-router-dom": "^4.1.1",
"react-scripts": "^1.1.5",
"react-scripts": "^3.1.1",
"react-table": "^6.10.0",
"react-tag-autocomplete": "^5.9.0",
"recharts": "^1.5.0",
......@@ -33,8 +33,18 @@
"@babel/core": "^7.4.3",
"@babel/preset-env": "^7.4.3",
"@babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.5",
"react-styleguidist": "^6.5.3",
"webpack": "^3.12.0"
"react-styleguidist": "^9.1.16"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
......@@ -43,28 +43,29 @@ function App() {
// Hook to set contrast and page context
const { state, dispatch } = React.useContext(Store);
const setContrastAction = (newContrast) => {
return dispatch({
type: 'SET_CONTRAST',
payload: newContrast
})
}
const setPageAction = (newPage) => {
return dispatch({
type: 'SET_PAGE',
payload: newPage
})
}
const setFontSizeAction = (newFontSize) => {
return dispatch({
type: 'SET_FONT_SIZE',
payload: newFontSize
})
}
// Get session information when the component did mount
React.useEffect(() => {
const setContrastAction = (newContrast) => {
return dispatch({
type: 'SET_CONTRAST',
payload: newContrast
})
}
const setPageAction = (newPage) => {
return dispatch({
type: 'SET_PAGE',
payload: newPage
})
}
const setFontSizeAction = (newFontSize) => {
return dispatch({
type: 'SET_FONT_SIZE',
payload: newFontSize
})
}
const contrast = sessionStorage.getItem('contrast');
if (contrast) setContrastAction(contrast);
const page = sessionStorage.getItem('page');
......@@ -74,7 +75,7 @@ function App() {
setFontSizeAction(fontSize);
document.getElementsByTagName("body")[0].style.fontSize = fontSize + "px";
}
}, []);
}, [dispatch]);
var contrastString = state.contrast
......
......@@ -148,7 +148,7 @@ class BuildBar extends Component {
var recurrentKeys = [];
var returnObj = {};
var newKey;
for (let key in obj) {
for (var key in obj) {
if (newKeys[key] || key === this.props.dataKey) {
newKey = newKeys[key] || key;
if (recurrentKeys.indexOf(newKey) === -1) {
......
......@@ -156,7 +156,7 @@ class BuildStackedBar extends Component {
var recurrentKeys = [];
var returnObj = {};
var newKey;
for (let key in obj) {
for (var key in obj) {
newKey = newKeys[key] || key;
if (recurrentKeys.indexOf(newKey) === -1) {
recurrentKeys.push(newKey);
......
......@@ -19,17 +19,21 @@ along with Portal-SMPPIR-React. If not, see <https://www.gnu.org/licenses/>.
*/
import React from 'react';
import React, { useContext, useEffect } from 'react';
import { Link } from 'react-router-dom'
import { Card, CardTitle, Dropdown, Icon } from 'react-materialize'
import '../Styles/MainCard.css'
import { Store } from '../Store';
function createRoutes(subpages, color) {
/**
* Creates the main card component for the application front-end. <br />
* @param {*} props
*/
function MainCard(props){
const { state, dispatch } = useContext(Store);
// Hook to set page context
const { dispatch } = React.useContext(Store);
const setPageAction = (newPage) => {
window.scrollTo(0, 0)
return dispatch({
......@@ -37,34 +41,43 @@ function createRoutes(subpages, color) {
payload: newPage
})
}
React.useEffect(()=>{});
var listItems = subpages['links'].map((subp, i) =>
<Link onClick={() => { setPageAction(subp) }} key={subp} className={color + ' waves-effect waves spacingInCard '} to={subpages['route']} >
{subp}
</Link>
useEffect(() => { });
var { color, title, subpages, text, image } = props;
var contrastString = state.contrast;
if (contrastString === "Contrast")
color = 'mainPageContrast'
const listItems = subpages['links'].map((subp, i) =>
<Link onClick={() => { setPageAction(subp) }} key={subp} className={color + ' waves-effect waves spacingInCard '} to={subpages['route']} >
{subp}
</Link>
);
var dropdownItems = [];
var visibility = 'none';
// If there are too many links put them in the dropdown.
for (var i = listItems.length - 5; i>0; i--){
for (var i = listItems.length - 5; i > 0; i--) {
dropdownItems.push(listItems.pop());
visibility = 'inline-block';
}
return (
// <DropdownList listItems={listItems} color={color}/>
<React.Fragment>
<Card className={`${contrastString}card-MainPage hoverable`} header={<CardTitle reveal image={require('../Images/'+image)} waves='light'/>}
title={title}
reveal={<div>{text}</div>}
>
<div className={'listMainPage'}>
{listItems}
</div>
<Dropdown
options={{ hover: true, constrainWidth:false }}
<Dropdown
options={{ hover: true, constrainWidth: false }}
trigger={
<Link
style={{display:visibility}}
<Link
style={{ display: visibility }}
className={color} to={'#'}
>
<Icon className={'dropdown-icon'}>expand_more</Icon>
......@@ -72,29 +85,8 @@ function createRoutes(subpages, color) {
}
>
{dropdownItems}
</Dropdown>
</React.Fragment>
);
}
/**
* Creates the main card component for the application front-end. <br />
* @param {*} props
*/
function MainCard(props){
const { state } = React.useContext(Store);
var { color, title, subpages, text, image } = props;
var contrastString = state.contrast;
if (contrastString === "Contrast")
color = 'mainPageContrast'
return (
<Card className={`${contrastString}card-MainPage hoverable`} header={<CardTitle reveal image={require('../Images/'+image)} waves='light'/>}
title={title}
reveal={<div>{text}</div>}>
{createRoutes(subpages, color)}
</Card>
</Dropdown>
</Card>
);
}
......
......@@ -72,7 +72,7 @@ function NavigationBar() {
<img alt='Logo do SMPPIR' id={'portal-logo'} src={logoSMPPIR} style={{ width: 200, marginLeft: 20, marginTop: 15 }} />
</Link>
<div className="left">
<SideNav className={`${contrastString}navBackground`} trigger={<a href=""><i className={`material-icons ${contrastString}navIcon`} style={{ marginLeft: 20 }}>menu</i></a>} options={{closeOnClick:true}}>
<SideNav className={`${contrastString}navBackground`} trigger={<a href='/#'><i className={`material-icons ${contrastString}navIcon`} style={{ marginLeft: 20 }}>menu</i></a>} options={{closeOnClick:true}}>
{links}
</SideNav>
</div>
......
......@@ -24,10 +24,8 @@ import React, { Component } from 'react';
import { Card, Row, Col, Button } from 'react-materialize';
import CardFooter from '../Components/CardFooter';
import UfBar from '../Components/UfBar';
// import GrayBar from '../Components/GrayBar';
import Map from '../Components/Map';
import { Store } from '../Store';
import AutocompleteApp from '../Components/AutocompleteApp';
import BuildStackedBar from '../Charts/BuildStackedBar';
import BuildBar from '../Charts/BuildBar';
import Loading from '../Components/Loading';
......
......@@ -60,7 +60,7 @@ class AgreementsInExecution extends Component {
let convenios = [];
objectConvenios.forEach((convenio) => {
let newConv = [];
for (const [key, value] of Object.entries(convenio)) {
for (var [key, value] of Object.entries(convenio)) {
if (key === 'QTD' || key === 'Rendimentos') {
continue;
}
......
......@@ -24,10 +24,8 @@ import React, { Component } from 'react';
import { Card, Row, Col, Button } from 'react-materialize';
import CardFooter from '../Components/CardFooter';
import UfBar from '../Components/UfBar';
// import GrayBar from '../Components/GrayBar';
import Map from '../Components/Map';
import { Store } from '../Store';
import AutocompleteApp from '../Components/AutocompleteApp';
import BuildStackedBar from '../Charts/BuildStackedBar';
import BuildBar from '../Charts/BuildBar';
import Loading from '../Components/Loading';
......
......@@ -254,7 +254,7 @@ class YouthEducation extends Component {
groups[item[year]] = [item];
}
});
for(let key in groups){ // para cada ano
for(var key in groups){ // para cada ano
aux = {};
popTot = 0;
MedComp = 0;
......@@ -318,7 +318,7 @@ class YouthEducation extends Component {
groups[item[year]] = [item];
}
});
for(let key in groups){ // para cada ano
for(var key in groups){ // para cada ano
aux = {1: 0, 2: 0, 3: 0, 4: 0, nulos:0};
for(let i = 0; i < groups[key].length;i++){
if ((groups[key][i][param2] === 2) || (groups[key][i][param2] === 4) ){
......@@ -389,7 +389,7 @@ class YouthEducation extends Component {
groups[item[year]] = [item];
}
});
for(let key in groups){ // para cada ano
for(var key in groups){ // para cada ano
aux = {1: 0, 2: 0, 3: 0, 4: 0, nulos:0};
for(let i = 0; i < groups[key].length;i++){
if (groups[key][i][param2] === 1 ){
......@@ -461,7 +461,7 @@ class YouthEducation extends Component {
groups[item[year]] = [item];
}
});
for(let key in groups){ // para cada ano
for(var key in groups){ // para cada ano
aux = {1: 0, 2: 0, null:0};
for(let i = 0; i < groups[key].length;i++){
if ((groups[key][i][param2] === 2) || (groups[key][i][param2] === 4) ){
......@@ -503,7 +503,7 @@ class YouthEducation extends Component {
groups[item[year]] = [item];
}
});
for(let key in groups){ // para cada ano
for(var key in groups){ // para cada ano
aux = {1: 0, 2: 0, null: 0};
for(let i = 0; i < groups[key].length;i++){
if (groups[key][i][param2] === 1){
......@@ -547,7 +547,7 @@ class YouthEducation extends Component {
groups[item[year]] = [item];
}
});
for(let key in groups){ // para cada ano
for(var key in groups){ // para cada ano
aux = {1: 0, 2: 0, 3: 0, 4: 0, null:0};
for(let i = 0; i < groups[key].length;i++){
if ((groups[key][i][param2] === 2) || (groups[key][i][param2] === 4) ){
......@@ -633,7 +633,7 @@ class YouthEducation extends Component {
groups[item[year]] = [item];
}
});
for(let key in groups){ // para cada ano
for(var key in groups){ // para cada ano
aux = {1: 0, 2: 0, 3: 0, 4: 0, null:0};
for(let i = 0; i < groups[key].length;i++){
if ((groups[key][i][param2] === 1) ){
......@@ -721,7 +721,7 @@ class YouthEducation extends Component {
groups[item[year]] = [item];
}
});
for(let key in groups){ // para cada ano
for(var key in groups){ // para cada ano
aux = {1: 0, 2: 0};
pop = 0
pop2 = 0
......@@ -796,7 +796,7 @@ class YouthEducation extends Component {
groups[item[year]] = [item];
}
});
for(let key in groups){ // para cada ano
for(var key in groups){ // para cada ano
aux = {1: 0, 2: 0};
pop = 0
pop2 = 0
......
......@@ -232,7 +232,7 @@ class YouthJob extends Component {
groups[item[year]] = [item];
}
});
for(let key in groups){
for(var key in groups){
aux = {1: 0, 2: 0, null:0};
for(let i = 0; i < groups[key].length;i++){
if ((groups[key][i][param2] === 2) || (groups[key][i][param2] === 4) )
......@@ -268,7 +268,7 @@ class YouthJob extends Component {
groups[item[year]] = [item];
}
});
for(let key in groups){
for(var key in groups){
aux = {1: 0, 2: 0, null:0};
for(let i = 0; i < groups[key].length;i++){
if (groups[key][i][param2] === 1)
......@@ -304,7 +304,7 @@ class YouthJob extends Component {
groups[item[year]] = [item];
}
});
for(let key in groups){
for(var key in groups){
aux ={1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, null:0};
for(let i = 0; i < groups[key].length;i++){
if ((groups[key][i][param2] === 2) || (groups[key][i][param2] === 4) )
......@@ -340,7 +340,7 @@ class YouthJob extends Component {
groups[item[year]] = [item];
}
});
for(let key in groups){
for(var key in groups){
aux = {1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, null:0};
for(let i = 0; i < groups[key].length;i++){
if ((groups[key][i][param2] === 2) || (groups[key][i][param2] === 4) )
......@@ -376,7 +376,7 @@ class YouthJob extends Component {
groups[item[year]] = [item];
}
});
for(let key in groups){
for(var key in groups){
aux = {1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, null:0};
for(let i = 0; i < groups[key].length;i++){
if (groups[key][i][param2] === 1)
......@@ -414,7 +414,7 @@ class YouthJob extends Component {
groups[item[year]] = [item];
}
});
for(let key in groups){
for(var key in groups){
aux = {};
popTot = 0;
salTot = 0;
......
......@@ -239,6 +239,7 @@ export function organizeJson(data, uniqueParameter, yearParameter = 'no_ano_pesq
var groups = {};
var finalJson = [];
var aux = {}
var key;
if(data !== null && data !== undefined) {
data.forEach(function(item) {
var list = groups[item[yearParameter]];
......@@ -249,7 +250,7 @@ export function organizeJson(data, uniqueParameter, yearParameter = 'no_ano_pesq
}
});
if(uniqueParameter === 'tipo_cota'){
for(let key in groups) {
for(key in groups) {
aux = {};
for(let i = 0; i < groups[key].length; i++){
if (groups[key][i].tipo_cota === null){
......@@ -261,7 +262,7 @@ export function organizeJson(data, uniqueParameter, yearParameter = 'no_ano_pesq
finalJson.push(aux);
};
}else{
for(let key in groups) {
for(key in groups) {
aux = {};
for(let i = 0; i < groups[key].length; i++){
if (groups[key][i].ds_raca_cor === null)
......
......@@ -472,7 +472,8 @@ function br({ active, onClick }) {
<Svg id="svg-map-brazil" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" style={{maxHeight: 460 }} viewBox="0 0 450 460">
<g>
{ states.map(state =>
{states.map(state =>
// eslint-disable-next-line
<a key={state.id} onClick={handler(state.id)} className={isActive(state.id)}>
<title>{state.name}</title>
{state.content.map((item, index) => ({ ...item, key: `${state.id}-${index}` }))}
......
......@@ -113,7 +113,7 @@ path#tocantins:hover { fill: #455104}
.map-selected > text { fill: white}
.map-selected {
fill: #1565c;
fill: #1565c0;
}
/*Old Colors*/
......
......@@ -496,7 +496,8 @@ function heatbr({ active, onClick,data,levels,datafield, colorDefault="#ededec"}
<Svg id="svg-map-brazil" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" style={{maxHeight: 460 }} viewBox="0 0 450 460">
<g>
{ states.map(state =>
{states.map(state =>
// eslint-disable-next-line
<a key={state.id} onClick={handler(state.id)} className={isActive(state.id)}>
<title>{state.name}</title>
{state.content.map((item, index) => ({ ...item, key: `${state.id}-${index}` }))}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment