diff --git a/src/components/NetworkSwitchNotification.jsx b/src/components/NetworkSwitchNotification.jsx
new file mode 100644
index 0000000..a162919
--- /dev/null
+++ b/src/components/NetworkSwitchNotification.jsx
@@ -0,0 +1,29 @@
+import React, { Component } from 'react';
+
+class NetworkSwitchNotification extends Component {
+ render = () => {
+ return
+
+
You have switched Networks
+
+
+
+
+ You are now connected to the
+ {this.props.network} Ethereum Network
+
+
+
+
+ }
+}
+
+export default NetworkSwitchNotification;
diff --git a/src/components/SetTrade.jsx b/src/components/SetTrade.jsx
index 414a2bc..c3ee985 100644
--- a/src/components/SetTrade.jsx
+++ b/src/components/SetTrade.jsx
@@ -1,20 +1,22 @@
// Libraries
import React from "react";
-import {inject, observer} from "mobx-react";
+import { inject, observer } from "mobx-react";
import ReactTooltip from "react-tooltip";
// UI Components
-import {SwapArrows, IdentityIcon, Circle, Attention} from "../components-ui/Icons";
+import { SwapArrows, IdentityIcon, Circle, Attention } from "../components-ui/Icons";
import Spinner from "../components-ui/Spinner";
import TokenAmount from "../components-ui/TokenAmount";
import TokensSelector from "../components-ui/TokensSelector";
// Utils
-import {toWei} from "../utils/helpers";
+import { toWei } from "../utils/helpers";
// Settings
import * as settings from "../settings";
import NetworkIndicator from "./NetworkIndicator";
+import NetworkSwitchNotification from "./NetworkSwitchNotification";
+import { autorun } from "mobx";
@inject("network")
@inject("system")
@@ -103,7 +105,7 @@ class SetTrade extends React.Component {
const amountToBuy = this.amountBuy.value;
const whole = amountToBuy.split(".")[0];
const decimals = amountToBuy.split(".")[1];
- if (whole.length <=15 && (!decimals || (decimals && decimals.length <= 18))) { // 18 should be replaced with any token's decimals according to some sort of configuration
+ if (whole.length <= 15 && (!decimals || (decimals && decimals.length <= 18))) { // 18 should be replaced with any token's decimals according to some sort of configuration
this.props.system.calculatePayAmount(this.state.from, this.state.to, amountToBuy);
}
}
@@ -126,180 +128,195 @@ class SetTrade extends React.Component {
render() {
return (
- this.state.showTokenSelector
- ?
- this.setState({showTokenSelector: false})} />
- :
-
-
+
+ {
+ this.props.network.hasSwitched &&
+ }
+ {
+ this.state.showTokenSelector
+ ?
+ this.setState({showTokenSelector: false})}/>
+ :
+
+
-
+
-
Enter Order Details
-
+ Enter Order Details
+
-
-
-
- {
- this.props.system.trade.errorOrders && !this.props.system.trade.errorInputSell &&
-
+
+
+
+ {
+ this.props.system.trade.errorOrders && !this.props.system.trade.errorInputSell &&
+
No orders available to {this.props.system.trade.errorOrders.type}
- {this.props.system.trade.errorOrders.amount} {this.props.system.trade.errorOrders.token}
+ {this.props.system.trade.errorOrders.amount} {this.props.system.trade.errorOrders.token}
- }
- {
- this.props.system.trade.errorInputSell &&
- (
- this.props.system.trade.errorInputSell === "funds"
- ?
-
You don't have enough {this.props.tokens[this.props.system.trade.from].name} in your Wallet
- :
- this.props.system.trade.errorInputSell === "gasCost"
- ?
-
You won't have enough ETH to pay for the gas!
- :
-
+ }
+ {
+ this.props.system.trade.errorInputSell &&
+ (
+ this.props.system.trade.errorInputSell === "funds"
+ ?
+ You don't have enough {this.props.tokens[this.props.system.trade.from].name} in your Wallet
+ :
+ this.props.system.trade.errorInputSell === "gasCost"
+ ?
+ You won't have enough ETH to pay for the gas!
+ :
+
{this.props.tokens[this.props.system.trade.from].symbol}
- Minimum Value: {this.props.system.trade.errorInputSell.replace("minValue:", "")}
+ Minimum Value: {this.props.system.trade.errorInputSell.replace("minValue:", "")}
- )
- }
- {
- !this.props.system.trade.errorOrders && !this.props.system.trade.errorInputSell && this.props.system.trade.errorInputBuy &&
-
+ )
+ }
+ {
+ !this.props.system.trade.errorOrders && !this.props.system.trade.errorInputSell && this.props.system.trade.errorInputBuy &&
+
{this.props.tokens[this.props.system.trade.to].symbol}
- Minimum Value: {this.props.system.trade.errorInputBuy.replace("minValue:", "")}
+ Minimum Value: {this.props.system.trade.errorInputBuy.replace("minValue:", "")}
- }
- {
- !this.props.system.trade.errorOrders && !this.props.system.trade.errorInputSell && !this.props.system.trade.errorInputBuy &&
-
+ }
+ {
+ !this.props.system.trade.errorOrders && !this.props.system.trade.errorInputSell && !this.props.system.trade.errorInputBuy &&
+
Price
-
+
The estimated price of your order is calculated based on the current depth of the OasisDEX order book and the size of your order.
-
- ~
+
+ ~
-
+
Slippage Limit
-
+
The maximum allowed difference between the estimated price of the order and the actual price. The two may differ if the order book changes before your trade executes.
- {settings.chain[this.props.network.network].threshold[[this.state.from, this.state.to].sort((a, b) => a > b).join("")]}%
+ {settings.chain[this.props.network.network].threshold[[this.state.from, this.state.to].sort((a, b) => a > b).join("")]}%
-
+
Gas cost
- {
- this.props.system.trade.txCost.gt(0)
- ?
- ~
- :
-
- }
+ {
+ this.props.system.trade.txCost.gt(0)
+ ?
+ ~
+ :
+
+ }
-
+
Price Impact
-
+
The difference between the best current price on the OasisDEX order book and the estimated price of your order.
- 5 ? "#E53935" : ""}}
- className="value">{this.priceImpact()}%
+ 5 ? "#E53935" : ""}}
+ className="value">{this.priceImpact()}%
-
- }
-
-
-