2022-06-28 15:11:19 +02:00
|
|
|
import React from 'react';
|
2022-04-13 18:23:41 +02:00
|
|
|
import { useSelector } from 'react-redux';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import classNames from 'classnames';
|
|
|
|
|
|
|
|
import Box from '../../../ui/box/box';
|
|
|
|
import Button from '../../../ui/button';
|
|
|
|
import { useI18nContext } from '../../../../hooks/useI18nContext';
|
|
|
|
import { getDetectedTokensInCurrentNetwork } from '../../../../selectors';
|
|
|
|
|
2022-06-28 15:11:19 +02:00
|
|
|
const DetectedTokensLink = ({ className = '', onClick }) => {
|
2022-04-13 18:23:41 +02:00
|
|
|
const t = useI18nContext();
|
|
|
|
const detectedTokens = useSelector(getDetectedTokensInCurrentNetwork);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Box
|
|
|
|
className={classNames('detected-tokens-link', className)}
|
|
|
|
marginTop={1}
|
|
|
|
>
|
|
|
|
<Button
|
|
|
|
type="link"
|
|
|
|
className="detected-tokens-link__link"
|
2022-05-11 22:27:58 +02:00
|
|
|
onClick={onClick}
|
2022-04-13 18:23:41 +02:00
|
|
|
>
|
|
|
|
{t('numberOfNewTokensDetected', [detectedTokens.length])}
|
|
|
|
</Button>
|
|
|
|
</Box>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
DetectedTokensLink.propTypes = {
|
2022-06-28 15:11:19 +02:00
|
|
|
onClick: PropTypes.func.isRequired,
|
2022-04-13 18:23:41 +02:00
|
|
|
className: PropTypes.string,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default DetectedTokensLink;
|