Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 674 Rev 676
Línea 1... Línea 1...
1
import React from 'react'
1
import React, { useRef, useEffect } from 'react'
2
import { axios } from '../../../utils'
2
import { axios } from '../../../utils'
3
import { Avatar } from '@mui/material'
3
import { Avatar } from '@mui/material'
4
import MapOutlinedIcon from '@mui/icons-material/MapOutlined'
4
import MapOutlinedIcon from '@mui/icons-material/MapOutlined'
5
import ShareOutlinedIcon from '@mui/icons-material/ShareOutlined'
5
import ShareOutlinedIcon from '@mui/icons-material/ShareOutlined'
6
import VisibilityOutlinedIcon from '@mui/icons-material/VisibilityOutlined'
6
import VisibilityOutlinedIcon from '@mui/icons-material/VisibilityOutlined'
7
import styled from 'styled-components'
7
import styled from 'styled-components'
Línea 8... Línea 8...
8
 
8
 
9
import Paraphrase from '../../UI/Paraphrase'
9
import Paraphrase from '../../UI/Paraphrase'
-
 
10
import StyledContainer from '../WidgetLayout'
-
 
11
import Options from '../../UI/Option'
-
 
12
import { useHistory } from 'react-router-dom'
-
 
13
 
-
 
14
const StyledProfileContainer = styled(StyledContainer)`
-
 
15
  padding: 10px;
-
 
16
  text-align: center;
Línea 10... Línea 17...
10
import StyledContainer from '../WidgetLayout'
17
`
11
 
18
 
12
const StyledProfileStatus = styled.div`
19
const StyledProfileStatus = styled.div`
13
  display: flex;
20
  display: flex;
Línea 23... Línea 30...
23
  country,
30
  country,
24
  connections,
31
  connections,
25
  linkAdmin,
32
  linkAdmin,
26
  linkImpersonate
33
  linkImpersonate
27
}) {
34
}) {
-
 
35
  const options = useRef([
-
 
36
    {
-
 
37
      label: 'Configuración de la cuenta',
-
 
38
      action: () => history.push('/account-settings')
-
 
39
    },
-
 
40
    {
-
 
41
      label: 'Política de privacidad',
-
 
42
      action: () => history.push('/privacy-policy')
-
 
43
    },
-
 
44
    { label: 'Política de cookies', action: () => history.push('/cookies') },
-
 
45
    { label: 'Cerrar sesión', action: () => history.push('/signout') }
-
 
46
  ])
-
 
47
  const history = useHistory()
-
 
48
 
28
  const getAdminUrl = async () => {
49
  const getAdminUrl = async () => {
29
    try {
50
    try {
30
      const { data } = await axios.get('/backend/signin-admin')
51
      const { data } = await axios.get('/backend/signin-admin')
31
      if (data.success) window.open(data.data)
52
      if (data.success) window.open(data.data)
32
    } catch (error) {
53
    } catch (error) {
33
      console.log('>>: error > ', error)
54
      console.log('>>: error > ', error)
34
    }
55
    }
35
  }
56
  }
Línea -... Línea 57...
-
 
57
 
-
 
58
  useEffect(() => {
-
 
59
    if (linkAdmin)
-
 
60
      options.current.unshift({ label: 'Administración', action: getAdminUrl })
-
 
61
 
-
 
62
    if (linkImpersonate)
-
 
63
      options.current.unshift({
-
 
64
        label: 'Personificar otro usuario',
-
 
65
        action: () => history.push('/impersonate')
-
 
66
      })
-
 
67
  }, [])
36
 
68
 
37
  return (
69
  return (
38
    <StyledContainer className='p-2'>
70
    <StyledProfileContainer>
39
      <Avatar
71
      <Avatar
40
        src={image}
72
        src={image}
41
        alt={`${name} profile-image`}
73
        alt={`${name} profile-image`}
42
        sx={{ margin: '0 auto', width: 100, height: 100 }}
74
        sx={{ margin: '0 auto', width: 100, height: 100 }}
Línea 57... Línea 89...
57
          <ShareOutlinedIcon />
89
          <ShareOutlinedIcon />
58
          {connections}
90
          {connections}
59
        </span>
91
        </span>
60
      </StyledProfileStatus>
92
      </StyledProfileStatus>
Línea 61... Línea -...
61
 
-
 
62
      <ul>
-
 
63
        {linkAdmin && (
-
 
64
          <li>
-
 
65
            <a href='#' onClick={() => getAdminUrl()}>
-
 
66
              Administración
-
 
67
            </a>
-
 
68
          </li>
-
 
69
        )}
-
 
70
        {linkImpersonate && (
-
 
71
          <li>
-
 
72
            <a href='/impersonate'>Personificar otro usuario</a>
-
 
73
          </li>
-
 
74
        )}
-
 
75
        <li>
-
 
76
          <a href='/account-settings'>Configuración de la cuenta</a>
-
 
77
        </li>
-
 
78
        <li>
-
 
79
          <a href='/privacy-policy'>Política de privacidad</a>
-
 
80
        </li>
-
 
81
        <li>
-
 
82
          <a href='/cookies'>Política de cookies</a>
-
 
83
        </li>
93
 
84
        <li className='logOutContainer'>
-
 
85
          <a className='logOutContainer__a' href='/signout'>
-
 
86
            Cerrar sesión
-
 
87
          </a>
-
 
88
        </li>
-
 
89
      </ul>
94
      <Options options={options.current} />
90
    </StyledContainer>
95
    </StyledProfileContainer>
91
  )
96
  )