Skip to content

Commit

Permalink
display negative price delta with opposite color to make it clearly v…
Browse files Browse the repository at this point in the history
…isible in UI
  • Loading branch information
norwnd committed Dec 29, 2024
1 parent 40896f7 commit f8a9d34
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion client/webserver/site/src/js/markets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3440,7 +3440,7 @@ class OrderTableRowManager {
page.rate.innerText = 'market'
this.redrawOrderRowEl()
} else {
const colorSellOrBuy = this.isSell() ? 'sellcolor' : 'buycolor'
let colorSellOrBuy = this.isSell() ? 'sellcolor' : 'buycolor'

page.rate.innerText = Doc.formatRateAtomToRateStep(this.msgRate, baseUnitInfo, quoteUnitInfo, rateStepAtom)
page.rate.classList.add(colorSellOrBuy)
Expand Down Expand Up @@ -3474,6 +3474,11 @@ class OrderTableRowManager {
if (priceDelta < 9.94) {
priceDeltaFormatted = `(${Doc.formatOneDecimalPrecision(priceDelta)}%)`
}
// invert price delta color in case order row is on the other side of "where it should be"
// compared to external price - to make it clearly visible in UI
if (priceDelta < 0.0) {
colorSellOrBuy = this.isSell() ? 'buycolor' : 'sellcolor'
}
}
page.rateDelta.innerText = priceDeltaFormatted
page.rateDelta.classList.add(colorSellOrBuy)
Expand Down

0 comments on commit f8a9d34

Please sign in to comment.