Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 1379 | Rev 1447 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1379 Rev 1380
Línea 11... Línea 11...
11
import styles from "./HomeSection.module.scss";
11
import styles from "./HomeSection.module.scss";
12
import { axios } from "../../../utils";
12
import { axios } from "../../../utils";
13
import { addNotification } from "../../../redux/notification/notification.actions";
13
import { addNotification } from "../../../redux/notification/notification.actions";
14
import ProfileInfo from "./ProfileInfo";
14
import ProfileInfo from "./ProfileInfo";
15
import SocialNetworks from "./SocialNetworks";
15
import SocialNetworks from "./SocialNetworks";
-
 
16
import HomeNews from "./HomeNews";
Línea 16... Línea 17...
16
 
17
 
17
const HomeSection = (props) => {
18
const HomeSection = (props) => {
18
  // props destructuring
19
  // props destructuring
Línea 19... Línea 20...
19
  const { routeTimeline, addNotification } = props;
20
  const { routeTimeline, addNotification } = props;
20
 
21
 
Línea 21... Línea 22...
21
  // backendVars destructuring
22
  // backendVars destructuring
22
  const { image, fullName, country, visits, connections, description, feed } = props.backendVars;
23
  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
      })
-
 
34
      .catch(() => {
-
 
35
        addNotification({
-
 
36
          style: "error",
-
 
37
          msg: "Disculpe, ha ocurrido un error buscando novedades",
24
 
38
        });
-
 
39
      })
-
 
40
  }
-
 
41
  React.useEffect(() => {
25
  // redux destructuring
42
    loadNews()
26
  const { setTimelineUrl } = props;
43
  }, [])
27
  
44
  setTimelineUrl(routeTimeline);
28
  setTimelineUrl(routeTimeline);
45
  return (
29
  return (
Línea 74... Línea 58...
74
          {/* <!-- CENTER COLUMN END --> */}
58
          {/* <!-- CENTER COLUMN END --> */}
Línea 75... Línea 59...
75
 
59
 
76
          {/* <!-- RIGTH COLUMN START --> */}
60
          {/* <!-- RIGTH COLUMN START --> */}
77
          <div className={styles.peopleYouMayKnow}>
61
          <div className={styles.peopleYouMayKnow}>
78
            {/* <?php echo $this->peopleYouMayKnowHelper($currentUser->id) ?> */}
62
            {/* <?php echo $this->peopleYouMayKnowHelper($currentUser->id) ?> */}
79
            <PeopleYouMayKnow />
63
            <PeopleYouMayKnow
80
            <div
64
            />
81
              style={{
-
 
82
                padding: '5% 0%'
-
 
83
              }}
65
            <HomeNews
84
            >
-
 
85
              <div className={styles.suggestions}>
-
 
86
                <div className="sd-title">
-
 
87
                  <h3>Novedades</h3>
-
 
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}
-
 
99
                            target="_blank"
-
 
100
                          >
-
 
101
                            {element.title}
-
 
102
                          </a>
-
 
103
                          <p>
-
 
104
                            {element.date}
-
 
105
                          </p>
-
 
106
                        </div>
-
 
107
                      )
-
 
108
                    })
-
 
109
                  }
-
 
110
                </div>
-
 
111
              </div>
-
 
112
            </div>
66
            />
113
          </div>
67
          </div>
114
          {/* <!--right-sidebar end--> */}
68
          {/* <!--right-sidebar end--> */}
115
        </div>
69
        </div>
116
        {/* <!-- RIGTH COLUMN END --> */}
70
        {/* <!-- RIGTH COLUMN END --> */}