Add persistent message to Ledger unlock.

This commit is contained in:
Will O'Beirne 2018-05-23 15:29:20 -04:00
parent 2b5b4848a8
commit a8cd2f5f53
No known key found for this signature in database
GPG Key ID: 44C190DB5DEAF9F6
3 changed files with 25 additions and 14 deletions

View File

@ -1,6 +1,14 @@
@import 'common/sass/variables';
.LedgerDecrypt { .LedgerDecrypt {
text-align: center; text-align: center;
&-tip {
font-size: $font-size-xs-bump;
opacity: 0.7;
margin-bottom: $space;
}
&-help { &-help {
margin-top: 10px; margin-top: 10px;
font-size: 13px; font-size: 13px;

View File

@ -28,7 +28,6 @@ interface State {
dPath: DPath; dPath: DPath;
error: string | null; error: string | null;
isLoading: boolean; isLoading: boolean;
showTip: boolean;
} }
type Props = OwnProps & StateProps; type Props = OwnProps & StateProps;
@ -39,8 +38,7 @@ class LedgerNanoSDecryptClass extends PureComponent<Props, State> {
chainCode: '', chainCode: '',
dPath: this.props.dPath || this.props.dPaths[0], dPath: this.props.dPath || this.props.dPaths[0],
error: null, error: null,
isLoading: false, isLoading: false
showTip: false
}; };
public UNSAFE_componentWillReceiveProps(nextProps: Props) { public UNSAFE_componentWillReceiveProps(nextProps: Props) {
@ -51,7 +49,7 @@ class LedgerNanoSDecryptClass extends PureComponent<Props, State> {
public render() { public render() {
const { network } = this.props; const { network } = this.props;
const { dPath, publicKey, chainCode, error, isLoading, showTip } = this.state; const { dPath, publicKey, chainCode, error, isLoading } = this.state;
const showErr = error ? 'is-showing' : ''; const showErr = error ? 'is-showing' : '';
if (!dPath) { if (!dPath) {
@ -71,6 +69,15 @@ class LedgerNanoSDecryptClass extends PureComponent<Props, State> {
return ( return (
<div className="LedgerDecrypt"> <div className="LedgerDecrypt">
<div className="LedgerDecrypt-tip">
{translate('LEDGER_TIP', {
$network: network.unit,
$browserSupportState: process.env.BUILD_ELECTRON
? translateRaw('DISABLED')
: translateRaw('ENABLED')
})}
</div>
<button <button
className="LedgerDecrypt-decrypt btn btn-primary btn-lg btn-block" className="LedgerDecrypt-decrypt btn btn-primary btn-lg btn-block"
onClick={this.handleNullConnect} onClick={this.handleNullConnect}
@ -92,10 +99,6 @@ class LedgerNanoSDecryptClass extends PureComponent<Props, State> {
<div className={`LedgerDecrypt-error alert alert-danger ${showErr}`}>{error || '-'}</div> <div className={`LedgerDecrypt-error alert alert-danger ${showErr}`}>{error || '-'}</div>
{showTip && (
<p className="LedgerDecrypt-tip">{translate('LEDGER_TIP', { $network: network.unit })}</p>
)}
<div className="LedgerDecrypt-help"> <div className="LedgerDecrypt-help">
<NewTabLink href="https://support.ledgerwallet.com/hc/en-us/articles/115005200009"> <NewTabLink href="https://support.ledgerwallet.com/hc/en-us/articles/115005200009">
{translate('HELP_ARTICLE_1')} {translate('HELP_ARTICLE_1')}
@ -123,8 +126,7 @@ class LedgerNanoSDecryptClass extends PureComponent<Props, State> {
private handleConnect = (dPath: DPath) => { private handleConnect = (dPath: DPath) => {
this.setState({ this.setState({
isLoading: true, isLoading: true,
error: null, error: null
showTip: false
}); });
LedgerWallet.getChainCode(dPath.value) LedgerWallet.getChainCode(dPath.value)
@ -138,8 +140,7 @@ class LedgerNanoSDecryptClass extends PureComponent<Props, State> {
.catch(err => { .catch(err => {
this.setState({ this.setState({
error: err.message, error: err.message,
isLoading: false, isLoading: false
showTip: true
}); });
}); });
}; };

View File

@ -413,7 +413,9 @@
"OLD_MYCRYPTO": "MyCrypto (Legacy Site)", "OLD_MYCRYPTO": "MyCrypto (Legacy Site)",
"LEDGER_REFERRAL_1": "Buy a Ledger Wallet", "LEDGER_REFERRAL_1": "Buy a Ledger Wallet",
"LEDGER_REFERRAL_2": "Dont have a Ledger? Order one now!", "LEDGER_REFERRAL_2": "Dont have a Ledger? Order one now!",
"LEDGER_TIP": "**Tip:** Make sure you're logged into the $network app on your hardware wallet, and have enabled browser support in the settings", "LEDGER_TIP": "Make sure your Ledger is unlocked, you've selected the **$network** app on your hardware wallet, and browser support is **$browserSupportState**.",
"ENABLED": "enabled",
"DISABLED": "disabled",
"LEDGER_TIMEOUT": "The request timed out", "LEDGER_TIMEOUT": "The request timed out",
"LEDGER_WRONG_APP": "Wrong application selected on your device", "LEDGER_WRONG_APP": "Wrong application selected on your device",
"LEDGER_LOCKED": "Your Ledger device is locked", "LEDGER_LOCKED": "Your Ledger device is locked",