aboutsummaryrefslogtreecommitdiffstats
path: root/mascara
diff options
context:
space:
mode:
authorChi Kei Chan <chikeichan@gmail.com>2017-10-04 06:08:21 +0800
committerChi Kei Chan <chikeichan@gmail.com>2017-10-21 12:51:37 +0800
commit63a5eca967ef5a305bf1823018445c642cad784b (patch)
tree2ebffcd482ba7ae7db76012069e103fe5134782d /mascara
parent25f4f69706b705b1bc9ef23e8c2c02c5d0dbd23b (diff)
downloadtangerine-wallet-browser-63a5eca967ef5a305bf1823018445c642cad784b.tar
tangerine-wallet-browser-63a5eca967ef5a305bf1823018445c642cad784b.tar.gz
tangerine-wallet-browser-63a5eca967ef5a305bf1823018445c642cad784b.tar.bz2
tangerine-wallet-browser-63a5eca967ef5a305bf1823018445c642cad784b.tar.lz
tangerine-wallet-browser-63a5eca967ef5a305bf1823018445c642cad784b.tar.xz
tangerine-wallet-browser-63a5eca967ef5a305bf1823018445c642cad784b.tar.zst
tangerine-wallet-browser-63a5eca967ef5a305bf1823018445c642cad784b.zip
Fix import
Diffstat (limited to 'mascara')
-rw-r--r--mascara/src/app/first-time/import-account-screen.js52
1 files changed, 31 insertions, 21 deletions
diff --git a/mascara/src/app/first-time/import-account-screen.js b/mascara/src/app/first-time/import-account-screen.js
index 944d8d544..bf8e209e4 100644
--- a/mascara/src/app/first-time/import-account-screen.js
+++ b/mascara/src/app/first-time/import-account-screen.js
@@ -1,5 +1,5 @@
import React, {Component, PropTypes} from 'react'
-import {connect} from 'react-redux';
+import {connect} from 'react-redux'
import classnames from 'classnames'
import LoadingScreen from './loading-screen'
import {importNewAccount, hideWarning} from '../../../../ui/app/actions'
@@ -11,7 +11,7 @@ const Input = ({ label, placeholder, onChange, errorMessage, type = 'text' }) =>
type={type}
placeholder={placeholder}
className={classnames('first-time-flow__input import-account__input', {
- 'first-time-flow__input--error': errorMessage
+ 'first-time-flow__input--error': errorMessage,
})}
onChange={onChange}
/>
@@ -19,6 +19,14 @@ const Input = ({ label, placeholder, onChange, errorMessage, type = 'text' }) =>
</div>
)
+Input.prototype.propTypes = {
+ label: PropTypes.string.isRequired,
+ placeholder: PropTypes.string.isRequired,
+ type: PropTypes.string.isRequired,
+ errorMessage: PropTypes.string.isRequired,
+ onChange: PropTypes.func.isRequired,
+}
+
class ImportAccountScreen extends Component {
static OPTIONS = {
PRIVATE_KEY: 'private_key',
@@ -31,6 +39,7 @@ class ImportAccountScreen extends Component {
next: PropTypes.func.isRequired,
importNewAccount: PropTypes.func.isRequired,
hideWarning: PropTypes.func.isRequired,
+ isLoading: PropTypes.bool.isRequired,
};
state = {
@@ -39,9 +48,9 @@ class ImportAccountScreen extends Component {
jsonFile: {},
}
- isValid() {
- const { OPTIONS } = ImportAccountScreen;
- const { privateKey, jsonFile, password } = this.state;
+ isValid () {
+ const { OPTIONS } = ImportAccountScreen
+ const { privateKey, jsonFile, password } = this.state
switch (this.state.selectedOption) {
case OPTIONS.JSON_FILE:
@@ -53,9 +62,9 @@ class ImportAccountScreen extends Component {
}
onClick = () => {
- const { OPTIONS } = ImportAccountScreen;
- const { importNewAccount, next } = this.props;
- const { privateKey, jsonFile, password } = this.state;
+ const { OPTIONS } = ImportAccountScreen
+ const { importNewAccount, next } = this.props
+ const { privateKey, jsonFile, password } = this.state
switch (this.state.selectedOption) {
case OPTIONS.JSON_FILE:
@@ -68,18 +77,18 @@ class ImportAccountScreen extends Component {
}
}
- renderPrivateKey() {
+ renderPrivateKey () {
return Input({
label: 'Add Private Key String',
placeholder: 'Enter private key',
onChange: e => this.setState({ privateKey: e.target.value }),
- errorMessage: this.props.warning && 'Something went wrong. Please make sure your private key is correct.'
+ errorMessage: this.props.warning && 'Something went wrong. Please make sure your private key is correct.',
})
}
- renderJsonFile() {
- const { jsonFile: { name } } = this.state;
- const { warning } = this.props;
+ renderJsonFile () {
+ const { jsonFile: { name } } = this.state
+ const { warning } = this.props
return (
<div className="">
@@ -95,7 +104,7 @@ class ImportAccountScreen extends Component {
<label
htmlFor="file"
className={classnames('import-account__file-input-label', {
- 'import-account__file-input-label--error': warning
+ 'import-account__file-input-label--error': warning,
})}
>
Choose File
@@ -111,14 +120,14 @@ class ImportAccountScreen extends Component {
placeholder: 'Enter Password',
type: 'password',
onChange: e => this.setState({ password: e.target.value }),
- errorMessage: warning && 'Please make sure your password is correct.'
+ errorMessage: warning && 'Please make sure your password is correct.',
})}
</div>
)
}
- renderContent() {
- const { OPTIONS } = ImportAccountScreen;
+ renderContent () {
+ const { OPTIONS } = ImportAccountScreen
switch (this.state.selectedOption) {
case OPTIONS.JSON_FILE:
@@ -129,11 +138,11 @@ class ImportAccountScreen extends Component {
}
}
- render() {
- const { OPTIONS } = ImportAccountScreen;
- const { selectedOption } = this.state;
+ render () {
+ const { OPTIONS } = ImportAccountScreen
+ const { selectedOption } = this.state
- return isLoading
+ return this.props.isLoading
? <LoadingScreen loadingMessage="Creating your new account" />
: (
<div className="import-account">
@@ -175,6 +184,7 @@ class ImportAccountScreen extends Component {
<a
href="https://github.com/MetaMask/faq/blob/master/README.md#q-i-cant-use-the-import-feature-for-uploading-a-json-file-the-window-keeps-closing-when-i-try-to-select-a-file"
className="first-time-flow__link import-account__faq-link"
+ rel="noopener noreferrer"
target="_blank"
>
File import not working?