Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 2995 | Rev 2997 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
2854 stevensc 1
import React from 'react'
2614 stevensc 2
import { useNavigate } from 'react-router-dom'
677 stevensc 3
import { useDispatch } from 'react-redux'
2854 stevensc 4
import { Avatar, styled, Typography } from '@mui/material'
5
import {
6
  VisibilityOutlined,
7
  MapOutlined,
8
  ShareOutlined
9
} from '@mui/icons-material'
674 stevensc 10
 
2996 stevensc 11
import { axios } from '@utils'
2994 stevensc 12
import { addNotification } from '@store/notification/notification.actions'
5 stevensc 13
 
2854 stevensc 14
import Widget from '@components/UI/Widget'
15
import Options from '@components/UI/Option'
676 stevensc 16
 
2854 stevensc 17
const Row = styled('div')(() => ({
18
  display: 'flex',
19
  justifyContent: 'space-around',
20
  alignItems: 'center'
21
}))
674 stevensc 22
 
5 stevensc 23
export default function ProfileInfo({
24
  image,
2996 stevensc 25
  fullName,
5 stevensc 26
  visits,
27
  country,
28
  connections,
29
  linkAdmin,
671 stevensc 30
  linkImpersonate
5 stevensc 31
}) {
2614 stevensc 32
  const navigate = useNavigate()
33
  const dispatch = useDispatch()
676 stevensc 34
 
2854 stevensc 35
  const getAdminUrl = async () => {
36
    try {
37
      const response = await axios.get('/backend/signin-admin')
38
      const { data, success } = response.data
39
      if (!success) throw new Error(data)
40
      window.open(data)
41
    } catch (error) {
42
      dispatch(addNotification({ style: 'danger', msg: error.message }))
43
    }
5 stevensc 44
  }
45
 
46
  return (
2854 stevensc 47
    <Widget>
2995 stevensc 48
      <Widget.Body>
49
        <Avatar
50
          src={image}
2996 stevensc 51
          alt={`${fullName} profile-image`}
2995 stevensc 52
          sx={{ margin: '0 auto', width: 100, height: 100 }}
53
        />
2996 stevensc 54
        <Typography variant='h2'>{fullName}</Typography>
674 stevensc 55
 
2995 stevensc 56
        <Row>
57
          <Typography variant='overline'>
58
            <VisibilityOutlined />
59
            {visits}
60
          </Typography>
2854 stevensc 61
 
2995 stevensc 62
          <Typography variant='overline'>
63
            <MapOutlined />
64
            {country}
65
          </Typography>
2854 stevensc 66
 
2995 stevensc 67
          <Typography variant='overline'>
68
            <ShareOutlined />
69
            {connections}
70
          </Typography>
674 stevensc 71
 
2996 stevensc 72
          {/* <Options>
73
            {linkAdmin ? (
74
              <Options.Item onClick={getAdminUrl}>Administración</Options.Item>
75
            ) : null}
2854 stevensc 76
 
2996 stevensc 77
            {linkImpersonate ? (
78
              <Options.Item onClick={() => navigate('/impersonate')}>
79
                Personificar otro usuario
80
              </Options.Item>
81
            ) : null}
82
 
83
            <Options.Item onClick={() => navigate('/account-settings')}>
84
              Configuración de la cuenta
2995 stevensc 85
            </Options.Item>
2996 stevensc 86
            <Options.Item onClick={() => navigate('/privacy-policy')}>
87
              Política de privacidad
88
            </Options.Item>
89
            <Options.Item onClick={() => navigate('/cookies')}>
90
              Política de cookies
91
            </Options.Item>
92
            <Options.Item onClick={() => navigate('/signout')}>
93
              Cerrar sesión
94
            </Options.Item>
95
          </Options> */}
96
        </Row>
2995 stevensc 97
      </Widget.Body>
2854 stevensc 98
    </Widget>
5 stevensc 99
  )
100
}