Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 5380 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

/* eslint-disable react/prop-types */
import React from 'react'
import parser from 'html-react-parser'
import { axios } from '../../../utils'

export default function ProfileInfo ({
  image,
  fullName,
  description,
  visits,
  country,
  connections,
  headerClasses = '',
  imageContainerClasses = '',
  linkAdmin,
  linkImpersonate
}) {
  const getAdminUrl = async () => {
    try {
      const { data } = await axios.get('/backend/signin-admin')
      if (data.success) window.open(data.data)
    } catch (error) {
      console.log('>>: error > ', error)
    }
  }

  return (
        <div className='user_profile-info'>
            <div className={'userProfile__header' + ' ' + headerClasses}>
                <div className={'userProfile__header__imgContainer' + ' ' + imageContainerClasses}>
                    <img src={image} alt="profile-image" />
                </div>
                <div className={'userProfile__header__nameContainer'}>
                    <p className="text-center font-weight-bold">
                        {fullName}
                    </p>
                    {!!description &&
                        <p className="text-center p-1 small-text-children">
                            {parser(description)}
                        </p>
                    }
                </div>
            </div>
            <div className='userProfile__headerBackground'></div>
            <div className="row">
                <div className="col w-100 text-center">
                    <p className='userProfile__connectionInfo__infoContainer__title'>
                        <i className="fa fa-eye" ></i>
                    </p>
                    <p className='userProfile__connectionInfo__infoContainer__title'>
                        {visits || ''}
                    </p>
                </div>
                <div className="col w-100 text-center">
                    <p className='userProfile__connectionInfo__infoContainer__title'>
                        <i className="pl-2 fa fa-map px-2"></i>
                    </p>
                    <p className='userProfile__connectionInfo__infoContainer__title'>
                        {country || ''}
                    </p>
                </div>
                <div className="col w-100 text-center">
                    <p className='userProfile__connectionInfo__infoContainer__title'>
                        <i className="fa fa-share-alt" ></i>
                    </p>
                    <p className='userProfile__connectionInfo__infoContainer__title'>
                        {connections}
                    </p>
                </div>
            </div>
            <ul>
                {linkAdmin &&
                    <li>
                        <a href="#" onClick={() => getAdminUrl()} >Administración</a>
                    </li>
                }
                {linkImpersonate &&
                    <li>
                        <a href="/impersonate">Personificar otro usuario</a>
                    </li>
                }
                <li>
                    <a href="/account-settings">Configuración de la cuenta</a>
                </li>
                <li>
                    <a href="/privacy-policy">Política de privacidad</a>
                </li>
                <li>
                    <a href="/cookies">Política de cookies</a>
                </li>
                <li className='logOutContainer'>
                    <a className='logOutContainer__a' href="/signout">
                        Cerrar sesión
                    </a>
                </li>
            </ul>
        </div>
  )
}