Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 2964 | Rev 3432 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 2964 Rev 3416
Línea 1... Línea 1...
1
import React from 'react'
1
import React from "react";
2
import { useSelector } from 'react-redux'
2
import { useSelector } from "react-redux";
3
import { Search } from '@mui/icons-material'
3
import { Search } from "@mui/icons-material";
4
 
4
 
5
import { debounce } from '@utils'
5
import { debounce } from "@utils";
6
import { useFetch, useSearchQuery } from '@hooks'
6
import { useFetch, useSearchQuery } from "@hooks";
7
 
7
 
8
import Input from '@components/UI/inputs/Input'
8
import Input from "@components/UI/inputs/Input";
9
import TitleSection from '@components/UI/TitleSection'
9
import TitleSection from "@components/UI/TitleSection";
10
import MyConnectionsList from '@components/connections/MyConnectionsList'
10
import MyConnectionsList from "@components/connections/MyConnectionsList";
11
import Pagination from '@components/common/Pagination'
11
import Pagination from "@components/common/Pagination";
Línea 12... Línea 12...
12
 
12
 
13
const MyConnectionsPage = () => {
13
const MyConnectionsPage = () => {
Línea 14... Línea 14...
14
  const labels = useSelector(({ intl }) => intl.labels)
14
  const labels = useSelector(({ intl }) => intl.labels);
15
 
15
 
16
  const { getStringParams, setParam } = useSearchQuery()
16
  const { getStringParams, setParam } = useSearchQuery();
17
  const { data, isLoading, refetch } = useFetch(
17
  const { data, loading, refetch } = useFetch(
Línea 18... Línea 18...
18
    `/connection/my-connections${getStringParams()}`
18
    `/connection/my-connections${getStringParams()}`
Línea 19... Línea 19...
19
  )
19
  );
20
 
20
 
21
  const handleSearch = debounce((e) => setParam('search', e.target.value))
21
  const handleSearch = debounce((e) => setParam("search", e.target.value));
22
 
22
 
23
  return (
23
  return (
24
    <>
24
    <>
25
      <TitleSection title={labels.first_level_persons} />
25
      <TitleSection title={labels.first_level_persons} />
26
      <Input icon={<Search />} onChange={handleSearch} variant='search' />
26
      <Input icon={<Search />} onChange={handleSearch} variant="search" />
27
      <MyConnectionsList
27
      <MyConnectionsList
28
        connections={data.current?.items}
28
        connections={data.current?.items}
29
        loading={isLoading}
29
        loading={loading}
30
        onComplete={refetch}
30
        onComplete={refetch}
31
      />
31
      />
32
      <Pagination
32
      <Pagination
33
        pages={data.total?.pages}
33
        pages={data.total?.pages}
34
        page={data.current?.page}
34
        page={data.current?.page}
35
        onChange={(page) => setParam('page', page)}
35
        onChange={(page) => setParam("page", page)}
Línea 36... Línea 36...
36
      />
36
      />