2022-11-30 16:34:50 +01:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { useI18nContext } from '../../../../hooks/useI18nContext';
|
|
|
|
|
|
|
|
import Popover from '../../../ui/popover';
|
|
|
|
import Box from '../../../ui/box';
|
|
|
|
import Button from '../../../ui/button';
|
|
|
|
import Typography from '../../../ui/typography';
|
|
|
|
import {
|
2023-02-23 22:20:07 +01:00
|
|
|
IconColor,
|
2022-11-30 16:34:50 +01:00
|
|
|
DISPLAY,
|
|
|
|
FLEX_DIRECTION,
|
|
|
|
FONT_WEIGHT,
|
2023-02-02 21:15:26 +01:00
|
|
|
JustifyContent,
|
|
|
|
TextColor,
|
|
|
|
TypographyVariant,
|
2022-11-30 16:34:50 +01:00
|
|
|
} from '../../../../helpers/constants/design-system';
|
|
|
|
import Identicon from '../../../ui/identicon';
|
|
|
|
import { shortenAddress } from '../../../../helpers/utils/util';
|
2023-02-23 22:20:07 +01:00
|
|
|
import { Icon, ICON_NAMES } from '../../../component-library';
|
2022-11-30 16:34:50 +01:00
|
|
|
|
|
|
|
const SignatureRequestOriginalWarning = ({
|
|
|
|
senderAddress,
|
|
|
|
name,
|
|
|
|
onSubmit,
|
|
|
|
onCancel,
|
|
|
|
}) => {
|
|
|
|
const t = useI18nContext();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Popover className="signature-request-warning__content">
|
|
|
|
<Box
|
|
|
|
display={DISPLAY.FLEX}
|
|
|
|
flexDirection={FLEX_DIRECTION.ROW}
|
|
|
|
padding={4}
|
|
|
|
className="signature-request-warning__content__header"
|
|
|
|
>
|
2023-02-23 22:20:07 +01:00
|
|
|
<Icon
|
|
|
|
name={ICON_NAMES.DANGER}
|
|
|
|
color={IconColor.errorDefault}
|
|
|
|
className="signature-request-warning__content__header__warning-icon"
|
|
|
|
/>
|
2023-02-02 21:15:26 +01:00
|
|
|
<Typography
|
|
|
|
variant={TypographyVariant.H4}
|
|
|
|
fontWeight={FONT_WEIGHT.BOLD}
|
|
|
|
>
|
2022-11-30 16:34:50 +01:00
|
|
|
{t('yourFundsMayBeAtRisk')}
|
|
|
|
</Typography>
|
|
|
|
</Box>
|
|
|
|
<Box
|
|
|
|
display={DISPLAY.FLEX}
|
|
|
|
padding={4}
|
2023-02-02 21:15:26 +01:00
|
|
|
justifyContent={JustifyContent.spaceBetween}
|
2022-11-30 16:34:50 +01:00
|
|
|
className="signature-request-warning__content__account"
|
|
|
|
>
|
|
|
|
<Box display={DISPLAY.FLEX}>
|
|
|
|
<Identicon address={senderAddress} diameter={32} />
|
|
|
|
<Typography
|
2023-02-02 21:15:26 +01:00
|
|
|
variant={TypographyVariant.H5}
|
2022-11-30 16:34:50 +01:00
|
|
|
marginLeft={2}
|
|
|
|
className="signature-request-warning__content__account-name"
|
|
|
|
>
|
|
|
|
<b>{name}</b> {` (${shortenAddress(senderAddress)})`}
|
|
|
|
</Typography>
|
|
|
|
</Box>
|
|
|
|
</Box>
|
|
|
|
|
|
|
|
<Typography
|
2023-02-02 21:15:26 +01:00
|
|
|
color={TextColor.textAlternative}
|
2022-11-30 16:34:50 +01:00
|
|
|
margin={4}
|
|
|
|
marginTop={4}
|
|
|
|
marginBottom={4}
|
2023-02-02 21:15:26 +01:00
|
|
|
variant={TypographyVariant.H6}
|
2022-11-30 16:34:50 +01:00
|
|
|
>
|
|
|
|
{t('signatureRequestWarning', [
|
|
|
|
<a
|
|
|
|
href="https://consensys.net/blog/metamask/the-seal-of-approval-know-what-youre-consenting-to-with-permissions-and-approvals-in-metamask/"
|
|
|
|
target="_blank"
|
|
|
|
type="link"
|
|
|
|
key="non_custodial_link"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
style={{ color: 'var(--color-primary-default)' }}
|
|
|
|
>
|
|
|
|
{t('learnMoreUpperCase')}
|
|
|
|
</a>,
|
|
|
|
])}
|
|
|
|
</Typography>
|
|
|
|
|
|
|
|
<Box
|
|
|
|
display={DISPLAY.FLEX}
|
|
|
|
flexDirection={FLEX_DIRECTION.COLUMN}
|
2023-02-02 21:15:26 +01:00
|
|
|
justifyContent={JustifyContent.spaceBetween}
|
2022-11-30 16:34:50 +01:00
|
|
|
padding={4}
|
|
|
|
className="signature-request-warning__footer"
|
|
|
|
>
|
|
|
|
<Button
|
|
|
|
className="signature-request-warning__footer__sign-button"
|
|
|
|
type="danger-primary"
|
|
|
|
onClick={onSubmit}
|
|
|
|
>
|
|
|
|
{t('sign')}
|
|
|
|
</Button>
|
|
|
|
<Button
|
|
|
|
className="signature-request-warning__footer__reject-button"
|
|
|
|
type="secondary"
|
|
|
|
onClick={onCancel}
|
|
|
|
>
|
|
|
|
{t('reject')}
|
|
|
|
</Button>
|
|
|
|
</Box>
|
|
|
|
</Popover>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
SignatureRequestOriginalWarning.propTypes = {
|
|
|
|
senderAddress: PropTypes.string,
|
|
|
|
name: PropTypes.string,
|
|
|
|
onSubmit: PropTypes.func,
|
|
|
|
onCancel: PropTypes.func,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default SignatureRequestOriginalWarning;
|