chore: reorder seller wizard

This commit is contained in:
Jonathan Rainville 2019-08-01 13:26:02 -04:00
parent b47fbd1e63
commit 3a6279056b
No known key found for this signature in database
GPG Key ID: 5F4630B759727D9C
8 changed files with 37 additions and 29 deletions

View File

@ -168,12 +168,12 @@ class App extends Component {
{this.props.isLicenseOwner &&
<Wizard path="/sell/" steps={[
{path: '/sell/location', component: SellLocation},
{path: '/sell/contact', component: SellContact},
{path: '/sell/asset', component: SellAsset},
{path: '/sell/payment-methods', component: SellPaymentMethods},
{path: '/sell/arbitrator', component: SellArbitrator},
{path: '/sell/currency', component: SellCurrency},
{path: '/sell/location', component: SellLocation},
{path: '/sell/contact', component: SellContact},
{path: '/sell/arbitrator', component: SellArbitrator},
{path: '/sell/margin', component: SellMargin},
{path: '/sell/limits', component: SellLimits, nextLabel: 'Post the offer'}
]}/>

View File

@ -20,6 +20,12 @@ class Location extends Component {
});
}
componentDidMount() {
if (!this.props.seller.currency) {
return this.props.wizard.previous();
}
}
validate(location) {
if (location) {
this.props.footer.enableNext();

View File

@ -71,7 +71,7 @@ class Contact extends Component {
} else {
this.setState({ statusContactCode: this.props.statusContactCode });
}
}
};
render() {
if (!this.state.ready) {

View File

@ -20,9 +20,6 @@ class Asset extends Component {
}
componentDidMount() {
if (!this.props.seller.username) {
return this.props.wizard.previous();
}
this.props.updateBalances();
}

View File

@ -38,7 +38,7 @@ class SelectArbitrator extends Component {
}
componentDidMount() {
if (!this.props.seller.paymentMethods.length) {
if (!this.props.seller.username) {
return this.props.wizard.previous();
}
this.setState({ready: true});

View File

@ -22,11 +22,10 @@ class Currency extends Component {
}
componentDidMount() {
if (!this.props.seller.arbitrator) {
this.props.wizard.previous();
} else {
this.setState({ready: true});
if (!this.props.seller.paymentMethods.length) {
return this.props.wizard.previous();
}
this.setState({ready: true});
}
validate(currency) {

View File

@ -27,13 +27,11 @@ class Margin extends Component {
}
componentDidMount() {
this.validate(this.props.seller.margin);
if (!this.props.seller.currency) {
this.props.wizard.previous();
} else {
this.setState({ready: true});
if (!this.props.seller.arbitrator) {
return this.props.wizard.previous();
}
this.validate(this.props.seller.margin);
this.setState({ready: true});
}
validate(margin) {
@ -63,7 +61,7 @@ class Margin extends Component {
margin={this.state.margin}
marginChange={this.marginChange}
feeMilliPercent={this.props.feeMilliPercent} />;
}
}

View File

@ -18,12 +18,17 @@ class Limits extends Component {
this.state = {
limitL: props.seller.limitL,
limitU: props.seller.limitU,
useCustomLimits: props.seller.useCustomLimits
useCustomLimits: props.seller.useCustomLimits,
ready: false
};
this.validate(props.seller.useCustomLimits, props.seller.limitL, props.seller.limitU);
}
componentDidMount(){
componentDidMount() {
if (isNaN(this.props.seller.margin)) {
return this.props.wizard.previous();
}
this.setState({ready: true});
this.offerCreated = false;
this.props.footer.onNext(this.postOffer);
}
@ -51,25 +56,25 @@ class Limits extends Component {
this.props.resetAddOfferStatus();
this.props.footer.onNext(this.postOffer);
this.props.footer.show();
}
};
validate(useCustomLimits, limitL, limitU) {
this.props.footer.enableNext();
limitL = limitL || 0;
limitU = limitU || 0;
if(useCustomLimits){
if((limitL > limitU) || (limitL === 0 && limitU === 0)){
if (useCustomLimits) {
if ((limitL > limitU) || (limitL === 0 && limitU === 0)) {
return this.props.footer.disableNext();
}
}
this.props.footer.enableNext();
}
customLimitsChange = (useCustomLimits) => {
this.validate(useCustomLimits, this.state.limitL, this.state.limitU);
this.setState({useCustomLimits});
}
this.setState({useCustomLimits}, () => {
this.validate(useCustomLimits, this.state.limitL, this.state.limitU);
});
};
limitChange = (limitL, limitU) => {
limitL = parseInt(limitL, 10);
@ -85,6 +90,9 @@ class Limits extends Component {
};
render() {
if (!this.state.ready) {
return <Loading page/>;
}
switch(this.props.addOfferStatus){
case States.pending:
return <Loading mining txHash={this.props.txHash}/>;