-
Notifications
You must be signed in to change notification settings - Fork 312
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1845 from CityOfZion/feature/watch-address
feature: adds watch only address (part I)
- Loading branch information
Showing
7 changed files
with
106 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// @flow | ||
import React from 'react' | ||
|
||
import Button from '../../components/Button' | ||
import LoginIcon from '../../assets/icons/login.svg' | ||
import styles from '../Home/Home.scss' | ||
import TextInput from '../../components/Inputs/TextInput' | ||
|
||
type Props = { | ||
watchOnlyLogin: (content: string) => void, | ||
} | ||
|
||
type State = { | ||
address: string, | ||
} | ||
|
||
export default class LoginPrivateKey extends React.Component<Props, State> { | ||
state = { | ||
address: '', | ||
} | ||
|
||
render = () => { | ||
const { watchOnlyLogin } = this.props | ||
const { address } = this.state | ||
|
||
return ( | ||
<div id="loginPrivateKey" className={styles.flexContainer}> | ||
<form | ||
onSubmit={e => { | ||
e.preventDefault() | ||
watchOnlyLogin(address) | ||
}} | ||
> | ||
<React.Fragment> | ||
<div className={styles.centeredInput}> | ||
<TextInput | ||
textInputClassName={styles.privateKeyInput} | ||
placeholder="Enter a public key here" | ||
value={address} | ||
onChange={(e: Object) => | ||
this.setState({ address: e.target.value }) | ||
} | ||
autoFocus | ||
/> | ||
</div> | ||
<div className={styles.privateKeyLoginButtonRow}> | ||
<Button | ||
id="loginButton" | ||
primary | ||
type="submit" | ||
renderIcon={LoginIcon} | ||
disabled={address.length < 10} | ||
> | ||
Login | ||
</Button> | ||
</div> | ||
</React.Fragment> | ||
</form> | ||
</div> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// @flow | ||
import { compose } from 'recompose' | ||
import { withActions, withProgress } from 'spunky' | ||
|
||
import LoginWatchOnly from './LoginWatchOnly' | ||
import withFailureNotification from '../../hocs/withFailureNotification' | ||
import { watchOnlyLoginActions } from '../../actions/authActions' | ||
|
||
const mapActionsToProps = actions => ({ | ||
watchOnlyLogin: address => actions.call({ address }), | ||
}) | ||
|
||
export default compose( | ||
withActions(watchOnlyLoginActions, mapActionsToProps), | ||
withFailureNotification(watchOnlyLoginActions), | ||
withProgress(watchOnlyLoginActions), | ||
)(LoginWatchOnly) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters