From 4a7d2222aafa95a5ea317d5658211e7f2634bc3a Mon Sep 17 00:00:00 2001 From: RadoslavDimchev Date: Fri, 12 Jan 2024 10:22:21 +0200 Subject: [PATCH] feat: reset is copied after 3 seconds copy --- .../KeyGeneration/RecoveryPhrase.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pages/ValidatorOnboarding/KeyGeneration/RecoveryPhrase.tsx b/src/pages/ValidatorOnboarding/KeyGeneration/RecoveryPhrase.tsx index 49706374..c5ee6107 100644 --- a/src/pages/ValidatorOnboarding/KeyGeneration/RecoveryPhrase.tsx +++ b/src/pages/ValidatorOnboarding/KeyGeneration/RecoveryPhrase.tsx @@ -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) - setIsCopied(true) + if (!isTimeoutActive) { + setIsCopied(true) + setIsTimeoutActive(true) + + setTimeout(() => { + setIsCopied(false) + setIsTimeoutActive(false) + }, 3000) + } } return (