Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 5357 Rev 5358
Línea 8... Línea 8...
8
import SendIcon from '@mui/icons-material/Send'
8
import SendIcon from '@mui/icons-material/Send'
Línea 9... Línea 9...
9
 
9
 
10
// Components
10
// Components
Línea 11... Línea 11...
11
import Spinner from '../../../shared/loading-spinner/Spinner'
11
import Spinner from '../../../shared/loading-spinner/Spinner'
12
 
12
 
13
const ContactsModal = ({ show }) => {
13
const ContactsModal = ({ show, onClose }) => {
14
  const [isShow, setIsShow] = useState(show)
14
  const [isShow, setIsShow] = useState(show)
15
  const [contacts, setContacts] = useState([])
15
  const [contacts, setContacts] = useState([])
Línea 16... Línea 16...
16
  const [loading, setLoading] = useState(false)
16
  const [loading, setLoading] = useState(false)
17
  const dispatch = useDispatch()
17
  const dispatch = useDispatch()
18
 
18
 
-
 
19
  const closeModal = () => {
19
  const closeModal = () => {
20
    setIsShow(false)
Línea 20... Línea 21...
20
    setIsShow(false)
21
    setContacts([])
Línea 21... Línea 22...
21
    setContacts([])
22
    onClose()
Línea 33... Línea 34...
33
        setContacts(response.data)
34
        setContacts(response.data)
34
      })
35
      })
35
      .finally(() => setLoading(false))
36
      .finally(() => setLoading(false))
36
  }
37
  }
Línea 37... Línea 38...
37
 
38
 
38
  const startConversation = async (create_url = '') => {
39
  const startConversation = (create_url = '') => {
39
    setLoading(true)
-
 
40
    await axios
40
    setLoading(true)
41
      .post(create_url)
41
    axios.post(create_url)
42
      .then(({ data: response }) => {
42
      .then(({ data: response }) => {
43
        if (response.success) closeModal()
43
        if (response.success) closeModal()
44
      })
44
      })
45
      .finally(() => setLoading(false))
45
      .finally(() => setLoading(false))
Línea 52... Línea 52...
52
  return (
52
  return (
53
    <Modal show={isShow} onHide={closeModal}>
53
    <Modal show={isShow} onHide={closeModal}>
54
      <Modal.Header closeButton>
54
      <Modal.Header closeButton>
55
        <h3 className="card-title font-weight-bold">Iniciar conversación</h3>
55
        <h3 className="card-title font-weight-bold">Iniciar conversación</h3>
56
      </Modal.Header>
56
      </Modal.Header>
57
      <Modal.Body>
57
      <Modal.Body className='pb-3'>
58
        <div className="form-group">
58
        <div className="form-group">
59
          <label htmlFor="search-people">Escribe el nombre</label>
59
          <label htmlFor="search-people">Escribe el nombre</label>
60
          <input
60
          <input
61
            type="text"
61
            type="text"
62
            className="form-control"
62
            className="form-control"
Línea 65... Línea 65...
65
          />
65
          />
66
        </div>
66
        </div>
67
        {loading
67
        {loading
68
          ? <Spinner />
68
          ? <Spinner />
69
          : contacts.map(({ name, image, link_open_or_create }) => (
69
          : contacts.map(({ name, image, link_open_or_create }) => (
70
              <div key={name} className="d-flex align-items-center justify-content-around">
70
              <div key={name} className="d-flex align-items-center justify-content-around" style={{ gap: '.5rem' }}>
71
                <div className="d-flex align-items-center">
71
                <div className="d-flex align-items-center">
72
                  <img src={image} alt={`User ${name} image`} width={40} height={40} style={{ borderRadius: '50%' }}/>
72
                  <img src={image} alt={`User ${name} image`} width={40} height={40} style={{ borderRadius: '50%' }}/>
73
                  <p>{name}</p>
73
                  <p>{name}</p>
74
                </div>
74
                </div>