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

feat: implement summary tag component #17858

Merged
merged 1 commit into from
Nov 14, 2023
Merged

Conversation

briansztamfater
Copy link
Member

@briansztamfater briansztamfater commented Nov 8, 2023

fixes #17848

Summary

Implements Summary tag component

summary.tag.ios.mp4

Platforms

  • Android
  • iOS

Steps to test

  • Open Status
  • Open quo preview
  • Select tag > Summary tag
  • Test component

status: ready

@briansztamfater briansztamfater added the feature feature requests label Nov 8, 2023
@briansztamfater briansztamfater self-assigned this Nov 8, 2023
@briansztamfater briansztamfater marked this pull request as draft November 8, 2023 23:33
@status-im-auto
Copy link
Member

status-im-auto commented Nov 8, 2023

Jenkins Builds

Click to see older builds (16)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 5c539dc #2 2023-11-08 23:40:05 ~5 min ios 📱ipa 📲
✔️ 5c539dc #2 2023-11-08 23:40:14 ~5 min android-e2e 🤖apk 📲
✔️ 5c539dc #2 2023-11-08 23:42:50 ~8 min android 🤖apk 📲
✔️ 5c539dc #2 2023-11-08 23:43:30 ~9 min tests 📄log
✔️ 70462ad #3 2023-11-09 03:33:16 ~6 min android 🤖apk 📲
✔️ 70462ad #3 2023-11-09 03:33:22 ~6 min android-e2e 🤖apk 📲
✔️ 70462ad #3 2023-11-09 03:35:33 ~8 min tests 📄log
✔️ 70462ad #3 2023-11-09 03:38:55 ~11 min ios 📱ipa 📲
✔️ 82d2709 #5 2023-11-10 17:49:23 ~6 min android-e2e 🤖apk 📲
✔️ 82d2709 #5 2023-11-10 17:53:50 ~11 min ios 📱ipa 📲
✔️ 82d2709 #5 2023-11-10 17:56:38 ~13 min android 🤖apk 📲
✔️ 82d2709 #5 2023-11-10 17:58:36 ~15 min tests 📄log
✔️ 544c1a7 #6 2023-11-10 23:27:47 ~5 min ios 📱ipa 📲
✔️ 544c1a7 #6 2023-11-10 23:28:41 ~6 min android-e2e 🤖apk 📲
✔️ 544c1a7 #6 2023-11-10 23:28:43 ~6 min android 🤖apk 📲
✔️ 544c1a7 #6 2023-11-10 23:30:38 ~8 min tests 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 1698c39 #7 2023-11-13 21:49:28 ~5 min android-e2e 🤖apk 📲
✔️ 1698c39 #7 2023-11-13 21:50:39 ~6 min android 🤖apk 📲
✔️ 1698c39 #7 2023-11-13 21:52:18 ~8 min tests 📄log
✔️ 1698c39 #7 2023-11-13 21:54:30 ~10 min ios 📱ipa 📲
✔️ 5573dad #8 2023-11-14 14:13:25 ~5 min android 🤖apk 📲
✔️ 5573dad #8 2023-11-14 14:13:31 ~5 min android-e2e 🤖apk 📲
✔️ 5573dad #8 2023-11-14 14:17:36 ~9 min tests 📄log
✔️ 5573dad #9 2023-11-14 14:47:45 ~17 min ios 📱ipa 📲

@briansztamfater briansztamfater marked this pull request as ready for review November 9, 2023 03:39
@briansztamfater briansztamfater changed the title [WIP] feat: implement summary tag component feat: implement summary tag component Nov 9, 2023
:address address
"")
customization-color (case type
:account (:customization-color account-props)
Copy link
Contributor

Choose a reason for hiding this comment

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

imo we should pass customization-color as it's own prop instead 👍

i.e

(defn- view-internal
  [{:keys [customization-color ...
           address type
           theme]
           ```

address type
theme]
:as props}]
(let [text (case type
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 we're making the api of this component really confusing here. Why not just have a "text" param and handle this outside in application code. although I would probably change "text" to something like "label"

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree too, I think this component should only receive the params it needs to work. Right now it's hard to know what keys are expected in those maps (account-props, user-props, network-props, etc) to make this work.

Also a docstring specifying the props supported for each type could work 👍

{:source (resources/get-token (keyword (string/lower-case (:symbol token-props))))
:style {:width 24
:height 24}}]
nil))
Copy link
Contributor

Choose a reason for hiding this comment

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

I personally would prefer this as something like:

(defn- left-view
  [{:keys [type  emoji customization-color label image-source
           ]}]
  (case type
    :account
    [account-avatar/view
     {:customization-color customization-color
      :size                24
      :emoji               emoji
      :type                :default}]
    :network
    [rn/image
     {:source image-source
      :style  {:width  24
               :height 24}}]
    :saved-address
    [wallet-user-avatar/wallet-user-avatar
     {:full-name           label
      :size                :size-24
      :customization-color customization-color }]
    :collectible
    [rn/image
     {:source image-source
      :style  style/collectible-image}]
    :user
    [user-avatar/user-avatar
     {:full-name           label
      :size                :xs
      :profile-picture     image-source
      :customization-color customization-color}]
    :token
    [rn/image
     {:source image-source
      :style  {:width  24
               :height 24}}]
    nil))

and also the token image resolving I prefer to do in the application code, as perhaps in some case they are urls and others based on images that we already have in the codebase.

cc @ulisesmac

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, I agree. The API looks cleaner 👍

Comment on lines 27 to 25
:style {:width 24
:height 24}}]
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be in the style ns :)

{:source (resources/get-token (keyword (string/lower-case (:symbol token-props))))
:style {:width 24
:height 24}}]
nil))
Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, I agree. The API looks cleaner 👍

address type
theme]
:as props}]
(let [text (case type
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree too, I think this component should only receive the params it needs to work. Right now it's hard to know what keys are expected in those maps (account-props, user-props, network-props, etc) to make this work.

Also a docstring specifying the props supported for each type could work 👍

@briansztamfater
Copy link
Member Author

@ulisesmac @J-Son89 thanks for the feedback, will refactor and simplify the component API :)

[quo.components.tags.summary-tag.view :as summary-tag]
[test-helpers.component :as h]))

(h/describe "Summary tag component tests"
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest adding one more test where the component instantiated with empty props, to make sure it doesn't crash

Copy link
Contributor

@vkjr vkjr Nov 10, 2023

Choose a reason for hiding this comment

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

Similarly, since we have a set of props packed under :token-props, :account-props, their empty state also worth testing.

❗ Right now component crashes the app in following scenarios:

[quo/summary-tag
         {:type        :token
          :token-props {}}]

this also:

[quo/summary-tag
         {:type        :account
          :account-props {}}]

Didn't test the rest

Copy link
Contributor

@vkjr vkjr left a comment

Choose a reason for hiding this comment

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

@briansztamfater, thanks for the PR!
Could you please also add tests to cover the cases when empty :token-props, :account-props, etc... passed to the component and make sure the component doesn't crash?
Thanks!

@briansztamfater
Copy link
Member Author

@briansztamfater, thanks for the PR! Could you please also add tests to cover the cases when empty :token-props, :account-props, etc... passed to the component and make sure the component doesn't crash? Thanks!

@vkjr Thanks for the feedback, I simplified the API so there is no token-props, account-props, etc anymore. Also refactored tests and added a case where we pass no props so we make sure it doesn't crash.

@briansztamfater briansztamfater requested a review from vkjr November 10, 2023 23:23
@briansztamfater
Copy link
Member Author

@Francesca-G can you please review this component? Thanks in advance!

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.

Looks good :)
Here's the review with some minor issues to check

Signed-off-by: Brian Sztamfater <brian@status.im>
@briansztamfater
Copy link
Member Author

@Francesca-G thanks for the feedback, updated the text in preview for the token variant (it is just a bug in the preview) and checked the height that is actually 32 points

Proceeding to merge, thanks!

@briansztamfater briansztamfater merged commit a74c934 into develop Nov 14, 2023
6 checks passed
@briansztamfater briansztamfater deleted the feat/summary-tag branch November 14, 2023 14:50
yevh-berdnyk pushed a commit that referenced this pull request Dec 8, 2023
Signed-off-by: Brian Sztamfater <brian@status.im>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Archived in project
Development

Successfully merging this pull request may close these issues.

Implement Summary Tag component
6 participants