2021-02-04 19:15:23 +01:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import React, { PureComponent } from 'react';
|
|
|
|
import Modal from '../../modal';
|
2018-09-24 07:07:19 +02:00
|
|
|
|
|
|
|
export default class RejectTransactionsModal extends PureComponent {
|
|
|
|
static contextTypes = {
|
|
|
|
t: PropTypes.func.isRequired,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2018-09-24 07:07:19 +02:00
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
onSubmit: PropTypes.func.isRequired,
|
|
|
|
hideModal: PropTypes.func.isRequired,
|
|
|
|
unapprovedTxCount: PropTypes.number.isRequired,
|
2022-11-30 08:13:14 +01:00
|
|
|
isRequestType: PropTypes.bool,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2018-09-24 07:07:19 +02:00
|
|
|
|
|
|
|
onSubmit = async () => {
|
2021-02-04 19:15:23 +01:00
|
|
|
const { onSubmit, hideModal } = this.props;
|
2018-09-24 07:07:19 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
await onSubmit();
|
|
|
|
hideModal();
|
|
|
|
};
|
2018-09-24 07:07:19 +02:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
render() {
|
2021-02-04 19:15:23 +01:00
|
|
|
const { t } = this.context;
|
2022-11-30 08:13:14 +01:00
|
|
|
const { hideModal, unapprovedTxCount, isRequestType } = this.props;
|
2018-09-24 07:07:19 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Modal
|
2022-11-30 08:13:14 +01:00
|
|
|
headerText={
|
|
|
|
isRequestType
|
|
|
|
? t('rejectRequestsN', [unapprovedTxCount])
|
|
|
|
: t('rejectTxsN', [unapprovedTxCount])
|
|
|
|
}
|
2018-09-24 07:07:19 +02:00
|
|
|
onClose={hideModal}
|
|
|
|
onSubmit={this.onSubmit}
|
|
|
|
onCancel={hideModal}
|
2018-09-27 21:04:58 +02:00
|
|
|
submitText={t('rejectAll')}
|
2018-09-24 07:07:19 +02:00
|
|
|
cancelText={t('cancel')}
|
|
|
|
>
|
|
|
|
<div>
|
|
|
|
<div className="reject-transactions__description">
|
2022-11-30 08:13:14 +01:00
|
|
|
{isRequestType
|
|
|
|
? t('rejectRequestsDescription', [unapprovedTxCount])
|
|
|
|
: t('rejectTxsDescription', [unapprovedTxCount])}
|
2018-09-24 07:07:19 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Modal>
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-09-24 07:07:19 +02:00
|
|
|
}
|
|
|
|
}
|