Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 597 Rev 598
Línea 1... Línea 1...
1
import React, { useRef, useState } from 'react'
1
import React, { useRef, useState } from 'react'
2
import { axios } from '../../utils'
2
import { axios } from '../../utils'
3
import { Link } from 'react-router-dom'
3
import { Link, useHistory } from 'react-router-dom'
4
import { addNotification } from 'store/notification/notification.actions'
4
import { addNotification } from 'store/notification/notification.actions'
5
import { useDispatch, useSelector } from 'react-redux'
5
import { useDispatch, useSelector } from 'react-redux'
6
import styled from 'styled-components'
6
import styled from 'styled-components'
Línea 7... Línea 7...
7
 
7
 
Línea 53... Línea 53...
53
  const [isShowConfirmation, setIsShowConfirmation] = useState(false)
53
  const [isShowConfirmation, setIsShowConfirmation] = useState(false)
54
  const [loading, setLoading] = useState(false)
54
  const [loading, setLoading] = useState(false)
55
  const confirmUrl = useRef('')
55
  const confirmUrl = useRef('')
56
  const labels = useSelector(({ intl }) => intl.labels)
56
  const labels = useSelector(({ intl }) => intl.labels)
57
  const dispatch = useDispatch()
57
  const dispatch = useDispatch()
-
 
58
  const history = useHistory()
Línea 58... Línea 59...
58
 
59
 
59
  const showConfirm = (url = '') => {
60
  const showConfirm = (url = '') => {
60
    setIsShowConfirmation(true)
61
    setIsShowConfirmation(true)
61
    confirmUrl.current = url
62
    confirmUrl.current = url
Línea 75... Línea 76...
75
    }
76
    }
76
  }
77
  }
Línea 77... Línea 78...
77
 
78
 
78
  const onConfirm = (url) => {
79
  const onConfirm = (url) => {
79
    setLoading(true)
-
 
80
 
80
    setLoading(true)
81
    axios
81
    axios
82
      .post(url)
82
      .post(url)
83
      .then((response) => {
83
      .then((response) => {
Línea 177... Línea 177...
177
    <>
177
    <>
178
      <StyledContainer>
178
      <StyledContainer>
179
        <div className={styles.profile_item_header}>
179
        <div className={styles.profile_item_header}>
180
          {image && <img src={image} alt="group image" />}
180
          {image && <img src={image} alt="group image" />}
181
          <div className={styles.profile_item_header_info}>
181
          <div className={styles.profile_item_header_info}>
182
            <h3 className="titulo">{name}</h3>
182
            <h3>{name}</h3>
Línea 183... Línea 183...
183
 
183
 
184
            {isTopData && email && <h4>{email}</h4>}
184
            {isTopData && email && <h4>{email}</h4>}
185
            {network && <h4>{network}</h4>}
185
            {network && <h4>{network}</h4>}
186
            {status && <h4>{status}</h4>}
186
            {status && <h4>{status}</h4>}
Línea 227... Línea 227...
227
            if (url === link_inmail && isTopData) {
227
            if (url === link_inmail && isTopData) {
228
              return null
228
              return null
229
            }
229
            }
Línea 230... Línea 230...
230
 
230
 
231
            return (
231
            return (
232
              <Link
232
              <button
233
                key={url}
-
 
234
                to={url}
-
 
235
                title={label}
-
 
236
                className="position-relative"
233
                key={url}
237
                onClick={(e) => {
234
                onClick={() => {
238
                  if (url === link_unfollow) {
-
 
239
                    e.preventDefault()
235
                  if (url === link_unfollow) {
240
                    handleUnfollow(url)
-
 
241
                    return
236
                    return handleUnfollow(url)
Línea 242... Línea 237...
242
                  }
237
                  }
243
 
-
 
244
                  if (url === link_admin) {
238
 
245
                    e.preventDefault()
-
 
246
                    getManageUrl()
239
                  if (url === link_admin) {
Línea 247... Línea 240...
247
                    return
240
                    return getManageUrl()
248
                  }
-
 
249
 
241
                  }
250
                  if (url === link_impersonate) {
-
 
251
                    e.preventDefault()
242
 
Línea 252... Línea 243...
252
                    getImpersonateUrl(url)
243
                  if (url === link_impersonate) {
253
                    return
244
                    return getImpersonateUrl(url)
-
 
245
                  }
254
                  }
246
 
255
 
247
                  if (!breakOptions.includes(url)) {
256
                  if (!breakOptions.includes(url)) {
248
                    return showConfirm(url)
257
                    e.preventDefault()
249
                  } else {
258
                    showConfirm(url)
250
                    history.push(url)
259
                  }
251
                  }
260
                }}
252
                }}
261
              >
253
              >
262
                <button className={`btn `}>{label}</button>
254
                {label}
263
              </Link>
255
              </button>
264
            )
256
            )