-
Notifications
You must be signed in to change notification settings - Fork 95
/
WalletAdd.js
184 lines (174 loc) · 6.54 KB
/
WalletAdd.js
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
// @flow
import React, { Component } from 'react';
import { observer } from 'mobx-react';
import { defineMessages, intlShape, FormattedHTMLMessage } from 'react-intl';
import classnames from 'classnames';
import SvgInline from 'react-svg-inline';
import logoIcon from '../../assets/images/yoroi-logo-white.inline.svg';
import settingsIcon from '../../assets/images/top-bar/setting-active.inline.svg';
import daedalusIcon from '../../assets/images/top-bar/daedalus-migration.inline.svg';
import { MAX_ADA_WALLETS_COUNT } from '../../config/numbersConfig';
import styles from './WalletAdd.scss';
import environmnent from '../../environment';
const messages = defineMessages({
title: {
id: 'wallet.add.page.title',
defaultMessage: '!!!Gateway to the financial world',
},
subTitle: {
id: 'wallet.add.page.subtitle.label',
defaultMessage: '!!!Yoroi light wallet for Cardano',
},
connectToHWTitle: {
id: 'wallet.add.page.hw.title',
defaultMessage: '!!!Connect to hardware wallet',
},
createTitle: {
id: 'wallet.add.page.create.title',
defaultMessage: '!!!Create wallet',
},
restoreTitle: {
id: 'wallet.add.page.restore.title',
defaultMessage: '!!!Restore wallet',
},
transferFundsTitle: {
id: 'wallet.add.page.daedalusTransfer.title',
defaultMessage: '!!!Transfer funds from a Daedalus wallet to Yoroi',
},
restoreNotificationMessage: {
id: 'wallet.add.dialog.restoreNotificationMessage',
defaultMessage: '!!!Wallet restoration is currently in progress. Until it completes, it is not possible to restore or import new wallets.',
},
createTrezorWalletNotificationMessage: {
id: 'wallet.add.dialog.createTrezorWalletNotificationMessage',
defaultMessage: '!!!Trezor Connect is currently in progress. Until it completes, it is not possible to restore or import new wallets.',
},
createLedgerWalletNotificationMessage: {
id: 'wallet.add.dialog.createLedgerWalletNotificationMessage',
defaultMessage: '!!!Ledger Connect is currently in progress. Until it completes, it is not possible to restore or import new wallets.',
},
});
type Props = {|
onCreate: Function,
onRestore: Function,
onHardwareConnect: Function,
onSettings: Function,
onDaedalusTransfer: Function,
isRestoreActive: boolean,
classicTheme: boolean,
|};
@observer
export default class WalletAdd extends Component<Props> {
static contextTypes = {
intl: intlShape.isRequired,
};
render() {
const { intl } = this.context;
const {
onCreate,
onRestore,
onHardwareConnect,
onSettings,
onDaedalusTransfer,
isRestoreActive,
} = this.props;
let activeNotification = null;
if (isRestoreActive) {
activeNotification = 'restoreNotificationMessage';
}
return (
<div className={styles.component}>
{/* Setting button */}
<div className={styles.hero}>
<div className={styles.settingsBar}>
<button type="button" onClick={onSettings} className={styles.settingsBarLink}>
<SvgInline svg={settingsIcon} width="30" height="30" />
</button>
</div>
<div className={styles.heroInner}>
{/* Left block */}
<div className={styles.heroLeft}>
<SvgInline svg={logoIcon} className={styles.heroLogo} />
<h2 className={styles.heroTitle}>
<FormattedHTMLMessage {...(messages.title)} />
</h2>
<h3 className={styles.heroSubTitle}>{intl.formatMessage(messages.subTitle)}</h3>
</div>
{/* Right block */}
<div className={styles.heroRight}>
<div className={styles.heroCardsList}>
{/* Connect to hardware wallet */}
{!environmnent.isShelley() &&
<button
type="button"
className="WalletAdd_btnConnectHW"
onClick={onHardwareConnect}
>
<div className={styles.heroCardsItem}>
<div className={classnames([styles.heroCardsItemBg, styles.bgConnectHW])} />
<div className={styles.heroCardsItemTitle}>
{intl.formatMessage(messages.connectToHWTitle)}
</div>
</div>
</button>
}
{/* Create wallet */}
<button
type="button"
className="WalletAdd_btnCreateWallet"
onClick={onCreate}
>
<div className={styles.heroCardsItem}>
<div className={classnames([styles.heroCardsItemBg, styles.bgCreateWallet])} />
<div className={styles.heroCardsItemTitle}>
{intl.formatMessage(messages.createTitle)}
</div>
</div>
</button>
{/* Restore wallet */}
<button
type="button"
className="WalletAdd_btnRestoreWallet"
onClick={onRestore}
>
<div className={styles.heroCardsItem}>
<div
className={classnames([styles.heroCardsItemBg, styles.bgRestoreWallet])}
/>
<div className={styles.heroCardsItemTitle}>
{intl.formatMessage(messages.restoreTitle)}
</div>
</div>
</button>
{activeNotification ? (
<div className={styles.notification}>
<FormattedHTMLMessage
{...messages[activeNotification]}
values={{ maxWalletsCount: MAX_ADA_WALLETS_COUNT }}
/>
</div>
) : null}
</div>
{/* Transfer funds from a Daedalus wallet to Yoroi */}
<button
type="button"
onClick={onDaedalusTransfer}
className={classnames([styles.heroCardsItem, styles.heroCardsItemLink])}
>
<SvgInline
svg={daedalusIcon}
width="45"
height="40"
className={styles.heroCardsItemLinkIcon}
/>
<div className={styles.heroCardsItemTitle}>
{intl.formatMessage(messages.transferFundsTitle)}
</div>
</button>
</div>
</div>
</div>
</div>
);
}
}