Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 3682 Rev 3685
Línea 1... Línea 1...
1
import React, { useEffect } from 'react'
1
import React, { useEffect } from 'react';
2
import { useParams } from 'react-router-dom'
2
import { useParams } from 'react-router-dom';
3
import { useDispatch, useSelector } from 'react-redux'
3
import { useDispatch, useSelector } from 'react-redux';
4
 
4
 
5
import { useFetch } from '@hooks'
5
import { useFetch } from '@hooks';
6
import { feedTypes } from '@store/feed/feed.types'
6
import { feedTypes } from '@store/feed/feed.types';
7
import {
-
 
8
  fetchFeeds,
-
 
9
  setCurrentPage,
-
 
10
  setTimelineUrl
-
 
11
} from '@store/feed/feed.actions'
7
import { fetchFeeds, setCurrentPage, setTimelineUrl } from '@store/feed/feed.actions';
12
 
-
 
13
import Spinner from '@components/UI/Spinner'
8
import { Pagination, Spinner } from '@shared/components';
14
import AppGrid from '@components/UI/layout/AppGrid'
9
import AppGrid from '@components/UI/layout/AppGrid';
15
import GroupWidget from '@components/widgets/linkedin/group-widget'
10
import GroupWidget from '@components/widgets/linkedin/group-widget';
16
import GroupActions from '@components/group/group-actions/GroupActions'
11
import GroupActions from '@groups/components/group-actions/GroupActions';
17
import AboutGroup from '@components/group/AboutGroup'
-
 
18
import ShareComponent from '@components/dashboard/linkedin/share/ShareComponent'
12
import ShareComponent from '@components/dashboard/linkedin/share/ShareComponent';
19
import FeedList from '@components/dashboard/linkedin/feed-list/FeedList'
13
import FeedList from '@components/dashboard/linkedin/feed-list/FeedList';
20
import Pagination from '@components/common/Pagination'
14
import Members from '@groups/components/members/Members';
21
import Members from '@components/group/members/Members'
15
import ShareModal from '@components/modals/ShareModal';
22
import ShareModal from '@components/modals/ShareModal'
16
import AboutGroup from '@groups/components/AboutGroup';
Línea 23... Línea 17...
23
 
17
 
24
const GroupPage = () => {
18
const GroupPage = () => {
25
  const { uuid } = useParams()
19
  const { uuid } = useParams();
26
  const dispatch = useDispatch()
20
  const dispatch = useDispatch();
27
  const { data, isLoading, refetch } = useFetch(`/group/view/${uuid}`)
21
  const { data, isLoading, refetch } = useFetch(`/group/view/${uuid}`);
28
 
22
 
29
  const { feeds, timelineUrl, currentPage, loading, pages } = useSelector(
-
 
30
    ({ feed }) => feed
-
 
31
  )
23
  const { feeds, timelineUrl, currentPage, loading, pages } = useSelector(({ feed }) => feed);
Línea 32... Línea 24...
32
  const allFeeds = feeds.allIds.map((id) => feeds.byId[id])
24
  const allFeeds = feeds.allIds.map((id) => feeds.byId[id]);
33
 
25
 
34
  const onChangePageHandler = (currentPage) => {
26
  const onChangePageHandler = (currentPage) => {
35
    dispatch(setCurrentPage(currentPage))
27
    dispatch(setCurrentPage(currentPage));
Línea 36... Línea 28...
36
    window.scrollTo(0, 0)
28
    window.scrollTo(0, 0);
37
  }
29
  };
38
 
30
 
Línea 39... Línea 31...
39
  useEffect(() => {
31
  useEffect(() => {
40
    dispatch(fetchFeeds(timelineUrl, currentPage))
32
    dispatch(fetchFeeds(timelineUrl, currentPage));
41
  }, [timelineUrl, currentPage])
33
  }, [timelineUrl, currentPage]);
Línea 42... Línea 34...
42
 
34
 
43
  useEffect(() => {
35
  useEffect(() => {
44
    dispatch(setTimelineUrl(`/feed/timeline/${data.group_uuid}/group`))
36
    dispatch(setTimelineUrl(`/feed/timeline/${data.group_uuid}/group`));
Línea 45... Línea 37...
45
  }, [data])
37
  }, [data]);
46
 
38
 
47
  if (isLoading) {
39
  if (isLoading) {
Línea 63... Línea 55...
63
                  feedType={feedTypes.GROUP}
55
                  feedType={feedTypes.GROUP}
64
                  postUrl={`/feed/add/group/${uuid}`}
56
                  postUrl={`/feed/add/group/${uuid}`}
65
                  image={data?.image}
57
                  image={data?.image}
66
                />
58
                />
67
                <FeedList feeds={allFeeds} loading={loading} />
59
                <FeedList feeds={allFeeds} loading={loading} />
68
                <Pagination
-
 
69
                  pages={pages}
-
 
70
                  page={currentPage}
-
 
71
                  onChange={onChangePageHandler}
60
                <Pagination pages={pages} page={currentPage} onChange={onChangePageHandler} />
72
                />
-
 
73
              </>
61
              </>
74
            )}
62
            )}
75
          </>
63
          </>
76
        )}
64
        )}
77
        renderAside={() => (
65
        renderAside={() => (
Línea 81... Línea 69...
81
          </>
69
          </>
82
        )}
70
        )}
83
      />
71
      />
84
      <ShareModal timelineUrl={timelineUrl} currentPage={currentPage} />
72
      <ShareModal timelineUrl={timelineUrl} currentPage={currentPage} />
85
    </>
73
    </>
86
  )
74
  );
87
}
75
};
Línea 88... Línea 76...
88
 
76