Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev Autor Línea Nro. Línea
2678 stevensc 1
import React from 'react'
2
import { useNavigate } from 'react-router-dom'
2842 stevensc 3
import { Avatar, Button, styled, Typography } from '@mui/material'
2678 stevensc 4
import { useSelector } from 'react-redux'
5
import parse from 'html-react-parser'
6
 
2827 stevensc 7
import colors from '@styles/colors'
2826 stevensc 8
 
2678 stevensc 9
import Widget from '@components/UI/Widget'
10
 
11
const WidgetButton = styled(Button)(() => ({
12
  alignItems: 'center',
13
  borderRadius: 0,
14
  color: colors.font.subtitle,
15
  display: 'flex',
16
  fontWeight: 600,
17
  justifyContent: 'space-between',
18
  width: '100%',
19
  '& span': {
20
    color: '#0a66c2'
21
  }
22
}))
23
 
24
const UserProfileAvatar = styled(Avatar)(() => ({
25
  width: '60px',
26
  height: '60px',
27
  margin: 'auto'
28
}))
29
 
30
const UserProfileCard = ({
31
  user: {
32
    cover = '',
33
    image = '',
34
    fullname = '',
35
    description = '',
36
    visits = 0,
37
    connections = 0
38
  }
39
}) => {
40
  const labels = useSelector(({ intl }) => intl.labels)
41
  const navigate = useNavigate()
42
 
43
  const handleNavigate = (path) => navigate(path)
44
 
45
  return (
46
    <Widget>
47
      <Widget.Media
48
        src={cover}
49
        alt={`${fullname} profile cover`}
50
        height={60}
51
        styles={{
52
          display: cover ? 'block' : 'none',
53
          marginBottom: cover ? '-20px' : '0px'
54
        }}
55
      />
56
 
2843 stevensc 57
      <Widget.Body styles={{ textAlign: 'center' }}>
2678 stevensc 58
        <UserProfileAvatar src={image} alt={`${fullname} profile image`} />
59
        <Typography variant='h2'>{parse(fullname ?? '')}</Typography>
60
        <Typography>{parse(description ?? '')}</Typography>
61
      </Widget.Body>
62
 
2842 stevensc 63
      <WidgetButton
64
        onClick={() => handleNavigate('/profile/people-viewed-profile')}
65
      >
66
        {labels.who_has_seen_my_profile}
2917 stevensc 67
        <Typography variant='overline'>{visits ?? 0}</Typography>
2842 stevensc 68
      </WidgetButton>
2678 stevensc 69
 
2842 stevensc 70
      <WidgetButton
71
        onClick={() => handleNavigate('/connection/my-connections')}
72
      >
73
        {labels.connections}
2917 stevensc 74
        <Typography variant='overline'>{connections ?? 0}</Typography>
2842 stevensc 75
      </WidgetButton>
2678 stevensc 76
    </Widget>
77
  )
78
}
79
 
80
export default UserProfileCard