Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 2964 Rev 3416
Línea 1... Línea 1...
1
import React from 'react'
1
import React from "react";
2
import { useSelector } from 'react-redux'
2
import { useSelector } from "react-redux";
3
import { Search } from '@mui/icons-material'
3
import { Search } from "@mui/icons-material";
4
 
4
 
5
import { debounce } from '@utils'
5
import { debounce } from "@utils";
6
import { useFetch, useSearchQuery } from '@hooks'
6
import { useFetch, useSearchQuery } from "@hooks";
7
 
7
 
8
import Spinner from '../../components/UI/Spinner'
8
import Spinner from "../../components/UI/Spinner";
9
import Input from '../../components/UI/inputs/Input'
9
import Input from "../../components/UI/inputs/Input";
10
import ProfileItem from '../../components/profile/ProfileItem'
10
import ProfileItem from "../../components/profile/ProfileItem";
11
import EmptySection from '../../components/UI/EmptySection'
11
import EmptySection from "../../components/UI/EmptySection";
12
import TitleSection from '../../components/UI/TitleSection'
12
import TitleSection from "../../components/UI/TitleSection";
13
import Pagination from '@components/common/Pagination'
13
import Pagination from "@components/common/Pagination";
Línea 14... Línea 14...
14
 
14
 
15
const ImpersonatePage = () => {
15
const ImpersonatePage = () => {
16
  const { getParam, setParam } = useSearchQuery()
16
  const { getParam, setParam } = useSearchQuery();
17
  const { data, isLoading } = useFetch(
17
  const { data, loading } = useFetch(
18
    '/impersonate?search=' + getParam('search')
18
    "/impersonate?search=" + getParam("search")
19
  )
19
  );
Línea 20... Línea 20...
20
  const labels = useSelector(({ intl }) => intl.labels)
20
  const labels = useSelector(({ intl }) => intl.labels);
Línea 21... Línea 21...
21
 
21
 
22
  const handleSearch = debounce((value) => setParam('keyword', value), 500)
22
  const handleSearch = debounce((value) => setParam("keyword", value), 500);
23
 
23
 
Línea 24... Línea 24...
24
  return (
24
  return (
Línea 25... Línea 25...
25
    <>
25
    <>
26
      <TitleSection title='Usuarios disponibles a personalizar' />
26
      <TitleSection title="Usuarios disponibles a personalizar" />
27
 
27
 
28
      <Input icon={<Search />} onChange={handleSearch} variant='search' />
28
      <Input icon={<Search />} onChange={handleSearch} variant="search" />
29
 
29
 
30
      {isLoading ? (
30
      {loading ? (
31
        <Spinner />
31
        <Spinner />
32
      ) : (
32
      ) : (
33
        <ul className='companies-list mt-3'>
33
        <ul className="companies-list mt-3">
Línea 45... Línea 45...
45
                />
45
                />
46
              )
46
              )
47
            )
47
            )
48
          ) : (
48
          ) : (
49
            <EmptySection
49
            <EmptySection
50
              align='left'
50
              align="left"
51
              message={labels.datatable_szerorecords}
51
              message={labels.datatable_szerorecords}
52
            />
52
            />
53
          )}
53
          )}
54
        </ul>
54
        </ul>
55
      )}
55
      )}
56
      <Pagination
56
      <Pagination
57
        pages={data.total?.pages}
57
        pages={data.total?.pages}
58
        page={data.current?.page}
58
        page={data.current?.page}
59
        onChange={(newPage) => setParam('page', newPage)}
59
        onChange={(newPage) => setParam("page", newPage)}
60
      />
60
      />
61
    </>
61
    </>
62
  )
62
  );
63
}
63
};
Línea 64... Línea 64...
64
 
64