Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 5697 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 5697 Rev 6357
Línea 5... Línea 5...
5
import { useDispatch } from 'react-redux'
5
import { useDispatch } from 'react-redux'
6
import { addNotification } from '../../../redux/notification/notification.actions'
6
import { addNotification } from '../../../redux/notification/notification.actions'
Línea 7... Línea 7...
7
 
7
 
8
import ConfirmModal from '../../../shared/confirm-modal/ConfirmModal'
8
import ConfirmModal from '../../../shared/confirm-modal/ConfirmModal'
-
 
9
import GroupsRoundedIcon from '@mui/icons-material/GroupsRounded'
Línea 9... Línea 10...
9
import GroupsRoundedIcon from '@mui/icons-material/GroupsRounded'
10
import useOutsideClick from '../../../hooks/useOutsideClick'
10
 
11
 
11
const FeedHeader = ({
12
const FeedHeader = ({
12
  ownerName,
13
  ownerName,
Línea 17... Línea 18...
17
  feedUnique,
18
  feedUnique,
18
  feedType,
19
  feedType,
19
}) => {
20
}) => {
20
  const [showConfirmModal, setShowConfirmModal] = useState(false)
21
  const [showConfirmModal, setShowConfirmModal] = useState(false)
21
  const [displayOption, setDisplayOption] = useState(false)
22
  const [displayOption, setDisplayOption] = useState(false)
22
  const deleteButton = useRef()
23
  const deleteButton = useRef(null)
-
 
24
  const outsideClick = useOutsideClick(deleteButton)
23
  const dispatch = useDispatch()
25
  const dispatch = useDispatch()
Línea 24... Línea 26...
24
 
26
 
Línea 25... Línea 27...
25
  const handleShowConfirmModal = () => setShowConfirmModal(!showConfirmModal)
27
  const handleShowConfirmModal = () => setShowConfirmModal(!showConfirmModal)
Línea 36... Línea 38...
36
      dispatch(deleteFeed(feedUnique))
38
      dispatch(deleteFeed(feedUnique))
37
    })
39
    })
38
  }
40
  }
Línea 39... Línea 41...
39
 
41
 
40
  useEffect(() => {
-
 
41
    const handleClickOutside = (event) => {
-
 
42
      if (
42
  useEffect(() => {
43
        deleteButton.current &&
-
 
44
        !deleteButton.current.contains(event.target)
-
 
45
      ) {
43
    if (!outsideClick) return
46
        setDisplayOption(false)
-
 
47
      }
-
 
48
    }
-
 
49
    document.addEventListener('mousedown', handleClickOutside)
-
 
50
 
-
 
51
    return () => {
-
 
52
      document.removeEventListener('mousedown', handleClickOutside)
-
 
53
    }
44
    setDisplayOption(false)
Línea 54... Línea 45...
54
  }, [deleteButton])
45
  }, [outsideClick])
55
 
46
 
56
  return (
47
  return (
57
    <>
48
    <>