2018-05-28 21:53:15 +02:00
|
|
|
// @flow
|
|
|
|
import React from 'react';
|
2019-07-18 00:22:47 +02:00
|
|
|
import Button from 'component/button';
|
|
|
|
import { Form } from 'component/common/form';
|
2018-05-28 21:53:15 +02:00
|
|
|
import { Modal } from 'modal/modal';
|
2020-05-01 19:55:42 +02:00
|
|
|
import Card from 'component/common/card';
|
2018-05-28 21:53:15 +02:00
|
|
|
|
|
|
|
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 19:55:42 +02:00
|
|
|
const title = __('Confirm Transaction');
|
2018-05-28 21:53:15 +02:00
|
|
|
return (
|
2020-05-01 19:55:42 +02:00
|
|
|
<Modal isOpen contentLabel={title} type="card" onAborted={closeModal}>
|
2019-07-21 23:31:22 +02:00
|
|
|
<Form onSubmit={() => this.onConfirmed()}>
|
2020-05-01 19:55:42 +02:00
|
|
|
<Card
|
|
|
|
title={title}
|
|
|
|
body={
|
|
|
|
<>
|
|
|
|
<div className="section">
|
|
|
|
<label>{__('Sending: ')}</label>
|
|
|
|
<blockquote>{amount} LBC</blockquote>
|
|
|
|
</div>
|
|
|
|
<div className="section">
|
|
|
|
<p>{__('To address: ')}</p>
|
|
|
|
<blockquote>{address}</blockquote>
|
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
}
|
|
|
|
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 00:22:47 +02:00
|
|
|
</Form>
|
2018-05-28 21:53:15 +02:00
|
|
|
</Modal>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ModalConfirmTransaction;
|