// Copyright 2019-2021 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 import React, { useCallback, useState } from 'react'; import { ButtonArea, Checkbox, MnemonicSeed, NextStepButton, VerticalSpace, Warning } from '../../components'; import useToast from '../../hooks/useToast'; import useTranslation from '../../hooks/useTranslation'; interface Props { onNextStep: () => void; seed: string; } const onCopy = (): void => { const mnemonicSeedTextElement = document.querySelector('textarea'); if (!mnemonicSeedTextElement) { return; } mnemonicSeedTextElement.select(); document.execCommand('copy'); }; function Mnemonic ({ onNextStep, seed }: Props): React.ReactElement { const { t } = useTranslation(); const [isMnemonicSaved, setIsMnemonicSaved] = useState(false); const { show } = useToast(); const _onCopy = useCallback((): void => { onCopy(); show(t('Copied')); }, [show, t]); return ( <> {t("Please write down your wallet's mnemonic seed and keep it in a safe place. The mnemonic can be used to restore your wallet. Keep it carefully to not lose your assets.")} ('I have saved my mnemonic seed safely.')} onChange={setIsMnemonicSaved} /> {t('Next step')} ); } export default React.memo(Mnemonic);