Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 3432 Rev 3694
Línea 1... Línea 1...
1
import React from 'react'
1
import React, { useState } from 'react';
-
 
2
import Search from '@mui/icons-material/Search';
2
import { useSelector } from 'react-redux'
3
import { Box, styled } from '@mui/material';
3
import { Search } from '@mui/icons-material'
4
import { useSelector } from 'react-redux';
4
 
5
 
5
import { debounce } from '@utils'
6
import { debounce } from '@utils';
6
import { useFetch, useSearchQuery } from '@hooks'
7
import { useFetch, useSearchQuery } from '@hooks';
7
 
8
 
8
import Spinner from '../../components/UI/Spinner'
9
import Spinner from '../../components/UI/Spinner';
9
import Input from '../../components/UI/inputs/Input'
10
import Input from '../../components/UI/inputs/Input';
10
import ProfileItem from '../../components/profile/ProfileItem'
11
import ProfileItem from '../../components/profile/ProfileItem';
11
import EmptySection from '../../components/UI/EmptySection'
12
import EmptySection from '../../components/UI/EmptySection';
12
import TitleSection from '../../components/UI/TitleSection'
13
import TitleSection from '../../components/UI/TitleSection';
13
import Pagination from '@components/common/Pagination'
14
import Pagination from '@components/common/Pagination';
Línea 14... Línea 15...
14
 
15
 
15
const ImpersonatePage = () => {
16
const ImpersonatePage = () => {
16
  const { getParam, setParam } = useSearchQuery()
-
 
17
  const { data, isLoading } = useFetch(
17
  const { getParam, setParam } = useSearchQuery();
18
    '/impersonate?search=' + getParam('search')
-
 
19
  )
18
  const { data, isLoading } = useFetch('/impersonate?search=' + getParam('search'));
Línea 20... Línea 19...
20
  const labels = useSelector(({ intl }) => intl.labels)
19
  const labels = useSelector(({ intl }) => intl.labels);
Línea 21... Línea 20...
21
 
20
 
22
  const handleSearch = debounce((value) => setParam('keyword', value), 500)
21
  const handleSearch = debounce((value) => setParam('keyword', value), 500);
23
 
22
 
Línea 30... Línea 29...
30
      {isLoading ? (
29
      {isLoading ? (
31
        <Spinner />
30
        <Spinner />
32
      ) : (
31
      ) : (
33
        <ul className='companies-list mt-3'>
32
        <ul className='companies-list mt-3'>
34
          {data.current?.items?.length > 0 ? (
33
          {data.current?.items?.length > 0 ? (
35
            data.current?.items?.map(
-
 
36
              ({ image, name, email, network, link_impersonate }, id) => (
34
            data.current?.items?.map(({ image, name, email, network, link_impersonate }, id) => (
37
                <ProfileItem
35
              <ProfileItem
38
                  isTopData
36
                isTopData
39
                  key={id}
37
                key={id}
40
                  image={image}
38
                image={image}
41
                  name={name}
39
                name={name}
42
                  email={email}
40
                email={email}
43
                  network={network}
41
                network={network}
44
                  link_impersonate={link_impersonate}
42
                link_impersonate={link_impersonate}
45
                />
43
              />
46
              )
-
 
47
            )
44
            ))
48
          ) : (
45
          ) : (
49
            <EmptySection
-
 
50
              align='left'
-
 
51
              message={labels.datatable_szerorecords}
46
            <EmptySection align='left' message={labels.datatable_szerorecords} />
52
            />
-
 
53
          )}
47
          )}
54
        </ul>
48
        </ul>
55
      )}
49
      )}
56
      <Pagination
50
      <Pagination
57
        pages={data.total?.pages}
51
        pages={data.total?.pages}
58
        page={data.current?.page}
52
        page={data.current?.page}
59
        onChange={(newPage) => setParam('page', newPage)}
53
        onChange={(newPage) => setParam('page', newPage)}
60
      />
54
      />
61
    </>
55
    </>
62
  )
56
  );
63
}
57
};
Línea 64... Línea 58...
64
 
58