Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 7218 Rev 7220
Línea 7... Línea 7...
7
import styled from 'styled-components'
7
import styled from 'styled-components'
Línea 8... Línea 8...
8
 
8
 
9
import QuestionCard from '../../components/my-coach/QuestionCard'
9
import QuestionCard from '../../components/my-coach/QuestionCard'
10
import ConfirmModal from '../../components/modals/ConfirmModal'
10
import ConfirmModal from '../../components/modals/ConfirmModal'
-
 
11
import AnswerCard from '../../components/my-coach/AnswerCard'
Línea 11... Línea 12...
11
import AnswerCard from '../../components/my-coach/AnswerCard'
12
import AnswerModal from '../../components/my-coach/AnswerModal'
12
 
13
 
13
const StyledSection = styled(Col)`
14
const StyledSection = styled(Col)`
14
  display: flex;
15
  display: flex;
Línea 106... Línea 107...
106
  const closeModal = () => {
107
  const closeModal = () => {
107
    actionUrl.current = ''
108
    actionUrl.current = ''
108
    setModalShow(null)
109
    setModalShow(null)
109
  }
110
  }
Línea -... Línea 111...
-
 
111
 
-
 
112
  const addAnswer = () => {
-
 
113
    setModalShow('addAnswer')
-
 
114
  }
-
 
115
 
-
 
116
  const onAddAnswer = ({ answers, item }) => {
-
 
117
    setQuestion((prevQuestion) => ({ ...prevQuestion, answers }))
-
 
118
    setAnswers((prevAnswers) => [item, ...prevAnswers])
-
 
119
  }
110
 
120
 
111
  useEffect(() => {
121
  useEffect(() => {
112
    getQuestion()
122
    getQuestion()
Línea 113... Línea 123...
113
  }, [])
123
  }, [])
Línea 153... Línea 163...
153
          <StyledSection md="8">
163
          <StyledSection md="8">
154
            <QuestionCard
164
            <QuestionCard
155
              key={question.uuid}
165
              key={question.uuid}
156
              onEdit={editQuestion}
166
              onEdit={editQuestion}
157
              onDelete={deleteQuestion}
167
              onDelete={deleteQuestion}
-
 
168
              onReply={addAnswer}
158
              {...question}
169
              {...question}
159
            />
170
            />
160
            {answers.map((answer) => (
171
            {answers.map((answer) => (
161
              <AnswerCard key={answer.unique} {...answer} />
172
              <AnswerCard key={answer.unique} {...answer} />
162
            ))}
173
            ))}
163
          </StyledSection>
174
          </StyledSection>
164
        </Row>
175
        </Row>
165
      </Container>
176
      </Container>
-
 
177
      <AnswerModal
-
 
178
        url={addUrl.current}
-
 
179
        show={modalShow === 'addAnswer'}
-
 
180
        onClose={closeModal}
-
 
181
        onComplete={onAddAnswer}
-
 
182
      />
166
      <ConfirmModal
183
      <ConfirmModal
167
        show={modalShow === 'delete'}
184
        show={modalShow === 'delete'}
168
        onClose={closeModal}
185
        onClose={closeModal}
169
        onAccept={confirmDelete}
186
        onAccept={confirmDelete}
170
      />
187
      />