Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/components/Configure/Configure.js
Show First 20 Lines • Show All 235 Lines • ▼ Show 20 Lines | const Configure = () => { | ||||
const [newWalletName, setNewWalletName] = useState(''); | const [newWalletName, setNewWalletName] = useState(''); | ||||
const [ | const [ | ||||
confirmationOfWalletToBeDeleted, | confirmationOfWalletToBeDeleted, | ||||
setConfirmationOfWalletToBeDeleted, | setConfirmationOfWalletToBeDeleted, | ||||
] = useState(''); | ] = useState(''); | ||||
const [newWalletNameIsValid, setNewWalletNameIsValid] = useState(null); | const [newWalletNameIsValid, setNewWalletNameIsValid] = useState(null); | ||||
const [walletDeleteValid, setWalletDeleteValid] = useState(null); | const [walletDeleteValid, setWalletDeleteValid] = useState(null); | ||||
const [seedInput, openSeedInput] = useState(false); | const [seedInput, openSeedInput] = useState(false); | ||||
const [showTranslationWarning, setShowTranslationWarning] = useState(false); | |||||
const showPopulatedDeleteWalletModal = walletInfo => { | const showPopulatedDeleteWalletModal = walletInfo => { | ||||
setWalletToBeDeleted(walletInfo); | setWalletToBeDeleted(walletInfo); | ||||
setShowDeleteWalletModal(true); | setShowDeleteWalletModal(true); | ||||
}; | }; | ||||
const showPopulatedRenameWalletModal = walletInfo => { | const showPopulatedRenameWalletModal = walletInfo => { | ||||
setWalletToBeRenamed(walletInfo); | setWalletToBeRenamed(walletInfo); | ||||
Show All 24 Lines | const Configure = () => { | ||||
const [isValidMnemonic, setIsValidMnemonic] = useState(null); | const [isValidMnemonic, setIsValidMnemonic] = useState(null); | ||||
useEffect(() => { | useEffect(() => { | ||||
// Update savedWallets every time the active wallet changes | // Update savedWallets every time the active wallet changes | ||||
updateSavedWallets(wallet); | updateSavedWallets(wallet); | ||||
}, [wallet]); | }, [wallet]); | ||||
useEffect(() => { | |||||
const detectedBrowserLang = navigator.language; | |||||
if (!detectedBrowserLang.includes('en-')) { | |||||
setShowTranslationWarning(true); | |||||
} | |||||
}, []); | |||||
// Need this function to ensure that savedWallets are updated on new wallet creation | // Need this function to ensure that savedWallets are updated on new wallet creation | ||||
const updateSavedWalletsOnCreate = async importMnemonic => { | const updateSavedWalletsOnCreate = async importMnemonic => { | ||||
// Event("Category", "Action", "Label") | // Event("Category", "Action", "Label") | ||||
// Track number of times a different wallet is activated | // Track number of times a different wallet is activated | ||||
Event('Configure.js', 'Create Wallet', 'New'); | Event('Configure.js', 'Create Wallet', 'New'); | ||||
const walletAdded = await addNewSavedWallet(importMnemonic); | const walletAdded = await addNewSavedWallet(importMnemonic); | ||||
if (!walletAdded) { | if (!walletAdded) { | ||||
Modal.error({ | Modal.error({ | ||||
▲ Show 20 Lines • Show All 209 Lines • ▼ Show 20 Lines | return ( | ||||
<ThemedCopyOutlined /> Backup your wallet | <ThemedCopyOutlined /> Backup your wallet | ||||
</h2> | </h2> | ||||
<Alert | <Alert | ||||
style={{ marginBottom: '12px' }} | style={{ marginBottom: '12px' }} | ||||
description="Your seed phrase is the only way to restore your wallet. Write it down. Keep it safe." | description="Your seed phrase is the only way to restore your wallet. Write it down. Keep it safe." | ||||
type="warning" | type="warning" | ||||
showIcon | showIcon | ||||
/> | /> | ||||
{showTranslationWarning && ( | |||||
<Alert | |||||
style={{ marginBottom: '12px' }} | |||||
description="Please do not translate your seed phrase. Store your seed phrase in English. You must re-enter these exact English words to restore your wallet from seed." | |||||
type="warning" | |||||
showIcon | |||||
/> | |||||
)} | |||||
{wallet && wallet.mnemonic && ( | {wallet && wallet.mnemonic && ( | ||||
<StyledCollapse> | <StyledCollapse> | ||||
<Panel header="Click to reveal seed phrase" key="1"> | <Panel header="Click to reveal seed phrase" key="1"> | ||||
<p className="notranslate"> | <p className="notranslate"> | ||||
{wallet && wallet.mnemonic ? wallet.mnemonic : ''} | {wallet && wallet.mnemonic ? wallet.mnemonic : ''} | ||||
</p> | </p> | ||||
</Panel> | </Panel> | ||||
</StyledCollapse> | </StyledCollapse> | ||||
▲ Show 20 Lines • Show All 148 Lines • Show Last 20 Lines |