import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' import { getEthConversionFromWeiHex, getValueFromWeiHex } from '../../helpers/conversions.util' import { formatDate } from '../../util' import TransactionActivityLogIcon from './transaction-activity-log-icon' import { CONFIRMED_STATUS } from './transaction-activity-log.constants' import prefixForNetwork from '../../../lib/etherscan-prefix-for-network' export default class TransactionActivityLog extends PureComponent { static contextTypes = { t: PropTypes.func, } static propTypes = { activities: PropTypes.array, className: PropTypes.string, conversionRate: PropTypes.number, inlineRetryIndex: PropTypes.number, inlineCancelIndex: PropTypes.number, nativeCurrency: PropTypes.string, onCancel: PropTypes.func, onRetry: PropTypes.func, primaryTransaction: PropTypes.object, } handleActivityClick = hash => { const { primaryTransaction } = this.props const { metamaskNetworkId } = primaryTransaction const prefix = prefixForNetwork(metamaskNetworkId) const etherscanUrl = `https://${prefix}etherscan.io/tx/${hash}` global.platform.openWindow({ url: etherscanUrl }) } renderInlineRetry (index, activity) { const { t } = this.context const { inlineRetryIndex, primaryTransaction = {}, onRetry } = this.props const { status } = primaryTransaction const { id } = activity return status !== CONFIRMED_STATUS && index === inlineRetryIndex ? (