Proyectos de Subversion LeadersLinked - SPA

Rev

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

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