Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 1535 | Rev 2343 | 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";
6
import {axios} from "../../../utils";
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
 
37
  const fetchAppliedJobs = async (searchParam='') => {
38
    setLoading(true);
39
    await axios
40
      .get(
41
        "/job/applied-jobs?search="+searchParam)
42
      .then((response) => {
43
        const resData = response.data;
44
        if (resData.success) {
45
          setAppliedJobs(resData.data);
46
        }
47
      });
48
    setLoading(false);
49
  };
50
 
1535 steven 51
 
1 www 52
 
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"
62
          style={{
63
            padding: "0 15px",
64
          }}
65
        >
66
          <div className="row" id="profiles-container">
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
                ) => (
1518 steven 79
                  <ProfileCard
80
                    key={index}
81
                    // image={image}
82
                    name={title}
83
                    status={employment_type}
1 www 84
                    link_view={link_view}
1518 steven 85
                    link_delete={link_remove}
86
                    fetchCallback={fetchAppliedJobs}
1 www 87
                  />
88
                )
89
              )
90
            ) : (
91
              <p>No hay resultados</p>
92
            )}
93
          </div>
94
          {/* <!--product-feed-tab end--> */}
95
        </div>
96
      </div>
97
      {loading && (
98
        <StyledSpinnerContainer>
99
          <Spinner />
100
        </StyledSpinnerContainer>
101
      )}
102
    </section>
103
  );
104
};
105
 
106
// const mapStateToProps = (state) => ({});
107
 
108
const mapDispatchToProps = {
109
  addNotification: (notification) => addNotification(notification),
110
};
111
 
112
export default connect(null, mapDispatchToProps)(AppliedJobs);