Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 1537 | Rev 2345 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 www 1
import React from "react";
2
import { useEffect, useState } from "react";
3
import { connect } from "react-redux";
4
import { useForm } from "react-hook-form";
5
import styled from "styled-components";
2343 stevensc 6
import { axios } from "../../../utils";
1 www 7
import { addNotification } from "../../../redux/notification/notification.actions";
8
import Spinner from "../../../shared/loading-spinner/Spinner";
1537 steven 9
import ProfileCard from "../../../components/Profile";
1535 steven 10
import SearchList from "../../../components/SearchList";
1 www 11
 
12
const StyledSpinnerContainer = styled.div`
13
  position: absolute;
14
  left: 0;
15
  top: 0;
16
  width: 100%;
17
  height: 100%;
18
  background: rgba(255, 255, 255, 0.4);
19
  display: flex;
20
  justify-content: center;
21
  align-items: center;
22
  z-index: 300;
23
`;
24
 
25
const AppliedJobs = (props) => {
26
  // states
27
  const [appliedJobs, setAppliedJobs] = useState([]);
28
  const [loading, setLoading] = useState(true);
29
 
30
  useEffect(() => {
31
    fetchAppliedJobs();
32
    return () => {
33
      clearTimeout(axiosThrottle);
34
    };
35
  }, []);
36
 
2343 stevensc 37
  const fetchAppliedJobs = async (searchParam = '') => {
1 www 38
    setLoading(true);
39
    await axios
40
      .get(
2343 stevensc 41
        "/job/applied-jobs?search=" + searchParam)
1 www 42
      .then((response) => {
43
        const resData = response.data;
44
        if (resData.success) {
45
          setAppliedJobs(resData.data);
46
        }
47
      });
48
    setLoading(false);
49
  };
50
 
51
 
2343 stevensc 52
 
1 www 53
  return (
54
    <section className="companies-info" style={{ position: "relative" }}>
55
      <div className="container">
1535 steven 56
        <SearchList
57
          title="Que he aplicado"
58
          fetchCallback={fetchAppliedJobs}
59
        />
1 www 60
        <div
61
          className="companies-list"
2343 stevensc 62
          id="profiles-container"
1 www 63
          style={{
64
            padding: "0 15px",
65
          }}
66
        >
2343 stevensc 67
          {appliedJobs.length > 0 ? (
68
            appliedJobs.map(
69
              (
70
                {
71
                  title,
72
                  employment_type,
73
                  last_date_of_application,
74
                  link_view,
75
                  link_remove,
76
                },
77
                index
78
              ) => (
79
                <ProfileCard
80
                  key={index}
81
                  // image={image}
82
                  name={title}
83
                  status={employment_type}
84
                  link_view={link_view}
85
                  link_delete={link_remove}
86
                  fetchCallback={fetchAppliedJobs}
87
                />
1 www 88
              )
2343 stevensc 89
            )
90
          ) : (
91
            <p>No hay resultados</p>
92
          )}
1 www 93
          {/* <!--product-feed-tab end--> */}
94
        </div>
95
      </div>
96
      {loading && (
97
        <StyledSpinnerContainer>
98
          <Spinner />
99
        </StyledSpinnerContainer>
100
      )}
101
    </section>
102
  );
103
};
104
 
105
// const mapStateToProps = (state) => ({});
106
 
107
const mapDispatchToProps = {
108
  addNotification: (notification) => addNotification(notification),
109
};
110
 
111
export default connect(null, mapDispatchToProps)(AppliedJobs);