Skip to content

Commit

Permalink
[general]:Bug fixes in inbox,limit default,retryconnection,netWorth (#91
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ishanisri authored and akspi committed Feb 15, 2019
1 parent b7832ea commit 22fe660
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
30 changes: 20 additions & 10 deletions public/src/components/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ export class Main extends React.Component<MainProps, MainState> {
stockDetails: [],
latestTransaction: new Transaction_pb,
networkTimeOut: moment(),
networkTimeOutCounterNotifs: 2,
networkTimeOutCounterTrans: 2,
networkTimeOutCounterPrices: 2,
networkTimeOutCounterNotifs: 1,
networkTimeOutCounterTrans: 1,
networkTimeOutCounterPrices: 1,
successCounter: 0,
connectionStatus: true,
};
Expand Down Expand Up @@ -142,9 +142,9 @@ export class Main extends React.Component<MainProps, MainState> {
this.setState({
networkTimeOut: moment(),
successCounter: 0,
networkTimeOutCounterNotifs: 2,
networkTimeOutCounterTrans: 2,
networkTimeOutCounterPrices: 2,
networkTimeOutCounterNotifs: 1,
networkTimeOutCounterTrans: 1,
networkTimeOutCounterPrices: 1,
connectionStatus: true,
});
} else {
Expand Down Expand Up @@ -187,7 +187,7 @@ export class Main extends React.Component<MainProps, MainState> {
let counter = this.getStreamCounter(flag);
if(counter != -1 && counter <= 3600)
{
counter = counter * 2;
counter = counter * 1.24;
this.setStreamCounter(flag,counter);
const endtime = moment();
if(endtime.diff(this.state.networkTimeOut) >= 20000)
Expand All @@ -196,8 +196,9 @@ export class Main extends React.Component<MainProps, MainState> {
networkTimeOut: moment(),
});
PNotify.removeAll();
showErrorNotif("Unable to connect to server. Please check your internet connection. Retrying in " + (counter) + "s", "Network error");
}

showErrorNotif("Unable to connect to server. Please check your internet connection. Retrying in " + (Math.round(counter)) + "s", "Network error");
}
setTimeout(func,counter*1000);
}
}
Expand All @@ -210,6 +211,16 @@ export class Main extends React.Component<MainProps, MainState> {
notifReq.setCount(10);
try {
const notifs = await DalalActionService.getNotifications(notifReq, sessionMd);
if(notifs.getNotificationsList().length === 0){
let blankNotif : Notification_pb = new Notification_pb;
blankNotif.setText("Nothing new here");
let blankNotifList = this.state.notifications;
blankNotifList[0] = blankNotif;
this.setState({
notifications:blankNotifList
});
}
else
this.setState({
notifications: notifs.getNotificationsList()
});
Expand Down Expand Up @@ -412,7 +423,6 @@ export class Main extends React.Component<MainProps, MainState> {
//and hence react's history wont be changing ie
//pushing to path in App cannot be retrieved by Route exact path
//because the history for react will not have those changes reflected

if (!this.state.isMarketOpen) {
$("#market-close-modal").modal({
closable:false,
Expand Down
3 changes: 2 additions & 1 deletion public/src/components/common/TinyNetworth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export class TinyNetworth extends React.Component<TinyNetworthProps, {}> {
render() {
const stockWorth = this.props.userTotal - this.props.userCash;
const stockWorthClass = stockWorth >= 0 ? "green" : "red";
const netWorthClass = this.props.userTotal >= 0 ? "green" : "red";
const connection = this.props.connectionStatus == true ? "Connected" : "Disconnected";
const connectionStatusClass = this.props.connectionStatus == true ? "green" : "red";
return (
Expand All @@ -45,7 +46,7 @@ export class TinyNetworth extends React.Component<TinyNetworthProps, {}> {
</h3>
</div>
<div className="ui five wide column box" data-content="Your net worth">
<h3 className="ui center aligned green header inverted">
<h3 className={"ui center aligned " + netWorthClass + " header inverted"}>
<i className="database icon very small"></i>
{addCommas(this.props.userTotal)}
</h3>
Expand Down
4 changes: 2 additions & 2 deletions public/src/components/trading_terminal/PlaceOrderBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class PlaceOrderBox extends React.Component<PlaceOrderBoxProps, {}> {
<a className="item" data-tab="stoploss">Stoploss</a>
<h3 className="panel-header item right">Place Order</h3>
</div>
<div className="ui tab inverted active" data-tab="market">
<div className="ui tab inverted " data-tab="market">
<div className="ui top attached tabular menu inverted place-order-box-menu">
<a className="active item green" data-tab="market/buy">BUY</a>
<a className="item red" data-tab="market/sell">SELL</a>
Expand Down Expand Up @@ -153,7 +153,7 @@ export class PlaceOrderBox extends React.Component<PlaceOrderBoxProps, {}> {
</div>
</div>
</div>
<div className="ui tab inverted" data-tab="limit">
<div className="ui tab inverted active" data-tab="limit">
<div className="ui top attached tabular menu inverted place-order-box-menu">
<a className="item active green" data-tab="limit/buy">BUY</a>
<a className="item red" data-tab="limit/sell">SELL</a>
Expand Down

0 comments on commit 22fe660

Please sign in to comment.