Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 1297 | Rev 1371 | 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
import parse from "html-react-parser";
11
 
12
import styles from "./HomeSection.module.scss";
13
import { axios } from "../../../utils";
14
import { addNotification } from "../../../redux/notification/notification.actions";
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
      })
33
      .catch(err => {
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}>
50
            <div className={styles.userProfile}>
51
              <div className={styles.userProfile__header}>
52
                <div className={styles.userProfile__header__imgContainer}>
53
                  <img src={image} alt="profile-image" />
54
                </div>
55
                <div className={styles.userProfile__header__nameContainer}>
56
                  <p
57
                    className="text-center font-weight-bold"
58
                  >
59
                    {fullName}
60
                  </p>
61
                  {
62
                    !!description && (
63
                      <p
64
                        className="text-center p-1 small-text-children"
65
                      >
66
                        {parse(description)}
67
                      </p>
68
                    )
69
                  }
70
                  {
71
                    !!country && (
72
                      <p
73
                        className="text-center"
74
                      >
75
                        <i className="pl-2 fa fa-map-marker px-2"></i>
76
                        {country}
77
                      </p>
78
                    )
79
                  }
80
                </div>
81
              </div>
82
              <div className={styles.userProfile__headerBackground}></div>
83
              <ul className={styles.userProfile__connectionInfo}>
84
                <li
85
                  className={styles.userProfile__connectionInfo__infoContainer}
86
                >
87
                  <p
88
                    className={
89
                      styles.userProfile__connectionInfo__infoContainer__title
90
                    }
91
                  >
1367 steven 92
                    <i className="fa fa-eye" />
1 www 93
                    <span
94
                      className={
95
                        styles.userProfile__connectionInfo__infoContainer__info
96
                      }
97
                    >
98
                      {visits}
99
                    </span>
100
                  </p>
101
                </li>
102
                <li
103
                  className={styles.userProfile__connectionInfo__infoContainer}
104
                >
105
                  <p
106
                    className={
107
                      styles.userProfile__connectionInfo__infoContainer__title
108
                    }
109
                  >
110
                    Conexiones
111
                    <span
112
                      className={
113
                        styles.userProfile__connectionInfo__infoContainer__info
114
                      }
115
                    >
116
                      {connections}
117
                    </span>
118
                  </p>
119
                </li>
120
              </ul>
121
            </div>
122
            <div className={`${styles.widget} ${styles.mobile_widget}`}>
123
              <div className={styles.widget__app}>
124
                <a href="#">
125
                  <img
126
                    className={styles.widget__app__img}
127
                    src="/images/icon-persons-you-may-know.png"
128
                    alt=""
129
                  />
130
                </a>
131
                <a href="#" className={styles.widget__app__title} title="">
132
                  Personas Sugeridas
133
                </a>
134
              </div>
135
              <div className={styles.widget__app}>
136
                <a href="#">
137
                  <img
138
                    className={styles.widget__app__img}
139
                    src="/images/icon-recent-news.png"
140
                    alt=""
141
                  />
142
                </a>
143
                <a href="#" className={styles.widget__app__title} title="">
2 steven 144
                  Novedades
1 www 145
                </a>
146
              </div>
147
            </div>
148
            <div className={styles.widget}>
149
              <div className={styles.widget__app}>
150
                <a href="#">
151
                  <img
152
                    className={styles.widget__app__img}
153
                    src="/images/logo-onroom.png"
154
                    alt=""
155
                  />
156
                </a>
157
                <a href="#" className={styles.widget__app__title} title="">
158
                  CESA ON ROOM
159
                </a>
160
              </div>
161
              {/* <div className={styles.widget__app}>
162
                <a href="#">
163
                  <img
164
                    className={styles.widget__app__img}
165
                    src="/images/logo-meeting-small.jpeg"
166
                    alt=""
167
                  />
168
                </a>
169
                <a href="#" className={styles.widget__app__title} title="">
170
                  CESA Meeting
171
                </a>
172
              </div> */}
173
              <div className={styles.widget__app}>
174
                <a href="#">
175
                  <img
176
                    className={styles.widget__app__img}
177
                    src="/images/logo-2getskills.jpeg"
178
                    alt=""
179
                  />
180
                </a>
181
                <a href="#" className={styles.widget__app__title} title="">
182
                  Microaprendizaje
183
                </a>
184
              </div>
185
            </div>
186
          </div>
187
          {/* <!--  LEFT COLUMN END --> */}
188
 
189
          {/* <!-- CENTER COLUMN START --> */}
190
          <div className={styles.feedSection}>
191
            {/* <!--posts-section star--> */}
192
            <ShareFeed feedType={feedTypes.DASHBOARD} postUrl="/feed/add" />
193
            <FeedSection
194
              routeTimeline={routeTimeline}
195
              feed={feed}
196
            />
197
            {/* <!--posts-section end--> */}
198
          </div>
199
          {/* <!-- CENTER COLUMN END --> */}
200
 
201
          {/* <!-- RIGTH COLUMN START --> */}
202
          <div className={styles.peopleYouMayKnow}>
203
            {/* <?php echo $this->peopleYouMayKnowHelper($currentUser->id) ?> */}
204
            <PeopleYouMayKnow />
205
            <div
206
              style={{
207
                padding: '5% 0%'
208
              }}
209
            >
210
              <div className={styles.suggestions}>
211
                <div className="sd-title">
2 steven 212
                  <h3>Novedades</h3>
1 www 213
                </div>
214
 
215
                <div className="suggestions-list">
216
                  {
217
                    news.map(element => {
218
                      return(
219
                        <div
220
                          key={element.title}
221
                        >
222
                          <a
223
                            href={element.link}
1297 steven 224
                            target="_blank"
1 www 225
                          >
226
                            {element.title}
227
                          </a>
228
                          <p>
229
                            {element.date}
230
                          </p>
231
                        </div>
232
                      )
233
                    })
234
                  }
235
                </div>
236
              </div>
237
            </div>
238
          </div>
239
          {/* <!--right-sidebar end--> */}
240
        </div>
241
        {/* <!-- RIGTH COLUMN END --> */}
242
      </div>
243
      <ShareModal />
244
      <NotificationAlert />
245
    </div>
246
  );
247
};
248
 
249
// const mapStateToProps = (state) => ({
250
 
251
// })
252
 
253
const mapDispatchToProps = {
254
  setTimelineUrl: (url) => setTimelineUrl(url),
255
  addNotification: (notification) => addNotification(notification),
256
};
257
 
258
export default connect(null, mapDispatchToProps)(HomeSection);