Skip to content

Commit

Permalink
feat(SettingIcon): Add clear symbols button (chrisleekr#626)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSmuks authored May 3, 2023
1 parent d321990 commit 8a54f8d
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ All notable changes to this project will be documented in this file.

- Added the prefix to environment parameter for `TRADINGVIEW` related - [#616](https://github.com/chrisleekr/binance-trading-bot/pull/616)
- 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)

Thanks [@TheSmuks](https://github.com/TheSmuks) for your great contributions. 💯 :heart:

## [0.0.97] - 2023-03-21

Expand Down
17 changes: 17 additions & 0 deletions public/css/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,23 @@ input[type='number'] {
End: Dust Transfer
*/

/**
Start: Symbols selection
*/
.btn-clear-symbols {
background-color: #f84960;
color: white;
}

.btn-clear-symbols:hover {
box-shadow: none;
color: white;
background-color: #ff4265;
}
/**
End: Symbols selection
*/

/**
Start: Grid Trade
*/
Expand Down
26 changes: 26 additions & 0 deletions public/js/SettingIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class SettingIcon extends React.Component {
this.handleBotOptionsChange = this.handleBotOptionsChange.bind(this);

this.handleSetValidation = this.handleSetValidation.bind(this);
this.symbolsTypeaheadRef = React.createRef();
}

getQuoteAssets(
Expand Down Expand Up @@ -259,6 +260,12 @@ class SettingIcon extends React.Component {

configuration.symbols = selected;

this.handleSetValidation('symbols', true);

if (_.isEmpty(configuration.symbols)) {
this.handleSetValidation('symbols', false);
}

const {
quoteAssets,
minNotionals,
Expand All @@ -278,6 +285,7 @@ class SettingIcon extends React.Component {
minNotionals
});
}}
ref={this.symbolsTypeaheadRef}
size='sm'
options={_.keys(exchangeSymbols)}
renderMenuItemChildren={(
Expand Down Expand Up @@ -315,10 +323,28 @@ class SettingIcon extends React.Component {
)}
defaultSelected={selectedSymbols}
placeholder='Choose symbols to monitor...'
isInvalid={
_.get(validation, `symbols`, true) === false
}
/>
</Form.Group>
</div>
</div>
<div className='row'>
<div className='col-12 text-right'>
<button
type='button'
className='btn btn-sm btn-clear-symbols'
onClick={e => {
e.preventDefault();
this.symbolsTypeaheadRef.current.clear();
const { configuration } = this.state;
configuration.symbols = [];
}}>
Clear selection
</button>
</div>
</div>
</Card.Body>
</Accordion.Collapse>
</Card>
Expand Down

0 comments on commit 8a54f8d

Please sign in to comment.