Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 1231 Rev 1609
Línea 1... Línea 1...
1
import React, { useEffect } from 'react'
1
import React, { useEffect } from 'react'
2
import { useDispatch, useSelector } from 'react-redux'
2
import { useDispatch, useSelector } from 'react-redux'
3
import { fetchFeeds, setCurrentPage } from '../../../../redux/feed/feed.actions'
-
 
Línea 4... Línea 3...
4
 
3
 
5
import Feed from '../feed-template/Feed'
4
import Feed from '../feed-template/Feed'
6
import Spinner from '../../../UI/Spinner'
5
import Spinner from '@app/components/UI/Spinner'
7
import EmptySection from '../../../UI/EmptySection'
6
import EmptySection from '@app/components/UI/EmptySection'
Línea 8... Línea 7...
8
import ShareModal from '../../../modals/ShareModal'
7
import { fetchFeeds, setCurrentPage } from '@app/redux/feed/feed.actions'
9
 
8
 
10
const PaginationComponent = React.lazy(() =>
9
const PaginationComponent = React.lazy(() =>
Línea 28... Línea 27...
28
  useEffect(() => {
27
  useEffect(() => {
29
    dispatch(setCurrentPage(1))
28
    dispatch(setCurrentPage(1))
30
  }, [])
29
  }, [])
Línea 31... Línea 30...
31
 
30
 
32
  useEffect(() => {
-
 
33
    if (feed) {
-
 
34
      fetchSpecificFeed()
-
 
35
    } else {
31
  useEffect(() => {
36
      dispatch(fetchFeeds(timelineUrl, currentPage))
-
 
37
    }
32
    feed ? fetchSpecificFeed() : dispatch(fetchFeeds(timelineUrl, currentPage))
Línea 38... Línea 33...
38
  }, [timelineUrl, currentPage, feed])
33
  }, [timelineUrl, currentPage, feed])
39
 
34
 
40
  if (loading) {
35
  if (loading) {
Línea 41... Línea 36...
41
    return <Spinner />
36
    return <Spinner />
42
  }
-
 
43
 
-
 
44
  if (!allFeeds.length) {
37
  }
45
    return (
-
 
46
      <>
-
 
47
        <EmptySection message='No hay publicaciones' />
-
 
48
        <ShareModal timelineUrl={timelineUrl} currentPage={currentPage} />
38
 
Línea 49... Línea 39...
49
      </>
39
  if (!allFeeds.length) {
50
    )
40
    return <EmptySection message='No hay publicaciones' />
51
  }
41
  }
52
 
42
 
53
  return (
43
  return (
54
    <>
44
    <>
55
      {allFeeds.map((feed) => {
45
      {allFeeds.map((feed) => {
56
        return <Feed key={feed.feed_uuid} image={image} {...feed} />
-
 
57
      })}
46
        return <Feed key={feed.feed_uuid} image={image} {...feed} />
58
      <React.Suspense fallback={null}>
-
 
59
        <PaginationComponent
47
      })}
-
 
48
      <React.Suspense fallback={null}>
-
 
49
        <PaginationComponent
60
          onChangePage={onChangePageHandler}
50
          pages={pages}
61
          pages={pages}
-
 
62
          isRow
51
          currentActivePage={currentPage}
63
          currentActivePage={currentPage}
52
          onChangePage={onChangePageHandler}
64
        />
53
          isRow
65
        <ShareModal timelineUrl={timelineUrl} currentPage={currentPage} />
54
        />