-
Notifications
You must be signed in to change notification settings - Fork 295
/
ICOPublicKeyBox.tsx
75 lines (70 loc) · 2.25 KB
/
ICOPublicKeyBox.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
// @flow
import React from 'react';
import { defineMessages, injectIntl, intlShape } from 'react-intl';
import BorderedBox from '../../widgets/BorderedBox';
import styles from './WalletSettings.scss';
import PublicKeyQRCodeDialog from './ICOPublicKeyQRCodeDialog';
import ICOPublicKeyDialog from './ICOPublicKeyDialog';
import PublicKeyField from './PublicKeyField';
import type { Locale } from '../../../../../common/types/locales.types';
import type { ReactIntlMessage } from '../../../types/i18nTypes';
export const messages: { [string]: ReactIntlMessage } = defineMessages({
publicKey: {
id: 'wallet.settings.icoPublicKey',
defaultMessage: '!!!ICO public key',
description: 'Wallet public key label.',
},
publicKeyDescription: {
id: 'wallet.settings.icoPublicKey.description',
defaultMessage:
"!!!Your wallet's ICO public key enables participation in the initial coin offering presales.",
description: 'ICO public key header on the wallet settings page.',
},
publicKeyShowInstruction: {
id: 'wallet.settings.icoPublicKeyShowInstruction',
defaultMessage:
'!!!Click the icon on the right to view your ICO public key.',
description: 'ICO public key show instruction.',
},
showQRCode: {
id: 'wallet.settings.showQRCode',
defaultMessage: '!!!Show QR code',
description: 'Show QR code tooltip.',
},
});
type Props = {
publicKey: ?string,
locale: Locale,
onCopyICOPublicKey: Function,
openDialogAction: Function,
intl: intlShape.isRequired,
};
const ICOPublicKeyBox = (props: Props) => {
const {
publicKey,
locale,
onCopyICOPublicKey,
openDialogAction,
intl,
} = props;
return (
<>
<BorderedBox className={styles.walletPublicKeyBox}>
<PublicKeyField
publicKey={publicKey || ''}
description={intl.formatMessage(messages.publicKeyDescription)}
locale={locale}
onCopyPublicKey={onCopyICOPublicKey}
onShowQRCode={() =>
openDialogAction({ dialog: PublicKeyQRCodeDialog })
}
onOpenWalletKeyDialog={() =>
openDialogAction({ dialog: ICOPublicKeyDialog })
}
messages={messages}
/>
</BorderedBox>
</>
);
};
export default injectIntl(ICOPublicKeyBox);