Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 2934 Rev 3416
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)
18
  const labels = useSelector(({ intl }) => intl.labels);
19
 
19
 
Línea 20... Línea 20...
20
  const { getStringParams, setParam } = useSearchQuery()
20
  const { getStringParams, setParam } = useSearchQuery();
Línea 21... Línea 21...
21
  const { data, isLoading, refetch } = useFetch(
21
  const { data, loading, refetch } = useFetch(
22
    '/profile/my-profiles' + getStringParams()
22
    "/profile/my-profiles" + getStringParams()
23
  )
23
  );
24
 
24
 
25
  const handleSearch = debounce((e) => setParam('search', e.target.value))
25
  const handleSearch = debounce((e) => setParam("search", e.target.value));
26
 
26
 
27
  return (
27
  return (
28
    <>
28
    <>
29
      <TitleSection
-
 
30
        title={labels.my_profiles}
-
 
31
        onAdd={toggleModal}
-
 
32
        addLabel={labels.add}
29
      <TitleSection
33
      />
-
 
34
      <Input icon={<Search />} onChange={handleSearch} variant='search' />
30
        title={labels.my_profiles}
35
      <MyProfilesList
31
        onAdd={toggleModal}
36
        profiles={data}
32
        addLabel={labels.add}
37
        loading={isLoading}
33
      />
38
        onComplete={refetch}
34
      <Input icon={<Search />} onChange={handleSearch} variant="search" />
39
      />
35
      <MyProfilesList profiles={data} loading={loading} onComplete={refetch} />
40
      <AddProfileModal
36
      <AddProfileModal
41
        show={isShowAddModal}
37
        show={isShowAddModal}
Línea 42... Línea 38...
42
        getProfiles={() => refetch()}
38
        getProfiles={() => refetch()}