2020-10-06 20:28:38 +02:00
|
|
|
import React, { useContext } from 'react'
|
|
|
|
import PropTypes from 'prop-types'
|
|
|
|
import classnames from 'classnames'
|
|
|
|
import { I18nContext } from '../../../../contexts/i18n'
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
export default function ViewOnEtherScanLink({
|
2020-10-06 20:28:38 +02:00
|
|
|
txHash,
|
|
|
|
blockExplorerUrl,
|
|
|
|
isCustomBlockExplorerUrl,
|
|
|
|
}) {
|
|
|
|
const t = useContext(I18nContext)
|
|
|
|
return (
|
|
|
|
<div
|
|
|
|
className={classnames('awaiting-swap__view-on-etherscan', {
|
|
|
|
'awaiting-swap__view-on-etherscan--visible': txHash,
|
|
|
|
'awaiting-swap__view-on-etherscan--invisible': !txHash,
|
|
|
|
})}
|
|
|
|
onClick={() => global.platform.openTab({ url: blockExplorerUrl })}
|
|
|
|
>
|
2020-11-03 00:41:28 +01:00
|
|
|
{isCustomBlockExplorerUrl
|
|
|
|
? t('viewOnCustomBlockExplorer', [blockExplorerUrl])
|
|
|
|
: t('viewOnEtherscan')}
|
2020-10-06 20:28:38 +02:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
ViewOnEtherScanLink.propTypes = {
|
|
|
|
txHash: PropTypes.string,
|
|
|
|
blockExplorerUrl: PropTypes.string,
|
|
|
|
isCustomBlockExplorerUrl: PropTypes.bool,
|
|
|
|
}
|