@@ -2,14 +2,14 @@ import PropTypes from 'prop-types'
22import React , { Component } from 'react'
33import { bindActionCreators } from 'redux'
44import { connect } from 'react-redux'
5- import { Person } from 'blockstack'
5+ import { config , Person } from 'blockstack'
66import Modal from 'react-modal'
77import SecondaryNavBar from '@components/SecondaryNavBar'
88import Alert from '@components/Alert'
99import IdentityItem from './components/IdentityItem'
1010import InputGroup from '@components/InputGroup'
1111import { IdentityActions } from './store/identity'
12- import { AccountActions } from '../account/store/account'
12+ import { AccountActions } from '../account/store/account'
1313
1414import log4js from 'log4js'
1515
@@ -29,7 +29,10 @@ function mapStateToProps(state) {
2929}
3030
3131function mapDispatchToProps ( dispatch ) {
32- return bindActionCreators ( Object . assign ( { } , IdentityActions , AccountActions ) , dispatch )
32+ return bindActionCreators (
33+ Object . assign ( { } , IdentityActions , AccountActions ) ,
34+ dispatch
35+ )
3336}
3437
3538class AllProfilesPage extends Component {
@@ -60,9 +63,10 @@ class AllProfilesPage extends Component {
6063
6164 componentWillMount ( ) {
6265 logger . info ( 'componentWillMount' )
63- this . props . refreshIdentities (
64- this . props . api ,
65- this . props . identityAddresses )
66+ this . props . refreshIdentities ( this . props . api , this . props . identityAddresses )
67+ config . network . getBlockHeight ( ) . then ( currentBlockHeight => {
68+ this . setState ( { currentBlockHeight } )
69+ } )
6670 }
6771
6872 componentWillReceiveProps ( nextProps ) {
@@ -82,17 +86,17 @@ class AllProfilesPage extends Component {
8286 }
8387 }
8488
85- onValueChange = ( event ) => {
89+ onValueChange = event => {
8690 this . setState ( {
8791 [ event . target . name ] : event . target . value
8892 } )
8993 }
9094
91- setDefaultIdentity = ( index ) => {
95+ setDefaultIdentity = index => {
9296 this . props . setDefaultIdentity ( index )
9397 }
9498
95- createNewProfile = ( event ) => {
99+ createNewProfile = event => {
96100 logger . info ( 'createNewProfile' )
97101 event . preventDefault ( )
98102
@@ -103,20 +107,21 @@ class AllProfilesPage extends Component {
103107
104108 this . props . createNewProfile (
105109 encryptedBackupPhrase ,
106- password , nextUnusedAddressIndex
110+ password ,
111+ nextUnusedAddressIndex
107112 )
108113 }
109114 }
110115
111- openPasswordPrompt = ( event ) => {
116+ openPasswordPrompt = event => {
112117 event . preventDefault ( )
113118 this . props . resetCreateNewProfileError ( )
114119 this . setState ( {
115120 passwordPromptIsOpen : true
116121 } )
117122 }
118123
119- closePasswordPrompt = ( event ) => {
124+ closePasswordPrompt = event => {
120125 if ( event ) {
121126 event . preventDefault ( )
122127 }
@@ -145,13 +150,17 @@ class AllProfilesPage extends Component {
145150 className = "container-fluid"
146151 >
147152 < form onSubmit = { this . createNewProfile } >
148- < h3 className = "modal-heading" > Enter your password to add another Blockstack ID</ h3 >
153+ < h3 className = "modal-heading" >
154+ Enter your password to add another Blockstack ID
155+ </ h3 >
149156 < div >
150- { createProfileError ?
151- < Alert key = "1" message = "Incorrect password" status = "danger" />
152- :
153- null
154- }
157+ { createProfileError ? (
158+ < Alert
159+ key = "1"
160+ message = "Incorrect password"
161+ status = "danger"
162+ />
163+ ) : null }
155164 </ div >
156165 < InputGroup
157166 name = "password"
@@ -167,11 +176,11 @@ class AllProfilesPage extends Component {
167176 type = "submit"
168177 disabled = { this . props . isProcessing }
169178 >
170- { this . props . isProcessing ?
179+ { this . props . isProcessing ? (
171180 < span > Processing...</ span >
172- :
181+ ) : (
173182 < span > Add another ID</ span >
174- }
183+ ) }
175184 </ button >
176185 </ form >
177186 </ Modal >
@@ -182,33 +191,35 @@ class AllProfilesPage extends Component {
182191 < div className = "m-t-40" >
183192 < div className = "container-fluid" >
184193 < ul className = "card-wrapper" >
185- { this . state . localIdentities . map ( ( identity , index ) => {
186- const person = new Person ( identity . profile )
187-
188- if ( identity . username ) {
189- identity . canAddUsername = false
190- } else {
191- identity . canAddUsername = true
192- }
193- return (
194- < IdentityItem
195- key = { index }
196- index = { index }
197- username = { identity . username }
198- pending = { identity . usernamePending }
199- avatarUrl = { person . avatarUrl ( ) || '' }
200- onClick = { ( event ) => {
201- event . preventDefault ( )
202- this . setDefaultIdentity ( index )
203- } }
204- ownerAddress = { identity . ownerAddress }
205- canAddUsername = { identity . canAddUsername }
206- isDefault = { index === this . props . defaultIdentity }
207- router = { this . props . router }
208- profileUrl = { `${ profileUrlBase } /${ index } /profile.json` }
209- />
210- )
211- } ) }
194+ { this . state . localIdentities . map ( ( identity , index ) => {
195+ const person = new Person ( identity . profile )
196+
197+ if ( identity . username ) {
198+ identity . canAddUsername = false
199+ } else {
200+ identity . canAddUsername = true
201+ }
202+ return (
203+ < IdentityItem
204+ key = { index }
205+ index = { index }
206+ username = { identity . username }
207+ pending = { identity . usernamePending }
208+ avatarUrl = { person . avatarUrl ( ) || '' }
209+ onClick = { event => {
210+ event . preventDefault ( )
211+ this . setDefaultIdentity ( index )
212+ } }
213+ ownerAddress = { identity . ownerAddress }
214+ canAddUsername = { identity . canAddUsername }
215+ expireBlock = { identity . expireBlock }
216+ isDefault = { index === this . props . defaultIdentity }
217+ router = { this . props . router }
218+ profileUrl = { `${ profileUrlBase } /${ index } /profile.json` }
219+ currentBlockHeight = { this . state . currentBlockHeight }
220+ />
221+ )
222+ } ) }
212223 </ ul >
213224 </ div >
214225 < div className = "container-fluid" >
@@ -224,8 +235,9 @@ class AllProfilesPage extends Component {
224235 </ div >
225236 < div className = "row m-t-20" >
226237 < p className = "col form-text text-muted" >
227- Have you recovered and are missing IDs? Just add them
228- back by using the "Add another ID" for each ID.
238+ Are you missing IDs after restoring the browser? Use
239+ { ' ' } < em > Add another ID</ em > { ' ' }
240+ for each ID you want to add back.
229241 </ p >
230242 </ div >
231243 </ div >
@@ -235,4 +247,7 @@ class AllProfilesPage extends Component {
235247 }
236248}
237249
238- export default connect ( mapStateToProps , mapDispatchToProps ) ( AllProfilesPage )
250+ export default connect (
251+ mapStateToProps ,
252+ mapDispatchToProps
253+ ) ( AllProfilesPage )
0 commit comments