mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-26 20:39:08 +01:00
e3380ba3ae
* UX: Icon: WIP: Remove fa-exclamation-triangle usages * Swap the rest of the icons * Fix color import * Update ui/pages/onboarding-flow/secure-your-wallet/skip-srp-backup-popover.stories.js Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net> * Update ui/pages/onboarding-flow/secure-your-wallet/skip-srp-backup-popover.stories.js Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net> * Update ui/pages/onboarding-flow/secure-your-wallet/skip-srp-backup-popover.stories.js Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net> * Update ui/pages/onboarding-flow/secure-your-wallet/skip-srp-backup-popover.js Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net> * Update ui/components/app/add-network/add-network.js Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net> * Update ui/components/ui/review-spending-cap/review-spending-cap.js Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net> * Fix lint * Fix alignment and sizes * Use IconColor * Update ui/components/app/custom-spending-cap/custom-spending-cap-tooltip.js Co-authored-by: George Marshall <george.marshall@consensys.net> * Update ui/components/app/confirmation-warning-modal/confirmation-warning-modal.js Co-authored-by: Danica Shen <zhaodanica@gmail.com> * Update ui/components/app/signature-request-original/signature-request-original-warning/signature-request-original-warning.js Co-authored-by: Danica Shen <zhaodanica@gmail.com> * Update ui/components/ui/review-spending-cap/review-spending-cap.js Co-authored-by: Danica Shen <zhaodanica@gmail.com> * Update ui/pages/onboarding-flow/secure-your-wallet/skip-srp-backup-popover.js Co-authored-by: Danica Shen <zhaodanica@gmail.com> * Fix imports * Use IconColor --------- Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net> Co-authored-by: George Marshall <george.marshall@consensys.net> Co-authored-by: Danica Shen <zhaodanica@gmail.com>
151 lines
3.9 KiB
JavaScript
151 lines
3.9 KiB
JavaScript
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 {
|
|
DISPLAY,
|
|
FLEX_DIRECTION,
|
|
FONT_WEIGHT,
|
|
JustifyContent,
|
|
TextColor,
|
|
TypographyVariant,
|
|
} from '../../../helpers/constants/design-system';
|
|
import Identicon from '../../ui/identicon';
|
|
import { shortenAddress } from '../../../helpers/utils/util';
|
|
import { Icon, ICON_NAMES } from '../../component-library';
|
|
|
|
const SetApproveForAllWarning = ({
|
|
collectionName,
|
|
senderAddress,
|
|
name,
|
|
total,
|
|
isERC721,
|
|
onSubmit,
|
|
onCancel,
|
|
}) => {
|
|
const t = useI18nContext();
|
|
|
|
const footer = (
|
|
<Box
|
|
display={DISPLAY.FLEX}
|
|
flexDirection={FLEX_DIRECTION.COLUMN}
|
|
justifyContent={JustifyContent.SPACE_BETWEEN}
|
|
className="set-approval-for-all-warning__footer"
|
|
>
|
|
<Button
|
|
className="set-approval-for-all-warning__footer__approve-button"
|
|
type="danger-primary"
|
|
onClick={onSubmit}
|
|
>
|
|
{t('approveButtonText')}
|
|
</Button>
|
|
<Button
|
|
className="set-approval-for-all-warning__footer__cancel-button"
|
|
type="secondary"
|
|
onClick={onCancel}
|
|
>
|
|
{t('reject')}
|
|
</Button>
|
|
</Box>
|
|
);
|
|
|
|
return (
|
|
<Popover className="set-approval-for-all-warning__content" footer={footer}>
|
|
<Box
|
|
display={DISPLAY.FLEX}
|
|
flexDirection={FLEX_DIRECTION.ROW}
|
|
padding={4}
|
|
className="set-approval-for-all-warning__content__header"
|
|
>
|
|
<Icon
|
|
name={ICON_NAMES.DANGER}
|
|
className="set-approval-for-all-warning__content__header__warning-icon"
|
|
/>
|
|
<Typography
|
|
variant={TypographyVariant.H4}
|
|
fontWeight={FONT_WEIGHT.BOLD}
|
|
>
|
|
{t('yourNFTmayBeAtRisk')}
|
|
</Typography>
|
|
</Box>
|
|
<Box
|
|
display={DISPLAY.FLEX}
|
|
padding={4}
|
|
justifyContent={JustifyContent.spaceBetween}
|
|
className="set-approval-for-all-warning__content__account"
|
|
>
|
|
<Box display={DISPLAY.FLEX}>
|
|
<Identicon address={senderAddress} diameter={32} />
|
|
<Typography
|
|
variant={TypographyVariant.H5}
|
|
marginLeft={2}
|
|
className="set-approval-for-all-warning__content__account-name"
|
|
>
|
|
<b>{name}</b> {` (${shortenAddress(senderAddress)})`}
|
|
</Typography>
|
|
</Box>
|
|
{isERC721 && total && (
|
|
<Typography>{`${t('total')}: ${total}`}</Typography>
|
|
)}
|
|
</Box>
|
|
|
|
<Typography
|
|
color={TextColor.textAlternative}
|
|
margin={4}
|
|
marginTop={4}
|
|
marginBottom={4}
|
|
variant={TypographyVariant.H6}
|
|
>
|
|
{t('nftWarningContent', [
|
|
<strong
|
|
key="non_custodial_bold"
|
|
className="set-approval-for-all-warning__content__bold"
|
|
>
|
|
{t('nftWarningContentBold', [collectionName])}
|
|
</strong>,
|
|
<strong key="non_custodial_grey">
|
|
{t('nftWarningContentGrey')}
|
|
</strong>,
|
|
])}
|
|
</Typography>
|
|
</Popover>
|
|
);
|
|
};
|
|
|
|
SetApproveForAllWarning.propTypes = {
|
|
/**
|
|
* NFT collection name that is being approved
|
|
*/
|
|
collectionName: PropTypes.string,
|
|
/**
|
|
* Address of a current user that is approving collection
|
|
*/
|
|
senderAddress: PropTypes.string,
|
|
/**
|
|
* Name of a current user that is approving collection
|
|
*/
|
|
name: PropTypes.string,
|
|
/**
|
|
* Total number of items that are being approved
|
|
*/
|
|
total: PropTypes.string,
|
|
/**
|
|
* Is asset standard ERC721
|
|
*/
|
|
isERC721: PropTypes.bool,
|
|
/**
|
|
* Function that approves collection
|
|
*/
|
|
onSubmit: PropTypes.func,
|
|
/**
|
|
* Function that rejects collection
|
|
*/
|
|
onCancel: PropTypes.func,
|
|
};
|
|
|
|
export default SetApproveForAllWarning;
|