-
Notifications
You must be signed in to change notification settings - Fork 54
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 #80 from JincorTech/feature/issue-77
Feature/issue 77
- Loading branch information
Showing
8 changed files
with
149 additions
and
74 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,41 @@ | ||
import React from 'react'; | ||
import { connect } from 'react-redux'; | ||
import s from './styles.css'; | ||
|
||
import Alert from '../../../components/app/Alert'; | ||
|
||
const AuthWrapper = (props) => { | ||
const { children, step } = props; | ||
|
||
const renderAlert = () => { | ||
if (step === 'wallet') { | ||
return ( | ||
<Alert> | ||
Save this information in a secure place. | ||
The access to your funds will be irrecoverable in case you lose it. | ||
</Alert> | ||
); | ||
} | ||
|
||
return null; | ||
}; | ||
|
||
return ( | ||
<div className={s.wrapper}> | ||
{renderAlert()} | ||
<div className={s.form}> | ||
<div className={s.logo}> | ||
<img src={require('../../../assets/images/logo.svg')}/> | ||
</div> | ||
|
||
<div className={s.body}> | ||
{children} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default connect((state) => ({ | ||
step: state.auth.signUp.step | ||
}))(AuthWrapper); |
File renamed without changes.
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 |
---|---|---|
@@ -1,66 +1,98 @@ | ||
import React from 'react'; | ||
import React, { Component } from 'react'; | ||
import { connect } from 'react-redux'; | ||
|
||
import { signUp, confirmEmail, endSignup } from '../../../redux/modules/auth/signUp'; | ||
import { | ||
signUp, | ||
confirmEmail, | ||
endSignup, | ||
changeStep, | ||
setActivationData | ||
} from '../../../redux/modules/auth/signUp'; | ||
|
||
import SignUpForm from '../../../components/auth/SignUpForm'; | ||
import ConfirmEmailForm from '../../../components/auth/ConfirmEmailForm'; | ||
import WalletData from '../../../components/auth/WalletData'; | ||
|
||
const SignUp = (props) => { | ||
const { | ||
step, | ||
spinner, | ||
verificationId, | ||
email, | ||
accessToken, | ||
wallets, | ||
params: { | ||
referralCode | ||
}, | ||
endSignup | ||
} = props; | ||
class SignUp extends Component { | ||
componentWillMount() { | ||
const { | ||
location: { | ||
query | ||
}, | ||
changeStep, | ||
setActivationData | ||
} = this.props; | ||
|
||
const renderStep = (currentStep) => { | ||
switch (currentStep) { | ||
case 'signup': | ||
return ( | ||
<SignUpForm | ||
spinner={spinner} | ||
onSubmit={signUp} | ||
referralCode={referralCode}/> | ||
); | ||
if (query.type === 'activate') { | ||
setActivationData({ | ||
email: query.email, | ||
verificationId: query.verificationId, | ||
code: query.code | ||
}); | ||
|
||
case 'pin': | ||
return ( | ||
<ConfirmEmailForm | ||
spinner={spinner} | ||
onSubmit={confirmEmail} | ||
email={email} | ||
verificationId={verificationId}/> | ||
); | ||
changeStep('pin'); | ||
} | ||
} | ||
|
||
case 'wallet': | ||
return ( | ||
<WalletData | ||
accessToken={accessToken} | ||
wallets={wallets} | ||
endSignup={endSignup}/> | ||
); | ||
render() { | ||
const { | ||
step, | ||
spinner, | ||
verificationId, | ||
email, | ||
accessToken, | ||
wallets, | ||
code, | ||
params: { | ||
referralCode | ||
}, | ||
endSignup | ||
} = this.props; | ||
|
||
default: | ||
return <div>Something went wrong</div>; | ||
} | ||
}; | ||
const renderStep = (currentStep) => { | ||
switch (currentStep) { | ||
case 'signup': | ||
return ( | ||
<SignUpForm | ||
spinner={spinner} | ||
onSubmit={signUp} | ||
referralCode={referralCode}/> | ||
); | ||
|
||
case 'pin': | ||
return ( | ||
<ConfirmEmailForm | ||
code={code} | ||
spinner={spinner} | ||
onSubmit={confirmEmail} | ||
email={email} | ||
verificationId={verificationId}/> | ||
); | ||
|
||
return renderStep(step); | ||
}; | ||
case 'wallet': | ||
return ( | ||
<WalletData | ||
accessToken={accessToken} | ||
wallets={wallets} | ||
endSignup={endSignup}/> | ||
); | ||
|
||
default: | ||
return <div>Something went wrong</div>; | ||
} | ||
}; | ||
|
||
return renderStep(step); | ||
} | ||
} | ||
|
||
export default connect( | ||
(state) => ({ | ||
...state.auth.signUp | ||
}), | ||
{ | ||
endSignup | ||
endSignup, | ||
changeStep, | ||
setActivationData | ||
} | ||
)(SignUp); |
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