Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Commit 4d5d148

Browse files
committed
Ensure correct status label
1 parent 3997850 commit 4d5d148

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

src/botPage/view/TradeInfoPanel/ClearButton.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export default class ClearButton extends React.PureComponent {
1111
componentDidMount() {
1212
globalObserver.register('summary.enable_clear', () => this.setState({ isButtonDisabled: false }));
1313
globalObserver.register('summary.disable_clear', () => this.setState({ isButtonDisabled: true }));
14-
globalObserver.register('bot.running', () => this.setState({ isButtonDisabled: true }));
1514
}
1615
// eslint-disable-next-line class-methods-use-this
1716
confirmClearLog() {

src/botPage/view/TradeInfoPanel/index.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ const activateStage = index => {
2727
};
2828

2929
class AnimateTrade extends Component {
30+
componentDidUpdate(prevProps, prevState) {
31+
console.log({ prevState, state: this.state });
32+
}
3033
constructor() {
3134
super();
3235
this.indicatorMessages = {
@@ -42,6 +45,12 @@ class AnimateTrade extends Component {
4245
};
4346
}
4447
componentWillMount() {
48+
const resetSummary = () => {
49+
resetAnimation();
50+
this.setState({ indicatorMessage: this.indicatorMessages.notRunning });
51+
};
52+
globalObserver.register('reset_animation', resetSummary);
53+
globalObserver.register('summary.clear', resetSummary);
4554
globalObserver.register('bot.running', () => {
4655
$('.stage-tooltip.top:eq(0)').addClass('running');
4756
this.setState({ indicatorMessage: this.indicatorMessages.running });
@@ -50,40 +59,31 @@ class AnimateTrade extends Component {
5059
$('.stage-tooltip.top:eq(0)').removeClass('running');
5160
this.setState({ indicatorMessage: this.indicatorMessages.stopped });
5261
});
53-
globalObserver.register('reset_animation', () => {
54-
resetAnimation();
55-
this.setState({ indicatorMessage: this.indicatorMessages.stopped });
56-
});
57-
5862
$('#stopButton').click(() => {
5963
$('.stage-tooltip.top:eq(0)').removeClass('running');
60-
this.setState({ indicatorMessage: this.state.stopMessage });
64+
this.setState({
65+
indicatorMessage: globalObserver.getState('isRunning')
66+
? this.indicatorMessages.stopping
67+
: this.indicatorMessages.stopped,
68+
});
6169
});
62-
6370
$('#runButton').click(() => {
6471
resetAnimation();
6572
$('.stage-tooltip.top:eq(0)').addClass('running');
66-
this.setState({
67-
indicatorMessage: this.indicatorMessages.starting,
68-
stopMessage : this.indicatorMessages.stopped,
69-
});
73+
this.setState({ indicatorMessage: this.indicatorMessages.starting });
7074
globalObserver.emit('summary.disable_clear');
71-
globalObserver.register('contract.status', contractStatus => {
72-
this.animateStage(contractStatus);
73-
});
75+
globalObserver.register('contract.status', contractStatus => this.animateStage(contractStatus));
7476
});
7577
}
7678
animateStage(contractStatus) {
7779
if (contractStatus.id === 'contract.purchase_sent') {
7880
resetAnimation();
7981
activateStage(0);
80-
8182
this.setState({
8283
buy_price: roundBalance({
8384
balance : contractStatus.proposal.ask_price,
8485
currency: contractStatus.currency,
8586
}),
86-
stopMessage: this.indicatorMessages.stopping,
8787
});
8888
} else if (contractStatus.id === 'contract.purchase_recieved') {
8989
$('.line').addClass('active');
@@ -92,7 +92,7 @@ class AnimateTrade extends Component {
9292
} else if (contractStatus.id === 'contract.sold') {
9393
$('.line').addClass('complete');
9494
activateStage(2);
95-
this.setState({ sell_id: contractStatus.data, stopMessage: this.indicatorMessages.stopped });
95+
this.setState({ sell_id: contractStatus.data });
9696
}
9797

9898
activateStage(contractStatus.id);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy