townhall: Compare numbers

This commit is contained in:
Łukasz Magiera 2019-11-10 23:07:54 +01:00
parent 55247b366c
commit 35b44f08c4

View File

@ -36,6 +36,8 @@ class App extends React.Component {
console.log(ev) console.log(ev)
let update = JSON.parse(ev.data) let update = JSON.parse(ev.data)
update.Update.Weight = Number(update.Update.Weight)
let wdiff = update.Update.Weight - (this.state[update.From] || {Weight: update.Update.Weight}).Weight let wdiff = update.Update.Weight - (this.state[update.From] || {Weight: update.Update.Weight}).Weight
wdiff = <span style={{color: wdiff < 0 ? '#f00' : '#f0f0f0'}}>{wdiff}</span> wdiff = <span style={{color: wdiff < 0 ? '#f00' : '#f0f0f0'}}>{wdiff}</span>