-
Notifications
You must be signed in to change notification settings - Fork 992
feat: add token overview component (status-im#13555) #13767
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
Conversation
Jenkins BuildsClick to see older builds (21)
|
019bdc4
to
2ec47e2
Compare
8bd9c3c
to
ec81d66
Compare
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.
Looks good, just some style comments
(def container-style {:display :flex :width "100%" :padding-left 20 :padding-right 20 :padding-top 12 :padding-bottom 12}) | ||
|
||
(defn price-direction [price-change increase decrease neutral] | ||
(if (> price-change 0) increase (if (< price-change 0) decrease neutral))) |
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.
Cond is better I think, a bit clearer
(cond
(> price-change 0) increase
(< price-change 0) decrease
:else neutral))
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.
oh yeah 😅 . thanks! :)
:background-color (price-direction direction colors/success-50-opa-40 colors/danger-50-opa-40 colors/divider-light)}}]) | ||
|
||
(defn get-direction [percentage-change] | ||
(if (= (js/parseInt percentage-change) 0) 0 |
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.
(if (zero? (js/parseInt percentage-change))
....
(let [direction (get-direction percentage-change)] | ||
[rn/view {:style container-style} | ||
[text/text {:number-of-lines 1 | ||
:size :paragraph-2} "Token Price"] |
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.
use labels for i18n
(i18n/label :token-price)
and then you can add them to translations/en.json
(only English is enough)
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.
Cool, sounds good :)
:size :heading-2} (str (get-in currencies/currencies [currency :symbol]) price)] | ||
|
||
[rn/view {:style {:display :flex :flex-direction :row :margin-top 6 :align-items :center}} | ||
(when (not (= direction 0)) [icons/icon (if (>= direction 0) :main-icons2/price-increase12 :main-icons2/price-decrease12) |
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.
(zero? direction)
:style {:height 32 | ||
:width 32}}]] | ||
[rn/view {:style {:display :flex :flex-direction :row :margin-top 6 :align-items :center}} | ||
(when (not (= direction 0)) [icons/icon (if (> direction 0) :main-icons2/price-increase12 :main-icons2/price-decrease12) |
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.
(zero? direction)
(pos? direction)
src/quo2/screens/token_overview.cljs
Outdated
[rn/view {:border :black | ||
:border-width 1 | ||
:align-items :center} | ||
[quo2/token-balance (merge @state {:token-img-src (if (= (:token @state) "ETH") eth-token snt-token)})] |
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.
merge
is used mostly when you have a map as the second parameter, not a finite set of known keys.
In that case you can use assoc
.
In your case:
(assoc @state :token-img-src (if ....))
But it's multivariadic, so you can also use it to assoc
multiple keys, for example
(assoc some-map :a 1 :b 2)
, equivalent to (merge some-map {:a 1 :b 2})
, but clearer and probably a tad faster.
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.
thanks for the help :)
src/quo2/screens/token_overview.cljs
Outdated
[quo2/token-balance (merge @state {:token-img-src (if (= (:token @state) "ETH") eth-token snt-token)})] | ||
[rn/view {:padding-vertical 25 | ||
:align-items :center}] | ||
[quo2/token-price (merge @state {:token-img-src (if (= (:token @state) "ETH") eth-token snt-token)})]]]))) |
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.
Same as above
d742586
to
351c1ac
Compare
351c1ac
to
12274a8
Compare
fixes #13555
Summary
Implemented token overview component. implemented as two separate components, one for token account total and for token price. Can easily be grouped into one component if needed but current use case in wallet designs have these being used independently -> https://www.figma.com/file/Q92CTbwanXZwSWrHWKfJqS/Wallet-for-Mobile?node-id=0%3A1
Platforms
Steps to test
Open app and go to quo2 components in settings menu
status: ready