2019-06-24 13:35:01 -04:00
|
|
|
const bindAll = require('lodash.bindall');
|
|
|
|
const defaults = require('lodash.defaultsdeep');
|
2019-06-24 11:31:16 -04:00
|
|
|
const PropTypes = require('prop-types');
|
|
|
|
const React = require('react');
|
|
|
|
|
|
|
|
const injectIntl = require('../../lib/intl.jsx').injectIntl;
|
|
|
|
const intlShape = require('../../lib/intl.jsx').intlShape;
|
|
|
|
|
2019-07-10 21:49:04 -04:00
|
|
|
const Progression = require('../progression/progression.jsx');
|
2019-07-18 20:39:16 -04:00
|
|
|
const UsernameStep = require('./username-step.jsx');
|
|
|
|
const BirthDateStep = require('./birthdate-step.jsx');
|
2019-07-23 21:21:16 -04:00
|
|
|
const GenderStep = require('./gender-step.jsx');
|
2019-08-08 00:26:17 -04:00
|
|
|
const CountryStep = require('./country-step.jsx');
|
2019-07-29 22:29:04 -04:00
|
|
|
const EmailStep = require('./email-step.jsx');
|
|
|
|
const WelcomeStep = require('./welcome-step.jsx');
|
2019-06-24 13:35:01 -04:00
|
|
|
|
2019-06-24 11:31:16 -04:00
|
|
|
/*
|
|
|
|
eslint-disable react/prefer-stateless-function, react/no-unused-prop-types, no-useless-constructor
|
|
|
|
*/
|
|
|
|
class JoinFlow extends React.Component {
|
|
|
|
constructor (props) {
|
|
|
|
super(props);
|
2019-06-24 13:35:01 -04:00
|
|
|
bindAll(this, [
|
|
|
|
'handleAdvanceStep'
|
|
|
|
]);
|
2019-07-10 21:49:04 -04:00
|
|
|
this.state = {
|
|
|
|
formData: {},
|
|
|
|
registrationError: null,
|
|
|
|
step: 0
|
|
|
|
};
|
2019-06-24 13:35:01 -04:00
|
|
|
}
|
|
|
|
handleAdvanceStep (formData) {
|
|
|
|
formData = formData || {};
|
|
|
|
this.setState({
|
|
|
|
step: this.state.step + 1,
|
|
|
|
formData: defaults({}, formData, this.state.formData)
|
|
|
|
});
|
2019-06-24 11:31:16 -04:00
|
|
|
}
|
|
|
|
render () {
|
|
|
|
return (
|
2019-06-24 13:35:01 -04:00
|
|
|
<React.Fragment>
|
2019-07-10 21:49:04 -04:00
|
|
|
<Progression step={this.state.step}>
|
2019-07-18 20:39:16 -04:00
|
|
|
<UsernameStep onNextStep={this.handleAdvanceStep} />
|
|
|
|
<BirthDateStep onNextStep={this.handleAdvanceStep} />
|
2019-07-23 21:21:16 -04:00
|
|
|
<GenderStep onNextStep={this.handleAdvanceStep} />
|
2019-08-08 00:26:17 -04:00
|
|
|
<CountryStep onNextStep={this.handleAdvanceStep} />
|
2019-07-29 22:29:04 -04:00
|
|
|
<EmailStep onNextStep={this.handleAdvanceStep} />
|
|
|
|
<WelcomeStep
|
2019-08-01 16:27:54 -04:00
|
|
|
email={this.state.formData.email}
|
2019-07-29 22:29:04 -04:00
|
|
|
username={this.state.formData.username}
|
|
|
|
onNextStep={this.handleAdvanceStep}
|
|
|
|
/>
|
2019-07-10 21:49:04 -04:00
|
|
|
</Progression>
|
2019-06-24 13:35:01 -04:00
|
|
|
</React.Fragment>
|
2019-06-24 11:31:16 -04:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
JoinFlow.propTypes = {
|
|
|
|
intl: intlShape,
|
|
|
|
onCompleteRegistration: PropTypes.func
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = injectIntl(JoinFlow);
|
|
|
|
|
|
|
|
/*
|
|
|
|
eslint-enable
|
|
|
|
*/
|