Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3432 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
3694 stevensc 1
import React, { useState } from 'react';
2
import Search from '@mui/icons-material/Search';
3
import { Box, styled } from '@mui/material';
4
import { useSelector } from 'react-redux';
2864 stevensc 5
 
3694 stevensc 6
import { debounce } from '@utils';
7
import { useFetch, useSearchQuery } from '@hooks';
5 stevensc 8
 
3694 stevensc 9
import TitleSection from '@components/UI/TitleSection';
10
import Input from '@components/UI/inputs/Input';
11
import Pagination from '@components/common/Pagination';
12
import PeopleViewedMyProfileList from '@components/profile/PeopleViewedMyProfileList';
5 stevensc 13
 
14
const PeopleViewedMyProfilePage = () => {
3694 stevensc 15
  const labels = useSelector(({ intl }) => intl.labels);
5 stevensc 16
 
3694 stevensc 17
  const { getStringParams, setParam } = useSearchQuery();
3432 stevensc 18
  const { data, isLoading, refetch } = useFetch(
19
    '/profile/people-viewed-profile' + getStringParams()
3694 stevensc 20
  );
5 stevensc 21
 
3694 stevensc 22
  const handleSearch = debounce((e) => setParam('search', e.target.value));
5 stevensc 23
 
24
  return (
2934 stevensc 25
    <>
5 stevensc 26
      <TitleSection title={labels.who_has_seen_my_profile} />
3432 stevensc 27
      <Input icon={<Search />} onChange={handleSearch} variant='search' />
2964 stevensc 28
      <PeopleViewedMyProfileList
29
        profiles={data.current?.items}
3432 stevensc 30
        loading={isLoading}
2964 stevensc 31
        onComplete={refetch}
32
      />
33
      <Pagination
34
        page={data.current?.page}
2934 stevensc 35
        pages={data.total?.pages}
3432 stevensc 36
        onChange={(page) => setParam('page', page)}
5 stevensc 37
      />
2934 stevensc 38
    </>
3694 stevensc 39
  );
40
};
5 stevensc 41
 
3694 stevensc 42
export default PeopleViewedMyProfilePage;