Page MenuHomePhabricator

[Cashtab] Add toggle switch to show Agora prices in XEC or fiat
ClosedPublic

Authored by bytesofman on Mon, Dec 23, 14:34.

Details

Summary

T3711

In general, fiat prices can be more "intuitive." However in practice this is not often the case for Agora spot prices, which may be something like $0.000017 USD per token.

Add a toggle switch to make it easy to switch.

The Switch component is updated to typescript while we are at it. Needed to do this to troubleshoot behavior of "hit switch on one component, toggles it on a different one". This ended up being related to Switch needing a unique name. Important React caveat to keep in mind when rendering 100s of components...especially when they all can spend money.

Test Plan

npm test

fiat

image.png (534×341 px, 52 KB)

xec

image.png (534×341 px, 51 KB)

Diff Detail

Repository
rABC Bitcoin ABC
Branch
spot-price-xec-toggle
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 31746
Build 62986: Build Diffcashtab-tests
Build 62985: arc lint + arc unit

Event Timeline

emack added a subscriber: emack.
emack added inline comments.
cashtab/src/components/Agora/OrderBook/index.tsx
831

so this is the param that determines whether getFormattedFiatPrice spits out a formatted Fiat or XEC price? I mean it works, just that the function name seems to indicate only formatting to fiat.

842
This revision is now accepted and ready to land.Tue, Dec 24, 01:09
bytesofman added inline comments.
cashtab/src/components/Agora/OrderBook/index.tsx
831

The function is designed to show prices in fiat, if fiat is available

Cashtab behavior is that fiatPrice is null if we do not have the price from the API

There are a few agora components using it this way -- i.e. to intentionally show the XEC price by directly passing null

It should be improved so that this usage is not so bootleg -- will get to it as I get into these various agora improvements