Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 4019 Rev 4020
Línea 1... Línea 1...
1
/* eslint-disable react/prop-types */
1
/* eslint-disable react/prop-types */
2
import React, { Suspense, useEffect } from "react";
2
import React, { useEffect, useState } from "react";
3
import { useDispatch, useSelector } from "react-redux";
3
import { useDispatch, useSelector } from "react-redux";
4
import { fetchFeeds, setCurrentPage } from "../../../redux/feed/feed.actions";
4
import { fetchFeeds, setCurrentPage } from "../../../redux/feed/feed.actions";
Línea 5... Línea 5...
5
 
5
 
6
import Spinner from "../../../shared/loading-spinner/Spinner";
6
import Spinner from "../../../shared/loading-spinner/Spinner";
Línea 7... Línea 7...
7
import Feed from "../feed/FeedTemplate";
7
import Feed from "../feed/FeedTemplate";
8
 
8
 
9
const ShareModal = React.lazy(() => import("../share-modal/ShareModal"))
-
 
10
const HomeNews = React.lazy(() => import("../home-section/HomeNews"))
9
const ShareModal = React.lazy(() => import("../share-modal/ShareModal"))
Línea 11... Línea 10...
11
const PeopleYouMayKnow = React.lazy(() => { if (window.innerWidth < 1000) return import("../../../shared/helpers/people-you-may-know/PeopleYouMayKnow") })
10
const HomeNews = React.lazy(() => import("../home-section/HomeNews"))
Línea 12... Línea 11...
12
const PaginationComponent = React.lazy(() => import("../../../shared/pagination/PaginationComponent"))
11
const PaginationComponent = React.lazy(() => import("../../../shared/pagination/PaginationComponent"))
Línea 13... Línea 12...
13
 
12
 
Línea 14... Línea 13...
14
const PATH = window.location.pathname
13
const PATH = window.location.pathname
-
 
14
 
-
 
15
// Props object {routeTimeline, feed, image}
-
 
16
 
-
 
17
const FeedSection = ({ feed, image }) => {
15
 
18
 
Línea 16... Línea 19...
16
// Props object {routeTimeline, feed, image}
19
  const { allFeeds, timelineUrl, pages, currentPage, loading } = useSelector((state) => state.feed)
Línea 29... Línea 32...
29
    } else {
32
    } else {
30
      return dispatch(fetchFeeds(timelineUrl, currentPage))
33
      return dispatch(fetchFeeds(timelineUrl, currentPage))
31
    }
34
    }
32
  }, []);
35
  }, []);
Línea -... Línea 36...
-
 
36
 
-
 
37
  useEffect(async () => {
-
 
38
    if (window.innerWidth < 1000) {
-
 
39
      const { PeopleYouMayKnow } = await import("../../../shared/helpers/people-you-may-know/PeopleYouMayKnow")
-
 
40
 
-
 
41
      setState({ ...state, PeopleYouMayKnow })
-
 
42
    }
Línea 33... Línea 43...
33
 
43
  }, []);
34
 
44
 
35
  const onChangePageHandler = (currentPage) => {
45
  const onChangePageHandler = (currentPage) => {
36
    dispatch(setCurrentPage(currentPage));
46
    dispatch(setCurrentPage(currentPage));
Línea 49... Línea 59...
49
      {allFeeds.length
59
      {allFeeds.length
50
        ? allFeeds.map((feed, index) =>
60
        ? allFeeds.map((feed, index) =>
51
          <>
61
          <>
52
            {
62
            {
53
              (index === 5 && PATH.includes('dashboard')) &&
63
              (index === 5 && PATH.includes('dashboard')) &&
54
              <Suspense fallback={<Spinner />}>
-
 
55
                <div className='d-block d-md-none'>
64
              <div className='d-block d-md-none'>
56
                  <PeopleYouMayKnow />
65
                <PeopleYouMayKnow />
57
                </div>
66
              </div>
58
              </Suspense>
-
 
59
            }
67
            }
60
            {
68
            {
61
              (index === 8 && PATH.includes('dashboard')) &&
69
              (index === 8 && PATH.includes('dashboard')) &&
62
              < div className='d-block d-md-none'>
70
              < div className='d-block d-md-none'>
63
                <HomeNews />
71
                <HomeNews />
Línea 79... Línea 87...
79
      <ShareModal
87
      <ShareModal
80
        timelineUrl={timelineUrl}
88
        timelineUrl={timelineUrl}
81
        currentPage={currentPage}
89
        currentPage={currentPage}
82
      />
90
      />
83
      <PaginationComponent
91
      <PaginationComponent
84
        isRow
-
 
85
        currentActivePage={currentPage}
-
 
86
        onChangePage={onChangePageHandler}
92
        onChangePage={onChangePageHandler}
87
        pages={pages}
93
        pages={pages}
-
 
94
        isRow
-
 
95
        currentActivePage={currentPage}
88
      />
96
      />
89
    </>
97
    </>
90
  );
98
  );
91
};
99
};