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

59 lines
1.7 KiB
React
Raw Normal View History

// @flow
import React from 'react';
2019-07-18 00:22:47 +02:00
import Button from 'component/button';
import { Form } from 'component/common/form';
import { Modal } from 'modal/modal';
2020-05-01 19:55:42 +02:00
import Card from 'component/common/card';
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');
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>
</Modal>
);
}
}
export default ModalConfirmTransaction;