Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 6741 Rev 6753
Línea 6... Línea 6...
6
 
6
 
7
import Spinner from '../UI/Spinner'
7
import Spinner from '../UI/Spinner'
Línea 8... Línea 8...
8
import ConfirmationBox from '../UI/ConfirmBox'
8
import ConfirmationBox from '../UI/ConfirmBox'
-
 
9
 
Línea 9... Línea 10...
9
 
10
import styles from './ProfileItem.module.scss'
10
import styles from './ProfileItem.module.scss'
11
import { Link } from 'react-router-dom'
11
 
12
 
12
const StyledSpinnerContainer = styled.div`
13
const StyledSpinnerContainer = styled.div`
Línea 53... Línea 54...
53
  const [isShowConfirmation, setIsShowConfirmation] = useState(false)
54
  const [isShowConfirmation, setIsShowConfirmation] = useState(false)
54
  const [loading, setLoading] = useState(false)
55
  const [loading, setLoading] = useState(false)
55
  const confirmUrl = useRef('')
56
  const confirmUrl = useRef('')
56
  const labels = useSelector(({ intl }) => intl.labels)
57
  const labels = useSelector(({ intl }) => intl.labels)
Línea 57... Línea 58...
57
 
58
 
58
  const handleConfirm = (url = '') => {
59
  const showConfirm = (url = '') => {
59
    setIsShowConfirmation(!isShowConfirmation)
60
    setIsShowConfirmation(true)
60
    confirmUrl.current = url
61
    confirmUrl.current = url
Línea -... Línea 62...
-
 
62
  }
-
 
63
 
-
 
64
  const closeConfirm = (url = '') => {
-
 
65
    setIsShowConfirmation(false)
-
 
66
    confirmUrl.current = ''
61
  }
67
  }
62
 
68
 
63
  const getImpersonateUrl = async (url = '') => {
69
  const getImpersonateUrl = async (url = '') => {
64
    try {
70
    try {
65
      const { data } = await axios.get(url)
71
      const { data } = await axios.get(url)
Línea 203... Línea 209...
203
            return null
209
            return null
204
          }
210
          }
Línea 205... Línea 211...
205
 
211
 
206
          return (
212
          return (
207
            <li key={option.label}>
213
            <li key={option.label}>
208
              <a
214
              <Link
209
                href={option.url}
215
                to={option.url}
210
                title={option.label}
216
                title={option.label}
211
                className="position-relative"
217
                className="position-relative"
212
                onClick={(e) => {
218
                onClick={(e) => {
213
                  if (!breakOptions.includes(option.url)) {
219
                  if (!breakOptions.includes(option.url)) {
214
                    e.preventDefault()
220
                    e.preventDefault()
215
                    handleConfirm(option.url)
221
                    showConfirm(option.url)
Línea 216... Línea 222...
216
                  }
222
                  }
217
 
223
 
218
                  if (option.url === link_unfollow) {
224
                  if (option.url === link_unfollow) {
Línea 231... Línea 237...
231
                }}
237
                }}
232
              >
238
              >
233
                <button className={`btn btn-${option.color}`}>
239
                <button className={`btn btn-${option.color}`}>
234
                  {option.label}
240
                  {option.label}
235
                </button>
241
                </button>
236
              </a>
242
              </Link>
237
            </li>
243
            </li>
238
          )
244
          )
239
        })}
245
        })}
240
        <ConfirmationBox
246
        <ConfirmationBox
241
          show={isShowConfirmation}
247
          show={isShowConfirmation}
242
          onClose={() => handleConfirm()}
248
          onClose={() => closeConfirm()}
243
          onAccept={() => onConfirm(confirmUrl.current)}
249
          onAccept={() => onConfirm(confirmUrl.current)}
244
        />
250
        />
245
      </ul>
251
      </ul>
246
      {loading && (
252
      {loading && (
247
        <StyledSpinnerContainer>
253
        <StyledSpinnerContainer>