diff --git a/CHANGELOG.md b/CHANGELOG.md index 04dda9b8..3dbfa0bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file. - Fixed the issue with minNotional - [#623](https://github.com/chrisleekr/binance-trading-bot/pull/623) - Add clear symbols button by [@TheSmuks](https://github.com/TheSmuks) - [#626](https://github.com/chrisleekr/binance-trading-bot/pull/626) - Improved customised setting details by [@rando128](https://github.com/rando128) - [#625](https://github.com/chrisleekr/binance-trading-bot/pull/625) +- Updated collapsable header UX by [@rando128](https://github.com/rando128) - [#624](https://github.com/chrisleekr/binance-trading-bot/pull/624) Thanks [@TheSmuks](https://github.com/TheSmuks) and [@rando128](https://github.com/rando128) for your great contributions. 💯 :heart: diff --git a/public/js/ProfitLossWrapper.js b/public/js/ProfitLossWrapper.js index 4fc4185b..fe92c787 100644 --- a/public/js/ProfitLossWrapper.js +++ b/public/js/ProfitLossWrapper.js @@ -9,6 +9,8 @@ class ProfitLossWrapper extends React.Component { symbols: {}, closedTradesLoading: false, closedTradesSetting: {}, + closedTradesOpened: window.innerWidth >= 826, + openedTradesOpened: window.innerWidth >= 826, selectedPeriod: null, selectedPeriodTZ: null, selectedPeriodLC: null @@ -17,6 +19,8 @@ class ProfitLossWrapper extends React.Component { this.setUpdate = this.setUpdate.bind(this); this.requestClosedTradesSetPeriod = this.requestClosedTradesSetPeriod.bind(this); + this.handleClosedTradesClick = this.handleClosedTradesClick.bind(this); + this.handleOpenedTradesClick = this.handleOpenedTradesClick.bind(this); } componentDidUpdate(nextProps) { @@ -79,6 +83,24 @@ class ProfitLossWrapper extends React.Component { } } + handleClosedTradesClick(event) { + const target = event.target.tagName.toLowerCase(); + if (target !== 'i' && target !== 'button') { + this.setState({ + closedTradesOpened: !this.state.closedTradesOpened + }); + } + } + + handleOpenedTradesClick(event) { + const target = event.target.tagName.toLowerCase(); + if (target !== 'i' && target !== 'button') { + this.setState({ + openedTradesOpened: !this.state.openedTradesOpened + }); + } + } + setUpdate(newStatus) { this.setState({ canUpdate: newStatus @@ -111,7 +133,13 @@ class ProfitLossWrapper extends React.Component { render() { const { sendWebSocket, isAuthenticated, closedTrades, totalProfitAndLoss } = this.props; - const { symbols, selectedPeriod, closedTradesLoading } = this.state; + const { + symbols, + selectedPeriod, + closedTradesLoading, + closedTradesOpened, + openedTradesOpened + } = this.state; if (_.isEmpty(totalProfitAndLoss)) { return ''; @@ -240,12 +268,15 @@ class ProfitLossWrapper extends React.Component { return (