You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
929 B
32 lines
929 B
4 years ago
|
import React, { useContext } from 'react';
|
||
|
import PropTypes from 'prop-types';
|
||
|
import classnames from 'classnames';
|
||
|
import { I18nContext } from '../../../../contexts/i18n';
|
||
4 years ago
|
|
||
4 years ago
|
export default function ViewOnEtherScanLink({
|
||
4 years ago
|
txHash,
|
||
|
blockExplorerUrl,
|
||
|
isCustomBlockExplorerUrl,
|
||
|
}) {
|
||
4 years ago
|
const t = useContext(I18nContext);
|
||
4 years ago
|
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 })}
|
||
|
>
|
||
4 years ago
|
{isCustomBlockExplorerUrl
|
||
4 years ago
|
? t('viewOnCustomBlockExplorer', [new URL(blockExplorerUrl).hostname])
|
||
4 years ago
|
: t('viewOnEtherscan')}
|
||
4 years ago
|
</div>
|
||
4 years ago
|
);
|
||
4 years ago
|
}
|
||
|
|
||
|
ViewOnEtherScanLink.propTypes = {
|
||
|
txHash: PropTypes.string,
|
||
|
blockExplorerUrl: PropTypes.string,
|
||
|
isCustomBlockExplorerUrl: PropTypes.bool,
|
||
4 years ago
|
};
|