Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 16674 Rev 16675
Línea 132... Línea 132...
132
      <form onSubmit={handleSubmit(onSubmit)}>
132
      <form onSubmit={handleSubmit(onSubmit)}>
133
        <Modal.Header closeButton>
133
        <Modal.Header closeButton>
134
          <Modal.Title>Compartir una publicación</Modal.Title>
134
          <Modal.Title>Compartir una publicación</Modal.Title>
135
        </Modal.Header>
135
        </Modal.Header>
136
        <Modal.Body>
136
        <Modal.Body>
137
          {loading ? (
137
          {!loading ? (
138
            <Spinner />
-
 
139
          ) : (
-
 
140
            <>
138
            <>
141
              <CKEditor
-
 
142
                onChange={(e) => setValue('description', e.editor.getData())}
-
 
143
                config={config}
-
 
144
              />
-
 
145
              {errors.description && <p>{errors.description.message}</p>}
-
 
146
              {modalType === shareModalTypes.SURVEY && <SurveyForm />}
139
              {modalType === shareModalTypes.SURVEY && <SurveyForm />}
-
 
140
              {modalType !== shareModalTypes.SURVEY && (
-
 
141
                <>
-
 
142
                  <CKEditor
-
 
143
                    onChange={(e) =>
-
 
144
                      setValue('description', e.editor.getData())
-
 
145
                    }
-
 
146
                    config={config}
-
 
147
                  />
-
 
148
                  {errors.description && <p>{errors.description.message}</p>}
-
 
149
                </>
-
 
150
              )}
147
              {![shareModalTypes.POST, shareModalTypes.SURVEY].includes(
151
              {![shareModalTypes.POST, shareModalTypes.SURVEY].includes(
148
                modalType
152
                modalType
149
              ) && (
153
              ) && (
150
                <DropzoneComponent
154
                <DropzoneComponent
151
                  modalType={modalType}
155
                  modalType={modalType}
Línea 154... Línea 158...
154
                  recomendationText={recomendationText[modalType]}
158
                  recomendationText={recomendationText[modalType]}
155
                />
159
                />
156
              )}
160
              )}
157
              {errors.file && <p>{errors.file.message}</p>}
161
              {errors.file && <p>{errors.file.message}</p>}
158
            </>
162
            </>
-
 
163
          ) : (
-
 
164
            <Spinner />
159
          )}
165
          )}
160
        </Modal.Body>
166
        </Modal.Body>
161
        <Modal.Footer>
167
        <Modal.Footer>
162
          <button
168
          <button
163
            className="btn btn-sm btn-primary"
169
            className="btn btn-sm btn-primary"
Línea 172... Línea 178...
172
            onClick={closeModal}
178
            onClick={closeModal}
173
          >
179
          >
174
            Cancelar
180
            Cancelar
175
          </button>
181
          </button>
176
          <button
182
          <button
177
            className="btn"
183
            className="btn btn-sm"
178
            disabled={loading}
184
            disabled={loading}
179
            onClick={() => dispatch(setModalType(shareModalTypes.SURVEY))}
185
            onClick={() => dispatch(setModalType(shareModalTypes.SURVEY))}
180
          >
186
          >
181
            Añadir encuesta
187
            Añadir encuesta
182
          </button>
188
          </button>
Línea 184... Línea 190...
184
      </form>
190
      </form>
185
    </Modal>
191
    </Modal>
186
  )
192
  )
187
}
193
}
Línea 188... Línea 194...
188
 
194
 
189
const SurveyForm = () => {
-
 
190
  const { register, reset, errors, watch } = useForm()
195
const SurveyForm = ({ register }) => {
Línea 191... Línea 196...
191
  const [optionsNumber, setOptionsNumber] = useState(2)
196
  const [optionsNumber, setOptionsNumber] = useState(2)
192
 
197
 
193
  const options = [
198
  const options = [
Línea 237... Línea 242...
237
            name={`option-${index + 1}`}
242
            name={`option-${index + 1}`}
238
            ref={register({ required: true })}
243
            ref={register({ required: true })}
239
          />
244
          />
240
        </div>
245
        </div>
241
      ))}
246
      ))}
-
 
247
      {optionsNumber < options.length && (
242
      <button className="btn btn-outline-primary rounded" onClick={addOption}>
248
        <button className="btn btn-outline-primary rounded" onClick={addOption}>
243
        Añadir opción
249
          Añadir opción
244
      </button>
250
        </button>
-
 
251
      )}
245
    </>
252
    </>
246
  )
253
  )
247
}
254
}
Línea 248... Línea 255...
248
 
255