Skip to content

Commit d295db0

Browse files
committed
Add sell order warning
1 parent f1f7eaa commit d295db0

File tree

1 file changed

+64
-2
lines changed

1 file changed

+64
-2
lines changed

js/main-unminified.js

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124441,6 +124441,44 @@
124441124441
)
124442124442
);
124443124443
return (
124444+
(alertify.sellInCrossWarning ||
124445+
alertify.dialog(
124446+
'sellInCrossWarning',
124447+
function() {
124448+
return {
124449+
build: function() {
124450+
this.setHeader(
124451+
'<div><i class="fa fa-exclamation-triangle fa-2x" style="color: rgb(230,162,38);"></i> Confirm your order</div>'
124452+
);
124453+
},
124454+
setup: function() {
124455+
return {
124456+
buttons: [
124457+
{
124458+
text: 'Yes, place order',
124459+
className: 'btn btn-default',
124460+
},
124461+
{
124462+
text: 'Cancel',
124463+
className: 'btn btn-default',
124464+
invokeOnClose: !0,
124465+
scope:'auxiliary',
124466+
},
124467+
],
124468+
focus: { element: 1 },
124469+
options: {
124470+
movable: !1,
124471+
resizable: !1,
124472+
pinnable: !1,
124473+
maximizable: !1,
124474+
},
124475+
};
124476+
},
124477+
};
124478+
},
124479+
!0,
124480+
'alert'
124481+
)),
124444124482
props.store.subscribe(function() {
124445124483
var state = props.store.getState();
124446124484
_this.setState({
@@ -124449,13 +124487,36 @@
124449124487
orders: state.orders,
124450124488
});
124451124489
}),
124452-
(_this.state = { sellTotal: '', sellInCross: void 0 }),
124490+
(_this.state = { sellTotal: '', sellInCross: void 0, bestBuyPrice: void 0 }),
124453124491
(_this.self = props.self),
124454124492
(_this.order = props.order),
124455124493
(_this.orderClick = function() {
124456124494
var amount = _this.refs.sellAmount.value,
124457124495
price = _this.refs.sellPrice.value,
124458124496
expires = _this.refs.sellExpires.value;
124497+
_this.state.sellInCross ?
124498+
alertify
124499+
.sellInCrossWarning(
124500+
"<p>"
124501+
+ "You will receive <strong>" + price + " " + _this.state.selectedBase.name + " per " + _this.state.selectedToken.name + "</strong>. "
124502+
+ "This price is <strong style='color:red;'>" + (_this.state.bestBuyPrice / price).toFixed(1) + " times lower</strong> than current best price for " + _this.state.selectedToken.name + ".<br/><br/>"
124503+
+ "Do you still want to place the order?</p>"
124504+
)
124505+
.set({
124506+
onok: function(e) {
124507+
console.log(e);
124508+
0 === e.index &&
124509+
_this.order.call(
124510+
_this.self,
124511+
_this.state.selectedToken.addr,
124512+
_this.state.selectedBase.addr,
124513+
'sell',
124514+
amount,
124515+
price,
124516+
expires
124517+
);
124518+
},
124519+
}) :
124459124520
_this.order.call(
124460124521
_this.self,
124461124522
_this.state.selectedToken.addr,
@@ -124486,8 +124547,9 @@
124486124547
'Your order is in cross with the best buy order in the order book (price = ' +
124487124548
bestBuy +
124488124549
').',
124550+
bestBuyPrice: bestBuy
124489124551
})
124490-
: _this.setState({ sellInCross: void 0 });
124552+
: _this.setState({ sellInCross: void 0, bestBuyPrice: void 0 });
124491124553
}
124492124554
}),
124493124555
_this

0 commit comments

Comments
 (0)