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';
|
2023-04-19 23:16:49 +02:00
|
|
|
import { Icon, IconName, IconSize } from '../../../component-library';
|
2023-02-16 14:26:14 +01:00
|
|
|
import { Color } from '../../../../helpers/constants/design-system';
|
2018-12-09 21:48:06 +01:00
|
|
|
|
2023-02-16 14:26:14 +01:00
|
|
|
export const ACTIVITY_ICONS = {
|
2023-04-19 23:16:49 +02:00
|
|
|
[TRANSACTION_CREATED_EVENT]: IconName.Add,
|
|
|
|
[TRANSACTION_SUBMITTED_EVENT]: IconName.ArrowUp,
|
|
|
|
[TRANSACTION_RESUBMITTED_EVENT]: IconName.ProgrammingArrows,
|
|
|
|
[TRANSACTION_CONFIRMED_EVENT]: IconName.Check,
|
|
|
|
[TRANSACTION_DROPPED_EVENT]: IconName.Close,
|
|
|
|
[TRANSACTION_ERRORED_EVENT]: IconName.Danger,
|
|
|
|
[TRANSACTION_CANCEL_ATTEMPTED_EVENT]: IconName.Close,
|
|
|
|
[TRANSACTION_CANCEL_SUCCESS_EVENT]: IconName.Close,
|
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,
|
2023-02-16 14:26:14 +01:00
|
|
|
eventKey: PropTypes.oneOf(Object.keys(ACTIVITY_ICONS)),
|
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;
|
2023-02-16 14:26:14 +01:00
|
|
|
const icon = ACTIVITY_ICONS[eventKey];
|
2018-12-09 21:48:06 +01:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className={classnames('transaction-activity-log-icon', className)}>
|
2023-02-16 14:26:14 +01:00
|
|
|
{icon ? (
|
2023-04-19 23:16:49 +02:00
|
|
|
<Icon name={icon} color={Color.iconDefault} size={IconSize.Sm} />
|
2022-03-23 16:24:56 +01:00
|
|
|
) : 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
|
|
|
}
|
|
|
|
}
|