Skip to content

Commit

Permalink
Merge pull request #267 from paulogama/master
Browse files Browse the repository at this point in the history
Visualizar Denúncia
  • Loading branch information
erikaya authored Jul 11, 2018
2 parents 0989bfb + f7d128e commit 25fefc3
Show file tree
Hide file tree
Showing 24 changed files with 594 additions and 8 deletions.
6 changes: 5 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@
"required": {
"some": [ "nesting", "id" ]
}
}
},
"jsx-a11y/anchor-is-valid": [ "error", {
"components": [ "Link" ],
"specialLink": [ "to" ]
}]
}

}
1 change: 0 additions & 1 deletion src/actions/criarDenunciaActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ export const criarDenunciaRequisicao = createAction(CRIAR_DENUNCIA_REQUISICAO);
export const criarDenunciaSucesso = createAction(CRIAR_DENUNCIA_SUCESSO);
export const criarDenunciaFalha = createAction(CRIAR_DENUNCIA_FALHA);
export const limpaEstadoUltimaDencunciaCadastrada = createAction(LIMPA_ESTADO_ULTIMA_DENUNCIA);

9 changes: 9 additions & 0 deletions src/actions/visualizarDenunciaActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { createAction } from 'redux-actions';

export const BUSCAR_DENUNCIA_POR_ID = 'BUSCAR_DENUNCIA_POR_ID';
export const BUSCA_DENUNCIAS_POR_ID_SUCESSO = 'BUSCA_DENUNCIAS_POR_ID_SUCESSO';
export const DETALHES_DENUNCIA = 'DETALHES_DENUNCIA';

export const buscaDenunciaPorId = createAction(BUSCAR_DENUNCIA_POR_ID);
export const buscaDenunciaPorIdSucesso = createAction(BUSCA_DENUNCIAS_POR_ID_SUCESSO);
export const detalhesDenuncia = createAction(DETALHES_DENUNCIA);
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';
import PropTypes from 'prop-types';
import './camposVisualizarDenuncia.css';

const CamposVisualizarDenuncia = ({ titulo, descricao }) => (
<div className="campos">
<div className="camposTitulo">
{titulo}
</div>
<div className="camposDescricao">
{descricao}
</div>
</div>
);

CamposVisualizarDenuncia.propTypes = {
titulo: PropTypes.string.isRequired,
descricao: PropTypes.string.isRequired
};

export default CamposVisualizarDenuncia;
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.campos {
padding-bottom: 19px;
}

.camposTitulo {
color: #838383;
font-family: Roboto;
font-size: 16px;
font-stretch: normal;
font-style: normal;
font-weight: normal;
line-height: normal;
letter-spacing: normal;
text-align: left;
}

.camposDescricao {
color: #1d1d1d;
font-family: Roboto;
font-size: 16px;
font-stretch: normal;
font-style: normal;
font-weight: normal;
letter-spacing: normal;
line-height: normal;
text-align: left;
}
41 changes: 41 additions & 0 deletions src/components/comum/carregamento/Carregamento.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React from 'react';

export default function Carregamento() {
return (
<div className="preloader-wrapper big active carregamento">
<div className="spinner-layer spinner-green">
<div className="circle-clipper left">
<div className="circle" />
</div>
<div className="gap-patch">
<div className="circle" />
</div>
<div className="circle-clipper right">
<div className="circle" />
</div>
</div>
<div className="spinner-layer spinner-yellow">
<div className="circle-clipper left">
<div className="circle" />
</div>
<div className="gap-patch">
<div className="circle" />
</div>
<div className="circle-clipper right">
<div className="circle" />
</div>
</div>
<div className="spinner-layer spinner-red">
<div className="circle-clipper left">
<div className="circle" />
</div>
<div className="gap-patch">
<div className="circle" />
</div>
<div className="circle-clipper right">
<div className="circle" />
</div>
</div>
</div>
);
}
5 changes: 5 additions & 0 deletions src/components/comum/carregamento/carregamento.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.carregamento {
display: flex;
align-items: center;
justify-content: center;
}
49 changes: 49 additions & 0 deletions src/components/comum/gradeCampos/GradeCampos.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import React from 'react';
import PropTypes from 'prop-types';

import SeparadorPontilhado from '../separadorPontilhado/SeparadorPontilhado';
import CamposVisualizarDenuncia from '../camposVisualizarDenuncia/CamposVisualizarDenuncia';
import './gradeCampos.css';

const GradeCampos = ({ dados }) => (
<div>
<div className="titulo-detalhes">
{dados.titulo}
</div>
<SeparadorPontilhado />
<div className="grade">
<div className="campos-esquerda">
{dados.camposEsquerda.map((campoEsquerda, index) => (
<CamposVisualizarDenuncia
key={index}
titulo={campoEsquerda.titulo}
descricao={campoEsquerda.descricao}
/>
))}
</div>
<div>
{dados.camposDireita.map((campoDireita, index) => (
<CamposVisualizarDenuncia
key={index}
titulo={campoDireita.titulo}
descricao={campoDireita.descricao}
/>
))}
</div>
</div>
</div>
);

GradeCampos.propTypes = {
dados: PropTypes.shape({
titulo: PropTypes.string,
camposEsquerda: PropTypes.array,
camposDireita: PropTypes.array
})
};

GradeCampos.defaultProps = {
dados: undefined
};

export default GradeCampos;
17 changes: 17 additions & 0 deletions src/components/comum/gradeCampos/gradeCampos.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.grade {
display: flex;
padding-top: 11px;
}

.titulo-detalhes {
color: #1d1d1d;
font-family: Roboto;
font-size: 18px;
font-stretch: normal;
font-style: normal;
font-weight: normal;
letter-spacing: normal;
line-height: normal;
padding-bottom: 18px;
text-align: left;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react';
import './separadorPontilhado.css';

const SeparadorPontilhado = () => (
<div className="separador" />
);

export default SeparadorPontilhado;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.separador {
height: 2px;
border: dashed 2px #f0f0f0
}
11 changes: 10 additions & 1 deletion src/components/moderador/DenunciaRow.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import React, { Component, Fragment } from 'react';
import { Link } from 'react-router-dom';
import PropTypes from 'prop-types';
import Combobox from '../comum/combobox';
import './painel-moderador.css';
import { detalhesDenuncia } from '../../actions/visualizarDenunciaActions';

function cliqueDetalhesDenuncia(denuncia) {
return () => {
denuncia.props.dispatch(detalhesDenuncia({ denuncia: denuncia.props.denuncia }));
};
}

class DenunciaRow extends Component {
constructor(props) {
Expand Down Expand Up @@ -28,7 +37,7 @@ class DenunciaRow extends Component {
<td>{agressao.cidade}</td>
<td>{agressao.bairro}</td>
<td>
<input type="button" className="mais-detalhes" value="mais detalhes" />
<Link to={`/visualizar-denuncia/${denuncia.id}`} className="mais-detalhes" onClick={cliqueDetalhesDenuncia(this)}> mais detalhes </Link>
</td>
<td width="50px">
<input
Expand Down
1 change: 0 additions & 1 deletion src/components/moderador/painel-moderador.css
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,3 @@
text-align: left;
color: #1d1d1d;
}

8 changes: 5 additions & 3 deletions src/components/moderador/painelModerador.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class PainelModerador extends Component {
</thead>
<tbody>
{denuncias.map(denuncia => (
<DenunciaRow denuncia={denuncia} />
<DenunciaRow key={denuncia.id} denuncia={denuncia} />
))}
</tbody>
</table>
Expand All @@ -53,7 +53,6 @@ class PainelModerador extends Component {
PainelModerador.propTypes = {
listaDenuncias: PropTypes.func.isRequired,
denuncias: PropTypes.arrayOf.isRequired

};

const mapDispatchToProps = dispatch => bindActionCreators({
Expand All @@ -63,7 +62,10 @@ const mapDispatchToProps = dispatch => bindActionCreators({
function mapStateToProps(state) {
return {
denuncias: Object.keys(state.listaDenunciaReducer.denuncias)
.map(key => state.listaDenunciaReducer.denuncias[key])
.map(key => ({
id: key,
...state.listaDenunciaReducer.denuncias[key]
}))
};
}

Expand Down
Loading

0 comments on commit 25fefc3

Please sign in to comment.