Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 1979 | Rev 2970 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1979 Rev 2969
Línea 1... Línea 1...
1
import React, { useEffect, useRef, useState } from 'react'
1
import React, { useEffect, useRef, useState } from 'react'
2
import { axios } from '../../utils'
-
 
3
import { useForm } from 'react-hook-form'
2
import { useForm } from 'react-hook-form'
4
import { connect } from 'react-redux'
-
 
5
 
-
 
6
import { updateFeed } from '../../redux/feed/feed.actions'
-
 
7
import { addNotification } from '../../redux/notification/notification.actions'
-
 
8
 
-
 
9
import LockClockIcon from '@mui/icons-material/LockClock'
-
 
10
import PublicIcon from '@mui/icons-material/Public'
-
 
Línea 11... Línea 3...
11
 
3
 
-
 
4
import styles from './survey.module.scss'
-
 
5
import { axios } from '@utils'
-
 
6
import { addNotification } from '@store/notification/notification.actions'
-
 
7
import { Public, LockClock } from '@mui/icons-material'
12
import styles from './survey.module.scss'
8
import { styled } from '@mui/material'
-
 
9
import { css } from '@emotion/react'
Línea 13... Línea 10...
13
import styled, { css } from 'styled-components'
10
import { updateFeed } from '@store/feed/feed.actions'
14
 
11
 
15
const RadioButton = styled.div`
12
const RadioButton = styled('div')`
16
  display: flex;
13
  display: flex;
17
  align-items: center;
14
  align-items: center;
18
  gap: 0.5rem;
15
  gap: 0.5rem;
Línea 60... Línea 57...
60
        text-shadow: none;
57
        text-shadow: none;
61
      }
58
      }
62
    `}
59
    `}
63
`
60
`
Línea 64... Línea 61...
64
 
61
 
65
const VoteTag = styled.span`
62
const VoteTag = styled('span')`
66
  position: absolute;
63
  position: absolute;
67
  bottom: 1rem;
64
  bottom: 1rem;
68
  right: 1rem;
65
  right: 1rem;
69
  color: var(--font-color) !important;
66
  color: var(--font-color) !important;
70
  font-weight: 600;
67
  font-weight: 600;
Línea 71... Línea 68...
71
`
68
`
-
 
69
 
72
 
70
const SurveyForm = (props) => {
73
const SurveyForm = ({
71
  const {
74
  active = false,
72
    active = false,
75
  question,
73
    question,
76
  answers = [],
74
    answers = [],
77
  votes,
75
    votes,
78
  time,
76
    time,
79
  resultType,
77
    resultType,
-
 
78
    voteUrl
80
  voteUrl,
79
  } = props
81
  addNotification, // Redux action
80
 
82
  updateFeed // Redux action
81
  console.log(props)
83
}) => {
82
 
84
  const [remainingTime, setRemainingTime] = useState('00:00:00')
83
  const [remainingTime, setRemainingTime] = useState('00:00:00')
85
  const [isActive, setIsActive] = useState(true)
84
  const [isActive, setIsActive] = useState(true)
86
  const [totalVotes, setTotalVotes] = useState(0)
85
  const [totalVotes, setTotalVotes] = useState(0)
Línea 184... Línea 183...
184
      {resultType === 'pu' && (
183
      {resultType === 'pu' && (
185
        <span
184
        <span
186
          className='mb-2'
185
          className='mb-2'
187
          title='El número de votos es visible para todos los usuarios'
186
          title='El número de votos es visible para todos los usuarios'
188
        >
187
        >
189
          <PublicIcon /> Público
188
          <Public /> Público
190
        </span>
189
        </span>
191
      )}
190
      )}
192
      {resultType === 'pr' && (
191
      {resultType === 'pr' && (
193
        <span
192
        <span
194
          className='mb-2'
193
          className='mb-2'
195
          title='Los resultados de la votación son privados'
194
          title='Los resultados de la votación son privados'
196
        >
195
        >
197
          <LockClockIcon /> Privado
196
          <LockClock /> Privado
198
        </span>
197
        </span>
199
      )}
198
      )}
200
      {answers.map(
199
      {answers.map(
201
        (option, index) =>
200
        (option, index) =>
202
          option && (
201
          option && (
Línea 228... Línea 227...
228
      {!isActive && <VoteTag>Tu voto ya fue emitido</VoteTag>}
227
      {!isActive && <VoteTag>Tu voto ya fue emitido</VoteTag>}
229
    </form>
228
    </form>
230
  )
229
  )
231
}
230
}
Línea 232... Línea -...
232
 
-
 
233
const mapDispatchToProps = {
-
 
234
  addNotification: (notification) => addNotification(notification),
-
 
235
  updateFeed: (payload) => updateFeed(payload)
-
 
236
}
-
 
237
 
231