feat: reset is copied after 3 seconds copy

This commit is contained in:
RadoslavDimchev 2024-01-12 10:22:21 +02:00
parent 5ca47a8ced
commit 4a7d2222aa
1 changed files with 10 additions and 1 deletions

View File

@ -17,6 +17,7 @@ type RecoveryPhraseProps = {
const RecoveryPhrase = ({ isKeystoreFiles }: RecoveryPhraseProps) => {
const [isReveal, setIsReveal] = useState(false)
const [isCopied, setIsCopied] = useState(false)
const [isTimeoutActive, setIsTimeoutActive] = useState(false)
const { generatedMnemonic } = useSelector((state: RootState) => state.keyGeneration)
const dispatch = useDispatch()
@ -41,7 +42,15 @@ const RecoveryPhrase = ({ isKeystoreFiles }: RecoveryPhraseProps) => {
const text = generatedMnemonic.join(' ')
navigator.clipboard.writeText(text)
if (!isTimeoutActive) {
setIsCopied(true)
setIsTimeoutActive(true)
setTimeout(() => {
setIsCopied(false)
setIsTimeoutActive(false)
}, 3000)
}
}
return (