Rev 2420 | Rev 2422 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
import React from "react";import { useEffect, useState } from "react";import { axios } from "../../../utils";const PeopleViewedHelper = (props) => {// props destructuringconst { profileId } = props;// statesconst [peopleViewedProfile, setPeopleViewedProfile] = useState([]);useEffect(() => {axios.get(`/helpers/people-viewed-profile/${profileId}`).then((response) => {const resData = response.data;(resData);if (resData.success) {setPeopleViewedProfile(resData.data);} else {// alert error}});}, []);return (<div className="right-sidebar border-radius border-gray" style={{ height: "450px" }}><div className="sd-title"><h3>Quién ha visto este perfil</h3></div><divclassName="mb-2"id="suggestions-similar-groups"style={{ height: "80%", overflowY: "auto" }}>{peopleViewedProfile.length?getData().map(({ id, name, image, profile }) => (<div className="suggestion-usd" key={id}><div className="row"><div className="col-md-4 col-sm-12" ><imgstyle={{ width: "50px", height: "auto" }}src={image}alt=""/></div><div className="col-md-8 col-sm-12 text-left"><div className="sgt-text"><h4className="cursor-pointer"onClick={() => window.location.href = profile}>{name}</h4></div></div></div></div>)): <div className="view-more">Sin sugerencias</div>}</div>{peopleViewedProfile.length >= 5&&<div className="w-100 text-center"><button className="btn btn-primary" onClick={() => setLookMore(!lookMore)}>{lookMore ? 'Ver menos' : 'Ver mas'}</button></div>}</div>);};export default PeopleViewedHelper;