-
Notifications
You must be signed in to change notification settings - Fork 295
/
DeleteWallet.tsx
85 lines (80 loc) · 2.95 KB
/
DeleteWallet.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// @flow
import type { Node } from 'react';
import React from 'react';
import { observer } from 'mobx-react';
import { defineMessages, injectIntl, intlShape } from 'react-intl';
import styles from './WalletSettings.scss';
import type { ReactIntlMessage } from '../../../types/i18nTypes';
import BorderedBox from '../../widgets/BorderedBox';
import WalletSettingsRemoveButton from './WalletSettingsRemoveButton';
import WalletSettingsActionConfirmationDialog from './WalletSettingsRemoveConfirmationDialog';
export const messages: { [string]: ReactIntlMessage } = defineMessages({
deleteWalletHeader: {
id: 'wallet.settings.deleteWallet.header',
defaultMessage: '!!!Delete wallet',
description: 'Delete wallet header on the wallet settings page.',
},
deleteWalletWarning1: {
id: 'wallet.settings.deleteWallet.warning1',
defaultMessage:
'!!!Once you delete this wallet it will be removed from the Daedalus interface and you will lose access to any remaining funds in the wallet. The only way to regain access after deletion is by restoring it using your wallet recovery phrase.',
description: 'Delete wallet warning explaining the consequences.',
},
deleteWalletWarning2: {
id: 'wallet.settings.deleteWallet.warning2',
defaultMessage:
'!!!You may wish to verify your recovery phrase before deletion to ensure that you can restore this wallet in the future, if desired.',
description: 'Delete wallet warning explaining the consequences.',
},
deleteButton: {
id: 'wallet.settings.deleteWalletButtonLabel',
defaultMessage: '!!!Delete wallet',
description: 'Label for the delete button on wallet settings',
},
});
type Props = {
openDialogAction: Function,
isDialogOpen: Function,
deleteWalletDialogContainer: Node,
onBlockForm: Function,
intl: intlShape.isRequired,
};
const DeleteWallet = observer(
({
openDialogAction,
isDialogOpen,
deleteWalletDialogContainer,
onBlockForm,
intl,
}: Props) => {
const label = intl.formatMessage(messages.deleteButton);
return (
<>
<BorderedBox className={styles.deleteWalletBox}>
<div className={styles.title}>
{intl.formatMessage(messages.deleteWalletHeader)}
</div>
<div className={styles.contentBox}>
<div>
<p>{intl.formatMessage(messages.deleteWalletWarning1)}</p>
<p>{intl.formatMessage(messages.deleteWalletWarning2)}</p>
</div>
<WalletSettingsRemoveButton
label={label}
onClick={React.useCallback(() => {
onBlockForm();
openDialogAction({
dialog: WalletSettingsActionConfirmationDialog,
});
})}
/>
</div>
</BorderedBox>
{isDialogOpen(WalletSettingsActionConfirmationDialog)
? deleteWalletDialogContainer
: false}
</>
);
}
);
export default injectIntl(DeleteWallet);