1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Onboarding V2: Fix 'Securing my Wallet' when coming from backup reminder after account recovery (#17088)

This commit is contained in:
ryanml 2023-01-05 23:14:32 -07:00 committed by PeterYinusa
parent 39f9b1e953
commit 925c835a89
2 changed files with 16 additions and 4 deletions

View File

@ -1,5 +1,5 @@
import React, { useState } from 'react';
import { useHistory } from 'react-router-dom';
import { useHistory, useLocation } from 'react-router-dom';
import PropTypes from 'prop-types';
import Box from '../../../components/ui/box';
import Button from '../../../components/ui/button';
@ -23,9 +23,14 @@ import RecoveryPhraseChips from './recovery-phrase-chips';
export default function RecoveryPhrase({ secretRecoveryPhrase }) {
const history = useHistory();
const t = useI18nContext();
const { search } = useLocation();
const [copied, handleCopy] = useCopyToClipboard();
const [phraseRevealed, setPhraseRevealed] = useState(false);
const [hiddenPhrase, setHiddenPhrase] = useState(false);
const searchParams = new URLSearchParams(search);
const isFromReminderParam = searchParams.get('isFromReminder')
? '/?isFromReminder=true'
: '';
return (
<div className="recovery-phrase" data-testid="recovery-phrase">
@ -122,7 +127,9 @@ export default function RecoveryPhrase({ secretRecoveryPhrase }) {
type="primary"
className="recovery-phrase__footer--button"
onClick={() => {
history.push(ONBOARDING_CONFIRM_SRP_ROUTE);
history.push(
`${ONBOARDING_CONFIRM_SRP_ROUTE}${isFromReminderParam}`,
);
}}
>
{t('next')}

View File

@ -1,5 +1,5 @@
import React, { useState } from 'react';
import { useHistory } from 'react-router-dom';
import { useHistory, useLocation } from 'react-router-dom';
import { useSelector } from 'react-redux';
import Box from '../../../components/ui/box';
import Button from '../../../components/ui/button';
@ -23,12 +23,17 @@ import SkipSRPBackup from './skip-srp-backup-popover';
export default function SecureYourWallet() {
const history = useHistory();
const t = useI18nContext();
const { search } = useLocation();
const currentLocale = useSelector(getCurrentLocale);
const [showSkipSRPBackupPopover, setShowSkipSRPBackupPopover] =
useState(false);
const searchParams = new URLSearchParams(search);
const isFromReminderParam = searchParams.get('isFromReminder')
? '/?isFromReminder=true'
: '';
const handleClickRecommended = () => {
history.push(ONBOARDING_REVIEW_SRP_ROUTE);
history.push(`${ONBOARDING_REVIEW_SRP_ROUTE}${isFromReminderParam}`);
};
const handleClickNotRecommended = () => {