@binary-com/smartcharts
Advanced tools
Comparing version 0.2.6 to 0.2.7
@@ -5,3 +5,3 @@ | ||
messageCallback = null; | ||
removeByCategoryCallback=null | ||
removeByCategoryCallback = null; | ||
@@ -8,0 +8,0 @@ notify(message) { |
@@ -99,3 +99,3 @@ import { // eslint-disable-line import/no-extraneous-dependencies,import/no-unresolved | ||
this.notifier.removeByCategory('activesymbol'); | ||
console.log('Symbol has changed to:', symbol); | ||
this.setState({ symbol }); | ||
}; | ||
@@ -113,22 +113,23 @@ | ||
renderTopWidgets = () => ( | ||
<React.Fragment> | ||
<ChartTitle onChange={this.symbolChange} /> | ||
<AssetInformation /> | ||
<ComparisonList /> | ||
<Notification | ||
notifier={this.notifier} | ||
/> | ||
</React.Fragment> | ||
); | ||
render() { | ||
const { settings, isConnectionOpened } = this.state; | ||
const { settings, isConnectionOpened, symbol } = this.state; | ||
const renderTopWidgets = () => ( | ||
<React.Fragment> | ||
<ChartTitle /> | ||
<AssetInformation /> | ||
<ComparisonList /> | ||
<Notification | ||
notifier={this.notifier} | ||
/> | ||
</React.Fragment> | ||
); | ||
return ( | ||
<SmartChart | ||
symbol={symbol} | ||
onMessage={e => this.notifier.notify(e)} | ||
isMobile={CIQ.isMobile} | ||
enableRouting | ||
topWidgets={renderTopWidgets} | ||
topWidgets={this.renderTopWidgets} | ||
chartControlsWidgets={renderControls} | ||
@@ -135,0 +136,0 @@ requestAPI={requestAPI} |
@@ -13,25 +13,20 @@ import React from 'react'; | ||
onMessage = (message, duration = 10) => { | ||
const messages = this.state.messages; | ||
message.id = (new Date()).getTime(); | ||
message.type = message.type || 'warning'; | ||
message.hide = false; | ||
const msg = { | ||
type: 'warning', | ||
...message, | ||
id: new Date().getTime(), | ||
hide: false, | ||
}; | ||
messages.push(message); | ||
this.setState({ | ||
messages, | ||
}); | ||
this.setState(prevState => ({ messages: prevState.messages.concat([msg]) })); | ||
if (duration > 0) { | ||
setTimeout(() => this.onRemove(message.id), duration * 1000); | ||
setTimeout(() => this.onRemove(msg.id), duration * 1000); | ||
} | ||
} | ||
}; | ||
onRemove(id) { | ||
let messages = this.state.messages.map((x) => { | ||
x.hide = x.id === id ? true : x.hide; | ||
return x; | ||
}); | ||
this.setState({ | ||
messages, | ||
}); | ||
this.setState(prevState => ({ | ||
messages: prevState.messages.map(message => ({ ...message, hide: message.id === id ? true : message.hide })), | ||
})); | ||
@@ -44,6 +39,5 @@ /** | ||
setTimeout(() => { | ||
messages = messages.filter(x => x.id !== id); | ||
this.setState({ | ||
messages, | ||
}); | ||
this.setState(prevState => ({ | ||
messages: prevState.messages.filter(x => x.id !== id), | ||
})); | ||
}, 300); | ||
@@ -64,3 +58,3 @@ } | ||
}); | ||
} | ||
}; | ||
@@ -67,0 +61,0 @@ render() { |
{ | ||
"name": "@binary-com/smartcharts", | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"main": "dist/smartcharts.js", | ||
@@ -5,0 +5,0 @@ "author": "amin@binary.com", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3370019
19885