Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3694 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
3719 stevensc 1
import React, { useState } from 'react';
2
import { useSelector } from 'react-redux';
3
import Search from '@mui/icons-material/Search';
4
 
5
import { debounce } from '@utils';
6
import { useFetch, useSearchQuery } from '@hooks';
7
 
8
import Input from '@components/UI/inputs/Input';
9
import TitleSection from '@components/UI/TitleSection';
10
import AddProfileModal from '@components/modals/AddProfileModal';
11
import MyProfilesList from '@components/profile/MyProfilesList';
12
 
13
const MyProfilesPage = () => {
14
  const [isShowAddModal, setIsShowAddModal] = useState(false);
15
 
16
  const toggleModal = () => setIsShowAddModal(!isShowAddModal);
17
 
18
  const labels = useSelector(({ intl }) => intl.labels);
19
 
20
  const { getStringParams, setParam } = useSearchQuery();
21
  const { data, isLoading, refetch } = useFetch('/profile/my-profiles' + getStringParams());
22
 
23
  const handleSearch = debounce((e) => setParam('search', e.target.value));
24
 
25
  return (
26
    <>
27
      <TitleSection title={labels.my_profiles} onAdd={toggleModal} addLabel={labels.add} />
28
      <Input
29
        icon={<Search />}
30
        onChange={handleSearch}
31
        placeholder={labels.search}
32
        variant='search'
33
        color='secondary'
34
      />
35
      <MyProfilesList profiles={data} loading={isLoading} onComplete={refetch} />
36
      <AddProfileModal show={isShowAddModal} getProfiles={() => refetch()} onHide={toggleModal} />
37
    </>
38
  );
39
};
40
 
41
export default MyProfilesPage;