-
Notifications
You must be signed in to change notification settings - Fork 295
/
UnpairWallet.tsx
85 lines (80 loc) · 2.64 KB
/
UnpairWallet.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,
FormattedHTMLMessage,
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({
unpairWalletHeader: {
id: 'wallet.settings.unpairWallet.header',
defaultMessage: '!!!Unpair wallet',
description: 'Unpair wallet header on the wallet settings page.',
},
unpairWalletWarning: {
id: 'wallet.settings.unpairWallet.warning',
defaultMessage:
'!!!Once you unpair 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: 'Unpair wallet warning explaining the consequences.',
},
unpairButton: {
id: 'wallet.settings.unpairWalletButtonLabel',
defaultMessage: '!!!Unpair wallet',
description: 'Label for the unpair button on wallet settings',
},
});
type Props = {
openDialogAction: Function,
isDialogOpen: Function,
unpairWalletDialogContainer: Node,
onBlockForm: Function,
intl: intlShape.isRequired,
};
const UnpairWallet = observer(
({
openDialogAction,
isDialogOpen,
unpairWalletDialogContainer,
onBlockForm,
intl,
}: Props) => {
const label = intl.formatMessage(messages.unpairButton);
return (
<>
<BorderedBox className={styles.unpairWalletBox}>
<div className={styles.title}>
{intl.formatMessage(messages.unpairWalletHeader)}
</div>
<div className={styles.contentBox}>
<div>
<p>
<FormattedHTMLMessage {...messages.unpairWalletWarning} />
</p>
</div>
<WalletSettingsRemoveButton
label={label}
onClick={React.useCallback(() => {
onBlockForm();
openDialogAction({
dialog: WalletSettingsActionConfirmationDialog,
});
})}
/>
</div>
</BorderedBox>
{isDialogOpen(WalletSettingsActionConfirmationDialog)
? unpairWalletDialogContainer
: false}
</>
);
}
);
export default injectIntl(UnpairWallet);