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

[Quo2] Implement Account Avatar Component #16795

Merged
merged 6 commits into from
Jul 31, 2023

Conversation

smohamedjavid
Copy link
Member

fixes #16761

Summary

This PR implements the Account Avatar component which is needed for wallet screen development.

Design

Link to Figma

Review notes

Since this wallet account accepts only emoji as a unique indicator. We use the rn/text component to display emoji.

Platforms

  • Android
  • iOS

Steps to test

  • Open Status
  • Navigate to Quo2 Preview > avatar > account avatar

status: ready

@status-im-auto
Copy link
Member

status-im-auto commented Jul 27, 2023

Jenkins Builds

Click to see older builds (36)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 671a100 #1 2023-07-27 10:43:19 ~6 min android-e2e 🤖apk 📲
✔️ 671a100 #1 2023-07-27 10:43:33 ~6 min ios 📱ipa 📲
✔️ 671a100 #1 2023-07-27 10:44:10 ~7 min android 🤖apk 📲
✔️ 671a100 #1 2023-07-27 10:45:34 ~8 min tests 📄log
✔️ ab43986 #2 2023-07-27 11:29:33 ~6 min android-e2e 🤖apk 📲
✔️ ab43986 #2 2023-07-27 11:29:34 ~6 min ios 📱ipa 📲
✔️ ab43986 #2 2023-07-27 11:35:58 ~12 min android 🤖apk 📲
✔️ ab43986 #2 2023-07-27 11:36:15 ~12 min tests 📄log
✔️ ea405ad #3 2023-07-27 12:59:39 ~6 min ios 📱ipa 📲
✔️ ea405ad #3 2023-07-27 12:59:55 ~6 min android-e2e 🤖apk 📲
✔️ ea405ad #3 2023-07-27 12:59:57 ~6 min android 🤖apk 📲
✔️ ea405ad #3 2023-07-27 13:02:03 ~8 min tests 📄log
✔️ 588dc3b #4 2023-07-27 14:28:33 ~6 min android-e2e 🤖apk 📲
✔️ 588dc3b #4 2023-07-27 14:28:39 ~6 min ios 📱ipa 📲
✔️ 588dc3b #4 2023-07-27 14:28:41 ~6 min android 🤖apk 📲
✔️ 588dc3b #4 2023-07-27 14:30:36 ~8 min tests 📄log
✔️ ac06d1e #5 2023-07-28 09:31:38 ~5 min android 🤖apk 📲
ac06d1e #5 2023-07-28 09:32:23 ~6 min ios 📄log
✔️ ac06d1e #5 2023-07-28 09:33:14 ~7 min android-e2e 🤖apk 📲
✔️ ac06d1e #5 2023-07-28 09:35:10 ~8 min tests 📄log
✔️ 8d1b460 #6 2023-07-28 10:09:12 ~6 min android 🤖apk 📲
✔️ 8d1b460 #6 2023-07-28 10:09:27 ~6 min ios 📱ipa 📲
✔️ 8d1b460 #6 2023-07-28 10:11:45 ~8 min android-e2e 🤖apk 📲
✔️ 8d1b460 #6 2023-07-28 10:11:46 ~8 min tests 📄log
✔️ 6576d3d #7 2023-07-31 06:58:38 ~6 min android-e2e 🤖apk 📲
✔️ 6576d3d #7 2023-07-31 06:58:40 ~6 min android 🤖apk 📲
✔️ 6576d3d #7 2023-07-31 06:59:00 ~6 min ios 📱ipa 📲
✔️ 6576d3d #7 2023-07-31 07:00:26 ~8 min tests 📄log
✔️ 884ca0b #8 2023-07-31 07:28:36 ~6 min android-e2e 🤖apk 📲
✔️ 884ca0b #8 2023-07-31 07:30:00 ~7 min ios 📱ipa 📲
✔️ 884ca0b #8 2023-07-31 07:30:13 ~8 min android 🤖apk 📲
✔️ 884ca0b #8 2023-07-31 07:31:59 ~9 min tests 📄log
✔️ c4c3423 #9 2023-07-31 12:09:24 ~5 min android 🤖apk 📲
✔️ c4c3423 #9 2023-07-31 12:10:16 ~6 min ios 📱ipa 📲
✔️ c4c3423 #9 2023-07-31 12:11:24 ~7 min android-e2e 🤖apk 📲
c4c3423 #9 2023-07-31 12:12:50 ~8 min tests 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 1cde56c #10 2023-07-31 12:21:44 ~6 min android-e2e 🤖apk 📲
✔️ 1cde56c #10 2023-07-31 12:21:45 ~6 min ios 📱ipa 📲
✔️ 1cde56c #10 2023-07-31 12:21:46 ~6 min android 🤖apk 📲
✔️ 1cde56c #10 2023-07-31 12:23:40 ~8 min tests 📄log
✔️ b867363 #11 2023-07-31 16:02:48 ~5 min android-e2e 🤖apk 📲
✔️ b867363 #11 2023-07-31 16:03:44 ~6 min android 🤖apk 📲
✔️ b867363 #11 2023-07-31 16:05:43 ~8 min ios 📱ipa 📲
✔️ b867363 #11 2023-07-31 16:06:49 ~9 min tests 📄log

@@ -14,7 +14,7 @@
(defn avatar
[avatar-props]
[rn/view {:style (style/avatar-border)}
[account-avatar/account-avatar (assoc avatar-props :size 48)]])
[account-avatar/view (assoc avatar-props :size 48)]])
Copy link
Member Author

Choose a reason for hiding this comment

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

The Account Avatar component is used in this component settings > accounts. I checked for usage across the codebase, but nothing was found.

It was introduced in this PR: #14643. I checked for the designs attached to this PR, looks like it was removed.

@J-Son89
Copy link
Contributor

J-Son89 commented Jul 27, 2023

it is also used in src/quo2/components/tabs/account_selector.cljs - well it's supposed to be anyway if you look at the designs - perhaps you can update that here too?

@smohamedjavid smohamedjavid force-pushed the feature/account-avatar-changes branch from ea405ad to 588dc3b Compare July 27, 2023 14:22
Copy link
Contributor

@ulisesmac ulisesmac left a comment

Choose a reason for hiding this comment

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

Good job 💯

Comment on lines 6 to 26
(defn get-border-radius
[size]
(case size
80 16
48 12
32 10
28 8
24 8
20 6
16 4))

(defn get-emoji-size
[size]
(case size
80 36
48 24
32 15
28 12
24 11
20 11
16 11))
Copy link
Contributor

Choose a reason for hiding this comment

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

This size param is passed directly from the component props, it means if we pass an invalid size while calling the component this case statement will crash with an exception. So please add the default value.

Also, I find a little hard passing a number for size, I mean, we have a set of valid sizes and any other number will fail, so maybe we could create a set of keywords (small, medium, or sm, md, etc), but I know this doesn't match with figma, so is hard.

Wdyt?

@J-Son89 @ilmotta

Copy link
Contributor

@ilmotta ilmotta Jul 28, 2023

Choose a reason for hiding this comment

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

I agree with the sentiment @ulisesmac. The problem is that the DS is built with non-semantic spaces and sizes. If we can convince them to change how they manage such a foundational aspect of their work then it would help create a more maintainable DS, but good luck convincing them about this 🤷🏼 It was always shocking to me that the entire app is designed without a grid system in mind. Many sizes/spaces are chosen arbitrarily (their own words), although they do try to follow some patterns, like multiples of 4.

As you hinted, we could come up with a standardized list of sizes and each component could use those instead of numbers, like what's used in Tailwind https://tailwindcss.com/docs/responsive-design. I actually like this and have commented a few times with @J-Son89. But this can also cause some confusion and extra mental effort to translate them to what's used in Figma and can also increase the likelihood of bugs. Since now we sort of want to just mimic what's in Figma to avoid these erroneous code<->Figma translations, the numbers might be okay for now.

On the other hand, it's a serious technical mistake to build the mobile app without responsiveness in mind from the get go. And responsiveness requires us to not hardcode magical numbers. It'll be very expensive (development-wise) to do this in the future. Flip phones and foldable phones are a thing now, and obviously tablets. Screen sizes are not that fixed little world of iPhone 11 used by the DS. It's just 😢. I know of many users who love their tablets and would like to use a "super app" such as Status in their bigger screens. Not to count many users like to read with their phones on the horizontal. Anyway, responsiveness and semantic sizes seem to be distant in the future...

This size param is passed directly from the component props, it means if we pass an invalid size while calling the component this case statement will crash with an exception. So please add the default value.

I really miss clj-kondo not having a rule for forcing a default result in case. I'm considering creating a new linter rule for this. I really don't see any benefit in risking throwing exceptions, so to me the rule is simple, we should always add a default value in case.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also, I find a little hard passing a number for size, I mean, we have a set of valid sizes and any other number will fail, so maybe we could create a set of keywords (small, medium, or sm, md, etc), but I know this doesn't match with figma, so is hard.

I understand @ulisesmac, It's a bit painful, I'm not a fan of numbers too as you mentioned it's error-prone, but we have to maintain the synchronisation between Figma and Quo2 implementation. I added a default value.


On the other hand, it's a serious technical mistake to build the mobile app without responsiveness in mind from the get go. And responsiveness requires us to not hardcode magical numbers. It'll be very expensive (development-wise) to do this in the future. Flip phones and foldable phones are a thing now, and obviously tablets. Screen sizes are not that fixed little world of iPhone 11 used by the DS. It's just 😢. I know of many users who love their tablets and would like to use a "super app" such as Status in their bigger screens. Not to count many users like to read with their phones on the horizontal. Anyway, responsiveness and semantic sizes seem to be distant in the future...

I don't encourage using pixel value as it's not responsive and will have different effects based on the DPI/PPI of the user's device. As you mentioned, it will become more tedious to refactor if we decide to be responsive in future. Can't argue 😢. This is more of a team discussion.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't encourage using pixel value as it's not responsive and will have different effects based on the DPI/PPI of the user's device. As you mentioned, it will become more tedious to refactor if we decide to be responsive in future. Can't argue cry. This is more of a team discussion.

For sure @smohamedjavid, this is a team-level discussion. I brought up to see how you guys reacted to it and if we're more on less on the same page. Nothing that blocks your PR.

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.

Well done!

{:label "Emoji"
:key :emoji
:type :text}
{:label "Customization color:"
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI @smohamedjavid, I recently added a function to help us be more DRY. https://github.com/mohsen-ghafouri/status-react/blob/43cba161d66255ec8983f08d74e6050643dd0b34/src/status_im2/contexts/quo_preview/preview.cljs#L226

But I think the better implementation might be to use this color-picker/color-list you used in this PR and which I've seen other PRs used as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, @ilmotta! This helps a lot.

I'm not sure about using color-picker/colour-list as we have :no-color option, which we agreed to remove due to some reason/issues from the Desktop app.

IMO, even the colour-list declaration (and usage in preview screens) in the color-picker component should get the colours from quo2.foundations.colors ns as it is our source of truth.

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps we can update the other uses in the preview screens to whatever you decide upon too.
I agree with your point @smohamedjavid but no strong opinions on this 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not clear to me either, I would just welcome such generalization because I keep seeing PRs repeating this field in preview screens. I'll keep an eye in my next PRs for quo components, and if this is not improved until then I'll try to do something, should be quick.

@smohamedjavid smohamedjavid force-pushed the feature/account-avatar-changes branch 2 times, most recently from ac06d1e to 8d1b460 Compare July 28, 2023 10:02
@status-im-auto
Copy link
Member

85% of end-end tests have passed

Total executed tests: 40
Failed tests: 6
Passed tests: 34
IDs of failed tests: 702732,703133,702851,703495,702731,702808 

Failed tests (6)

Click to expand
  • Rerun failed tests

  • Class TestActivityCenterContactRequestMultipleDevicePR:

    1. test_activity_center_contact_request_accept_swipe_mark_all_as_read, id: 702851

    Device 2: Tap on found: Button
    Device 2: Find `Button` by `accessibility id`: `create-new-profile`

    medium/test_activity_center.py:87: in test_activity_center_contact_request_accept_swipe_mark_all_as_read
        self.device_2.create_user(second_user=True, username=new_username)
    ../views/sign_in_view.py:230: in create_user
        self.create_new_profile_button.click()
    ../views/base_element.py:91: in click
        self.find_element().click()
    ../views/base_element.py:80: in find_element
        raise NoSuchElementException(
     Device 2: Button by accessibility id: `create-new-profile` is not found on the screen
    



    Device sessions

    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_pin_messages, id: 702732

    Test is not run, e2e blocker  
    

    [[reason: [NOTRUN] Pin feature is in development]]

    2. test_group_chat_mute_chat, id: 703495

    Device 2: Click until ChatMessageInput by accessibility id: chat-message-input will be presented
    Device 2: Looking for a message by text: Chat is unmuted now

    critical/chats/test_group_chat.py:607: in test_group_chat_mute_chat
        self.errors.verify_no_errors()
    base_test_case.py:183: in verify_no_errors
        pytest.fail('\n '.join([self.errors.pop(0) for _ in range(len(self.errors))]))
     New messages counter near chat name is not shown after unmute
    



    Device sessions

    3. test_group_chat_offline_pn, id: 702808

    Device 3: Looking for a message by text: message from old member
    Device 3: Looking for a message by text: message from new member

    critical/chats/test_group_chat.py:439: in test_group_chat_offline_pn
        self.errors.verify_no_errors()
    base_test_case.py:183: in verify_no_errors
        pytest.fail('\n '.join([self.errors.pop(0) for _ in range(len(self.errors))]))
     Messages PN was not fetched from offline
    



    Device sessions

    Class TestCommunityOneDeviceMerged:

    1. test_restore_multiaccount_with_waku_backup_remove_switch, id: 703133

    Test is not run, e2e blocker  
    

    [[reason: [NOTRUN] Restoring communities issue: 16787; restoring contacts issue: 15500]]

    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_pin_messages, id: 702731

    Test is not run, e2e blocker  
    

    [[reason: [NOTRUN] Pin feature is in development]]

    Passed tests (34)

    Click to expand

    Class TestActivityMultipleDevicePR:

    1. test_activity_center_mentions, id: 702957
    Device sessions

    2. test_navigation_jump_to, id: 702936
    Device sessions

    3. test_activity_center_reply_read_unread_delete_filter_swipe, id: 702947
    Device sessions

    4. test_activity_center_admin_notification_accept_swipe, id: 702958
    Device sessions

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_several_images_send_reply, id: 703194
    Device sessions

    2. test_community_one_image_send_reply, id: 702859
    Device sessions

    3. test_community_emoji_send_copy_paste_reply, id: 702840
    Device sessions

    4. test_community_mark_all_messages_as_read, id: 703086
    Device sessions

    5. test_community_contact_block_unblock_offline, id: 702894
    Device sessions

    6. test_community_mentions_push_notification, id: 702786
    Device sessions

    7. test_community_message_delete, id: 702839
    Device sessions

    8. test_community_message_send_check_timestamps_sender_username, id: 702838
    Device sessions

    9. test_community_links_with_previews_github_youtube_twitter_gif_send_enable, id: 702844
    Device sessions

    10. test_community_message_edit, id: 702843
    Device sessions

    11. test_community_leave, id: 702845
    Device sessions

    12. test_community_unread_messages_badge, id: 702841
    Device sessions

    Class TestCommunityOneDeviceMerged:

    1. test_community_copy_and_paste_message_in_chat_input, id: 702742
    Device sessions

    2. test_community_undo_delete_message, id: 702869
    Device sessions

    3. test_community_navigate_to_channel_when_relaunch, id: 702846
    Device sessions

    4. test_community_mute_community_and_channel, id: 703382
    Device sessions

    Class TestActivityCenterContactRequestMultipleDevicePR:

    1. test_activity_center_contact_request_decline, id: 702850
    Device sessions

    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_emoji_send_reply_and_open_link, id: 702782
    Device sessions

    2. test_1_1_chat_text_message_delete_push_disappear, id: 702733
    Device sessions

    3. test_1_1_chat_delete_via_long_press_relogin, id: 702784
    Device sessions

    4. test_1_1_chat_push_emoji, id: 702813
    Device sessions

    5. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745
    Device sessions

    6. test_1_1_chat_is_shown_message_sent_delivered_from_offline, id: 702783
    Device sessions

    7. test_1_1_chat_mute_chat, id: 703496
    Device sessions

    8. test_1_1_chat_edit_message, id: 702855
    Device sessions

    9. test_1_1_chat_send_image_save_and_share, id: 703391
    Device sessions

    10. test_1_1_chat_message_reaction, id: 702730
    Device sessions

    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_send_image_save_and_share, id: 703297
    Device sessions

    2. test_group_chat_reactions, id: 703202
    Device sessions

    3. test_group_chat_join_send_text_messages_push, id: 702807
    Device sessions

    @smohamedjavid
    Copy link
    Member Author

    @Francesca-G - Can we get a design review on this component, please?

    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

    @smohamedjavid smohamedjavid force-pushed the feature/account-avatar-changes branch from 884ca0b to c4c3423 Compare July 31, 2023 12:03
    @smohamedjavid
    Copy link
    Member Author

    @Francesca-G - Regarding issue 1, We use the same size (px) for height and width as mentioned in Figma.

    We don't use any value less than mentioned in Figma.


    For issue 2, Please check as I updated the emoji to fit in the container for small-size variants.

    Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
    Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
    Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
    Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
    Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
    Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
    @smohamedjavid smohamedjavid force-pushed the feature/account-avatar-changes branch from 1cde56c to b867363 Compare July 31, 2023 15:56
    @smohamedjavid smohamedjavid merged commit 81b8c7c into develop Jul 31, 2023
    2 checks passed
    @smohamedjavid smohamedjavid deleted the feature/account-avatar-changes branch July 31, 2023 16:24
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    feature feature requests
    Projects
    Archived in project
    Archived in project
    Development

    Successfully merging this pull request may close these issues.

    update quo2 Avatar -Account avatar component sizes
    7 participants