lbry-desktop/ui/modal/modalConfirmTransaction/view.jsx

58 lines
1.9 KiB
React
Raw Normal View History

// @flow
import React from 'react';
2019-07-18 05:22:47 +07:00
import Button from 'component/button';
import { Form } from 'component/common/form';
import { Modal } from 'modal/modal';
2020-05-01 13:55:42 -04:00
import Card from 'component/common/card';
2020-09-02 16:08:37 -04:00
import LbcSymbol from 'component/common/lbc-symbol';
type Props = {
address: string,
amount: number,
closeModal: () => void,
sendToAddress: (string, number) => void,
};
class ModalConfirmTransaction extends React.PureComponent<Props> {
onConfirmed() {
const { closeModal, sendToAddress, amount, address } = this.props;
sendToAddress(address, amount);
closeModal();
}
render() {
const { amount, address, closeModal } = this.props;
2020-05-01 13:55:42 -04:00
const title = __('Confirm Transaction');
return (
2020-05-01 13:55:42 -04:00
<Modal isOpen contentLabel={title} type="card" onAborted={closeModal}>
2019-07-21 17:31:22 -04:00
<Form onSubmit={() => this.onConfirmed()}>
2020-05-01 13:55:42 -04:00
<Card
title={title}
body={
2020-09-02 16:08:37 -04:00
<div className="section section--padded card--inline confirm__wrapper">
2020-05-01 13:55:42 -04:00
<div className="section">
2020-09-02 16:08:37 -04:00
<div className="confirm__label">{__('Sending')}</div>
2020-09-10 11:54:41 -04:00
<div className="confirm__value">{<LbcSymbol postfix={amount} size={22} />}</div>
2020-09-02 16:08:37 -04:00
<div className="confirm__label">{__('To')}</div>
<div className="confirm__value">{address}</div>
2020-05-01 13:55:42 -04:00
</div>
2020-09-02 16:08:37 -04:00
</div>
2020-05-01 13:55:42 -04:00
}
actions={
<>
<div className="section__actions">
<Button autoFocus button="primary" label={__('Send')} onClick={() => this.onConfirmed()} />
<Button button="link" label={__('Cancel')} onClick={closeModal} />
</div>
<p className="help">{__('Once the transaction is sent, it cannot be reversed.')}</p>
</>
}
/>
2019-07-18 05:22:47 +07:00
</Form>
</Modal>
);
}
}
export default ModalConfirmTransaction;