chore: reorder seller wizard
This commit is contained in:
parent
b47fbd1e63
commit
3a6279056b
|
@ -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'}
|
||||
]}/>
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -71,7 +71,7 @@ class Contact extends Component {
|
|||
} else {
|
||||
this.setState({ statusContactCode: this.props.statusContactCode });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
if (!this.state.ready) {
|
||||
|
|
|
@ -20,9 +20,6 @@ class Asset extends Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (!this.props.seller.username) {
|
||||
return this.props.wizard.previous();
|
||||
}
|
||||
this.props.updateBalances();
|
||||
}
|
||||
|
||||
|
|
|
@ -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});
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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} />;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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}/>;
|
||||
|
|
Loading…
Reference in New Issue