2022-05-09 19:47:06 +02:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2022-08-10 03:26:25 +02:00
|
|
|
import classNames from 'classnames';
|
2022-05-09 19:47:06 +02:00
|
|
|
import { useI18nContext } from '../../../../hooks/useI18nContext';
|
|
|
|
|
|
|
|
import Popover from '../../../ui/popover';
|
|
|
|
import Button from '../../../ui/button';
|
|
|
|
import Typography from '../../../ui/typography/typography';
|
|
|
|
import { TYPOGRAPHY } from '../../../../helpers/constants/design-system';
|
|
|
|
|
|
|
|
const DetectedTokenIgnoredPopover = ({
|
2022-08-10 03:26:25 +02:00
|
|
|
partiallyIgnoreDetectedTokens,
|
2022-05-09 19:47:06 +02:00
|
|
|
onCancelIgnore,
|
|
|
|
handleClearTokensSelection,
|
|
|
|
}) => {
|
|
|
|
const t = useI18nContext();
|
|
|
|
|
|
|
|
const footer = (
|
|
|
|
<>
|
|
|
|
<Button
|
|
|
|
className="detected-token-ignored-popover__ignore-button"
|
|
|
|
type="secondary"
|
|
|
|
onClick={onCancelIgnore}
|
|
|
|
>
|
|
|
|
{t('cancel')}
|
|
|
|
</Button>
|
|
|
|
<Button
|
|
|
|
className="detected-token-ignored-popover__import-button"
|
|
|
|
type="primary"
|
|
|
|
onClick={handleClearTokensSelection}
|
|
|
|
>
|
|
|
|
{t('confirm')}
|
|
|
|
</Button>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Popover
|
2022-08-10 03:26:25 +02:00
|
|
|
title={
|
|
|
|
partiallyIgnoreDetectedTokens
|
|
|
|
? t('importSelectedTokens')
|
|
|
|
: t('areYouSure')
|
|
|
|
}
|
|
|
|
className={classNames('detected-token-ignored-popover', {
|
|
|
|
'detected-token-ignored-popover--import': partiallyIgnoreDetectedTokens,
|
|
|
|
'detected-token-ignored-popover--ignore':
|
|
|
|
!partiallyIgnoreDetectedTokens,
|
|
|
|
})}
|
2022-05-09 19:47:06 +02:00
|
|
|
footer={footer}
|
|
|
|
>
|
|
|
|
<Typography
|
|
|
|
variant={TYPOGRAPHY.H6}
|
|
|
|
tag={TYPOGRAPHY.H6}
|
2022-07-20 22:47:51 +02:00
|
|
|
marginTop={0}
|
|
|
|
marginRight={5}
|
|
|
|
marginBottom={7}
|
|
|
|
marginLeft={5}
|
2022-05-09 19:47:06 +02:00
|
|
|
>
|
2022-08-10 03:26:25 +02:00
|
|
|
{partiallyIgnoreDetectedTokens
|
|
|
|
? t('importSelectedTokensDescription')
|
|
|
|
: t('ignoreTokenWarning')}
|
2022-05-09 19:47:06 +02:00
|
|
|
</Typography>
|
|
|
|
</Popover>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
DetectedTokenIgnoredPopover.propTypes = {
|
2022-08-10 03:26:25 +02:00
|
|
|
partiallyIgnoreDetectedTokens: PropTypes.bool.isRequired,
|
2022-05-09 19:47:06 +02:00
|
|
|
onCancelIgnore: PropTypes.func.isRequired,
|
|
|
|
handleClearTokensSelection: PropTypes.func.isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default DetectedTokenIgnoredPopover;
|