Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 5473 Rev 5483
Línea 1... Línea 1...
1
/* eslint-disable react/prop-types */
1
/* eslint-disable react/prop-types */
2
import React, { useState } from "react";
2
import React, { useState, useEffect } from 'react'
3
import LanguagesModal from "./LanguagesModal";
3
import { useSelector } from 'react-redux'
Línea -... Línea 4...
-
 
4
 
-
 
5
import IconButton from '@mui/material/IconButton'
4
 
6
import EditIcon from '@mui/icons-material/Edit'
-
 
7
import LanguagesModal from './LanguagesModal'
-
 
8
import EmptySection from '../../../shared/empty-section/EmptySection'
-
 
9
 
-
 
10
const Languages = ({ languages, languagesOptions, userId, isEdit }) => {
-
 
11
  const [settedLanguages, setSettedLanguages] = useState(languages)
-
 
12
  const [isModalOpen, setIsModalOpen] = useState(false)
5
const Languages = ({
13
 
-
 
14
  const labels = useSelector((state) => state.labels)
6
  userLanguages,
15
 
7
  languagesOptions,
16
  const handleEdit = () => {
8
  userIdEncrypted
17
    setIsModalOpen(true)
-
 
18
  }
9
}) => {
19
 
10
  const [isModalOpen, setIsModalOpen] = useState(false);
20
  useEffect(() => {
-
 
21
    setSettedLanguages(languages)
Línea 11... Línea 22...
11
  const [userLanguagesArray, setUserLanguagesArray] = useState(userLanguages);
22
  }, [])
12
 
23
 
13
  return (
24
  return (
14
    <>
25
    <>
15
      <div className="user-profile-ov">
26
      <div className="profile-attr">
16
        <h3>
-
 
17
          Idiomas
-
 
18
          <a
27
        <div className="profile-attr-header">
19
            href="#"
28
          <h3>Idiomas</h3>
20
            title=""
-
 
21
            className="btn-languages-edit"
-
 
22
            onClick={() => setIsModalOpen(true)}
29
          {isEdit && (
23
          >
30
            <IconButton onClick={handleEdit}>
24
            <i className="fa fa-pencil"></i>
31
              <EditIcon />
25
          </a>
32
            </IconButton>
26
        </h3>
33
          )}
27
        <ul>
34
        </div>
28
          {
35
        {settedLanguages.length ? (
29
            userLanguagesArray.length
36
          <ul id="list-languages">
30
              ? userLanguagesArray.map(({ name }) =>
37
            {settedLanguages.map(({ name, value }) => (
31
                <li key={name}>
38
              <li key={value}>
32
                  <a href="#" title="">
39
                <a href="#" title="">
33
                    {name}
40
                  {name}
34
                  </a>
41
                </a>
35
                </li>
42
              </li>
36
              )
43
            ))}
-
 
44
          </ul>
37
              : <li>Sin información</li>
45
        ) : (
38
          }
46
          <EmptySection align="left" message={labels.EMPTY} />
39
        </ul>
47
        )}
40
      </div>
48
      </div>
41
      <LanguagesModal
49
      <LanguagesModal
42
        show={isModalOpen}
50
        show={isModalOpen}
43
        closeModal={() => setIsModalOpen(false)}
51
        closeModal={() => setIsModalOpen(false)}
44
        userIdEncrypted={userIdEncrypted}
52
        userIdEncrypted={userId}
45
        languagesOptions={languagesOptions}
53
        languagesOptions={languagesOptions}
46
        userLanguages={userLanguagesArray}
54
        userLanguages={settedLanguages}
47
        setLanguages={(newLanguages) => setUserLanguagesArray(newLanguages)}
55
        setLanguages={(newLanguages) => setSettedLanguages(newLanguages)}
48
      />
56
      />
49
    </>
57
    </>
Línea 50... Línea 58...
50
  );
58
  )