mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-29 08:21:30 +00:00
61 lines
1.5 KiB
JavaScript
61 lines
1.5 KiB
JavaScript
// @flow
|
|
import React from 'react';
|
|
import { FormRow, FormField } from 'component/common/form';
|
|
import { Modal } from 'modal/modal';
|
|
import Button from 'component/button';
|
|
|
|
type Props = {
|
|
closeModal: () => void,
|
|
unlockWallet: string => void,
|
|
walletDecryptSucceded: boolean,
|
|
updateWalletStatus: boolean,
|
|
};
|
|
|
|
class ModalWalletDecrypt extends React.PureComponent<Props> {
|
|
state = {
|
|
submitted: false, // Prior actions could be marked complete
|
|
};
|
|
|
|
submitDecryptForm() {
|
|
this.setState({ submitted: true });
|
|
this.props.decryptWallet();
|
|
}
|
|
|
|
componentDidUpdate() {
|
|
const { props, state } = this;
|
|
|
|
if (state.submitted && props.walletDecryptSucceded === true) {
|
|
props.closeModal();
|
|
props.updateWalletStatus();
|
|
}
|
|
}
|
|
|
|
render() {
|
|
const { closeModal, walletDecryptSucceded } = this.props;
|
|
|
|
return (
|
|
<Modal
|
|
isOpen
|
|
contentLabel={__('Decrypt Wallet')}
|
|
type="confirm"
|
|
confirmButtonLabel={__('Decrypt Wallet')}
|
|
abortButtonLabel={__('Cancel')}
|
|
onConfirmed={() => this.submitDecryptForm()}
|
|
onAborted={closeModal}
|
|
>
|
|
{__(
|
|
'Your wallet has been encrypted with a local password, performing this action will remove this password.'
|
|
)}
|
|
<FormRow padded>
|
|
<Button
|
|
button="link"
|
|
label={__('Learn more')}
|
|
href="https://lbry.io/faq/wallet-encryption"
|
|
/>
|
|
</FormRow>
|
|
</Modal>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default ModalWalletDecrypt;
|