2021-02-04 19:15:23 +01:00
|
|
|
import React, { PureComponent } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import classnames from 'classnames';
|
2018-12-09 21:48:06 +01:00
|
|
|
|
|
|
|
import {
|
|
|
|
TRANSACTION_CREATED_EVENT,
|
|
|
|
TRANSACTION_SUBMITTED_EVENT,
|
|
|
|
TRANSACTION_RESUBMITTED_EVENT,
|
|
|
|
TRANSACTION_CONFIRMED_EVENT,
|
|
|
|
TRANSACTION_DROPPED_EVENT,
|
|
|
|
TRANSACTION_ERRORED_EVENT,
|
|
|
|
TRANSACTION_CANCEL_ATTEMPTED_EVENT,
|
|
|
|
TRANSACTION_CANCEL_SUCCESS_EVENT,
|
2021-02-04 19:15:23 +01:00
|
|
|
} from '../transaction-activity-log.constants';
|
2018-12-09 21:48:06 +01:00
|
|
|
|
2022-03-23 16:24:56 +01:00
|
|
|
export const imageHash = {
|
|
|
|
[TRANSACTION_CREATED_EVENT]: 'fa-plus',
|
|
|
|
[TRANSACTION_SUBMITTED_EVENT]: 'fa-arrow-up',
|
|
|
|
[TRANSACTION_RESUBMITTED_EVENT]: 'fa-retweet',
|
|
|
|
[TRANSACTION_CONFIRMED_EVENT]: 'fa-check',
|
|
|
|
[TRANSACTION_DROPPED_EVENT]: 'fa-times',
|
|
|
|
[TRANSACTION_ERRORED_EVENT]: 'fa-exclamation',
|
|
|
|
[TRANSACTION_CANCEL_ATTEMPTED_EVENT]: 'fa-times',
|
|
|
|
[TRANSACTION_CANCEL_SUCCESS_EVENT]: 'fa-times',
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2018-12-09 21:48:06 +01:00
|
|
|
|
|
|
|
export default class TransactionActivityLogIcon extends PureComponent {
|
|
|
|
static contextTypes = {
|
|
|
|
t: PropTypes.func,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2018-12-09 21:48:06 +01:00
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
className: PropTypes.string,
|
|
|
|
eventKey: PropTypes.oneOf(Object.keys(imageHash)),
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2018-12-09 21:48:06 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
render() {
|
2021-02-04 19:15:23 +01:00
|
|
|
const { className, eventKey } = this.props;
|
2022-03-23 16:24:56 +01:00
|
|
|
const iconClassName = imageHash[eventKey];
|
2018-12-09 21:48:06 +01:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className={classnames('transaction-activity-log-icon', className)}>
|
2022-03-23 16:24:56 +01:00
|
|
|
{iconClassName ? (
|
|
|
|
<i
|
|
|
|
className={classnames(
|
|
|
|
'fa',
|
|
|
|
'transaction-activity-log-icon__icon',
|
|
|
|
iconClassName,
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
) : null}
|
2018-12-09 21:48:06 +01:00
|
|
|
</div>
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-12-09 21:48:06 +01:00
|
|
|
}
|
|
|
|
}
|