Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 1371 | Rev 1379 | 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";
1 www 15
 
16
const HomeSection = (props) => {
17
  // props destructuring
18
  const { routeTimeline, addNotification } = props;
19
 
20
  // backendVars destructuring
21
  const { image, fullName, country, visits, connections, description, feed } = props.backendVars;
22
 
23
  // redux destructuring
24
  const { setTimelineUrl } = props;
25
  const [news, setNews] = React.useState([])
26
  const loadNews = () => {
27
    axios.get('/helpers/posts')
28
      .then(res => {
29
        if(res.data.success){
30
          setNews(res.data.data)
31
        }
32
      })
1378 steven 33
      .catch(() => {
1 www 34
        addNotification({
35
          style: "error",
36
          msg: "Disculpe, ha ocurrido un error buscando novedades",
37
        });
38
      })
39
  }
40
  React.useEffect(() => {
41
    loadNews()
42
  }, [])
43
  setTimelineUrl(routeTimeline);
44
  return (
45
    <div>
46
      <div className="main-section">
47
        <div className={styles.mainSection}>
48
          {/* <!--  LEFT COLUMN START --> */}
49
          <div className={styles.sectionHeader}>
1378 steven 50
            <ProfileInfo
51
              image={image}
52
              fullName={fullName}
53
              description={description}
54
              visits={visits}
55
              country={country}
56
              connections={connections}
57
            />
1 www 58
            <div className={`${styles.widget} ${styles.mobile_widget}`}>
59
              <div className={styles.widget__app}>
60
                <a href="#">
61
                  <img
62
                    className={styles.widget__app__img}
63
                    src="/images/icon-persons-you-may-know.png"
64
                    alt=""
65
                  />
66
                </a>
67
                <a href="#" className={styles.widget__app__title} title="">
68
                  Personas Sugeridas
69
                </a>
70
              </div>
71
              <div className={styles.widget__app}>
72
                <a href="#">
73
                  <img
74
                    className={styles.widget__app__img}
75
                    src="/images/icon-recent-news.png"
76
                    alt=""
77
                  />
78
                </a>
79
                <a href="#" className={styles.widget__app__title} title="">
2 steven 80
                  Novedades
1 www 81
                </a>
82
              </div>
83
            </div>
84
            <div className={styles.widget}>
85
              <div className={styles.widget__app}>
86
                <a href="#">
87
                  <img
88
                    className={styles.widget__app__img}
89
                    src="/images/logo-onroom.png"
90
                    alt=""
91
                  />
92
                </a>
93
                <a href="#" className={styles.widget__app__title} title="">
94
                  CESA ON ROOM
95
                </a>
96
              </div>
97
              {/* <div className={styles.widget__app}>
98
                <a href="#">
99
                  <img
100
                    className={styles.widget__app__img}
101
                    src="/images/logo-meeting-small.jpeg"
102
                    alt=""
103
                  />
104
                </a>
105
                <a href="#" className={styles.widget__app__title} title="">
106
                  CESA Meeting
107
                </a>
108
              </div> */}
109
              <div className={styles.widget__app}>
110
                <a href="#">
111
                  <img
112
                    className={styles.widget__app__img}
113
                    src="/images/logo-2getskills.jpeg"
114
                    alt=""
115
                  />
116
                </a>
117
                <a href="#" className={styles.widget__app__title} title="">
118
                  Microaprendizaje
119
                </a>
120
              </div>
121
            </div>
122
          </div>
123
          {/* <!--  LEFT COLUMN END --> */}
124
 
125
          {/* <!-- CENTER COLUMN START --> */}
126
          <div className={styles.feedSection}>
127
            {/* <!--posts-section star--> */}
128
            <ShareFeed feedType={feedTypes.DASHBOARD} postUrl="/feed/add" />
129
            <FeedSection
130
              routeTimeline={routeTimeline}
131
              feed={feed}
132
            />
133
            {/* <!--posts-section end--> */}
134
          </div>
135
          {/* <!-- CENTER COLUMN END --> */}
136
 
137
          {/* <!-- RIGTH COLUMN START --> */}
138
          <div className={styles.peopleYouMayKnow}>
139
            {/* <?php echo $this->peopleYouMayKnowHelper($currentUser->id) ?> */}
140
            <PeopleYouMayKnow />
141
            <div
142
              style={{
143
                padding: '5% 0%'
144
              }}
145
            >
146
              <div className={styles.suggestions}>
147
                <div className="sd-title">
2 steven 148
                  <h3>Novedades</h3>
1 www 149
                </div>
150
 
151
                <div className="suggestions-list">
152
                  {
153
                    news.map(element => {
154
                      return(
155
                        <div
156
                          key={element.title}
157
                        >
158
                          <a
159
                            href={element.link}
1297 steven 160
                            target="_blank"
1 www 161
                          >
162
                            {element.title}
163
                          </a>
164
                          <p>
165
                            {element.date}
166
                          </p>
167
                        </div>
168
                      )
169
                    })
170
                  }
171
                </div>
172
              </div>
173
            </div>
174
          </div>
175
          {/* <!--right-sidebar end--> */}
176
        </div>
177
        {/* <!-- RIGTH COLUMN END --> */}
178
      </div>
179
      <ShareModal />
180
      <NotificationAlert />
181
    </div>
182
  );
183
};
184
 
185
// const mapStateToProps = (state) => ({
186
 
187
// })
188
 
189
const mapDispatchToProps = {
190
  setTimelineUrl: (url) => setTimelineUrl(url),
191
  addNotification: (notification) => addNotification(notification),
192
};
193
 
194
export default connect(null, mapDispatchToProps)(HomeSection);