diff --git a/CHANGELOG.md b/CHANGELOG.md
index 93a53ec..594867c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,40 @@
# Changelog
+### 1.9.0
+
+1. Nueva funcion: Apoyar un proyecto. Ahora se puede apoyar un proyecto, como usuario registrado o como anonimo (con la necesidad de ingresar la informacion, un captcha, y una validacion por email)
+2. Se agrega la posibilida de que en el perfil del diputada/o se pueda descargar la planilla con un listado de la informacion de quienes apoyaron los proyectos
+3. Cambios visuales: Ahora los header de las cards de los proyectos tendrán una imagen de -LA PRIMERA- etiqueta/categoria elegida en el formulario del proyecto. En el caso de que no existiera, se pondrá una imagen estandar
+
+Listado de cambios:
+
+- Agregado campo "apoyos" en Documents como array de strings (emails)
+- Agregado campo "apoyosCount" en las apis que devuelven Documents (para mostrar en tarjetas de home y dentro del proyecto)
+- Se implementó un método de captcha para apoyos externos
+- Se desarrollo un circuito de validación de apoyo externo (usuarix no registradx) por email usando tabla de tokens
+- Al apoyar, se valida que ese mail no haya apoyado ya una vez
+- Al apoyar, se valida que ese mail no tenga un token de validación vigente (creado en las últimas 48hs)
+- Verificacion del captcha! (svg-captcha https://www.npmjs.com/package/svg-captcha)
+- Usuarix no registradxs: Al poner mail y nombre se le avisa a lx usuarix de que va a recibir un mail para validar
+- Se genera token de un solo uso (que "caduque" a las 48hs) para validar voto
+- Se crea la tabla apoyoTokens con campos: token, fecha creación, email
+- El token se generará como uuid v4 (https://www.npmjs.com/package/uuid)
+- En el script init borraran los token más viejos que de 48hs
+- Enviar mail (desde notifier) con link con el token en la url para validar el voto
+- Cuando alguien X entré a validar el token, se verifica que este en el rango de 48hs (sino se avisa que ya expiró), y si lo está se registra un apoyo a nombre del mail del token y se borra el token
+- Para apoyos internos (usuarix registradx) simplemente registrar el apoyo y ya
+- Se agrega la posibilidad de descargar un excel con todos los apoyos registrados en los proyectos.
+- Se quito el campo de URL de la imagen, dado que no va a ser mas utlilzado
+- Ahora las etiquetas cuentan con una "key", importante para coordinar con que imagen mostrar en el header de la card del proyecto
+- Ahora para monitores mas grandes-largos (2K/4K) se muestran 4 columnas de cards de proyectos en la home
+
+Compatible con:
+* `leyesabiertas-web:1.9.0`
+* `leyesabiertas-core:1.9.0`
+* `leyesabiertas-notifier:1.9.0`
+* `leyesabiertas-keycloak:1.8.0`
+
### 1.8.1
* Cambiado la extension de excel de xls a xlsx
@@ -10,7 +44,6 @@ Compatible con:
* `leyesabiertas-notifier:1.8.0`
* `leyesabiertas-keycloak:1.8.0`
-
### 1.8.0
Listado de cambios hasta el momento:
diff --git a/components/apoyar-formulario/component.js b/components/apoyar-formulario/component.js
new file mode 100644
index 0000000..7ff8305
--- /dev/null
+++ b/components/apoyar-formulario/component.js
@@ -0,0 +1,265 @@
+import React, { Component, Fragment } from 'react'
+import styled from 'styled-components'
+import fetch from 'isomorphic-unfetch'
+import WithUserContext from '../../components/with-user-context/component'
+import getConfig from 'next/config'
+const { publicRuntimeConfig: { API_URL } } = getConfig()
+
+const Container = styled.form`
+ z-index: 2
+ position: absolute
+ width: 330px
+ right: 0
+ background-color: white
+ padding: 1.2em
+ box-shadow: 0px 2px 4px #cac7c7
+ color: black
+ text-align: left
+ text-transform: none
+ cursor: auto;
+ margin-top: 7px;
+ font-size:1.7rem
+
+ @media(max-width:700px){
+ position: fixed;
+ bottom: 0;
+ left: 0;
+ width: 100%;
+ }
+
+ input {
+ padding: 5px;
+ }
+`
+
+const Label = styled.label`
+ display: block
+ span {
+ display: block
+ font-weight: bold
+ padding: 14px 0px 7px
+ }
+ input {
+ width: 100%
+ }
+`
+
+const ApoyosSpan = styled.span`
+ color: #6f78e6
+ font-weight: bold
+`
+
+const ApoyarButton = styled.button`
+ width: 100%
+ padding: 13px 0;
+ background-color: #6f78e6
+ color: white
+ font-weight: bold
+ border: none
+ :focus {outline:0;}
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+
+ img{
+ position: relative;
+ top: 1px;
+ margin-right: 5px;
+ }
+`
+const CloseButton = styled.div`
+ width: 65px;
+ margin-left: auto;
+ margin-bottom: 7px;
+ background-color: transparent;
+ border: none;
+ color: #960c0c;
+ cursor: pointer;
+ font-weight: bold;
+ font-size: 1.3rem;
+ @media(max-width:700px){
+ font-size: 1.7rem;
+ }
+`
+
+const CaptchaGroup = styled.div`
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ padding-top: 20px;
+ img {
+ padding-bottom: 5px;
+ }
+ input {
+ width: 70px;
+ text-align: center;
+ /*text-transform: uppercase;*/
+ }
+`
+
+const CaptchaTitle = styled.span`
+ font-weight: bold;
+`
+
+const ErrorSpan = styled.span`
+ display: block;
+ color:red
+ padding-bottom: 5px;
+ margin-top: 20px;
+`
+
+const ApoyandoGroup = styled.div`
+ text-align: center
+ display: flex;
+ flex-direction: column;
+ img {
+ margin-bottom: 18px;
+ height: 40px;
+ }
+`
+
+const ApoyandoSpan = styled.span`
+ font-weight: bold;
+ margin-bottom: 8px;
+`
+
+const ApoyandoPersonasSpan = styled.span`
+ color: #6f78e6
+ font-weight: bold;
+`
+
+class ApoyarFormulario extends Component {
+ state = {
+ formError: null,
+ svg: null,
+ token: null,
+ nombre_apellido: '',
+ email: '',
+ captcha: '',
+ }
+
+ constructor (props) {
+ super(props)
+
+ this.nombreApellidoInput = this.nombreApellidoInput.bind(this)
+ this.emailInput = this.emailInput.bind(this)
+ this.captchaInput = this.captchaInput.bind(this)
+ this.closeClick = this.closeClick.bind(this)
+
+ this.handleSubmit = this.handleSubmit.bind(this)
+ }
+
+ nombreApellidoInput(e) { this.setState({ nombre_apellido: e.target.value }) }
+ emailInput(e) { this.setState({ email: e.target.value }) }
+ captchaInput(e) { this.setState({ captcha: e.target.value }) }
+
+ handleSubmit(e){
+ e.preventDefault()
+
+ const { authenticated } = this.props.authContext
+
+ this.props.apoyarProyecto(!authenticated && {
+ token: this.state.token,
+ nombre_apellido: this.state.nombre_apellido,
+ email: this.state.email,
+ captcha: this.state.captcha,
+ }).then(async (res) => {
+ if (res.status == 200){
+ this.setState({formError: null})
+ if (!authenticated)
+ this.props.apoyoAnonExitoso()
+ }else{
+ let err
+ try {
+ err = (await res.json()).error
+ } catch(_) {
+ err = "Ha ocurrido un error"
+ }
+ this.setState({formError: err})
+ }
+ })
+ }
+
+ closeClick(){
+ const hideApoyarForm = localStorage.getItem('hide-apoyar-form') || false
+ if (!hideApoyarForm)
+ localStorage.setItem('hide-apoyar-form', true)
+ this.props.toggleFormulario()
+ }
+
+ componentWillMount() {
+ if (!this.props.authContext.authenticated && !this.state.svg) {
+ fetch(`${API_URL}/api/v1/documents/captcha-data`)
+ .then(r => r.json())
+ .then(j => this.setState({svg: j.img, token: j.token}))
+ }
+ }
+
+ render () {
+ const { authenticated, user } = this.props.authContext
+ const { project, hasAnonApoyado } = this.props
+ const { svg } = this.state
+
+ if (!project) return null
+
+ const apoyosMinusOne = project.apoyosCount-1
+
+ return (
+
+ CERRAR ✖
+ { project.userIsApoyado &&
+
+
+ ¡Ya estás apoyando esta propuesta!
+ {project.apoyosCount > 1 &&
+
+ { apoyosMinusOne } {apoyosMinusOne == 1 ? 'persona' : 'personas'} y vos
+ Están apoyando la propuesta
+
+ }
+
+ }
+ { hasAnonApoyado &&
+
+
+ ¡Gracias!
+
+ Enviamos un mail a su casilla para validar su apoyo
+
+
+ }
+ { !hasAnonApoyado && !project.userIsApoyado &&
+
+ { project.apoyosCount || 0 } personas están apoyando la propuesta
+ ¿Querés apoyarla también?
+ { !authenticated &&
+
+
+
+
+ Validá que no sos un robot:
+ {svg ?
+
+ :
+ Cargando imagen...
+ }
+
+
+
+ }
+ {this.state.formError}
+
Quiero apoyar la propuesta
+
+ }
+
+ )
+ }
+}
+
+export default WithUserContext(ApoyarFormulario)
diff --git a/components/card/component.js b/components/card/component.js
index 0555a2e..a48f917 100644
--- a/components/card/component.js
+++ b/components/card/component.js
@@ -5,10 +5,11 @@ import styled from 'styled-components'
import CardHeader from '../../elements/card-header/component'
import CardContent from '../../elements/card-content/component'
import CardSocial from '../../elements/card-social/component'
+import WithDocumentTagsContext from '../../components/document-tags-context/component'
const CardContainer = styled.div`
margin: 0 1% 30px;
-width: 31%;
+width: 23%;
box-shadow: 0 4px 20px 0 rgba(0,0,0,0.05);
background-color: #ffffff;
border: solid 1px #e9e9e9;
@@ -17,28 +18,34 @@ box-sizing: border-box;
cursor: pointer;
display: block;
position: relative;
-@media (max-width: 1100px) {
+@media (max-width: 1408px) {
+ width: 31%;
+ }
+@media (max-width: 1216px) {
width: 48%;
}
-@media (max-width: 760px) {
+@media (max-width: 600px) {
width: 100%;
}
`
-const Card = ({ project }) => (
+const Card = ({ project, tags }) => (
-
+ {/* */}
+ 0} img={`/static/assets/images/${tags && project.currentVersion.content.tags && project.currentVersion.content.tags.length > 0 ? tags.find(x => project.currentVersion.content.tags[0] == x.value).key : 'trama-default'}.jpg`} published={project.published} />
0}
party={project.author.fields && project.author.fields.party ? project.author.fields.party : ''} />
+ closed={project.closed}
+ apoyosCount={project.apoyosCount} />
@@ -48,4 +55,4 @@ Card.propTypes = {
project: PropTypes.object.isRequired
}
-export default Card
+export default WithDocumentTagsContext(Card)
diff --git a/components/project-fields/component.js b/components/project-fields/component.js
index c03da96..b1787f7 100644
--- a/components/project-fields/component.js
+++ b/components/project-fields/component.js
@@ -982,14 +982,14 @@ class ProjectFields extends Component {
onChange={this.handleInputChange}
placeholder='Hacer uso correcto de mayúsculas y minúsculas' />
-
+ {/*
Ingrese la URL para la imagen de encabezado:
-
+ */}
Fecha de cierre del proyecto:
{/* (
+const ProjectHeader = ({ project, section, isPublished, isAuthor, setPublish, togglePublish, contextualCommentsCount, contributionsCount, contributorsCount, currentSection, withComments, apoyarProyecto }) => (
-
+ //
+
Presentación
Artículos
+
}
{currentSection === '/versiones' &&
Presentación
Artículos
+
}
{currentSection === '/articulado' &&
Presentación
Artículos
+
{withComments ? : }
Modo lectura
diff --git a/components/project-table-item/component.js b/components/project-table-item/component.js
index 817af25..9d57207 100644
--- a/components/project-table-item/component.js
+++ b/components/project-table-item/component.js
@@ -94,7 +94,8 @@ export default ({ project }) => (
{project.closed ? : } {project.closed ? 'Cerrado' : 'Abierto'} -
{project.published ? : } {project.published ? 'Publico' : 'Oculto'} -
{project.commentsCount} Aport{project.commentsCount > 1 ? 'es' : 'e'} -
- {project.currentVersion.version} {project.currentVersion.version > 1 ? 'Versiones' : 'Versión'}
+ {project.currentVersion.version} {project.currentVersion.version > 1 ? 'Versiones' : 'Versión'} -
+ {project.apoyosCount} Apoyo{project.apoyosCount != 1 && 's'}
Fecha de creación: {formatDate(project.createdAt)} -
Fecha de cierre: {formatDate(project.currentVersion.content.closingDate)}
@@ -110,6 +111,11 @@ export default ({ project }) => (
{project.currentVersion.version} {project.currentVersion.version > 1 ? 'Versiones' : 'Versión'}
+
+
+ {project.apoyosCount} Apoyo{project.apoyosCount != 1 && 's'}
+
+
{formatDate(project.createdAt)}
diff --git a/components/validar-apoyo/component.js b/components/validar-apoyo/component.js
new file mode 100644
index 0000000..6af82ad
--- /dev/null
+++ b/components/validar-apoyo/component.js
@@ -0,0 +1,98 @@
+import React, { useEffect, useState } from 'react'
+import styled from 'styled-components'
+import Link from 'next/link'
+import getConfig from 'next/config'
+const { publicRuntimeConfig: { API_URL } } = getConfig()
+import fetch from 'isomorphic-unfetch'
+import Masonry from 'react-masonry-component';
+import Card from '../../components/card/component'
+
+const Wrapper = styled.div`
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ padding: 20px 60px 0 60px;
+`
+const Box = styled.div`
+ font-size: 1.8rem;
+ padding: 20px 40px;
+ background-color: #74acce;
+ color: white;
+ margin-bottom: 20px;
+`
+const Note = styled.div`
+ font-size: 1.6rem;
+ a {
+ color:#5c97bc
+ font-weight: bold;
+ }
+ a:hover,a:active,a:focus {
+ color:#2f6a8e
+ }
+`
+
+const ProjectsTitle = styled.h1`
+ margin-top: 50px;
+`
+
+export default () => {
+ const [isValidado, setIsValidado] = useState(null);
+ const [project, setProject] = useState(null);
+ const [projects, setProjects] = useState(null);
+
+ // mount event
+ useEffect(() => {
+ const queryString = window.location.search;
+ const urlParams = new URLSearchParams(queryString);
+ const v = urlParams.get('v');
+
+ fetch(`${API_URL}/api/v1/documents/apoyo-anon-validar/${v}`)
+ .then(r => r.json())
+ .then(j => {
+ if (j.error){
+ setIsValidado(false)
+ fetch(`${API_URL}/api/v1/documents`).then(r => r.json()).then(j => setProjects(j.results))
+ }else {
+ let rProject = j.document
+ setProject(rProject)
+ setIsValidado(true)
+ fetch(`${API_URL}/api/v1/documents`).then(r => r.json()).then(j => setProjects(j.results.filter(d => d._id != rProject._id)))
+ }
+ })
+ }, [])
+
+ return (
+
+
+
+ { isValidado === null ?
+ 'Validando apoyo...'
+ : (
+ isValidado ?
+ '¡Su apoyo ha sido validado con éxito!'
+ :
+ 'No se ha podido validar su apoyo'
+ )
+ }
+
+
+
+ Haga click
+
+ aquí
+
+ para volver al {project && 'proyecto' || 'inicio'}
+
+
+ Otros proyectos que puedes apoyar:
+ {projects &&
+
+ {projects.map((p, i) => (
+
+ ))}
+
+ }
+
+
+ )
+}
diff --git a/containers/general-container/component.js b/containers/general-container/component.js
index 8b9ffa9..63d13f4 100644
--- a/containers/general-container/component.js
+++ b/containers/general-container/component.js
@@ -54,6 +54,46 @@ class GeneralContainer extends Component {
}
}
+ apoyarProyecto = async (anonData) => {
+ // anonData == {token, nombre_apellido, email, captcha}
+ const { authenticated, keycloak } = this.props.authContext
+ const { project } = this.state
+
+ if (!project)
+ return
+
+ let projectId = project.document._id
+ let url
+ let headers = { 'Content-Type': 'application/json' }
+ let body
+
+ if (authenticated && keycloak && keycloak.token){
+ url = `${API_URL}/api/v1/documents/${projectId}/apoyar`
+ Object.assign(headers, {
+ Authorization: `Bearer ${keycloak.token}`
+ })
+ body = {}
+ } else {
+ url = `${API_URL}/api/v1/documents/${projectId}/apoyar-anon`
+ body = {
+ token: anonData.token,
+ nombre_apellido: anonData.nombre_apellido,
+ email: anonData.email,
+ captcha: anonData.captcha,
+ }
+ }
+
+ return fetch(url, {
+ headers,
+ method: 'POST',
+ body: JSON.stringify(body)
+ }).then(async (res) => {
+ if (res.status == 200)
+ this.fetchDocument(projectId, keycloak && keycloak.token)
+ return res
+ })
+ }
+
render () {
return (
@@ -61,7 +101,12 @@ class GeneralContainer extends Component {
-
+
)
diff --git a/containers/hero/component.js b/containers/hero/component.js
index 48638d1..1c0c0a5 100644
--- a/containers/hero/component.js
+++ b/containers/hero/component.js
@@ -5,31 +5,39 @@ import HeroTitle from '../../elements/hero-title/component'
import HeroSubtitle from '../../elements/hero-subtitle/component'
import HeroVideo from '../../elements/hero-video/component'
+// const StyledHero = styled.div`
+// min-height: 350px;
+// background-image: url('/static/assets/background-hero.jpg');
+// background-repeat: no-repeat;
+// background-position: right 0px bottom 42%;
+// background-size: 120%;
+// display: flex;
+// flex-direction: column;
+// align-items: flex-start;
+// justify-content: center;
+// padding: 0 7rem;
+// @media (max-width: 1060px) {
+// background-position: 46% center;
+// background-size: cover;
+// }
+// @media (max-width:700px){
+// padding: 0 20px;
+// }
+// `
const StyledHero = styled.div`
- min-height: 350px;
- background-image: url('/static/assets/background-hero.jpg');
- background-repeat: no-repeat;
- background-position: right 0px bottom 42%;
- background-size: 120%;
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- justify-content: center;
- padding: 0 7rem;
- @media (max-width: 1060px) {
- background-position: 46% center;
- background-size: cover;
- }
- @media (max-width:700px){
- padding: 0 20px;
- }
+ // min-height: 350px;
`
const Hero = () => (
- Plataforma de Participación Ciudadana en Propuestas de Ley
+ {/* Plataforma de Participación Ciudadana en Propuestas de Ley
¡Participe haciendo aportes para co-crear mejores leyes!
-
+ */}
+
)
diff --git a/containers/my-projects/component.js b/containers/my-projects/component.js
index 3baa3e0..08dfa97 100644
--- a/containers/my-projects/component.js
+++ b/containers/my-projects/component.js
@@ -253,7 +253,6 @@ const ButtonTable = styled.div`
background-color: #5c97bc;
color: #FFF;
cursor: pointer;
- font-family: var(--medium);
}
&[disabled]{
cursor: not-allowed;
@@ -471,6 +470,30 @@ class MyProjects extends Component {
}
}
+ downloadApoyos = async () => {
+ try {
+ const result = await fetch(`${API_URL}/api/v1/documents/my-documents/export-apoyos-xls`,{
+ headers: {
+ Authorization: `Bearer ${this.props.authContext.keycloak.token}`,
+ 'Content-Type': 'application/json'
+ }
+ })
+ const blob = await result.blob()
+
+ // Download API Files With React & Fetch - https://medium.com/yellowcode/download-api-files-with-react-fetch-393e4dae0d9e
+ const url = window.URL.createObjectURL(new Blob([blob]));
+ const link = document.createElement('a');
+ link.href = url;
+ link.setAttribute('download', 'Apoyos.xlsx'); // 3. Append to html page
+ document.body.appendChild(link); // 4. Force download
+ link.click(); // 5. Clean up and remove the link
+ link.parentNode.removeChild(link);
+
+ } catch (err) {
+ console.error(err)
+ }
+ }
+
render() {
const {
projects,
@@ -496,15 +519,22 @@ class MyProjects extends Component {
disabled={!hasProjects}>
Descargar info. de participantes
+
+ Descargar apoyos
+
Nombre
Status
- Aportes
- Fecha creación
- Fecha de cierre
+ Aportes
+ Apoyos
+ Fecha creación
+ Fecha de cierre
Acciones
diff --git a/containers/participate/component.js b/containers/participate/component.js
index 0bf7606..bfb0cf6 100644
--- a/containers/participate/component.js
+++ b/containers/participate/component.js
@@ -33,7 +33,7 @@ const Participate = (props) => {
-
+
diff --git a/containers/projects/component.js b/containers/projects/component.js
index 7fc010a..4689ea1 100644
--- a/containers/projects/component.js
+++ b/containers/projects/component.js
@@ -10,6 +10,7 @@ import Button from '../../elements/button/component'
import getConfig from 'next/config'
import Masonry from 'react-masonry-component';
import TagsSelect from '../../elements/tags-select/component.js'
+import WithDocumentTagsContext from '../../components/document-tags-context/component'
const { publicRuntimeConfig: { API_URL } } = getConfig()
@@ -114,6 +115,7 @@ class Projects extends Component {
// filter: {
// closed: null
// }
+ tags: []
}
}
@@ -160,6 +162,15 @@ class Projects extends Component {
})
}
+ async componentWillMount () {
+ this.setState({
+ tags: (await this.props.fetchDocumentTags()).map(
+ tag => ({ value: tag._id, label: tag.name, key: tag.key })
+ )
+ })
+ }
+
+
async componentDidMount() {
this.getDocuments()
}
@@ -195,7 +206,8 @@ class Projects extends Component {
projects,
query,
loadMoreAvailable,
- loading
+ loading,
+ tags
} = this.state
return (
@@ -220,7 +232,7 @@ class Projects extends Component {
style={{ width: '100%', margin: '4.8rem 0 1.6rem' }}
options={masonryOptions}>
{projects.map((p, i) => (
-
+
))}
@@ -242,4 +254,4 @@ class Projects extends Component {
}
}
-export default Projects
+export default WithDocumentTagsContext(Projects)
diff --git a/containers/user-project-container/component.js b/containers/user-project-container/component.js
index 8bb0b15..cc41534 100644
--- a/containers/user-project-container/component.js
+++ b/containers/user-project-container/component.js
@@ -55,7 +55,7 @@ export default class extends Component {
setPublish = (isPublished) => this.setState({ isPublished: isPublished })
render() {
- const { project, section, fetchDocument } = this.props
+ const { project, section, fetchDocument, apoyarProyecto } = this.props
const { withComments, isPublished } = this.state
if (!project || !project.document) return null
const { isAuthor } = project
@@ -86,7 +86,9 @@ export default class extends Component {
contributionsCount={project.contributionsCount}
currentSection={this.props.section}
withComments={withComments}
+ apoyarProyecto={apoyarProyecto}
/>
+
{this.props.section === '/propuesta' &&
diff --git a/elements/card-header/component.js b/elements/card-header/component.js
index 320d256..726025d 100644
--- a/elements/card-header/component.js
+++ b/elements/card-header/component.js
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types'
import styled from 'styled-components'
import Icon from 'react-icons-kit/Icon'
import { eyeSlash } from 'react-icons-kit/fa/eyeSlash'
+
const Wrapper = styled.div`
width: 100%;
height: 126px;
@@ -14,6 +15,11 @@ background-position: center;
// position: relative;
`
+const CoverImage = styled.img`
+ width: 100%;
+ //max-height:126px;
+`
+
const Label = styled.span`
position: absolute;
top: 13px;
@@ -33,11 +39,20 @@ const Label = styled.span`
bottom: 7px
`
-const CardHeader = ({ img, published }) => (
+const CardHeader = ({ hasImage, img, published }) => {
+ if(hasImage) {
+ return (
+
+
+
+ )
+ }
+ return (
{ !published && }
)
+}
CardHeader.propTypes = {
img: PropTypes.string,
diff --git a/elements/card-social/component.js b/elements/card-social/component.js
index 676ec78..56dfda7 100644
--- a/elements/card-social/component.js
+++ b/elements/card-social/component.js
@@ -21,16 +21,19 @@ const CommentaryItems = styled.div`
padding-bottom: 1rem;
text-transform:uppercase;
display: flex;
-align-items: center;
-margin: 0 auto;
+width: 100%;
+justify-content: space-evenly;
`
const CommentaryIcon = styled.div`
width: 18px;
height: 17px;
- background-image: url(${'/static/assets/comment-icon.svg'});
+ background-image: url(${(props) => `/static/assets/${props.icon}`});
background-size: cover;
background-repeat: no-repeat;
+ display: inline-block;
+ position: relative;
+ top: 3px;
`
const LimitDate = styled.div`
@@ -45,13 +48,19 @@ const LimitDate = styled.div`
`
const Span = styled.span`
font-family: var(--bold);
- margin: 0 0.5rem 0 1rem;
+ margin: 0 0.2rem 0 0.3rem;
`
-const Social = ({ commentaries, closed }) => (
+const Social = ({ commentaries, closed, apoyosCount }) => (
-
- {commentaries} {commentaries === 1 ? ' Aporte' : ' Aportes'}
+
+
+ {commentaries} {commentaries === 1 ? ' Aporte' : ' Aportes'}
+
+
+
+ {apoyosCount} {apoyosCount === 1 ? ' Apoyo' : ' Apoyos'}
+
{closed &&
Finalizó el periodo para aportes
diff --git a/elements/mode-bar-apoyar-button/component.js b/elements/mode-bar-apoyar-button/component.js
new file mode 100644
index 0000000..d968d25
--- /dev/null
+++ b/elements/mode-bar-apoyar-button/component.js
@@ -0,0 +1,86 @@
+import React, { useState, useEffect } from 'react'
+import styled from 'styled-components'
+import ApoyarFormulario from '../../components/apoyar-formulario/component'
+import getConfig from 'next/config'
+const { publicRuntimeConfig: { API_URL } } = getConfig()
+
+const StyledButton = styled.button`
+ border: none;
+ padding: 10px 40px;
+ text-transform: uppercase;
+ font-size: 1.4rem;
+ color: ${(props) => props.active ? '#4a5d68' : '#FFF'};
+ background-color: ${(props) => props.active ? 'white' : '#5c97bc'};
+ font-family: ${(props) => props.active ? 'var(--bold)' : 'var(--regular)'};
+ cursor: ${(props) => props.project && !props.project.closed ? 'pointer' : 'auto'};
+ font-weight: bold;
+ :hover{}
+ @media(max-width:700px){
+ padding: 10px 9px;
+ }
+
+ img {
+ position: absolute;
+ top: 8px;
+ @media(max-width:700px){
+ display: none
+ }
+ }
+`
+
+const Text = styled.span`
+ margin-left: 25px;
+ @media(max-width:700px){
+ margin-left: 0;
+ }
+`
+const TextCount = styled.span`
+ @media(max-width:700px){
+ display: none
+ }
+`
+
+const WrapperDiv = styled.div`
+ position: relative; /*para que funcione el absolute del formulario popup*/
+ float: right;
+`
+
+const ModeBarApoyarButton = (props) => {
+ // react hooks
+ const [showFormulario, setShowFormulario] = useState(localStorage.getItem('hide-apoyar-form') ? false : true);
+ const [hasAnonApoyado, setHasAnonApoyado] = useState(false);
+
+ function toggleFormulario() {
+ setShowFormulario(!showFormulario)
+ }
+
+ function apoyoAnonExitoso() {
+ setHasAnonApoyado(true)
+ }
+
+ const { project } = props
+
+ if (!project) return null
+
+ return
+
+
+
+ { project.closed ? 'Apoyos' :
+ (project.userIsApoyado ? 'Apoyando' : 'Quiero Apoyar')
+ }
+ ({ project.apoyosCount || 0 })
+
+
+ { showFormulario &&
+
+ }
+
+}
+
+export default ModeBarApoyarButton
diff --git a/elements/mode-bar-link-button/component.js b/elements/mode-bar-link-button/component.js
index f6570d3..d1297a7 100644
--- a/elements/mode-bar-link-button/component.js
+++ b/elements/mode-bar-link-button/component.js
@@ -17,6 +17,9 @@ const StyledLinkButton = styled.button`
color: #FFF;
font-family: var(--bold);
}
+ @media(max-width:700px){
+ padding: 10px 9px;
+ }
`
const ModeBarLinkButton = (props) => (
diff --git a/package-lock.json b/package-lock.json
index c8686ee..6b40d97 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
- "name": "congreso",
- "version": "1.7.0",
+ "name": "leyesabiertas-web",
+ "version": "1.9.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/package.json b/package.json
index d10b2d3..38462d9 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
- "name": "congreso",
- "version": "1.7.0",
+ "name": "leyesabiertas-web",
+ "version": "1.9.0",
"description": "",
"main": "index.js",
"scripts": {
diff --git a/pages/validar-apoyo.js b/pages/validar-apoyo.js
new file mode 100644
index 0000000..5f40344
--- /dev/null
+++ b/pages/validar-apoyo.js
@@ -0,0 +1,20 @@
+import React, { Component } from 'react'
+import NavBar from '../containers/navbar/component'
+import SecondaryNavbar from '../containers/secondary-navbar/component'
+import ValidarApoyo from '../components/validar-apoyo/component'
+import SecondaryFooter from '../containers/secondary-footer/component'
+import Footer from '../containers/footer/component'
+
+export default class extends Component {
+ render () {
+ return (
+
+
+
+
+
+
+
+ )
+ }
+}
diff --git a/static/assets/apoyar-icon-azul.svg b/static/assets/apoyar-icon-azul.svg
new file mode 100644
index 0000000..827b601
--- /dev/null
+++ b/static/assets/apoyar-icon-azul.svg
@@ -0,0 +1,11 @@
+
diff --git a/static/assets/apoyar-icon.svg b/static/assets/apoyar-icon.svg
new file mode 100644
index 0000000..7bccd88
--- /dev/null
+++ b/static/assets/apoyar-icon.svg
@@ -0,0 +1,11 @@
+
diff --git a/static/assets/corazon.svg b/static/assets/corazon.svg
new file mode 100644
index 0000000..d87a1f8
--- /dev/null
+++ b/static/assets/corazon.svg
@@ -0,0 +1,38 @@
+
+
diff --git a/static/assets/images/agricultura.jpg b/static/assets/images/agricultura.jpg
new file mode 100644
index 0000000..9f6a1fc
Binary files /dev/null and b/static/assets/images/agricultura.jpg differ
diff --git a/static/assets/images/ambiente.jpg b/static/assets/images/ambiente.jpg
new file mode 100644
index 0000000..593d702
Binary files /dev/null and b/static/assets/images/ambiente.jpg differ
diff --git a/static/assets/images/banner-01.mp4 b/static/assets/images/banner-01.mp4
new file mode 100644
index 0000000..0060cd5
Binary files /dev/null and b/static/assets/images/banner-01.mp4 differ
diff --git a/static/assets/images/banner-01.webm b/static/assets/images/banner-01.webm
new file mode 100644
index 0000000..abe95b1
Binary files /dev/null and b/static/assets/images/banner-01.webm differ
diff --git a/static/assets/images/ciencia-tecnologia.jpg b/static/assets/images/ciencia-tecnologia.jpg
new file mode 100644
index 0000000..8605251
Binary files /dev/null and b/static/assets/images/ciencia-tecnologia.jpg differ
diff --git a/static/assets/images/comercio.jpg b/static/assets/images/comercio.jpg
new file mode 100644
index 0000000..bdf42e4
Binary files /dev/null and b/static/assets/images/comercio.jpg differ
diff --git a/static/assets/images/cultura.jpg b/static/assets/images/cultura.jpg
new file mode 100644
index 0000000..6eba2ea
Binary files /dev/null and b/static/assets/images/cultura.jpg differ
diff --git a/static/assets/images/deportes.jpg b/static/assets/images/deportes.jpg
new file mode 100644
index 0000000..e3f86ff
Binary files /dev/null and b/static/assets/images/deportes.jpg differ
diff --git a/static/assets/images/derechos-humanos.jpg b/static/assets/images/derechos-humanos.jpg
new file mode 100644
index 0000000..f719d9c
Binary files /dev/null and b/static/assets/images/derechos-humanos.jpg differ
diff --git a/static/assets/images/discapacidad.jpeg b/static/assets/images/discapacidad.jpeg
new file mode 100644
index 0000000..93bdc0a
Binary files /dev/null and b/static/assets/images/discapacidad.jpeg differ
diff --git a/static/assets/images/economia.jpg b/static/assets/images/economia.jpg
new file mode 100644
index 0000000..d524df7
Binary files /dev/null and b/static/assets/images/economia.jpg differ
diff --git a/static/assets/images/educacion.jpg b/static/assets/images/educacion.jpg
new file mode 100644
index 0000000..788ed77
Binary files /dev/null and b/static/assets/images/educacion.jpg differ
diff --git a/static/assets/images/federalizacion.jpg b/static/assets/images/federalizacion.jpg
new file mode 100644
index 0000000..9be529c
Binary files /dev/null and b/static/assets/images/federalizacion.jpg differ
diff --git a/static/assets/images/genero-diversidad.jpg b/static/assets/images/genero-diversidad.jpg
new file mode 100644
index 0000000..7cc2e62
Binary files /dev/null and b/static/assets/images/genero-diversidad.jpg differ
diff --git a/static/assets/images/homenajes.jpg b/static/assets/images/homenajes.jpg
new file mode 100644
index 0000000..67569bc
Binary files /dev/null and b/static/assets/images/homenajes.jpg differ
diff --git a/static/assets/images/impuestos.jpg b/static/assets/images/impuestos.jpg
new file mode 100644
index 0000000..e79f7c0
Binary files /dev/null and b/static/assets/images/impuestos.jpg differ
diff --git a/static/assets/images/industria.jpg b/static/assets/images/industria.jpg
new file mode 100644
index 0000000..45d1076
Binary files /dev/null and b/static/assets/images/industria.jpg differ
diff --git a/static/assets/images/internacional.jpg b/static/assets/images/internacional.jpg
new file mode 100644
index 0000000..c71303d
Binary files /dev/null and b/static/assets/images/internacional.jpg differ
diff --git a/static/assets/images/justicia.jpg b/static/assets/images/justicia.jpg
new file mode 100644
index 0000000..e545013
Binary files /dev/null and b/static/assets/images/justicia.jpg differ
diff --git a/static/assets/images/legislacion.jpg b/static/assets/images/legislacion.jpg
new file mode 100644
index 0000000..35e4b70
Binary files /dev/null and b/static/assets/images/legislacion.jpg differ
diff --git a/static/assets/images/libertad.jpg b/static/assets/images/libertad.jpg
new file mode 100644
index 0000000..979a5b7
Binary files /dev/null and b/static/assets/images/libertad.jpg differ
diff --git a/static/assets/images/mercosur.jpg b/static/assets/images/mercosur.jpg
new file mode 100644
index 0000000..4270c8a
Binary files /dev/null and b/static/assets/images/mercosur.jpg differ
diff --git a/static/assets/images/modernizacion-transparencia.jpg b/static/assets/images/modernizacion-transparencia.jpg
new file mode 100644
index 0000000..977e854
Binary files /dev/null and b/static/assets/images/modernizacion-transparencia.jpg differ
diff --git a/static/assets/images/obras-publicas.jpg b/static/assets/images/obras-publicas.jpg
new file mode 100644
index 0000000..0a8fb04
Binary files /dev/null and b/static/assets/images/obras-publicas.jpg differ
diff --git a/static/assets/images/prevision-social.jpg b/static/assets/images/prevision-social.jpg
new file mode 100644
index 0000000..64a7249
Binary files /dev/null and b/static/assets/images/prevision-social.jpg differ
diff --git a/static/assets/images/salud.jpg b/static/assets/images/salud.jpg
new file mode 100644
index 0000000..92618bb
Binary files /dev/null and b/static/assets/images/salud.jpg differ
diff --git a/static/assets/images/seguridad.jpg b/static/assets/images/seguridad.jpg
new file mode 100644
index 0000000..8ca3351
Binary files /dev/null and b/static/assets/images/seguridad.jpg differ
diff --git a/static/assets/images/thumbnail-banner-01.jpg b/static/assets/images/thumbnail-banner-01.jpg
new file mode 100644
index 0000000..973ae51
Binary files /dev/null and b/static/assets/images/thumbnail-banner-01.jpg differ
diff --git a/static/assets/images/thumbnail-banner-01.png b/static/assets/images/thumbnail-banner-01.png
new file mode 100644
index 0000000..2e2bf26
Binary files /dev/null and b/static/assets/images/thumbnail-banner-01.png differ
diff --git a/static/assets/images/trabajo.jpg b/static/assets/images/trabajo.jpg
new file mode 100644
index 0000000..785eac4
Binary files /dev/null and b/static/assets/images/trabajo.jpg differ
diff --git a/static/assets/images/trama-default.jpg b/static/assets/images/trama-default.jpg
new file mode 100644
index 0000000..ecbc0f7
Binary files /dev/null and b/static/assets/images/trama-default.jpg differ
diff --git a/static/assets/images/transporte.jpg b/static/assets/images/transporte.jpg
new file mode 100644
index 0000000..d93fd62
Binary files /dev/null and b/static/assets/images/transporte.jpg differ
diff --git a/static/assets/images/turismo.jpg b/static/assets/images/turismo.jpg
new file mode 100644
index 0000000..e020726
Binary files /dev/null and b/static/assets/images/turismo.jpg differ