Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 1378 | Rev 1380 | 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 { connect } from "react-redux";
3
import { setTimelineUrl } from "../../../redux/feed/feed.actions";
4
import { feedTypes } from "../../../redux/feed/feed.types";
5
import PeopleYouMayKnow from "../../../shared/helpers/people-you-may-know/PeopleYouMayKnow";
6
import NotificationAlert from "../../../shared/notification/NotificationAlert";
7
import FeedSection from "../feed-section/FeedSection";
8
import ShareFeed from "../share-feed/ShareFeed";
9
import ShareModal from "../share-modal/ShareModal";
10
 
11
import styles from "./HomeSection.module.scss";
12
import { axios } from "../../../utils";
13
import { addNotification } from "../../../redux/notification/notification.actions";
1378 steven 14
import ProfileInfo from "./ProfileInfo";
1379 steven 15
import SocialNetworks from "./SocialNetworks";
1 www 16
 
17
const HomeSection = (props) => {
18
  // props destructuring
19
  const { routeTimeline, addNotification } = props;
20
 
21
  // backendVars destructuring
22
  const { image, fullName, country, visits, connections, description, feed } = props.backendVars;
23
 
24
  // redux destructuring
25
  const { setTimelineUrl } = props;
26
  const [news, setNews] = React.useState([])
27
  const loadNews = () => {
28
    axios.get('/helpers/posts')
29
      .then(res => {
30
        if(res.data.success){
31
          setNews(res.data.data)
32
        }
33
      })
1378 steven 34
      .catch(() => {
1 www 35
        addNotification({
36
          style: "error",
37
          msg: "Disculpe, ha ocurrido un error buscando novedades",
38
        });
39
      })
40
  }
41
  React.useEffect(() => {
42
    loadNews()
43
  }, [])
44
  setTimelineUrl(routeTimeline);
45
  return (
46
    <div>
47
      <div className="main-section">
48
        <div className={styles.mainSection}>
49
          {/* <!--  LEFT COLUMN START --> */}
50
          <div className={styles.sectionHeader}>
1378 steven 51
            <ProfileInfo
52
              image={image}
53
              fullName={fullName}
54
              description={description}
55
              visits={visits}
56
              country={country}
57
              connections={connections}
58
            />
1379 steven 59
            <SocialNetworks
60
            />
1 www 61
          </div>
62
          {/* <!--  LEFT COLUMN END --> */}
63
 
64
          {/* <!-- CENTER COLUMN START --> */}
65
          <div className={styles.feedSection}>
66
            {/* <!--posts-section star--> */}
67
            <ShareFeed feedType={feedTypes.DASHBOARD} postUrl="/feed/add" />
68
            <FeedSection
69
              routeTimeline={routeTimeline}
70
              feed={feed}
71
            />
72
            {/* <!--posts-section end--> */}
73
          </div>
74
          {/* <!-- CENTER COLUMN END --> */}
75
 
76
          {/* <!-- RIGTH COLUMN START --> */}
77
          <div className={styles.peopleYouMayKnow}>
78
            {/* <?php echo $this->peopleYouMayKnowHelper($currentUser->id) ?> */}
79
            <PeopleYouMayKnow />
80
            <div
81
              style={{
82
                padding: '5% 0%'
83
              }}
84
            >
85
              <div className={styles.suggestions}>
86
                <div className="sd-title">
2 steven 87
                  <h3>Novedades</h3>
1 www 88
                </div>
89
 
90
                <div className="suggestions-list">
91
                  {
92
                    news.map(element => {
93
                      return(
94
                        <div
95
                          key={element.title}
96
                        >
97
                          <a
98
                            href={element.link}
1297 steven 99
                            target="_blank"
1 www 100
                          >
101
                            {element.title}
102
                          </a>
103
                          <p>
104
                            {element.date}
105
                          </p>
106
                        </div>
107
                      )
108
                    })
109
                  }
110
                </div>
111
              </div>
112
            </div>
113
          </div>
114
          {/* <!--right-sidebar end--> */}
115
        </div>
116
        {/* <!-- RIGTH COLUMN END --> */}
117
      </div>
118
      <ShareModal />
119
      <NotificationAlert />
120
    </div>
121
  );
122
};
123
 
124
// const mapStateToProps = (state) => ({
125
 
126
// })
127
 
128
const mapDispatchToProps = {
129
  setTimelineUrl: (url) => setTimelineUrl(url),
130
  addNotification: (notification) => addNotification(notification),
131
};
132
 
133
export default connect(null, mapDispatchToProps)(HomeSection);