2023-01-13 17:11:27 +01:00
|
|
|
import React, { useState, useContext } from 'react';
|
2021-10-06 20:52:25 +02:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { useHistory } from 'react-router-dom';
|
2022-12-15 15:38:15 +01:00
|
|
|
import { useDispatch } from 'react-redux';
|
2021-10-06 20:52:25 +02:00
|
|
|
import { useI18nContext } from '../../../hooks/useI18nContext';
|
|
|
|
import Button from '../../../components/ui/button';
|
|
|
|
import Popover from '../../../components/ui/popover';
|
|
|
|
import Box from '../../../components/ui/box';
|
|
|
|
import Typography from '../../../components/ui/typography';
|
|
|
|
import {
|
2023-02-02 21:15:26 +01:00
|
|
|
AlignItems,
|
2023-02-23 22:20:07 +01:00
|
|
|
IconColor,
|
2021-10-06 20:52:25 +02:00
|
|
|
FLEX_DIRECTION,
|
|
|
|
FONT_WEIGHT,
|
2023-02-02 21:15:26 +01:00
|
|
|
JustifyContent,
|
|
|
|
TypographyVariant,
|
2021-10-06 20:52:25 +02:00
|
|
|
} from '../../../helpers/constants/design-system';
|
2022-12-15 15:38:15 +01:00
|
|
|
import { setSeedPhraseBackedUp } from '../../../store/actions';
|
2021-10-06 20:52:25 +02:00
|
|
|
import Checkbox from '../../../components/ui/check-box';
|
|
|
|
import { ONBOARDING_COMPLETION_ROUTE } from '../../../helpers/constants/routes';
|
2023-04-03 17:31:04 +02:00
|
|
|
import {
|
|
|
|
MetaMetricsEventCategory,
|
|
|
|
MetaMetricsEventName,
|
|
|
|
} from '../../../../shared/constants/metametrics';
|
2023-01-13 17:11:27 +01:00
|
|
|
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
2023-02-23 22:20:07 +01:00
|
|
|
import {
|
|
|
|
Icon,
|
2023-04-24 16:19:19 +02:00
|
|
|
IconName,
|
|
|
|
IconSize,
|
|
|
|
} from '../../../components/component-library';
|
2021-10-06 20:52:25 +02:00
|
|
|
|
|
|
|
export default function SkipSRPBackup({ handleClose }) {
|
|
|
|
const [checked, setChecked] = useState(false);
|
|
|
|
const t = useI18nContext();
|
|
|
|
const history = useHistory();
|
2022-12-15 15:38:15 +01:00
|
|
|
const dispatch = useDispatch();
|
2023-01-13 17:11:27 +01:00
|
|
|
const trackEvent = useContext(MetaMetricsContext);
|
2022-12-15 15:38:15 +01:00
|
|
|
|
2021-10-06 20:52:25 +02:00
|
|
|
return (
|
|
|
|
<Popover
|
|
|
|
className="skip-srp-backup-popover"
|
|
|
|
footer={
|
|
|
|
<Box
|
|
|
|
className="skip-srp-backup-popover__footer"
|
2023-02-02 21:15:26 +01:00
|
|
|
justifyContent={JustifyContent.center}
|
|
|
|
alignItems={AlignItems.center}
|
2021-10-06 20:52:25 +02:00
|
|
|
>
|
2023-01-13 17:11:27 +01:00
|
|
|
<Button
|
|
|
|
onClick={() => {
|
|
|
|
trackEvent({
|
2023-04-03 17:31:04 +02:00
|
|
|
category: MetaMetricsEventCategory.Onboarding,
|
|
|
|
event:
|
|
|
|
MetaMetricsEventName.OnboardingWalletSecuritySkipCanceled,
|
2023-01-13 17:11:27 +01:00
|
|
|
});
|
|
|
|
handleClose();
|
|
|
|
}}
|
|
|
|
type="secondary"
|
|
|
|
rounded
|
|
|
|
>
|
2021-10-06 20:52:25 +02:00
|
|
|
{t('goBack')}
|
|
|
|
</Button>
|
|
|
|
<Button
|
2021-11-10 18:27:10 +01:00
|
|
|
data-testid="skip-srp-backup"
|
2021-10-06 20:52:25 +02:00
|
|
|
disabled={!checked}
|
|
|
|
type="primary"
|
|
|
|
rounded
|
2022-12-15 15:38:15 +01:00
|
|
|
onClick={async () => {
|
|
|
|
await dispatch(setSeedPhraseBackedUp(false));
|
2023-01-13 17:11:27 +01:00
|
|
|
trackEvent({
|
2023-04-03 17:31:04 +02:00
|
|
|
category: MetaMetricsEventCategory.Onboarding,
|
|
|
|
event:
|
|
|
|
MetaMetricsEventName.OnboardingWalletSecuritySkipConfirmed,
|
2023-01-13 17:11:27 +01:00
|
|
|
});
|
2022-12-15 15:38:15 +01:00
|
|
|
history.push(ONBOARDING_COMPLETION_ROUTE);
|
|
|
|
}}
|
2021-10-06 20:52:25 +02:00
|
|
|
>
|
|
|
|
{t('skip')}
|
|
|
|
</Button>
|
|
|
|
</Box>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<Box
|
|
|
|
flexDirection={FLEX_DIRECTION.COLUMN}
|
2023-02-02 21:15:26 +01:00
|
|
|
alignItems={AlignItems.center}
|
|
|
|
justifyContent={JustifyContent.center}
|
2021-10-06 20:52:25 +02:00
|
|
|
margin={4}
|
|
|
|
>
|
2023-02-23 22:20:07 +01:00
|
|
|
<Icon
|
2023-04-24 16:19:19 +02:00
|
|
|
name={IconName.Danger}
|
|
|
|
size={IconSize.Xl}
|
2023-02-23 22:20:07 +01:00
|
|
|
className="skip-srp-backup-popover__icon"
|
|
|
|
color={IconColor.errorDefault}
|
|
|
|
/>
|
2023-02-02 21:15:26 +01:00
|
|
|
<Typography
|
2023-03-22 08:52:30 +01:00
|
|
|
variant={TypographyVariant.H3}
|
2023-02-02 21:15:26 +01:00
|
|
|
fontWeight={FONT_WEIGHT.BOLD}
|
|
|
|
>
|
2021-10-06 20:52:25 +02:00
|
|
|
{t('skipAccountSecurity')}
|
|
|
|
</Typography>
|
2023-02-02 21:15:26 +01:00
|
|
|
<Box justifyContent={JustifyContent.center} margin={3}>
|
2022-03-15 02:27:02 +01:00
|
|
|
<label className="skip-srp-backup-popover__label">
|
|
|
|
<Checkbox
|
|
|
|
className="skip-srp-backup-popover__checkbox"
|
|
|
|
onClick={() => setChecked(!checked)}
|
|
|
|
checked={checked}
|
|
|
|
dataTestId="skip-srp-backup-popover-checkbox"
|
|
|
|
/>
|
|
|
|
<Typography
|
|
|
|
className="skip-srp-backup-popover__details"
|
2023-03-22 08:52:30 +01:00
|
|
|
variant={TypographyVariant.H7}
|
2022-03-15 02:27:02 +01:00
|
|
|
>
|
|
|
|
{t('skipAccountSecurityDetails')}
|
|
|
|
</Typography>
|
|
|
|
</label>
|
2021-10-06 20:52:25 +02:00
|
|
|
</Box>
|
|
|
|
</Box>
|
|
|
|
</Popover>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
SkipSRPBackup.propTypes = {
|
|
|
|
handleClose: PropTypes.func,
|
|
|
|
};
|