Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 3432 Rev 3435
Línea 1... Línea 1...
1
import React, { useState } from 'react'
1
import React, { useState } 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 AddProfileModal from '@components/modals/AddProfileModal'
10
import AddProfileModal from '@components/modals/AddProfileModal';
11
import MyProfilesList from '@components/profile/MyProfilesList'
11
import MyProfilesList from '@components/profile/MyProfilesList';
Línea 12... Línea 12...
12
 
12
 
13
const MyProfilesPage = () => {
13
const MyProfilesPage = () => {
Línea 14... Línea 14...
14
  const [isShowAddModal, setIsShowAddModal] = useState(false)
14
  const [isShowAddModal, setIsShowAddModal] = useState(false);
Línea 15... Línea 15...
15
 
15
 
Línea 16... Línea 16...
16
  const toggleModal = () => setIsShowAddModal(!isShowAddModal)
16
  const toggleModal = () => setIsShowAddModal(!isShowAddModal);
17
 
17
 
18
  const labels = useSelector(({ intl }) => intl.labels)
-
 
19
 
-
 
Línea 20... Línea 18...
20
  const { getStringParams, setParam } = useSearchQuery()
18
  const labels = useSelector(({ intl }) => intl.labels);
Línea 21... Línea 19...
21
  const { data, isLoading, refetch } = useFetch(
19
 
22
    '/profile/my-profiles' + getStringParams()
20
  const { getStringParams, setParam } = useSearchQuery();
23
  )
-
 
24
 
21
  const { data, isLoading, refetch } = useFetch('/profile/my-profiles' + getStringParams());
25
  const handleSearch = debounce((e) => setParam('search', e.target.value))
-
 
26
 
-
 
27
  return (
-
 
28
    <>
22
 
29
      <TitleSection
-
 
30
        title={labels.my_profiles}
-
 
31
        onAdd={toggleModal}
-
 
32
        addLabel={labels.add}
23
  const handleSearch = debounce((e) => setParam('search', e.target.value));
33
      />
-
 
34
      <Input icon={<Search />} onChange={handleSearch} variant='search' />
-
 
35
      <MyProfilesList
-
 
36
        profiles={data}
24
 
37
        loading={isLoading}
-
 
38
        onComplete={refetch}
-
 
39
      />
25
  return (
40
      <AddProfileModal
26
    <>
41
        show={isShowAddModal}
27
      <TitleSection title={labels.my_profiles} onAdd={toggleModal} addLabel={labels.add} />
Línea 42... Línea 28...
42
        getProfiles={() => refetch()}
28
      <Input icon={<Search />} onChange={handleSearch} variant='search' color='secondary' />