Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 3682 Rev 3688
Línea 1... Línea 1...
1
import React from 'react'
1
import React from 'react';
2
import { useSelector } from 'react-redux'
2
import { Grid, PageHeader, SearchBar, Spinner } from '@shared/components';
3
import { Search } from '@mui/icons-material'
-
 
4
 
-
 
5
import { debounce } from '@utils'
-
 
6
import { useFetch, useSearchQuery } from '@hooks'
3
import { useGroupsRequestsSent } from '@groups/hooks';
7
 
-
 
8
import Input from '@components/UI/inputs/Input'
-
 
9
import TitleSection from '@components/UI/TitleSection'
-
 
10
import GroupsRequestsReceivedList from '@components/group/GroupsRequestsReceivedList'
4
import { GroupsRequestsSentCard } from '@groups/components';
Línea 11... Línea 5...
11
 
5
 
12
const GroupsRequestsReceivedPage = () => {
-
 
13
  const labels = useSelector(({ intl }) => intl.labels)
-
 
14
 
6
const GroupsRequestsReceivedPage = () => {
15
  const { getStringParams, setParam } = useSearchQuery()
-
 
16
  const { data, isLoading, refetch } = useFetch(
-
 
17
    '/group/invitations-received' + getStringParams()
-
 
18
  )
-
 
19
 
-
 
Línea 20... Línea 7...
20
  const handleSearch = debounce((e) => setParam('search', e.target.value))
7
  const { groups, loading, acceptRequest, rejectRequest, searchGroups } = useGroupsRequestsSent();
21
 
8
 
22
  return (
9
  return (
23
    <>
10
    <>
24
      <TitleSection title={labels.invitations_received} />
11
      <PageHeader title='Invitaciones recibidas' />
25
      <Input icon={<Search />} onChange={handleSearch} variant='search' />
12
      <SearchBar placeholder='Buscar grupo' color='secondary' onChange={searchGroups} />
-
 
13
      {loading ? (
-
 
14
        <Spinner />
26
      <GroupsRequestsReceivedList
15
      ) : (
-
 
16
        <Grid
-
 
17
          items={groups}
-
 
18
          emptyMessage='No hay grupos'
-
 
19
          keyExtractor={(group) => group.link_view}
27
        groups={data}
20
          renderItem={(group) => (
-
 
21
            <GroupsRequestsSentCard
-
 
22
              group={group}
-
 
23
              onAccept={() => acceptRequest(group.link_accept)}
-
 
24
              onReject={() => rejectRequest(group.link_reject)}
28
        loading={isLoading}
25
            />
-
 
26
          )}
29
        onComplete={refetch}
27
        />
30
      />
28
      )}
31
    </>
29
    </>
Línea 32... Línea 30...
32
  )
30
  );