feat: add state for is copied phrase

This commit is contained in:
RadoslavDimchev 2023-10-13 16:27:28 +03:00
parent b48aec8103
commit d97ccc8c9e
1 changed files with 4 additions and 5 deletions

View File

@ -1,6 +1,6 @@
import { Stack, YStack } from 'tamagui'
import { Button, InformationBox, Text } from '@status-im/components'
import { CloseCircleIcon, CopyIcon } from '@status-im/icons'
import { CloseCircleIcon, CopyIcon, CheckIcon } from '@status-im/icons'
import { useEffect, useState } from 'react'
import { generateMnemonic } from 'web-bip39'
import wordlist from 'web-bip39/wordlists/english'
@ -15,6 +15,7 @@ type RecoveryPhraseProps = {
const RecoveryPhrase = ({ isKeystoreFiles }: RecoveryPhraseProps) => {
const [isReveal, setIsReveal] = useState(false)
const [isCopied, setIsCopied] = useState(false)
const { generatedMnemonic } = useSelector((state: RootState) => state.keyGeneration)
const dispatch = useDispatch()
@ -32,12 +33,10 @@ const RecoveryPhrase = ({ isKeystoreFiles }: RecoveryPhraseProps) => {
}
const copyRecoveryPhraseHandler = () => {
if (isKeystoreFiles) {
return
}
const text = generatedMnemonic.join(' ')
navigator.clipboard.writeText(text)
setIsCopied(true)
}
return (