Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 3890 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3890 Rev 5070
Línea 1... Línea 1...
1
/* eslint-disable react/prop-types */
1
/* eslint-disable react/prop-types */
2
import React from "react";
-
 
3
import { useEffect, useState } from "react";
2
import React, { useEffect, useState } from 'react'
4
import { axios } from "../../../utils";
3
import { axios } from '../../../utils'
Línea 5... Línea 4...
5
 
4
 
6
const PeopleViewedHelper = ({ profileId }) => {
-
 
7
 
5
const PeopleViewedHelper = ({ profileId }) => {
8
  const [peopleViewedProfile, setPeopleViewedProfile] = useState([]);
6
  const [peopleViewedProfile, setPeopleViewedProfile] = useState([])
Línea 9... Línea 7...
9
  const [lookMore, setLookMore] = useState(false);
7
  const [lookMore, setLookMore] = useState(false)
10
 
8
 
11
  useEffect(() => {
9
  useEffect(() => {
12
    axios.get(`/helpers/people-viewed-profile/${profileId}`)
10
    axios.get(`/helpers/people-viewed-profile/${profileId}`)
13
      .then(({ data }) => {
11
      .then(({ data }) => {
14
        if (data.success) setPeopleViewedProfile(data.data)
12
        if (data.success) setPeopleViewedProfile(data.data)
Línea 15... Línea 13...
15
      });
13
      })
16
  }, []);
14
  }, [])
17
 
15
 
18
  const getData = () => {
16
  const getData = () => {
19
    let infoFollows = [...peopleViewedProfile]
17
    let infoFollows = [...peopleViewedProfile]
20
    if (!lookMore) {
18
    if (!lookMore) {
21
      infoFollows = infoFollows.slice(0, 5);
19
      infoFollows = infoFollows.slice(0, 5)
Línea 22... Línea 20...
22
    }
20
    }
23
    return infoFollows
21
    return infoFollows
24
  }
22
  }
25
 
23
 
26
  return (
24
  return (
27
    <div className="peopleYouMayKnow">
25
    <div className="peopleYouMayKnow">
28
      <div className="sd-title d-flex align-items-center justify-content-between">
26
      <div className="sd-title d-flex align-items-center justify-content-between">
29
        <h3>Quien ha visto este Perfil:</h3>
27
        <h3>{`${LABELS.WHO_HAS_SEEN_THIS_PROFILE}:`}</h3>
30
        {peopleViewedProfile.length >= 5 &&
28
        {peopleViewedProfile.length >= 5 &&
31
          <span className="cursor-pointer" onClick={() => setLookMore(!lookMore)}>
29
          <span className="cursor-pointer" onClick={() => setLookMore(!lookMore)}>
32
            {lookMore ? 'Ver menos' : 'Ver mas'}
30
            {lookMore ? LABELS.VIEW_LESS : LABELS.VIEW_MORE}
33
          </span>
31
          </span>
Línea 46... Línea 44...
46
              >
44
              >
47
                <img src={image} alt={`${name} profile image`} />
45
                <img src={image} alt={`${name} profile image`} />
48
                <h4>{name}</h4>
46
                <h4>{name}</h4>
49
              </a>
47
              </a>
50
            </div>)
48
            </div>)
51
          : <div className="view-more">Nadie ha visto tu perfil aún</div>
49
          : <div className="view-more">{LABELS.PROFILE_NOT_VIEWED}</div>
52
        }
50
        }
53
      </div>
51
      </div>
Línea 54... Línea 52...
54
 
52
 
55
    </div>
53
    </div>
56
  );
54
  )
Línea 57... Línea 55...
57
};
55
}