Skip to content

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

Merged
merged 1 commit into from
Aug 23, 2022

Conversation

J-Son89
Copy link
Contributor

@J-Son89 J-Son89 commented Aug 4, 2022

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

  • Android
  • iOS

Steps to test

Open app and go to quo2 components in settings menu

status: ready

@J-Son89 J-Son89 changed the title feat: add token tag component (status-im#13555) feat: add token overview component (status-im#13555) Aug 4, 2022
@status-im-auto
Copy link
Member

status-im-auto commented Aug 4, 2022

Jenkins Builds

Click to see older builds (21)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 8cc605c #1 2022-08-04 23:07:05 ~9 min android-e2e 📦apk 📲
✔️ 8cc605c #1 2022-08-04 23:07:39 ~9 min android 📦apk 📲
✔️ 8cc605c #1 2022-08-04 23:08:32 ~10 min ios 📦ipa 📲
✔️ 019bdc4 #2 2022-08-05 15:27:43 ~7 min android 📦apk 📲
✔️ 019bdc4 #2 2022-08-05 15:29:30 ~9 min android-e2e 📦apk 📲
✔️ 019bdc4 #2 2022-08-05 15:34:17 ~14 min ios 📦ipa 📲
✔️ 2ec47e2 #3 2022-08-09 08:50:54 ~7 min android-e2e 📦apk 📲
✔️ 2ec47e2 #3 2022-08-09 08:50:56 ~7 min android 📦apk 📲
✔️ 2ec47e2 #3 2022-08-09 08:53:41 ~10 min ios 📦ipa 📲
✔️ 8bd9c3c #4 2022-08-16 12:17:21 ~7 min android-e2e 📦apk 📲
✔️ 8bd9c3c #4 2022-08-16 12:17:59 ~7 min android 📦apk 📲
✔️ 8bd9c3c #4 2022-08-16 12:24:16 ~14 min ios 📦ipa 📲
✔️ ec81d66 #5 2022-08-22 09:09:16 ~9 min android 📦apk 📲
✔️ ec81d66 #5 2022-08-22 09:09:17 ~9 min android-e2e 📦apk 📲
✔️ ec81d66 #5 2022-08-22 09:12:37 ~12 min ios 📦ipa 📲
✔️ 146200b #6 2022-08-22 12:00:17 ~10 min android-e2e 📦apk 📲
✔️ 146200b #6 2022-08-22 12:01:20 ~11 min android 📦apk 📲
✔️ 146200b #6 2022-08-22 12:03:01 ~13 min ios 📦ipa 📲
✔️ b950959 #7 2022-08-23 08:32:32 ~7 min android-e2e 📦apk 📲
✔️ b950959 #7 2022-08-23 08:32:52 ~7 min android 📦apk 📲
✔️ b950959 #7 2022-08-23 08:38:43 ~13 min ios 📦ipa 📲
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 351c1ac #8 2022-08-23 14:25:57 ~7 min android-e2e 📦apk 📲
✔️ 351c1ac #8 2022-08-23 14:28:25 ~9 min android 📦apk 📲
✔️ 351c1ac #8 2022-08-23 14:31:51 ~12 min ios 📦ipa 📲
✔️ 12274a8 #9 2022-08-23 15:05:58 ~7 min android 📦apk 📲
✔️ 12274a8 #9 2022-08-23 15:06:04 ~7 min android-e2e 📦apk 📲
✔️ 12274a8 #9 2022-08-23 15:10:59 ~12 min ios 📦ipa 📲

@J-Son89 J-Son89 force-pushed the feat/token-overview branch 2 times, most recently from 019bdc4 to 2ec47e2 Compare August 9, 2022 08:42
@J-Son89 J-Son89 force-pushed the feat/token-overview branch 2 times, most recently from 8bd9c3c to ec81d66 Compare August 22, 2022 08:59
Copy link
Contributor

@cammellos cammellos left a 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)))
Copy link
Contributor

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))

Copy link
Contributor Author

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
Copy link
Contributor

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"]
Copy link
Contributor

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)

Copy link
Contributor Author

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)
Copy link
Contributor

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(zero? direction)
(pos? direction)

[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)})]
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the help :)

[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)})]]])))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

@J-Son89 J-Son89 force-pushed the feat/token-overview branch 4 times, most recently from d742586 to 351c1ac Compare August 23, 2022 14:18
@J-Son89 J-Son89 force-pushed the feat/token-overview branch from 351c1ac to 12274a8 Compare August 23, 2022 14:57
@siddarthkay siddarthkay merged commit 5377072 into develop Aug 23, 2022
@siddarthkay siddarthkay deleted the feat/token-overview branch August 23, 2022 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

UI Component - Token Overview
5 participants