feat: add state for is copied phrase
This commit is contained in:
parent
b48aec8103
commit
d97ccc8c9e
|
@ -1,6 +1,6 @@
|
||||||
import { Stack, YStack } from 'tamagui'
|
import { Stack, YStack } from 'tamagui'
|
||||||
import { Button, InformationBox, Text } from '@status-im/components'
|
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 { useEffect, useState } from 'react'
|
||||||
import { generateMnemonic } from 'web-bip39'
|
import { generateMnemonic } from 'web-bip39'
|
||||||
import wordlist from 'web-bip39/wordlists/english'
|
import wordlist from 'web-bip39/wordlists/english'
|
||||||
|
@ -15,6 +15,7 @@ type RecoveryPhraseProps = {
|
||||||
|
|
||||||
const RecoveryPhrase = ({ isKeystoreFiles }: RecoveryPhraseProps) => {
|
const RecoveryPhrase = ({ isKeystoreFiles }: RecoveryPhraseProps) => {
|
||||||
const [isReveal, setIsReveal] = useState(false)
|
const [isReveal, setIsReveal] = useState(false)
|
||||||
|
const [isCopied, setIsCopied] = useState(false)
|
||||||
const { generatedMnemonic } = useSelector((state: RootState) => state.keyGeneration)
|
const { generatedMnemonic } = useSelector((state: RootState) => state.keyGeneration)
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
|
|
||||||
|
@ -32,12 +33,10 @@ const RecoveryPhrase = ({ isKeystoreFiles }: RecoveryPhraseProps) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const copyRecoveryPhraseHandler = () => {
|
const copyRecoveryPhraseHandler = () => {
|
||||||
if (isKeystoreFiles) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const text = generatedMnemonic.join(' ')
|
const text = generatedMnemonic.join(' ')
|
||||||
navigator.clipboard.writeText(text)
|
navigator.clipboard.writeText(text)
|
||||||
|
|
||||||
|
setIsCopied(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in New Issue