parent
4e446410eb
commit
e1497fafa6
@ -1,46 +1,92 @@ |
||||
import React, {Component, PropTypes} from 'react' |
||||
import {connect} from 'react-redux'; |
||||
import {createNewVaultAndKeychain} from '../../../../ui/app/actions' |
||||
import LoadingScreen from './loading-screen' |
||||
import Breadcrumbs from './breadcrumbs' |
||||
|
||||
export default class CreatePasswordScreen extends Component { |
||||
class CreatePasswordScreen extends Component { |
||||
static propTypes = { |
||||
isLoading: PropTypes.bool.isRequired, |
||||
createAccount: PropTypes.func.isRequired, |
||||
next: PropTypes.func.isRequired |
||||
} |
||||
|
||||
state = { |
||||
password: '', |
||||
confirmPassword: '' |
||||
} |
||||
|
||||
isValid() { |
||||
const {password, confirmPassword} = this.state; |
||||
|
||||
if (!password || !confirmPassword) { |
||||
return false; |
||||
} |
||||
|
||||
if (password.length < 8) { |
||||
return false; |
||||
} |
||||
|
||||
return password === confirmPassword; |
||||
} |
||||
|
||||
createAccount = () => { |
||||
if (!this.isValid()) { |
||||
return; |
||||
} |
||||
|
||||
const {password} = this.state; |
||||
const {createAccount, next} = this.props; |
||||
|
||||
createAccount(password) |
||||
.then(next); |
||||
} |
||||
|
||||
render() { |
||||
return ( |
||||
<div className="create-password"> |
||||
<div className="create-password__title"> |
||||
Create Password |
||||
const { isLoading } = this.props |
||||
|
||||
return isLoading |
||||
? <LoadingScreen loadingMessage="Creating your new account" /> |
||||
: ( |
||||
<div className="create-password"> |
||||
<div className="create-password__title"> |
||||
Create Password |
||||
</div> |
||||
<input |
||||
className="first-time-flow__input" |
||||
type="password" |
||||
placeholder="New Password (min 8 characters)" |
||||
onChange={e => this.setState({password: e.target.value})} |
||||
/> |
||||
<input |
||||
className="first-time-flow__input create-password__confirm-input" |
||||
type="password" |
||||
placeholder="Confirm Password" |
||||
onChange={e => this.setState({confirmPassword: e.target.value})} |
||||
/> |
||||
<button |
||||
className="first-time-flow__button" |
||||
disabled={!this.isValid()} |
||||
onClick={this.createAccount} |
||||
> |
||||
Create |
||||
</button> |
||||
<a |
||||
href="" |
||||
className="first-time-flow__link create-password__import-link" |
||||
onClick={e => e.preventDefault()} |
||||
> |
||||
Import an account |
||||
</a> |
||||
<Breadcrumbs total={3} currentIndex={0} /> |
||||
</div> |
||||
<input |
||||
className="first-time-flow__input" |
||||
type="password" |
||||
placeholder="New Password (min 8 characters)" |
||||
onChange={e => this.setState({password: e.target.value})} |
||||
/> |
||||
<input |
||||
className="first-time-flow__input create-password__confirm-input" |
||||
type="password" |
||||
placeholder="Confirm Password" |
||||
onChange={e => this.setState({confirmPassword: e.target.value})} |
||||
/> |
||||
<button |
||||
className="first-time-flow__button" |
||||
> |
||||
Create |
||||
</button> |
||||
<a |
||||
href="" |
||||
className="first-time-flow__link create-password__import-link" |
||||
onClick={e => e.preventDefault()} |
||||
> |
||||
Import an account |
||||
</a> |
||||
<Breadcrumbs total={3} currentIndex={0} /> |
||||
</div> |
||||
) |
||||
) |
||||
} |
||||
} |
||||
|
||||
} |
||||
export default connect( |
||||
({ appState: { isLoading } }) => ({ isLoading }), |
||||
dispatch => ({ |
||||
createAccount: password => dispatch(createNewVaultAndKeychain(password)) |
||||
}) |
||||
)(CreatePasswordScreen) |
||||
|
@ -0,0 +1,11 @@ |
||||
import React, {Component, PropTypes} from 'react' |
||||
import Spinner from './Spinner' |
||||
|
||||
export default function LoadingScreen({ className = '', loadingMessage }) { |
||||
return ( |
||||
<div className={`${className} loading-screen`}> |
||||
<Spinner color="#1B344D" /> |
||||
<div className="loading-screen__message">{loadingMessage}</div> |
||||
</div> |
||||
); |
||||
} |
@ -0,0 +1,70 @@ |
||||
import React from 'react'; |
||||
|
||||
export default function Spinner({ className = '', color = "#000000" }) { |
||||
return ( |
||||
<div className={`spinner ${className}`}> |
||||
<svg className="lds-spinner" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" style={{background: 'none'}}> |
||||
<g transform="rotate(0 50 50)"> |
||||
<rect x={47} y={16} rx={0} ry={0} width={6} height={20} fill={color}> |
||||
<animate attributeName="opacity" values="1;0" dur="1s" begin="-0.9166666666666666s" repeatCount="indefinite" /> |
||||
</rect> |
||||
</g> |
||||
<g transform="rotate(30 50 50)"> |
||||
<rect x={47} y={16} rx={0} ry={0} width={6} height={20} fill={color}> |
||||
<animate attributeName="opacity" values="1;0" dur="1s" begin="-0.8333333333333334s" repeatCount="indefinite" /> |
||||
</rect> |
||||
</g> |
||||
<g transform="rotate(60 50 50)"> |
||||
<rect x={47} y={16} rx={0} ry={0} width={6} height={20} fill={color}> |
||||
<animate attributeName="opacity" values="1;0" dur="1s" begin="-0.75s" repeatCount="indefinite" /> |
||||
</rect> |
||||
</g> |
||||
<g transform="rotate(90 50 50)"> |
||||
<rect x={47} y={16} rx={0} ry={0} width={6} height={20} fill={color}> |
||||
<animate attributeName="opacity" values="1;0" dur="1s" begin="-0.6666666666666666s" repeatCount="indefinite" /> |
||||
</rect> |
||||
</g> |
||||
<g transform="rotate(120 50 50)"> |
||||
<rect x={47} y={16} rx={0} ry={0} width={6} height={20} fill={color}> |
||||
<animate attributeName="opacity" values="1;0" dur="1s" begin="-0.5833333333333334s" repeatCount="indefinite" /> |
||||
</rect> |
||||
</g> |
||||
<g transform="rotate(150 50 50)"> |
||||
<rect x={47} y={16} rx={0} ry={0} width={6} height={20} fill={color}> |
||||
<animate attributeName="opacity" values="1;0" dur="1s" begin="-0.5s" repeatCount="indefinite" /> |
||||
</rect> |
||||
</g> |
||||
<g transform="rotate(180 50 50)"> |
||||
<rect x={47} y={16} rx={0} ry={0} width={6} height={20} fill={color}> |
||||
<animate attributeName="opacity" values="1;0" dur="1s" begin="-0.4166666666666667s" repeatCount="indefinite" /> |
||||
</rect> |
||||
</g> |
||||
<g transform="rotate(210 50 50)"> |
||||
<rect x={47} y={16} rx={0} ry={0} width={6} height={20} fill={color}> |
||||
<animate attributeName="opacity" values="1;0" dur="1s" begin="-0.3333333333333333s" repeatCount="indefinite" /> |
||||
</rect> |
||||
</g> |
||||
<g transform="rotate(240 50 50)"> |
||||
<rect x={47} y={16} rx={0} ry={0} width={6} height={20} fill={color}> |
||||
<animate attributeName="opacity" values="1;0" dur="1s" begin="-0.25s" repeatCount="indefinite" /> |
||||
</rect> |
||||
</g> |
||||
<g transform="rotate(270 50 50)"> |
||||
<rect x={47} y={16} rx={0} ry={0} width={6} height={20} fill={color}> |
||||
<animate attributeName="opacity" values="1;0" dur="1s" begin="-0.16666666666666666s" repeatCount="indefinite" /> |
||||
</rect> |
||||
</g> |
||||
<g transform="rotate(300 50 50)"> |
||||
<rect x={47} y={16} rx={0} ry={0} width={6} height={20} fill={color}> |
||||
<animate attributeName="opacity" values="1;0" dur="1s" begin="-0.08333333333333333s" repeatCount="indefinite" /> |
||||
</rect> |
||||
</g> |
||||
<g transform="rotate(330 50 50)"> |
||||
<rect x={47} y={16} rx={0} ry={0} width={6} height={20} fill={color}> |
||||
<animate attributeName="opacity" values="1;0" dur="1s" begin="0s" repeatCount="indefinite" /> |
||||
</rect> |
||||
</g> |
||||
</svg> |
||||
</div> |
||||
); |
||||
} |
@ -0,0 +1,40 @@ |
||||
import React, {Component, PropTypes} from 'react' |
||||
import {connect} from 'react-redux'; |
||||
import Identicon from '../../../../ui/app/components/identicon' |
||||
import Breadcrumbs from './breadcrumbs' |
||||
|
||||
class UniqueImageScreen extends Component { |
||||
static propTypes = { |
||||
address: PropTypes.string.isRequired, |
||||
next: PropTypes.func.isRequired |
||||
} |
||||
|
||||
render() { |
||||
return ( |
||||
<div className="unique-image"> |
||||
<Identicon address={this.props.address} diameter={70} /> |
||||
<div className="unique-image__title">You unique account image</div> |
||||
<div className="unique-image__body-text"> |
||||
This image was programmatically generated for you by your new account number. |
||||
</div> |
||||
<div className="unique-image__body-text"> |
||||
You’ll see this image everytime you need to confirm a transaction. |
||||
</div> |
||||
<button |
||||
className="first-time-flow__button" |
||||
onClick={this.props.next} |
||||
> |
||||
Next |
||||
</button> |
||||
<Breadcrumbs total={3} currentIndex={1} /> |
||||
</div> |
||||
) |
||||
} |
||||
} |
||||
|
||||
export default connect( |
||||
({ metamask: { identities } }) => ({ |
||||
address: Object.entries(identities) |
||||
.map(([key]) => key)[0] |
||||
}) |
||||
)(UniqueImageScreen) |
Loading…
Reference in new issue