import React, { useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { ALERT_STATE } from '../../../../ducks/alerts'; import { connectAccount, dismissAlert, dismissAndDisableAlert, getAlertState, switchToAccount, } from '../../../../ducks/alerts/unconnected-account'; import { getOriginOfCurrentTab, getOrderedConnectedAccountsForActiveTab, getSelectedAddress, getSelectedIdentity, } from '../../../../selectors'; import { isExtensionUrl } from '../../../../helpers/utils/util'; import Popover from '../../../ui/popover'; import Button from '../../../ui/button'; import Checkbox from '../../../ui/check-box'; import Tooltip from '../../../ui/tooltip'; import ConnectedAccountsList from '../../connected-accounts-list'; import { useI18nContext } from '../../../../hooks/useI18nContext'; const { ERROR, LOADING } = ALERT_STATE; const UnconnectedAccountAlert = () => { const t = useI18nContext(); const dispatch = useDispatch(); const alertState = useSelector(getAlertState); const connectedAccounts = useSelector( getOrderedConnectedAccountsForActiveTab, ); const origin = useSelector(getOriginOfCurrentTab); const selectedIdentity = useSelector(getSelectedIdentity); const selectedAddress = useSelector(getSelectedAddress); const [dontShowThisAgain, setDontShowThisAgain] = useState(false); const onClose = async () => { return dontShowThisAgain ? await dispatch(dismissAndDisableAlert()) : dispatch(dismissAlert()); }; const footer = ( <> {alertState === ERROR ? (