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

3rd Update - Switch NetworkDisplay with PickerNetwork #21083

Closed
wants to merge 9 commits into from

Conversation

MaxwellDG
Copy link

@MaxwellDG MaxwellDG commented Sep 27, 2023

This is fixing a 3nd instance of #20485.

As stated by @georgewrmarshall in #20485 there are some expected, and accepted UI differences:

The colourful circle now includes a letter when it's not an image
The height is slightly different. They're now all static at 32px

Initial:
Network_3_Initial

Current:
Network_3_Current

@MaxwellDG MaxwellDG requested a review from a team as a code owner September 27, 2023 19:15
@github-actions
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@MaxwellDG MaxwellDG changed the title Switch NetworkDisplay to PickerNetwork and update snapshot 3rd Update - Switch NetworkDisplay with PickerNetwork Sep 27, 2023
Comment on lines +50 to +59
as="div"
src={currentNetwork?.rpcPrefs?.imageUrl}
label={
providerConfig?.type === NETWORK_TYPES.RPC
? providerConfig?.nickname ?? t('privateNetwork')
: t(getNetworkLabelKey(providerConfig?.type))
}
backgroundColor={BackgroundColor.transparent}
borderColor={BorderColor.borderMuted}
iconProps={{ display: Display.None }}
Copy link
Contributor

Choose a reason for hiding this comment

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

@MaxwellDG @georgewrmarshall Do we have icons for our built in networks? I don't know if we want to introduce the letters here? Might cause user confusion.

Copy link
Author

Choose a reason for hiding this comment

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

I don't believe there's icons for the built-in ones. The previous components just used small coloured circles. And I couldn't see any Sepolia or Goerli related images in Storybook. Maybe you know of some elsewhere you'd like me to use?

Copy link
Author

Choose a reason for hiding this comment

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

In ui\selectors\selectors.js, where the data for the test networks are retrieved from, this is an example object:

{ chainId: CHAIN_IDS.GOERLI, nickname: GOERLI_DISPLAY_NAME, rpcUrl: CHAIN_ID_TO_RPC_URL_MAP[CHAIN_IDS.GOERLI], providerType: NETWORK_TYPES.GOERLI, ticker: TEST_NETWORK_TICKER_MAP[NETWORK_TYPES.GOERLI], id: NETWORK_TYPES.GOERLI, removable: false, },

Doesn't look like they have the property .rpcPrefs?.imageUrl which usually supplies the icon for other networks

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe the icons are retrieved here

src={currentNetwork?.rpcPrefs?.imageUrl}

Sepolia and Goreli test networks use a combination of html elements and color to create the icon but this adds complexity to how we display networks. I'll create a ticket to add the images and migrate them over. This should reduce the complexity if all networks are displayed using images.

Copy link
Contributor

Choose a reason for hiding this comment

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

Created an issue here #21142

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.

The code is looking good but I'm not sure this component is used anywhere so instead of replacing the NetworkDisplay component we may be able to remove this folder(ui/components/app/signature-request-header) completely. Apologies for not catching this earlier. The good news is by removing these component files we will get some small performance benefits in prod and dev because we are also removing redundant CSS, tests and storybook files. Let's get confirmation from @matthewwalsh0 on the confirmations team to see if we can remove them.

@georgewrmarshall georgewrmarshall added team-design-system All issues relating to design system in Extension external-contributor labels Oct 2, 2023
@MaxwellDG MaxwellDG mentioned this pull request Oct 10, 2023
14 tasks
@georgewrmarshall
Copy link
Contributor

Hey @MaxwellDG, Can you update the snapshots for this PR too?

@MaxwellDG MaxwellDG force-pushed the update/picker-network-3 branch from 397a527 to 5623313 Compare November 14, 2023 18:28
Copy link

codecov bot commented Nov 22, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (2bdbf83) 68.38% compared to head (89dcd1b) 68.38%.

Files Patch % Lines
...quest-header/signature-request-header.component.js 80.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #21083      +/-   ##
===========================================
- Coverage    68.38%   68.38%   -0.00%     
===========================================
  Files         1052     1052              
  Lines        41888    41892       +4     
  Branches     11164    11167       +3     
===========================================
+ Hits         28645    28646       +1     
- Misses       13243    13246       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MaxwellDG MaxwellDG closed this Dec 6, 2023
@MaxwellDG MaxwellDG deleted the update/picker-network-3 branch December 6, 2023 19:51
@github-actions github-actions bot locked and limited conversation to collaborators Dec 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
external-contributor team-design-system All issues relating to design system in Extension
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants