3719 |
stevensc |
1 |
import React from 'react';
|
|
|
2 |
import Search from '@mui/icons-material/Search';
|
|
|
3 |
import { useSelector } from 'react-redux';
|
|
|
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 CompanyWhenIWorkList from '@components/company/CompanyWhenIWorkList';
|
|
|
11 |
|
|
|
12 |
const CompaniesWhenIWorkPage = () => {
|
|
|
13 |
const labels = useSelector(({ intl }) => intl.labels);
|
|
|
14 |
|
|
|
15 |
const { getStringParams, setParam } = useSearchQuery();
|
|
|
16 |
const {
|
|
|
17 |
data: companies,
|
|
|
18 |
isLoading,
|
|
|
19 |
refetch
|
|
|
20 |
} = useFetch('/company/i-work-with' + getStringParams());
|
|
|
21 |
|
|
|
22 |
const handleSearch = debounce((e) => setParam('search', e.target.value));
|
|
|
23 |
|
|
|
24 |
return (
|
|
|
25 |
<>
|
|
|
26 |
<TitleSection title={labels.companies_i_work_with} />
|
|
|
27 |
<Input icon={<Search />} onChange={handleSearch} variant='search' />
|
|
|
28 |
<CompanyWhenIWorkList companies={companies} loading={isLoading} onComplete={refetch} />
|
|
|
29 |
</>
|
|
|
30 |
);
|
|
|
31 |
};
|
|
|
32 |
|
|
|
33 |
export default CompaniesWhenIWorkPage;
|