Skip to content
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

Implement account_card and variants #16801

Merged
merged 4 commits into from
Aug 1, 2023
Merged

Conversation

FFFra
Copy link
Contributor

@FFFra FFFra commented Jul 27, 2023

fixes #16028

Summary

This PR enhances the wallet accounts functionality, with all variants (Default, Add-account, Watch-only, and Empty) with a dynamic preview mode. It supports both light and dark modes, includes comprehensive unit tests, and aligns with the provided design specifications. Please refer to the attached demo for a practical demonstration. Feedback and suggestions are most welcome.

Tests

All tests should run correctly

Platforms

  • Android
  • iOS
Functional
  • wallet/transactions

Steps to test

Please navigate to "Profile and Quo.2.0 Preview" and locate the component under "Wallet/account-card."

Demo light mode

1-Light-Simulator.Screen.Recording.-.iPhone.11.Pro.-.2023-07-28.at.18.20.18.mp4

Demo dark mode

2-Simulator.Screen.Recording.-.iPhone.11.Pro.-.2023-07-28.at.18.24.06.mp4

@status-im-auto
Copy link
Member

status-im-auto commented Jul 27, 2023

Jenkins Builds

Click to see older builds (37)
Commit #️⃣ Finished (UTC) Duration Platform Result
2ee5801 #1 2023-07-27 17:27:25 ~2 min tests 📄log
✔️ 2ee5801 #1 2023-07-27 17:30:51 ~6 min android 🤖apk 📲
✔️ 2ee5801 #1 2023-07-27 17:31:01 ~6 min android-e2e 🤖apk 📲
✔️ 2ee5801 #1 2023-07-27 17:32:02 ~7 min ios 📱ipa 📲
5569564 #2 2023-07-28 18:06:30 ~2 min tests 📄log
✔️ 5569564 #2 2023-07-28 18:09:15 ~5 min android 🤖apk 📲
✔️ 5569564 #2 2023-07-28 18:09:25 ~5 min android-e2e 🤖apk 📲
✔️ 5569564 #2 2023-07-28 18:10:16 ~6 min ios 📱ipa 📲
49f7810 #3 2023-07-28 18:27:31 ~4 min tests 📄log
✔️ 49f7810 #3 2023-07-28 18:29:27 ~6 min android-e2e 🤖apk 📲
✔️ 49f7810 #3 2023-07-28 18:29:44 ~6 min android 🤖apk 📲
✔️ 49f7810 #3 2023-07-28 18:30:39 ~7 min ios 📱ipa 📲
49f7810 #4 2023-07-28 18:37:40 ~1 min tests 📄log
✔️ 019613a #5 2023-07-28 19:10:20 ~5 min android 🤖apk 📲
✔️ 019613a #5 2023-07-28 19:11:24 ~6 min ios 📱ipa 📲
✔️ 019613a #5 2023-07-28 19:13:01 ~8 min android-e2e 🤖apk 📲
✔️ 019613a #6 2023-07-28 19:13:57 ~9 min tests 📄log
✔️ ebf7cdf #6 2023-07-29 10:37:37 ~6 min ios 📱ipa 📲
✔️ ebf7cdf #6 2023-07-29 10:40:14 ~9 min android 🤖apk 📲
✔️ ebf7cdf #6 2023-07-29 10:40:18 ~9 min android-e2e 🤖apk 📲
✔️ ebf7cdf #7 2023-07-29 10:40:54 ~9 min tests 📄log
d597a53 #8 2023-07-31 16:05:36 ~3 min tests 📄log
✔️ d597a53 #7 2023-07-31 16:08:55 ~6 min android 🤖apk 📲
✔️ d597a53 #7 2023-07-31 16:09:49 ~7 min ios 📱ipa 📲
✔️ d597a53 #7 2023-07-31 16:10:43 ~8 min android-e2e 🤖apk 📲
7cc768e #9 2023-08-01 13:41:08 ~3 min tests 📄log
✔️ 7cc768e #8 2023-08-01 13:44:06 ~6 min android-e2e 🤖apk 📲
✔️ 7cc768e #8 2023-08-01 13:44:10 ~6 min android 🤖apk 📲
✔️ 7cc768e #8 2023-08-01 13:44:36 ~6 min ios 📱ipa 📲
✔️ 1e02504 #9 2023-08-01 13:51:38 ~5 min android-e2e 🤖apk 📲
✔️ 1e02504 #9 2023-08-01 13:52:25 ~6 min ios 📱ipa 📲
✔️ 1e02504 #9 2023-08-01 13:55:08 ~9 min android 🤖apk 📲
✔️ 1e02504 #11 2023-08-01 13:56:48 ~10 min tests 📄log
✔️ 02ce914 #10 2023-08-01 14:22:02 ~6 min ios 📱ipa 📲
✔️ 02ce914 #10 2023-08-01 14:24:31 ~9 min android-e2e 🤖apk 📲
✔️ 02ce914 #10 2023-08-01 14:24:43 ~9 min android 🤖apk 📲
✔️ 02ce914 #12 2023-08-01 14:25:16 ~9 min tests 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 8fe172c #11 2023-08-01 16:37:10 ~5 min android 🤖apk 📲
✔️ 8fe172c #11 2023-08-01 16:39:10 ~7 min ios 📱ipa 📲
✔️ 8fe172c #11 2023-08-01 16:39:21 ~7 min android-e2e 🤖apk 📲
✔️ 874c19a #14 2023-08-01 16:53:29 ~5 min android-e2e 🤖apk 📲
✔️ 874c19a #14 2023-08-01 16:53:45 ~5 min android 🤖apk 📲
✔️ 874c19a #14 2023-08-01 16:54:52 ~6 min ios 📱ipa 📲
✔️ 874c19a #16 2023-08-01 16:57:06 ~8 min tests 📄log

empty? (= :empty type)]
[rn/view (style/card customization-color watch-only? metrics? theme)
[rn/view {:style {:flex-direction :row :align-items :center}}
[rn/view {:margin-right 8 :margin-top 2 :style (style/loader-view 16 16 watch-only? theme)}]
Copy link
Contributor

Choose a reason for hiding this comment

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

Quick one: missing encapsulating the map inside {:style ...}.

(let [watch-only? (= :watch-only type)
empty? (= :empty type)]
[rn/view (style/card customization-color watch-only? metrics? theme)
[rn/view {:style {:flex-direction :row :align-items :center}}
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be beneficial if you could move more styles from the view namespace to the style one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree

[rn/view {:style style/watch-only-container}
[rn/view {:style (style/loader-view 57 8 watch-only? theme)}]
(when watch-only? [icon/icon :reveal {:color colors/neutral-50 :size 12}])]]
[rn/view {:margin-top 13 :style (style/loader-view (if empty? 56 80) 16 watch-only? theme)}]
Copy link
Contributor

Choose a reason for hiding this comment

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

This line is a bit difficult to read. Unfortunately the formatter moves the number 13 to the next line bleh, nothing we can do. Suggestion, assoc the value to the style so that we don't leave style props like margin-top outside of the :style map.

[rn/view
 {:style (assoc (style/loader-view (if empty? 56 80)
                                   16
                                   watch-only?
                                   theme)
                :margin-top
                13)}]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

super cool!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I applied in other cases too. Tks!

account-amount (if (= :empty state) "€0.00" amount)
account-name (if (= :empty state) "Account 1" name)
account-percentage (if (= :empty state) "€0.00" percentage-value)
]
Copy link
Contributor

Choose a reason for hiding this comment

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

Dangling square bracket. Reminder that dangling parentheses won't be fixed by the formatter.

theme]}]
(let [watch-only? (= :watch-only type)
empty? (= :empty type)
account-amount (if (= :empty state) "€0.00" amount)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think all these values should be translated @FFFra. Euros don't make sense for most users in the world and Account 1 is also in English.

Numbers should be formatted according to their localization. Take a look at the utils.i18n/format-currency function, it might be just what you need.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, but as far as I know, fiat currencies and symbol handlers are not defined in this case. I will double-check with the team if I can change that now. Nice catch!

@J-Son89, what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's discuss this with the team first :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm checking the codebase to confirm the best approach and will back to you guys

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, yeah, let's always align with designers if the examples are not in Figma. Thanks @FFFra

:style (style/metrics watch-only? theme)}
account-percentage]
(when (not empty?)
[:<> [rn/view (style/separator watch-only? theme)]
Copy link
Contributor

Choose a reason for hiding this comment

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

[Code style] We almost always add a line break after :<>.

[quo2.components.markdown.text :as text]
[quo2.theme :as theme]))

(defn loading-view
Copy link
Contributor

Choose a reason for hiding this comment

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

This and the other function in this ns can also be private.

:align-items :center}}
[text/text
{:size :heading-1
:weight :semi-bold} "Account card"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing line break after the closing bracket. https://guide.clojure.style/#vertically-align-fn-args

[rn/view {:margin-top 13 :style (style/loader-view (if empty? 56 80) 16 watch-only? theme)}]
(when metrics?
[rn/view
{:margin-top 10
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 the comment I made above, :margin-top should be assoc'ed into the map returned by style/loader-view because style properties should be placed inside the style map. It's not wrong you know, but it's the guideline in status-mobile.

Copy link

@Francesca-G Francesca-G left a comment

Choose a reason for hiding this comment

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

Here's the Figma frame with the design review.
Please refer to "Review 2", thank you :)

Copy link
Contributor

@ilmotta ilmotta left a comment

Choose a reason for hiding this comment

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

@FFFra, great work and thanks for not rushing to merge the PR. Take good care of your first PR! I sometimes come back to my first one in status-mobile to remember the "old" days ;)

I'm leaving my approve, although as we discussed I think the component is not 100% ready to shine without proper localization of the money amounts and currencies. I would consider creating a separate issue and merging this PR if you're blocked by external factors (new designs). Since this component has no usages yet, the really important thing IMO is to make sure there's follow-up work on it to make it 100% :)

@FFFra FFFra force-pushed the ff/account-card-component branch from 2ee5801 to 5569564 Compare July 28, 2023 18:03
@FFFra FFFra requested a review from Francesca-G July 28, 2023 18:08
@FFFra FFFra force-pushed the ff/account-card-component branch 2 times, most recently from 019613a to ebf7cdf Compare July 29, 2023 10:30
Copy link

@Francesca-G Francesca-G left a comment

Choose a reason for hiding this comment

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

Here's the Figma frame please refer to review 3 :)

@FFFra FFFra requested a review from Francesca-G July 31, 2023 16:01
@FFFra FFFra force-pushed the ff/account-card-component branch 4 times, most recently from 3a0cb5b to a036c51 Compare August 1, 2023 16:45
@FFFra FFFra force-pushed the ff/account-card-component branch from a036c51 to 874c19a Compare August 1, 2023 16:47
@FFFra FFFra merged commit 7c73b7e into develop Aug 1, 2023
2 checks passed
@FFFra FFFra deleted the ff/account-card-component branch August 1, 2023 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Archived in project
Development

Successfully merging this pull request may close these issues.

Implement quo2 - Wallet - account card component
5 participants