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
Fix Issue #691 - Flash on Price Change #870
Conversation
Added Los Angeles API Node
merge staging
fix merge issue
- Store previous change state w/ timestamp - Pulsate with Up/Down flashing colors
Still to do:
|
@@ -58,12 +59,40 @@ class MarketGroup extends React.Component { | |||
return ( | |||
!utils.are_equal_shallow(nextState, this.state) || | |||
!utils.are_equal_shallow(nextProps.markets, this.props.markets) || | |||
nextState.marketsCache !== this.state.marketsCache || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will always return true, use utils.are_equal_shallow to compare arrays or objects.
…nto tianyekuo-staging
* modifiying table padding and borders * test * adding sorting by date * fixing to merge * fixing to merge
Fix invalid td coloring
…es-ui into 691_FlashOnPriceChange
@@ -252,6 +278,9 @@ class AccountOverview extends React.Component { | |||
const canDepositWithdraw = !!this.props.backedCoins.get("OPEN", []).find(a => a.symbol === asset.get("symbol")); | |||
const canWithdraw = canDepositWithdraw && (hasBalance && balanceObject.get("balance") != 0); | |||
const canBuy = !!this.props.bridgeCoins.get(symbol); | |||
const changeClass = !marketsCache[asset.get("id")] ? "" : marketsCache[asset.get("id")][1] == 0 ? "" : marketsCache[asset.get("id")][1] < 0 ? marketsCache[asset.get("id")][2] ? "pulsate-down" : "change-down" : marketsCache[asset.get("id")][2] ? "pulsate-up" : "change-up"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this line does what you think it does. The syntax is incorrect (too many : parts like here: ? "pulsate-down" : "change-down" : marketsCache[asset.get("id")][2]
) and marketsCache[asset.get("id")][1] is a string so you should parse it before comparing it to 0.
|
||
case "change": | ||
let change = utils.format_number(stats && stats.change ? stats.change : 0, 2); | ||
let changeClass = change === "0.00" ? "" : change > 0 ? flash ? " pulsate-up" : " change-up" : flash ? " pulsate-down" : " change-down"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The syntax is incorrect here as well.
} | ||
|
||
let change_on_price = utils.format_number(stats && stats.change ? stats.change : 0, 2); | ||
let changeClass_on_price = change_on_price === "0.00" ? "" : change_on_price > 0 ? flash ? " pulsate-up" : " change-up" : flash ? " pulsate-down" : " change-down"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here
} | ||
|
||
marketsCache[id][0] = timestamp; | ||
marketsCache[id][1] = change; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend using parseFloat here for the change value.
marketsCache[id] = [timestamp, "0.00", false]; | ||
} | ||
|
||
if(change != marketsCache[id][1] && marketsCache[id][1] != "0.00") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parsing as float below means you can use !== 0
here. In general you should always use strict equalities.
let marketChangeValue = this.getValue(); | ||
let dayChangeClass = parseFloat(marketChangeValue) === 0 ? "" : parseFloat(marketChangeValue) < 0 ? "change-down" : "change-up"; | ||
let dayChangeClass = parseFloat(marketChangeValue) === 0 ? "" : parseFloat(marketChangeValue) < 0 ? flash ? "pulsate-down" : "change-down" : flash ? "pulsate-up" : "change-up"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This syntax is also incorrect.
I will rework this in a new branch and make a new PR once completed. |
Proposal for Issue #691
Not sure if this is the most efficient model, but it works when I try it.