import React, { FormEvent } from 'react' import Caret from '@images/caret.svg' import { accountTruncate } from '@utils/web3' import Loader from '@shared/atoms/Loader' import styles from './Account.module.css' import { useWeb3 } from '@context/Web3' import Avatar from '@shared/atoms/Avatar' // Forward ref for Tippy.js // eslint-disable-next-line const Account = React.forwardRef((props, ref: any) => { const { accountId, accountEns, accountEnsAvatar, web3Modal, connect } = useWeb3() async function handleActivation(e: FormEvent) { // prevent accidentially submitting a form the button might be in e.preventDefault() await connect() } return !accountId && web3Modal?.cachedProvider ? ( // Improve user experience for cached provider when connecting takes some time ) : accountId ? ( ) : ( ) }) export default Account