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

chore: enable multiselect in asset-picker network modal #28975

Merged
merged 70 commits into from
Dec 11, 2024

Conversation

micaelae
Copy link
Member

@micaelae micaelae commented Dec 5, 2024

Description

Figma: https://www.figma.com/design/IuOIRmU3wI0IdJIfol0ESu/Cross-Chain-Swaps?node-id=7-24563&node-type=canvas&m=dev

Changes

  • enables multi network selection in the Asset Picker, and displaying tokens from multiple chains
  • adds support for searching tokens by address
  • updates the PickerNetwork component to show multiple network icons
  • refactors TokenListItem for less truncation

Open in GitHub Codespaces

Related issues

Fixes:

Manual testing steps

  1. To test locally set BRIDGE_USE_DEV_APIS=1 in .metamaskrc, then try selecting networks/tokens in the Bridge experience
  2. Also try to do some e2e tests in the Send and Swap/Send flows

Screenshots/Recordings

Before -> After

Screenshot 2024-12-05 at 9 36 14 PMScreenshot 2024-12-05 at 9 34 06 PM

Screenshot 2024-12-05 at 9 36 23 PMScreenshot 2024-12-05 at 9 33 54 PM

Screenshot 2024-12-05 at 9 36 37 PMScreenshot 2024-12-05 at 9 37 45 PM

Screenshot 2024-12-05 at 9 36 44 PMScreenshot 2024-12-05 at 9 37 55 PM

Screenshot 2024-12-10 at 11 25 09 AMScreenshot 2024-12-10 at 11 25 14 AM

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@micaelae micaelae force-pushed the mb894-asset-picker-updates-2 branch 2 times, most recently from 19797c7 to 8dd03fd Compare December 5, 2024 22:30
@micaelae micaelae marked this pull request as ready for review December 9, 2024 06:03
@micaelae micaelae requested review from a team as code owners December 9, 2024 06:03
Copy link
Member

@NidhiKJha NidhiKJha left a comment

Choose a reason for hiding this comment

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

Copy link
Member

@NidhiKJha NidhiKJha left a comment

Choose a reason for hiding this comment

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

Asset Picker seems to be broken in storybook
Screenshot 2024-12-09 at 11 35 25 AM

Comment on lines 55 to 66
{avatarComponent ?? (
<AvatarNetwork
className="mm-picker-network__avatar-network"
src={src}
name={label}
size={AvatarNetworkSize.Xs}
{...avatarNetworkProps}
/>
)}

Copy link
Member

Choose a reason for hiding this comment

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

Picker Network is for changing a network so I am not sure why we are making it conditional.

Copy link
Member Author

Choose a reason for hiding this comment

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

Refactored this so an override for the avatar is no longer required. The PickerNetwork for bridge has multiple stacked network icons so we need to be able to render an AvatarGroup. Will add a story for this as well

@micaelae micaelae force-pushed the mb894-asset-picker-updates-2 branch 4 times, most recently from 49df7cb to 79e5326 Compare December 10, 2024 01:02
@micaelae micaelae requested a review from NidhiKJha December 10, 2024 05:28
@metamaskbot
Copy link
Collaborator

Builds ready [c73adde]
Page Load Metrics (1983 ± 138 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint159929331988285137
domContentLoaded158728681964278134
load159129311983287138
domInteractive236635136
backgroundConnect94520115
firstReactRender15321952
getState103145124115
initialActions00000
loadScripts117324041536265127
setupStore719831
uiStartup181931822245306147
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 6.96 KiB (0.09%)
  • common: 5.1 KiB (0.06%)

Copy link
Member

@NidhiKJha NidhiKJha left a comment

Choose a reason for hiding this comment

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

Looks really good. Changes I have reviewed:

  • verified that the Send flow works as expected
  • verified that the asset list shows expected data
  • verified that the bridge network picker (excl asset picker) has the expected networks
  • AvatarGroup + PickerNetwork styling changes are visible in bridge network picker

Before, I approve. Just one last question: The select all box looks different in Bridge than in other flows:

Bridge experience select all

Screenshot 2024-12-10 at 5 10 20 PM

Extension view select all

Screenshot 2024-12-10 at 5 09 26 PM

@micaelae
Copy link
Member Author

Looks really good. Changes I have reviewed:

  • verified that the Send flow works as expected
  • verified that the asset list shows expected data
  • verified that the bridge network picker (excl asset picker) has the expected networks
  • AvatarGroup + PickerNetwork styling changes are visible in bridge network picker

Before, I approve. Just one last question: The select all box looks different in Bridge than in other flows:

Bridge experience select all

Screenshot 2024-12-10 at 5 10 20 PM

Extension view select all

Screenshot 2024-12-10 at 5 09 26 PM

This is intentional! In a separate PR I'll be updating the shape of the avatar and this size works better for the bridge picker

@metamaskbot
Copy link
Collaborator

Builds ready [19d57f3]
Page Load Metrics (1827 ± 73 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint16382296182714771
domContentLoaded15912247179214972
load16392299182715273
domInteractive257535136
backgroundConnect890362512
firstReactRender1591252110
getState783951357435
initialActions00000
loadScripts12081813138614369
setupStore720831
uiStartup184426422117236113
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 7.08 KiB (0.09%)
  • common: 5.1 KiB (0.06%)

@micaelae micaelae force-pushed the mb894-asset-picker-updates-2 branch 3 times, most recently from bb7fa63 to fbb0117 Compare December 10, 2024 22:50
@metamaskbot
Copy link
Collaborator

Builds ready [31734e1]
Page Load Metrics (2005 ± 127 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint167925552000256123
domContentLoaded165625291964260125
load166525532005265127
domInteractive257342188
backgroundConnect965332010
firstReactRender1695372914
getState743771739546
initialActions01000
loadScripts127320431550228109
setupStore627942
uiStartup189231672414412198
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 6.59 KiB (0.08%)
  • common: 5.1 KiB (0.06%)

Copy link
Contributor

@georgewrmarshall georgewrmarshall left a comment

Choose a reason for hiding this comment

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

Component Library changes LGTM could we please add a unit test for avatarGroupProps

@@ -27,6 +28,7 @@ export const PickerNetwork: PickerNetworkComponent = React.forwardRef(
<C extends React.ElementType = 'button'>(
{
className = '',
avatarGroupProps,
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we add a unit test for this prop to ensure the testing coverage is 100% 🙏

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

@micaelae micaelae force-pushed the mb894-asset-picker-updates-2 branch from 31734e1 to d9c1d7b Compare December 11, 2024 01:56
@metamaskbot
Copy link
Collaborator

Builds ready [d9c1d7b]
Page Load Metrics (1878 ± 106 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint22225121790423203
domContentLoaded162525011853226109
load163625121878221106
domInteractive245832105
backgroundConnect76026189
firstReactRender15382053
getState98138125105
initialActions00000
loadScripts121220541441213102
setupStore711811
uiStartup185928912141260125
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 6.59 KiB (0.08%)
  • common: 5.1 KiB (0.06%)

@metamaskbot
Copy link
Collaborator

Builds ready [d9c1d7b]
Page Load Metrics (1878 ± 106 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint22225121790423203
domContentLoaded162525011853226109
load163625121878221106
domInteractive245832105
backgroundConnect76026189
firstReactRender15382053
getState98138125105
initialActions00000
loadScripts121220541441213102
setupStore711811
uiStartup185928912141260125
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 6.59 KiB (0.08%)
  • common: 5.1 KiB (0.06%)

@metamaskbot
Copy link
Collaborator

Builds ready [5cfaf7f]
Page Load Metrics (1773 ± 67 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint16019821616488234
domContentLoaded15141973175813967
load15221983177313967
domInteractive23362842
backgroundConnect76420178
firstReactRender1591292512
getState713031375928
initialActions01000
loadScripts11491560135912459
setupStore7391194
uiStartup176526262090218105
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 6.59 KiB (0.08%)
  • common: 5.06 KiB (0.06%)

matthewwalsh0
matthewwalsh0 previously approved these changes Dec 11, 2024
NidhiKJha
NidhiKJha previously approved these changes Dec 11, 2024
@micaelae micaelae force-pushed the mb894-asset-picker-updates-2 branch from 0ce3565 to 139c9c3 Compare December 11, 2024 19:50
@metamaskbot
Copy link
Collaborator

Builds ready [139c9c3]
Page Load Metrics (1782 ± 71 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint24320351571560269
domContentLoaded15202008175313967
load15242043178214771
domInteractive268142199
backgroundConnect77434168
firstReactRender16100463014
getState487373115
initialActions01000
loadScripts10891509131712761
setupStore623942
uiStartup17152401204619091
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 6.59 KiB (0.08%)
  • common: 5.09 KiB (0.06%)

@micaelae micaelae enabled auto-merge December 11, 2024 20:36
@micaelae micaelae added this pull request to the merge queue Dec 11, 2024
Merged via the queue into main with commit 70bdc86 Dec 11, 2024
77 checks passed
@micaelae micaelae deleted the mb894-asset-picker-updates-2 branch December 11, 2024 21:13
@github-actions github-actions bot locked and limited conversation to collaborators Dec 11, 2024
@metamaskbot metamaskbot added the release-12.10.1 Issue or pull request that will be included in release 12.10.1 label Dec 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.10.1 Issue or pull request that will be included in release 12.10.1 team-bridge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants