Rev 3437 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
import React, { useState } from 'react';
import { useSelector } from 'react-redux';
import Search from '@mui/icons-material/Search';
import { Box, styled } from '@mui/material';
import { debounce } from '@utils';
import { useFetch, useSearchQuery } from '@hooks';
import Input from '@components/UI/inputs/Input';
import TitleSection from '@components/UI/TitleSection';
import AddProfileModal from '@components/modals/AddProfileModal';
import MyProfilesList from '@components/profile/MyProfilesList';
const MyProfilesPage = () => {
const [isShowAddModal, setIsShowAddModal] = useState(false);
const toggleModal = () => setIsShowAddModal(!isShowAddModal);
const labels = useSelector(({ intl }) => intl.labels);
const { getStringParams, setParam } = useSearchQuery();
const { data, isLoading, refetch } = useFetch('/profile/my-profiles' + getStringParams());
const handleSearch = debounce((e) => setParam('search', e.target.value));
return (
<>
<TitleSection title={labels.my_profiles} onAdd={toggleModal} addLabel={labels.add} />
<Input
icon={<Search />}
onChange={handleSearch}
placeholder={labels.search}
variant='search'
color='secondary'
/>
<MyProfilesList profiles={data} loading={isLoading} onComplete={refetch} />
<AddProfileModal show={isShowAddModal} getProfiles={() => refetch()} onHide={toggleModal} />
</>
);
};
export default MyProfilesPage;