lbry-desktop/src/renderer/modal/modalWalletDecrypt/view.jsx

64 lines
1.5 KiB
React
Raw Normal View History

2018-07-18 21:48:30 +02:00
// @flow
import React from 'react';
import { Modal } from 'modal/modal';
import Button from 'component/button';
type Props = {
closeModal: () => void,
2018-09-26 19:48:07 +02:00
decryptWallet: () => void,
2018-07-18 21:48:30 +02:00
walletDecryptSucceded: boolean,
updateWalletStatus: boolean,
};
class ModalWalletDecrypt extends React.PureComponent<Props> {
state = {
submitted: false, // Prior actions could be marked complete
};
componentDidUpdate() {
const { props, state } = this;
if (state.submitted && props.walletDecryptSucceded === true) {
props.closeModal();
props.updateWalletStatus();
}
}
2018-09-26 19:48:07 +02:00
submitDecryptForm() {
this.setState({ submitted: true });
this.props.decryptWallet();
}
2018-07-18 21:48:30 +02:00
render() {
2018-10-19 22:38:07 +02:00
const { closeModal } = this.props;
2018-07-18 21:48:30 +02:00
return (
<Modal
isOpen
2018-09-26 19:48:07 +02:00
title={__('Decrypt Wallet')}
2018-07-18 21:48:30 +02:00
contentLabel={__('Decrypt Wallet')}
type="confirm"
confirmButtonLabel={__('Decrypt Wallet')}
abortButtonLabel={__('Cancel')}
onConfirmed={() => this.submitDecryptForm()}
onAborted={closeModal}
>
2018-09-26 19:48:07 +02:00
<section className="card__content">
<p>
{__(
'Your wallet has been encrypted with a local password, performing this action will remove this password.'
)}{' '}
<Button
button="link"
label={__('Learn more')}
href="https://lbry.io/faq/wallet-encryption"
/>.
</p>
2018-09-26 19:48:07 +02:00
</section>
2018-07-18 21:48:30 +02:00
</Modal>
);
}
}
export default ModalWalletDecrypt;