Proyectos de Subversion LeadersLinked - SPA

Rev

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

import React from 'react'
import { useSelector } from 'react-redux'
import { Search } from '@mui/icons-material'

import { debounce } from '@utils'
import { useFetch, useSearchQuery } from '@hooks'

import TitleSection from '@components/UI/TitleSection'
import Input from '@components/UI/inputs/Input'
import Pagination from '@components/common/Pagination'
import PeopleViewedMyProfileList from '@components/profile/PeopleViewedMyProfileList'

const PeopleViewedMyProfilePage = () => {
  const labels = useSelector(({ intl }) => intl.labels)

  const { getStringParams, setParam } = useSearchQuery()
  const { data, isLoading, refetch } = useFetch(
    '/profile/people-viewed-profile' + getStringParams()
  )

  const handleSearch = debounce((e) => setParam('search', e.target.value))

  return (
    <>
      <TitleSection title={labels.who_has_seen_my_profile} />
      <Input icon={<Search />} onChange={handleSearch} variant='search' />
      <PeopleViewedMyProfileList
        profiles={data.current?.items}
        loading={isLoading}
        onComplete={refetch}
      />
      <Pagination
        page={data.current?.page}
        pages={data.total?.pages}
        onChange={(page) => setParam('page', page)}
      />
    </>
  )
}

export default PeopleViewedMyProfilePage