Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[general]:Bug fixes in inbox,limit default,retryconnection,netWorth #91

Merged
merged 1 commit into from
Feb 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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