Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 3023 Rev 3076
Línea 1... Línea 1...
1
import React, { useMemo } from 'react'
1
import React, { useMemo } from 'react'
2
import { useForm } from 'react-hook-form'
2
import { useForm } from 'react-hook-form'
-
 
3
import {
-
 
4
  FormControlLabel,
-
 
5
  Radio,
-
 
6
  RadioGroup,
-
 
7
  styled,
-
 
8
  Typography
3
import { styled, Typography } from '@mui/material'
9
} from '@mui/material'
4
import { Public, LockClock } from '@mui/icons-material'
10
import { Public, LockClock } from '@mui/icons-material'
Línea 5... Línea 11...
5
 
11
 
6
import { axios } from '@utils'
12
import { axios } from '@utils'
7
import { getTimeDiff } from '@utils/dates'
13
import { getTimeDiff } from '@utils/dates'
8
import { updateFeed } from '@store/feed/feed.actions'
14
import { updateFeed } from '@store/feed/feed.actions'
Línea 9... Línea 15...
9
import { addNotification } from '@store/notification/notification.actions'
15
import { addNotification } from '@store/notification/notification.actions'
10
 
-
 
Línea 11... Línea 16...
11
import Widget from '@components/UI/Widget'
16
 
12
import CheckboxInput from '@components/UI/inputs/Checkbox'
17
import Widget from '@components/UI/Widget'
13
 
18
 
14
const AnswerContainer = styled('div')`
19
const AnswerContainer = styled('div')`
Línea 101... Línea 106...
101
            <LockClock sx={{ fontSize: '1.3rem' }} /> Privado
106
            <LockClock sx={{ fontSize: '1.3rem' }} /> Privado
102
          </Typography>
107
          </Typography>
103
        )}
108
        )}
Línea 104... Línea 109...
104
 
109
 
-
 
110
        <form onChange={sendVote}>
105
        <form onChange={sendVote}>
111
          <RadioGroup defaultValue='female' name='customized-radios'>
106
          {answers.map((answer, index) => {
112
            {answers.map((answer, index) => {
107
            if (answer === null) return null
113
              if (answer === null) return null
108
 
114
 
109
            return (
115
              return (
110
              <AnswerContainer
116
                <AnswerContainer
111
                key={answer}
117
                  key={answer}
112
                sx={{
118
                  sx={{
113
                  '::before': {
119
                    '::before': {
114
                    content: '',
120
                      content: '',
115
                    position: 'absolute',
121
                      position: 'absolute',
116
                    left: 0,
122
                      left: 0,
117
                    top: 0,
123
                      top: 0,
118
                    height: '100%',
124
                      height: '100%',
119
                    backgroundColor: '#0002',
125
                      backgroundColor: '#0002',
120
                    zIndex: 4,
126
                      zIndex: 4,
121
                    width: totalVotes
127
                      width: totalVotes
122
                      ? `${getPorcentage(votes[index], totalVotes)}%`
128
                        ? `${getPorcentage(votes[index], totalVotes)}%`
123
                      : 0
129
                        : 0
124
                  }
-
 
125
                }}
-
 
126
              >
-
 
127
                <CheckboxInput
-
 
128
                  name='vote'
-
 
129
                  value={index + 1}
-
 
130
                  label={answer}
-
 
131
                  control={control}
-
 
132
                  disabled={!active}
-
 
133
                  labelStyles={{
-
 
134
                    display: 'flex',
-
 
135
                    alignItems: 'center',
-
 
136
                    gap: 0.5,
-
 
137
                    margin: 0
130
                    }
-
 
131
                  }}
-
 
132
                >
-
 
133
                  <FormControlLabel
138
                  }}
134
                    value={index + 1}
-
 
135
                    control={<Radio />}
139
                  checkBoxStyles={{ padding: 0 }}
136
                    label={answer}
140
                />
137
                  />
141
 
138
 
142
                {totalVotes ? (
139
                  {totalVotes ? (
143
                  <Typography variant='overline'>
140
                    <Typography variant='overline'>
144
                    {getPorcentage(votes[index], totalVotes)}%
141
                      {getPorcentage(votes[index], totalVotes)}%
145
                  </Typography>
142
                    </Typography>
146
                ) : null}
143
                  ) : null}
147
              </AnswerContainer>
144
                </AnswerContainer>
148
            )
145
              )
-
 
146
            })}
Línea 149... Línea 147...
149
          })}
147
          </RadioGroup>
150
 
148
 
151
          <Typography variant='overline'>
149
          <Typography variant='overline'>