import React, { useEffect, useRef } from 'react'; import PropTypes from 'prop-types'; import { useSelector } from 'react-redux'; import { ALERT_TYPES } from '../../../../shared/constants/alerts'; import Tooltip from '../../../components/ui/tooltip'; import ToggleButton from '../../../components/ui/toggle-button'; import { setAlertEnabledness } from '../../../store/actions'; import { getAlertEnabledness } from '../../../ducks/metamask/metamask'; import { useI18nContext } from '../../../hooks/useI18nContext'; import { handleHooksSettingsRefs } from '../../../helpers/utils/settings-search'; const AlertSettingsEntry = ({ alertId, description, title, alertIndex }) => { const t = useI18nContext(); const settingsRefs = useRef(alertIndex); useEffect(() => { handleHooksSettingsRefs(t, t('alerts'), settingsRefs, alertIndex); }, [settingsRefs, t, alertIndex]); const isEnabled = useSelector((state) => getAlertEnabledness(state)[alertId]); return ( <>