Skip to content

Refactor Bottom Sheet to use Theme Context #16710

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 5 commits into from
Jul 20, 2023

Conversation

smohamedjavid
Copy link
Member

Summary

This PR updates Bottom Sheet to use the theme (for theme provider) provided on the bottom sheet args when dispatching. This will ensure the theme is passed down to its child components where it can consume and render based on the theme.

Changes done:

Bottom Sheet
  • Fix Bottom Sheet to use the correct background colour (neutral-95) for dark mode (as per Figma)
  • Fix the Icon colour for danger in light mode
  • Updated Quo2 Preview to provide an option for the bottom sheet theme
Action Drawer
  • Refactor the Action Drawer component to consume theme context

Testing notes

Kindly test the areas where the bottom sheet is displayed such as Chat, Communities, ...etc.

For dark themed bottom sheet, Check Activity Centre more / options, and Verification Request bottom sheet.

Platforms

  • Android
  • iOS

status: ready

@status-im-auto
Copy link
Member

status-im-auto commented Jul 18, 2023

Jenkins Builds

Click to see older builds (16)
Commit #️⃣ Finished (UTC) Duration Platform Result
43f00ed #1 2023-07-18 08:02:26 ~2 min tests 📄log
✔️ 3f6edbf #2 2023-07-18 08:11:16 ~6 min android 🤖apk 📲
✔️ 3f6edbf #2 2023-07-18 08:11:43 ~6 min android-e2e 🤖apk 📲
✔️ 3f6edbf #2 2023-07-18 08:14:18 ~9 min tests 📄log
✔️ 2192e22 #3 2023-07-18 08:20:33 ~5 min android 🤖apk 📲
✔️ 2192e22 #3 2023-07-18 08:21:13 ~6 min ios 📱ipa 📲
✔️ 2192e22 #3 2023-07-18 08:21:26 ~6 min android-e2e 🤖apk 📲
✔️ 2192e22 #3 2023-07-18 08:23:08 ~7 min tests 📄log
✔️ f96c2a9 #4 2023-07-18 08:39:41 ~5 min android-e2e 🤖apk 📲
✔️ f96c2a9 #4 2023-07-18 08:39:43 ~5 min android 🤖apk 📲
✔️ f96c2a9 #4 2023-07-18 08:40:12 ~6 min ios 📱ipa 📲
✔️ f96c2a9 #4 2023-07-18 08:41:41 ~7 min tests 📄log
✔️ 67e881e #5 2023-07-19 16:02:17 ~7 min android-e2e 🤖apk 📲
✔️ 67e881e #5 2023-07-19 16:02:40 ~8 min ios 📱ipa 📲
✔️ 67e881e #5 2023-07-19 16:03:08 ~8 min android 🤖apk 📲
✔️ 67e881e #5 2023-07-19 16:03:27 ~9 min tests 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 09c93f2 #6 2023-07-19 17:03:28 ~5 min android-e2e 🤖apk 📲
✔️ 09c93f2 #6 2023-07-19 17:04:14 ~6 min ios 📱ipa 📲
✔️ 09c93f2 #6 2023-07-19 17:05:40 ~7 min android 🤖apk 📲
✔️ 09c93f2 #6 2023-07-19 17:06:59 ~8 min tests 📄log
✔️ fbedbd8 #7 2023-07-20 14:07:54 ~5 min android 🤖apk 📲
✔️ fbedbd8 #7 2023-07-20 14:08:49 ~6 min ios 📱ipa 📲
✔️ fbedbd8 #7 2023-07-20 14:10:44 ~8 min android-e2e 🤖apk 📲
✔️ fbedbd8 #7 2023-07-20 14:11:11 ~8 min tests 📄log

@smohamedjavid smohamedjavid marked this pull request as ready for review July 18, 2023 08:03
[quo2.components.markdown.text :as text]
[quo2.foundations.colors :as colors]
[react-native.core :as rn]
[quo2.components.drawers.action-drawers.style :as style]))
[quo2.theme :as theme]))
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: @ilmotta and I noticed that this can clash with theme prop, it's safer if we start doing [quo2.theme :as quo.theme]

@smohamedjavid smohamedjavid force-pushed the refactor/bottom-sheet-theme branch from 43f00ed to 3f6edbf Compare July 18, 2023 08:04
@@ -16,58 +16,47 @@
{:label "Show red options?"
:key :show-red-options?
:type :boolean}
{:label "Override theme"
:key :override-theme
{:label "Drawer theme"
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm, let's just remove this option and take it from the system settings. @mmilad75 and I were discussing we could also put the system theme selector in the preview screens too? rather than in the preview menu as it makes it easier to experiment with.

Copy link
Member Author

Choose a reason for hiding this comment

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

@J-Son89 - I think we will need this selector as it will help us test the scenario such as the user's screen in light mode, but the bottom sheet needs to be rendered in dark mode.

This is the same as how the bottom sheet is used in Activity Center.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah that makes sense. thanks for the explanation! :)

@J-Son89
Copy link
Contributor

J-Son89 commented Jul 18, 2023

Great stuff @smohamedjavid! 😎

@smohamedjavid smohamedjavid force-pushed the refactor/bottom-sheet-theme branch from 3f6edbf to 2192e22 Compare July 18, 2023 08:14
@J-Son89
Copy link
Contributor

J-Son89 commented Jul 18, 2023

there's one or two uses in the codebase of quo/action-drawer that have override-theme perhaps you can remove them in this pr too?
one is in: status-im2.contexts.onboarding.select-photo.method-menu.view
status-im2.contexts.syncing.setup-syncing.view


(defn action-drawer
[sections]
[:<>
(doall
(for [actions sections]
(doall
(map action actions))))])
(let [filtered-actions (filter some? actions)]
Copy link
Member Author

Choose a reason for hiding this comment

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

I had to filter as we receive some nil values. This is due to the usage of when like:

(defn notification-actions
[{:keys [chat-id group-chat public? chat-type muted-till]} inside-chat? needs-divider?]
[(mark-as-read-entry chat-id needs-divider?)
(mute-chat-entry chat-id chat-type muted-till)
(notifications-entry false)
(when inside-chat?
(fetch-messages-entry))
(when (or (not group-chat) public?)
(show-qr-entry))
(when-not group-chat
(share-profile-entry))
(when public?
(share-group-entry))])

These need to be refactored to use cond as it's safer and won't produce nil if the condition fails.


Prior to this filter, the component checks the value on render:

@smohamedjavid
Copy link
Member Author

there's one or two uses in the codebase of quo/action-drawer that have override-theme perhaps you can remove them in this pr too? one is in: status-im2.contexts.onboarding.select-photo.method-menu.view status-im2.contexts.syncing.setup-syncing.view

Removed the usage. Thanks, @J-Son89!

@pavloburykh pavloburykh self-assigned this Jul 19, 2023
@status-im-auto
Copy link
Member

89% of end-end tests have passed

Total executed tests: 36
Failed tests: 4
Passed tests: 32
IDs of failed tests: 702731,702732,702851,703133 

Failed tests (4)

Click to expand
  • Rerun failed tests

  • Class TestCommunityOneDeviceMerged:

    1. test_restore_multiaccount_with_waku_backup_remove_switch, id: 703133

    Device 1: Tap on found: Button
    Device 1: Find `Button` by `accessibility id`: `show-new-account-options`

    critical/test_public_chat_browsing.py:356: in test_restore_multiaccount_with_waku_backup_remove_switch
        self.sign_in.recover_access(passphrase=waku_user.seed, second_user=True)
    ../views/sign_in_view.py:257: in recover_access
        self.plus_profiles_button.click()
    ../views/base_element.py:91: in click
        self.find_element().click()
    ../views/base_element.py:80: in find_element
        raise NoSuchElementException(
     Device 1: Button by accessibility id: `show-new-account-options` is not found on the screen
    



    Device sessions

    Class TestActivityCenterContactRequestMultipleDevicePR:

    1. test_activity_center_contact_request_accept_swipe_mark_all_as_read, id: 702851

    Device 1: Find ChatsTab by accessibility id: chats-stack-tab
    Device 1: Tap on found: ChatsTab

    medium/test_activity_center.py:86: in test_activity_center_contact_request_accept_swipe_mark_all_as_read
        self.home_1.notifications_unread_badge.wait_for_visibility_of_element(30)
    ../views/base_element.py:135: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 1: BaseElement by accessibility id:`activity-center-unread-count` is not found on the screen after wait_for_visibility_of_element
    



    Device sessions

    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_pin_messages, id: 702731

    Test is not run, e2e blocker  
    

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

    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_pin_messages, id: 702732

    Test is not run, e2e blocker  
    

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

    Passed tests (32)

    Click to expand

    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_emoji_send_reply_and_open_link, id: 702782
    Device sessions

    2. test_1_1_chat_send_image_save_and_share, id: 703391
    Device sessions

    3. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745
    Device sessions

    4. test_1_1_chat_text_message_delete_push_disappear, id: 702733
    Device sessions

    5. test_1_1_chat_push_emoji, id: 702813
    Device sessions

    6. test_1_1_chat_edit_message, id: 702855
    Device sessions

    7. test_1_1_chat_message_reaction, id: 702730
    Device sessions

    8. test_1_1_chat_delete_via_long_press_relogin, id: 702784
    Device sessions

    9. test_1_1_chat_is_shown_message_sent_delivered_from_offline, id: 702783
    Device sessions

    Class TestActivityMultipleDevicePR:

    1. test_activity_center_mentions, id: 702957
    Device sessions

    2. test_activity_center_admin_notification_accept_swipe, id: 702958
    Device sessions

    3. test_navigation_jump_to, id: 702936
    Device sessions

    4. test_activity_center_reply_read_unread_delete_filter_swipe, id: 702947
    Device sessions

    Class TestActivityCenterContactRequestMultipleDevicePR:

    1. test_activity_center_contact_request_decline, id: 702850
    Device sessions

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_emoji_send_copy_paste_reply, id: 702840
    Device sessions

    2. test_community_one_image_send_reply, id: 702859
    Device sessions

    3. test_community_links_with_previews_github_youtube_twitter_gif_send_enable, id: 702844
    Device sessions

    4. test_community_unread_messages_badge, id: 702841
    Device sessions

    5. test_community_message_delete, id: 702839
    Device sessions

    6. test_community_message_edit, id: 702843
    Device sessions

    7. test_community_message_send_check_timestamps_sender_username, id: 702838
    Device sessions

    8. test_community_several_images_send_reply, id: 703194
    Device sessions

    9. test_community_mark_all_messages_as_read, id: 703086
    Device sessions

    10. test_community_leave, id: 702845
    Device sessions

    11. test_community_contact_block_unblock_offline, id: 702894
    Device sessions

    12. test_community_mentions_push_notification, id: 702786
    Device sessions

    Class TestCommunityOneDeviceMerged:

    1. test_community_navigate_to_channel_when_relaunch, id: 702846
    Device sessions

    2. test_community_copy_and_paste_message_in_chat_input, id: 702742
    Device sessions

    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_offline_pn, id: 702808
    Device sessions

    2. test_group_chat_join_send_text_messages_push, id: 702807
    Device sessions

    3. test_group_chat_send_image_save_and_share, id: 703297
    Device sessions

    4. test_group_chat_reactions, id: 703202
    Device sessions

    @pavloburykh
    Copy link
    Contributor

    pavloburykh commented Jul 19, 2023

    @smohamedjavid thanx for the PR!

    Please take a look at the following issue

    ISSUE 1 Messages longtap context drawer has wrong color in dark mode

    On screenshot below you can see wrong color of context drawer block which differs from the rest bottom sheet blocks

    photo_2023-07-19 16 39 44

    @pavloburykh
    Copy link
    Contributor

    @smohamedjavid also, I think it would be helpful to ask @Francesca-G for review of this PR. WDYT?

    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.

    @pavloburykh here's the Figma frame with the design review :)

    @smohamedjavid
    Copy link
    Member Author

    @pavloburykh - Thanks for testing this PR!

    Regarding

    ISSUE 1 Messages longtap context drawer has wrong color in dark mode

    Thanks for spotting this!

    I noticed that this list was using the menu-item component. But It should use the action-drawer component as described in Figma. That's why there was a background colour bug.

    I created an issue: #16722 to replace it.

    Meanwhile, I have pushed a colour fix to that menu-item component. Kindly retest.

    @smohamedjavid
    Copy link
    Member Author

    @smohamedjavid also, I think it would be helpful to ask @Francesca-G for review of this PR. WDYT?

    Too late to comment :) We haven't addressed any design system updates or design reviews in this PR. This PR just updates the theme context for the bottom sheet. But, we got the review from @Francesca-G.

    @smohamedjavid
    Copy link
    Member Author

    smohamedjavid commented Jul 19, 2023

    @Francesca-G Thanks a lot for the quick review. Appreciate it!

    Before are my findings,

    For incorrect typography issues in the author and message preview.
    I noticed that you are inside a chat and long-pressed on a particular message to open the bottom sheet. But, on the left design, it's the chat preview (chats list) screen.

    Additionally, I noticed that we haven't implemented the design on the left (chat preview item on action drawer) yet.


    The issue regarding icon color are due to incorrect component usage. I have updated the colour in the component for now. I have opened an issue to replace the usage with the action-drawer component on that screen.


    Regarding author is not shown on top of the message in the bottom sheet.

    This is not related to the PR but it's an interesting bug. Thanks for spotting it!

    This happens when the user (sender/receiver) sends a message (there is no message from the same author above), and sends a couple of messages after that.

    On the chat, from the second message, we don't display the author as it's from the same author.

    This same component is being used in the preview of the bottom sheet. @pavloburykh - We can create a separate issue to fix this.

    Also, the bottom sheet causing issues with chat header blur is reproducible on nightly or latest develop. Not related to this PR changes.

    @pavloburykh
    Copy link
    Contributor

    @pavloburykh - We can create a separate issue to fix this.

    Done, I have logged a separate issue #16736

    @smohamedjavid thanx for fixing issue 1. PR is ready for merge.

    @smohamedjavid smohamedjavid force-pushed the refactor/bottom-sheet-theme branch from 09c93f2 to fbedbd8 Compare July 20, 2023 14:01
    @smohamedjavid smohamedjavid merged commit 9731e70 into develop Jul 20, 2023
    @smohamedjavid smohamedjavid deleted the refactor/bottom-sheet-theme branch July 20, 2023 14:13
    @tumanov-alex tumanov-alex mentioned this pull request Aug 3, 2023
    J-Son89 pushed a commit that referenced this pull request Aug 8, 2023
    Add locked input component, tests, styles
    Add translations
    Add duration icons
    
    Remove extra code
    
    Use theme from context
    
    Add missing code
    
    Update styles
    Update gas icon (previous was not reacting to size change)
    Use text from components instead of rn/text
    
    Fix styling for transaction sheet preview, locked input & account selector components
    Fix purple 50 color since it doesn't match design
    
    Work on PR suggestions
    Fix style to be pixel-perfect
    
    Comment-in tests
    
    Fix style
    
    Add docs for locked-input component
    
    Remove extra code
    
    Fixed design discrepancies
    
    Fix font-weight
    
    Fix purple color in account selector
    
    Remove unused icons
    
    Fix linter
    
    Fix tests
    
    fix for airplane mode
    
    [161108] Optimize message styling when there's multiple mentions on top of each other (#16505)
    
    Fix failing mute till test (#16453)
    
    fix navigation to community from discover communities screen (#16702)
    
    Update version to 0.162.3
    
    [#16703] The display name is not resolved in chats for user sender after relogin (#16704)
    
    Mute community
    
    * mute and unmute community
    
    status-im/status-go@dfdaa72...e6187ae
    
    * mute and unmute community and all community chats
    
    status-im/status-go@dfdaa72...3abc86e
    
    * updated statu-go
    
    status-im/status-go@dfdaa72...919123e
    
    * refactored mute chat drawer
    
    status-im/status-go@d3e650d...3af0b17
    
    * refactored mute chat drawer
    
    status-im/status-go@dfdaa72...3af0b17
    
    * fixing mute channels
    
    * fixed mute community channels
    
    * update community chats mute status
    
    status-im/status-go@dfdaa72...dc50ac2
    
    * added mute and unmute community toast
    
    status-im/status-go@dfdaa72...c06f7a6
    
    * unmute community when atleast one community channel is unmuted
    
    status-im/status-go@dfdaa72...e691c47
    
    * updated status-go
    
    status-im/status-go@b2e56f5...c52718c
    
    * updated status-go version v0.162.5
    
    [Fix] Scroll to bottom on editing message (#16630)
    
    This commit fixes (by skipping) the scroll to the bottom of messages when the user edits a message and sends it.
    
    Signed-off-by: Mohamed Javid <[email protected]>
    
    Refactor `Bottom Sheet` to use Theme Context (#16710)
    
    This commit updates "Bottom Sheet" to use the theme (for theme provider) provided on the bottom sheet args when dispatching. This will ensure the theme is passed down to its child components where it can consume and render based on the theme.
    
    Changes done:
    
    In Bottom Sheet:
     - Fix Bottom Sheet to use the correct background colour (neutral-95) for dark mode (as per Figma)
     - Fix the Icon colour for danger in light mode
     - Updated Quo2 Preview to provide an option for the bottom sheet theme
    
    In Action Drawer:
     - Refactor the Action Drawer component to consume theme context
    
    Signed-off-by: Mohamed Javid <[email protected]>
    
    Revert extra commits
    
    Revert extra commits
    
    Revert extra changes
    J-Son89 pushed a commit that referenced this pull request Aug 8, 2023
    Add locked input component, tests, styles
    Add translations
    Add duration icons
    
    Remove extra code
    
    Use theme from context
    
    Add missing code
    
    Update styles
    Update gas icon (previous was not reacting to size change)
    Use text from components instead of rn/text
    
    Fix styling for transaction sheet preview, locked input & account selector components
    Fix purple 50 color since it doesn't match design
    
    Work on PR suggestions
    Fix style to be pixel-perfect
    
    Comment-in tests
    
    Fix style
    
    Add docs for locked-input component
    
    Remove extra code
    
    Fixed design discrepancies
    
    Fix font-weight
    
    Fix purple color in account selector
    
    Remove unused icons
    
    Fix linter
    
    Fix tests
    
    fix for airplane mode
    
    [161108] Optimize message styling when there's multiple mentions on top of each other (#16505)
    
    Fix failing mute till test (#16453)
    
    fix navigation to community from discover communities screen (#16702)
    
    Update version to 0.162.3
    
    [#16703] The display name is not resolved in chats for user sender after relogin (#16704)
    
    Mute community
    
    * mute and unmute community
    
    status-im/status-go@dfdaa72...e6187ae
    
    * mute and unmute community and all community chats
    
    status-im/status-go@dfdaa72...3abc86e
    
    * updated statu-go
    
    status-im/status-go@dfdaa72...919123e
    
    * refactored mute chat drawer
    
    status-im/status-go@d3e650d...3af0b17
    
    * refactored mute chat drawer
    
    status-im/status-go@dfdaa72...3af0b17
    
    * fixing mute channels
    
    * fixed mute community channels
    
    * update community chats mute status
    
    status-im/status-go@dfdaa72...dc50ac2
    
    * added mute and unmute community toast
    
    status-im/status-go@dfdaa72...c06f7a6
    
    * unmute community when atleast one community channel is unmuted
    
    status-im/status-go@dfdaa72...e691c47
    
    * updated status-go
    
    status-im/status-go@b2e56f5...c52718c
    
    * updated status-go version v0.162.5
    
    [Fix] Scroll to bottom on editing message (#16630)
    
    This commit fixes (by skipping) the scroll to the bottom of messages when the user edits a message and sends it.
    
    Signed-off-by: Mohamed Javid <[email protected]>
    
    Refactor `Bottom Sheet` to use Theme Context (#16710)
    
    This commit updates "Bottom Sheet" to use the theme (for theme provider) provided on the bottom sheet args when dispatching. This will ensure the theme is passed down to its child components where it can consume and render based on the theme.
    
    Changes done:
    
    In Bottom Sheet:
     - Fix Bottom Sheet to use the correct background colour (neutral-95) for dark mode (as per Figma)
     - Fix the Icon colour for danger in light mode
     - Updated Quo2 Preview to provide an option for the bottom sheet theme
    
    In Action Drawer:
     - Refactor the Action Drawer component to consume theme context
    
    Signed-off-by: Mohamed Javid <[email protected]>
    
    Revert extra commits
    
    Revert extra commits
    
    Revert extra changes
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    No open projects
    Archived in project
    Development

    Successfully merging this pull request may close these issues.

    6 participants