mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
78f4684b2a
* MetaMetrics: add EVENT.CATEGORIES const * MetaMetrics: add EVENT.CATEGORIES.INPAGE_PROVIDER * MetaMetrics: add EVENT.CATEGORIES.AUTH * MetaMetrics: add EVENT.CATEGORIES.ACCOUNTS pt. 1 * MetaMetrics: add EVENT.CATEGORIES.ACCOUNTS pt. 2 confirm we want to use 'Accounts' instead of 'Account' * MetaMetrics: add EVENT.CATEGORIES.MESSAGES * MetaMetrics: add EVENT.CATEGORIES.RETENTION const * MetaMetrics: add EVENT.CATEGORIES.SETTINGS * MetaMask: add missing EVENT.CATEGORIES.SNAPS * MetaMetrics: add EVENT.CATEGORIES.WALLET const * MetaMetrics: add EVENT.CATEGORIES.ONBOARDING const * MetaMetrics: add EVENT.CATEGORIES.ONBOARDING & EVENT.CATEGORIES.TRANSACTIONS consts * MetaMetrics: use EVENT.CATEGORIES * ducks/swaps: revert slice name * MetaMetrics: add missing EVENT.CATEGORIES.NETWORK
51 lines
1.6 KiB
JavaScript
51 lines
1.6 KiB
JavaScript
import React, { useContext } from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import classnames from 'classnames';
|
|
import { I18nContext } from '../../../../contexts/i18n';
|
|
import { getURLHostName } from '../../../../helpers/utils/util';
|
|
import { MetaMetricsContext } from '../../../../contexts/metametrics';
|
|
import { EVENT } from '../../../../../shared/constants/metametrics';
|
|
|
|
export default function ViewOnEtherScanLink({
|
|
txHash,
|
|
blockExplorerUrl,
|
|
isCustomBlockExplorerUrl,
|
|
}) {
|
|
const t = useContext(I18nContext);
|
|
const trackEvent = useContext(MetaMetricsContext);
|
|
|
|
return (
|
|
<div
|
|
className={classnames('awaiting-swap__view-on-etherscan', {
|
|
'awaiting-swap__view-on-etherscan--visible': txHash,
|
|
'awaiting-swap__view-on-etherscan--invisible': !txHash,
|
|
})}
|
|
onClick={() => {
|
|
trackEvent({
|
|
event: 'Clicked Block Explorer Link',
|
|
category: EVENT.CATEGORIES.SWAPS,
|
|
properties: {
|
|
link_type: 'Transaction Block Explorer',
|
|
action: 'Swap Transaction',
|
|
block_explorer_domain: getURLHostName(blockExplorerUrl),
|
|
},
|
|
});
|
|
global.platform.openTab({ url: blockExplorerUrl });
|
|
}}
|
|
>
|
|
{isCustomBlockExplorerUrl
|
|
? t('viewOnCustomBlockExplorer', [
|
|
t('blockExplorerSwapAction'),
|
|
getURLHostName(blockExplorerUrl),
|
|
])
|
|
: t('viewOnEtherscan', [t('blockExplorerSwapAction')])}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
ViewOnEtherScanLink.propTypes = {
|
|
txHash: PropTypes.string,
|
|
blockExplorerUrl: PropTypes.string,
|
|
isCustomBlockExplorerUrl: PropTypes.bool,
|
|
};
|