import React, { useEffect } from 'react' import { useTimer } from '../../hooks/useTimer' import { forgetAccount } from '../../messaging/uiActions' import { Address } from './Address' import { Button } from './Button' type Props = { address?: string genesisHash?: string | null name?: string } export const Key: React.FC = ({ ...account }) => { const timer = useTimer() const removing = timer.started useEffect(() => { if (timer.fired) forgetAccount(account.address as string).catch(console.error) }, [timer.fired]) return (
{!removing && (
)} {!removing && (
)} {removing && (
Removing “{account.name}” — {timer.value}s
)}
) }