2021-06-05 08:33:58 +02:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { useHistory } from 'react-router-dom';
|
|
|
|
import { useI18nContext } from '../../../hooks/useI18nContext';
|
|
|
|
// Components
|
|
|
|
import Box from '../../ui/box';
|
|
|
|
import Button from '../../ui/button';
|
|
|
|
import Popover from '../../ui/popover';
|
|
|
|
// Helpers
|
|
|
|
import {
|
|
|
|
DISPLAY,
|
2023-04-29 01:18:46 +02:00
|
|
|
TextAlign,
|
2023-04-27 18:06:49 +02:00
|
|
|
TextVariant,
|
2021-06-05 08:33:58 +02:00
|
|
|
BLOCK_SIZES,
|
2023-04-27 18:06:49 +02:00
|
|
|
FontWeight,
|
2023-02-02 21:15:26 +01:00
|
|
|
JustifyContent,
|
|
|
|
TextColor,
|
2021-06-05 08:33:58 +02:00
|
|
|
} from '../../../helpers/constants/design-system';
|
2023-02-01 16:28:09 +01:00
|
|
|
import { ONBOARDING_UNLOCK_ROUTE } from '../../../helpers/constants/routes';
|
2023-07-20 00:32:35 +02:00
|
|
|
import { Text } from '../../component-library';
|
2021-06-05 08:33:58 +02:00
|
|
|
|
|
|
|
export default function RecoveryPhraseReminder({ onConfirm, hasBackedUp }) {
|
|
|
|
const t = useI18nContext();
|
|
|
|
const history = useHistory();
|
|
|
|
|
|
|
|
const handleBackUp = () => {
|
2023-02-01 16:28:09 +01:00
|
|
|
history.push(ONBOARDING_UNLOCK_ROUTE);
|
2021-06-05 08:33:58 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Popover centerTitle title={t('recoveryPhraseReminderTitle')}>
|
2022-07-20 22:47:51 +02:00
|
|
|
<Box
|
|
|
|
paddingRight={4}
|
|
|
|
paddingBottom={6}
|
|
|
|
paddingLeft={4}
|
|
|
|
className="recovery-phrase-reminder"
|
|
|
|
>
|
2023-04-27 18:06:49 +02:00
|
|
|
<Text
|
2023-02-02 21:15:26 +01:00
|
|
|
color={TextColor.textDefault}
|
2023-04-29 01:18:46 +02:00
|
|
|
align={TextAlign.Center}
|
2023-04-27 18:06:49 +02:00
|
|
|
variant={TextVariant.bodyMd}
|
|
|
|
marginBottom={4}
|
2021-06-05 08:33:58 +02:00
|
|
|
>
|
|
|
|
{t('recoveryPhraseReminderSubText')}
|
2023-04-27 18:06:49 +02:00
|
|
|
</Text>
|
2022-07-20 22:47:51 +02:00
|
|
|
<Box marginTop={4} marginBottom={8}>
|
2021-06-05 08:33:58 +02:00
|
|
|
<ul className="recovery-phrase-reminder__list">
|
2023-04-27 18:06:49 +02:00
|
|
|
<Text
|
|
|
|
as="li"
|
|
|
|
color={TextColor.textDefault}
|
|
|
|
fontWeight={FontWeight.Bold}
|
|
|
|
>
|
|
|
|
{t('recoveryPhraseReminderItemOne')}
|
|
|
|
</Text>
|
|
|
|
<Text as="li">{t('recoveryPhraseReminderItemTwo')}</Text>
|
|
|
|
<Text as="li">
|
2021-06-05 08:33:58 +02:00
|
|
|
{hasBackedUp ? (
|
|
|
|
t('recoveryPhraseReminderHasBackedUp')
|
|
|
|
) : (
|
|
|
|
<>
|
|
|
|
{t('recoveryPhraseReminderHasNotBackedUp')}
|
|
|
|
<Box display={DISPLAY.INLINE_BLOCK} marginLeft={1}>
|
|
|
|
<Button
|
|
|
|
type="link"
|
|
|
|
onClick={handleBackUp}
|
|
|
|
style={{
|
|
|
|
fontSize: 'inherit',
|
|
|
|
padding: 0,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{t('recoveryPhraseReminderBackupStart')}
|
|
|
|
</Button>
|
|
|
|
</Box>
|
|
|
|
</>
|
|
|
|
)}
|
2023-04-27 18:06:49 +02:00
|
|
|
</Text>
|
2021-06-05 08:33:58 +02:00
|
|
|
</ul>
|
|
|
|
</Box>
|
2023-02-02 21:15:26 +01:00
|
|
|
<Box justifyContent={JustifyContent.center}>
|
2021-06-05 08:33:58 +02:00
|
|
|
<Box width={BLOCK_SIZES.TWO_FIFTHS}>
|
2021-10-05 21:20:42 +02:00
|
|
|
<Button type="primary" onClick={onConfirm}>
|
2021-06-05 08:33:58 +02:00
|
|
|
{t('recoveryPhraseReminderConfirm')}
|
|
|
|
</Button>
|
|
|
|
</Box>
|
|
|
|
</Box>
|
|
|
|
</Box>
|
|
|
|
</Popover>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
RecoveryPhraseReminder.propTypes = {
|
|
|
|
hasBackedUp: PropTypes.bool.isRequired,
|
|
|
|
onConfirm: PropTypes.func.isRequired,
|
|
|
|
};
|