Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 3014 Rev 3015
Línea 50... Línea 50...
50
  right: 1rem;
50
  right: 1rem;
51
  color: var(--font-color) !important;
51
  color: var(--font-color) !important;
52
  font-weight: 600;
52
  font-weight: 600;
53
`
53
`
Línea 54... Línea 54...
54
 
54
 
-
 
55
const SurveyForm = (props) => {
55
const SurveyForm = ({
56
  const {
56
  active = 0,
57
    active = 0,
57
  question = '¿Cómo consideras el ambiente laboral?',
58
    question = '¿Cómo consideras el ambiente laboral?',
58
  answers = ['Excelente', 'Regular', null, null, null],
59
    answers = ['Excelente', 'Regular', null, null, null],
59
  votes = [null, null, null, null, null],
60
    votes = [null, null, null, null, null],
60
  time = 0,
61
    time = 0,
61
  voteUrl = '/feed/vote/d454717c-ba6f-485c-b94c-4fbb5f5bed94',
62
    voteUrl = '/feed/vote/d454717c-ba6f-485c-b94c-4fbb5f5bed94',
-
 
63
    resultType = 'pu',
62
  resultType
64
    voted = 0
63
}) => {
65
  } = props
64
  const [remainingTime, setRemainingTime] = useState('00:00:00')
66
  const [remainingTime, setRemainingTime] = useState('00:00:00')
65
  const [isActive, setIsActive] = useState(true)
67
  const [isActive, setIsActive] = useState(true)
Línea 66... Línea 68...
66
  const timeRef = useRef(time)
68
  const timeRef = useRef(time)
Línea -... Línea 69...
-
 
69
 
-
 
70
  const { register, handleSubmit } = useForm()
67
 
71
 
68
  const { register, handleSubmit } = useForm()
72
  console.log(props)
69
 
73
 
70
  const totalVotes = useMemo(
74
  const totalVotes = useMemo(
71
    () =>
75
    () =>
Línea 145... Línea 149...
145
          title='Los resultados de la votación son privados'
149
          title='Los resultados de la votación son privados'
146
        >
150
        >
147
          <LockClock /> Privado
151
          <LockClock /> Privado
148
        </span>
152
        </span>
149
      )}
153
      )}
150
      {answers.map(
154
      {answers.map((answer, index) => {
151
        (option, index) =>
155
        if (answer === null) return null
-
 
156
 
152
          option && (
157
        return (
153
            <RadioButton disabled={!isActive} key={index}>
158
          <RadioButton key={answer}>
154
              <input
159
            <input
155
                type='radio'
160
              type='radio'
156
                name='vote'
161
              name='vote'
157
                id={`vote-${index + 1}`}
-
 
158
                disabled={!isActive}
-
 
159
                ref={register({ required: true })}
162
              ref={register({ required: true })}
160
                value={index + 1}
163
              value={index + 1}
161
              />
164
            />
162
              <label htmlFor={`vote-${index + 1}`}>{option}</label>
165
            <label htmlFor={`vote-${index + 1}`}>{answer}</label>
163
              {!!totalVotes && (
166
            {/*  {!!totalVotes && (
164
                <span className='mb-0'>
167
              <span className='mb-0'>
165
                  {getPorcentage(votes[index], totalVotes)}%
168
                {getPorcentage(votes[index], totalVotes)}%
166
                </span>
169
              </span>
167
              )}
170
            )} */}
168
            </RadioButton>
171
          </RadioButton>
169
          )
172
        )
170
      )}
173
      })}
171
      <span>Tiempo restante: {remainingTime}</span>
174
      <span>Tiempo restante: </span>
172
      {!isActive && <VoteTag>Tu voto ya fue emitido</VoteTag>}
175
      {!isActive && <VoteTag>Tu voto ya fue emitido</VoteTag>}
173
    </form>
176
    </form>
174
  )
177
  )
175
}
178
}