Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 2441 Rev 3641
Línea -... Línea 1...
-
 
1
/* eslint-disable react/prop-types */
1
import React from "react";
2
import React from "react";
2
import { useEffect, useState } from "react";
3
import { useEffect, useState } from "react";
3
import { axios } from "../../../utils";
4
import { axios } from "../../../utils";
Línea 4... Línea 5...
4
 
5
 
5
const PeopleViewedHelper = (props) => {
-
 
6
  // props destructuring
-
 
Línea 7... Línea -...
7
  const { profileId } = props;
-
 
8
 
6
const PeopleViewedHelper = ({ profileId }) => {
9
  // states
7
 
Línea 10... Línea 8...
10
  const [peopleViewedProfile, setPeopleViewedProfile] = useState([]);
8
  const [peopleViewedProfile, setPeopleViewedProfile] = useState([]);
11
  const [lookMore, setLookMore] = useState(false);
-
 
12
 
9
  const [lookMore, setLookMore] = useState(false);
13
  useEffect(() => {
10
 
14
    axios
-
 
15
      .get(`/helpers/people-viewed-profile/${profileId}`)
-
 
16
      .then((response) => {
-
 
17
        const resData = response.data;
11
  useEffect(() => {
18
        (resData);
-
 
19
        if (resData.success) {
-
 
20
          setPeopleViewedProfile(resData.data);
-
 
21
        } else {
12
    axios.get(`/helpers/people-viewed-profile/${profileId}`)
22
          // alert error
13
      .then(({ data }) => {
Línea 23... Línea 14...
23
        }
14
        if (data.success) setPeopleViewedProfile(data.data)
24
      });
15
      });
Línea 31... Línea 22...
31
    }
22
    }
32
    return infoFollows
23
    return infoFollows
33
  }
24
  }
Línea 34... Línea 25...
34
 
25
 
35
  return (
26
  return (
36
    <div className="right-sidebar border-radius border-gray p-3" style={{ maxHeight: '450px', marginTop: '0' }}>
27
    <div className="right-sidebar peopleYouMayKnow" style={{ maxHeight: '450px', marginTop: '0' }}>
37
      <div className="sd-title">
28
      <div className="sd-title">
38
        <h3>Quién ha visto este perfil</h3>
29
        <h3>Quién ha visto este perfil</h3>
39
      </div>
30
      </div>
40
      <div
31
      <div
41
        className="mb-2"
32
        className="mb-2"
42
        id="suggestions-similar-groups"
33
        id="suggestions-similar-groups"
43
        style={{ height: "80%", overflowY: "auto" }}
34
        style={{ height: "80%", overflowY: "auto" }}
44
      >
35
      >
45
        {peopleViewedProfile.length
-
 
46
          ?
36
        {peopleViewedProfile.length
47
          getData().map(({ id, name, image, profile }) => (
37
          ? getData().map(({ id, name, image, profile }) =>
48
            <div className="suggestion-usd" key={id}>
38
            <div className="suggestion-usd" key={id}>
49
              <div className="row">
39
              <div className="row">
50
                <div className="col-md-4 col-sm-12" >
40
                <div className="col-md-4 col-sm-12" >
51
                  <img
41
                  <img
Línea 63... Línea 53...
63
                      {name}
53
                      {name}
64
                    </h4>
54
                    </h4>
65
                  </div>
55
                  </div>
66
                </div>
56
                </div>
67
              </div>
57
              </div>
68
            </div>
58
            </div>)
69
          ))
-
 
70
          : <div className="view-more">Sin sugerencias</div>
59
          : <div className="view-more">Sin sugerencias</div>
71
        }
60
        }
72
      </div>
61
      </div>
73
      {
-
 
74
        peopleViewedProfile.length >= 5
62
      {peopleViewedProfile.length >= 5 &&
75
        &&
-
 
76
        <div className="w-100 text-center">
63
        <div className="w-100 text-center">
77
          <button className="btn btn-primary" onClick={() => setLookMore(!lookMore)}>
64
          <button className="btn btn-primary" onClick={() => setLookMore(!lookMore)}>
78
            {lookMore ? 'Ver menos' : 'Ver mas'}
65
            {lookMore ? 'Ver menos' : 'Ver mas'}
79
          </button>
66
          </button>
80
        </div>
67
        </div>