Skip to content

Conversation

@filipsekulic
Copy link
Contributor

@filipsekulic filipsekulic commented Apr 28, 2022

Explanation

Created a new feature for adding the popular custom networks. When enabled from the Experimental tab, this feature allows users to add one of the popular custom networks like Arbitrum One, Polygon Mainnet etc.

More Information

Fixes: #12903

Screenshots/Screencaps

Screen.Recording.2022-06-23.at.10.31.33.mov

Manual Testing Steps

  1. Go to the Settings.
  2. Click on the Experimental tab.
  3. Enable the toggle switch Show Custom Network List.
  4. From this step there are two ways to continue the flow:
    • The first one is to click on the Networks tab within the Settings and then to click on the button Add a network.
    • The second one is to open the network dropdown menu from the app header and then to click on the button Add Network.
  5. The new screen is now shown. The modal view has the back (<) button which takes the user to the Networks screen. Also, the networks which rely on third parties have the exclamation triangle next to their name which can be hovered and then the tooltip with information shows up with a link Learn more which takes the user to the web-page The risks of connecting to an unknown network.
    NOTE: If the button Add a network manually from the app footer is clicked, then the screen for manually adding the network is shown and from there the network can be added by entering the appropriate information about the network.
  6. The popular custom network can be added by clicking on the Add button. When clicked, the popup with the network information shows up. This popup has tooltips (i) which show information when hovered. Clicking on the scams and network security risks takes the user to the web-page User Guide: Custom networks and sidechains. If a button View all details is clicked then the new, smaller popup shows up with the information about the network and this popup can be closed by simply clicking on the Close button or X.
  7. The main popup can be closed by clicking on the Cancel button which rejects the pending approval for adding the network and the user stays on the same page. If the Approve button is clicked, then the network will be added, the user will be taken to the Home page and the new popup will show up.
  8. From this step, user can switch to the newly created network by clicking on the button Switch to network_name or click on the Dismiss button and later switch to that network.

@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.

@filipsekulic filipsekulic force-pushed the integrate-flow-adding-custom-network branch from 2e85a18 to d355d10 Compare April 28, 2022 15:16
@filipsekulic filipsekulic force-pushed the integrate-flow-adding-custom-network branch from ca65009 to 18c1cb9 Compare May 9, 2022 09:40
@metamaskbot
Copy link
Collaborator

Builds ready [49757b5]
Page Load Metrics (2331 ± 124 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint952682381757364
domContentLoaded187027112302282135
load191727112331259124
domInteractive187027112302282135

highlights:

storybook

@filipsekulic filipsekulic changed the title [WIP]: Adding popular custom network integration Adding popular custom network integration May 11, 2022
@metamaskbot
Copy link
Collaborator

Builds ready [0b58edf]
Page Load Metrics (1750 ± 32 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint821746186358172
domContentLoaded1633188317385928
load1637188317506732
domInteractive1633188317385928

highlights:

storybook

@mirjanaKukic
Copy link
Contributor

Verified by QA

@metamaskbot
Copy link
Collaborator

Builds ready [0b83142]
Page Load Metrics (1704 ± 39 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint761739334566272
domContentLoaded1561188416858943
load1561188417048239
domInteractive1561188416858943

highlights:

storybook

@filipsekulic
Copy link
Contributor Author

@metamaskbot
Copy link
Collaborator

Builds ready [c36f1a8]
Page Load Metrics (1818 ± 67 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint831647184336161
domContentLoaded16072159179612459
load16072159181813967
domInteractive16072159179612459

highlights:

storybook

@filipsekulic filipsekulic marked this pull request as ready for review May 13, 2022 11:15
@filipsekulic filipsekulic requested a review from a team as a code owner May 13, 2022 11:15
@filipsekulic filipsekulic requested a review from PeterYinusa May 13, 2022 11:15
@filipsekulic filipsekulic self-assigned this May 13, 2022
"message": "Yes, let's try"
},
"youHaveAddedAll": {
"message": "You've added all the popular networks. You can discover more networks $1 Or you can $2"
Copy link
Contributor

Choose a reason for hiding this comment

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

We need a description key here to describe what $1 and $2 represent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in: dc67e85


&__button {
display: inline !important;
padding: 0 !important;
Copy link
Contributor

Choose a reason for hiding this comment

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

There are a lot of !important usages in this file. Can these be avoided with a parent className?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in: dc67e85

/**
* Icon location
*/
leftIconUrl: PropTypes.string,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we default leftIconUrl to ''?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in: dc67e85

@darkwing
Copy link
Contributor

This is how it looks in rtl direction:
RTLNetworks

I think some of the CSS added in this PR could be changed from margin-left to margin-inline-start, for example, to improve RTL support. Might be worth looking at!

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.

Looking really good nice work using the 8px grid values for bounding box values(margin, padding). Made a couple small suggestions.

Not sure if this is a biggy? Some warning appears about the history stack when a network is deleted

warning.history.mov

This might be an existing prop type error but it would be good to fix:

Screen Shot 2022-05-14 at 11 43 25 AM

Comment on lines 97 to 106
key="link"
className="add-network__edge-case-box__link"
href="https://chainlist.wtf/"
target="_blank"
rel="noreferrer"
>
{t('here')}.
</a>,
<Button
key="link"
Copy link
Contributor

Choose a reason for hiding this comment

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

Keys should have different ids

Suggested change
key="link"
className="add-network__edge-case-box__link"
href="https://chainlist.wtf/"
target="_blank"
rel="noreferrer"
>
{t('here')}.
</a>,
<Button
key="link"
key="link"
className="add-network__edge-case-box__link"
href="https://chainlist.wtf/"
target="_blank"
rel="noreferrer"
>
{t('here')}.
</a>,
<Button
key="button"

Screen Shot 2022-05-14 at 12 23 56 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in: dc67e85

</Box>
}
trigger="mouseenter"
theme={theme === THEME_TYPE.DEFAULT ? 'light' : 'dark'}
Copy link
Contributor

@georgewrmarshall georgewrmarshall May 14, 2022

Choose a reason for hiding this comment

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

Doesn't look like THEME_TYPE object has a DEFAULT key which is why the tooltip is still showing in dark mode. @darkwing should we add a DEFAULT key to the THEME_TYPE object? Then this will work as expected.

export const THEME_TYPE = {
LIGHT: 'light',
DARK: 'dark',
OS: 'os',
};

Before

Screen Shot 2022-05-14 at 12 56 15 PM

After

After adding DEFAULT to THEME_TYPE

Screen Shot 2022-05-14 at 12 53 24 PM

Screen Shot 2022-05-14 at 12 58 36 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in: dc67e85

Copy link
Contributor

Choose a reason for hiding this comment

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

Still looks like it's using the wrong text color here

Screen Shot 2022-05-16 at 2 07 30 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! 💯
Thanks! 😊
I have not seen there was the OS theme option, and that was the part I was missing...
You can check it again and see the changes: 8986581

Copy link
Contributor

@georgewrmarshall georgewrmarshall May 17, 2022

Choose a reason for hiding this comment

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

Nice! 🙏

@metamaskbot
Copy link
Collaborator

Builds ready [dc67e85]
Page Load Metrics (1783 ± 53 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint881737266486233
domContentLoaded15942124177611254
load15942124178311153
domInteractive15942124177511254

highlights:

storybook

@metamaskbot
Copy link
Collaborator

Builds ready [8986581]
Page Load Metrics (1835 ± 53 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint891659183339163
domContentLoaded16202062182210751
load16302067183511053
domInteractive16202062182210751

highlights:

storybook

Comment on lines +46 to +48
if (child?.hide === true) {
return allChildren;
}
Copy link

Choose a reason for hiding this comment

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

Suggested change
if (child?.hide === true) {
return allChildren;
}
if (child?.hide) {
return allChildren;
}

Comment on lines 132 to 135
if (getEnvironmentType() === ENVIRONMENT_TYPE_POPUP) {
global.platform.openExtensionInBrowser(ADD_NETWORK_ROUTE);
this.props.history.push(ADD_POPULAR_CUSTOM_NETWORK);
} else {
this.props.history.push(ADD_NETWORK_ROUTE);
this.props.history.push(ADD_POPULAR_CUSTOM_NETWORK);
Copy link

Choose a reason for hiding this comment

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

why do we need a condition here if we can just pass this.props.history.push(ADD_POPULAR_CUSTOM_NETWORK);

Copy link
Contributor

Choose a reason for hiding this comment

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

That's true. @filipsekulic I guess the if/else can be removed here?

}

function getValues(pendingApproval, t, actions) {
const originIsMetaMask = pendingApproval.origin === 'metamask';
Copy link

Choose a reason for hiding this comment

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

You can reuse Line 88

{t('someNetworksMayPoseSecurity')}{' '}
<a
key="zendesk_page_link"
href="https://metamask.zendesk.com/hc/en-us/articles/4417500466971"
Copy link

Choose a reason for hiding this comment

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

Can this URL be put in a constant mapping file

@metamaskbot
Copy link
Collaborator

Builds ready [5d2b555]
Page Load Metrics (1769 ± 63 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint831823190375180
domContentLoaded16152124175412158
load16152143176913263
domInteractive16152124175412158

highlights:

storybook

@metamaskbot
Copy link
Collaborator

Builds ready [f551831]
Page Load Metrics (1894 ± 61 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint991900211388186
domContentLoaded16542174187411857
load16732175189412761
domInteractive16542174187411857

highlights:

storybook

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.

Can you rebase from develop please @filipsekulic? There are some UI updates that might affect this page

Also can we make this header the same as this one so it's consistent?

This header:
Screen Shot 2022-05-26 at 1 43 16 PM

should look like this:
Screen Shot 2022-05-26 at 1 41 37 PM

Then this header should probably be updated
Screen Shot 2022-05-26 at 1 46 18 PM

@georgewrmarshall
Copy link
Contributor

Also noticed the token icons get squashed when the network name is longer
Screen Shot 2022-05-26 at 12 06 49 PM

@metamaskbot
Copy link
Collaborator

Builds ready [13d5550]
Page Load Metrics (1647 ± 41 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint7611991126
domContentLoaded1548183516247737
load1556183516478541
domInteractive1548183516247737

highlights:

storybook

@filipsekulic filipsekulic force-pushed the integrate-flow-adding-custom-network branch from 57f24d9 to a17ecfa Compare June 22, 2022 14:50
@metamaskbot
Copy link
Collaborator

Builds ready [a17ecfa]
Page Load Metrics (2054 ± 110 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint912252223466224
domContentLoaded171325362051230111
load171325372054229110
domInteractive171325362051230111

highlights:

storybook

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.

UI LGTM! Nice work 💯 Could you please add a PR description and "Manual Testing Steps" it helps the support content folks write documentation

  • verified adding / removing networks
  • verified UI in light/dark mode
  • verified responsive layout
  • verified flow in popover/action view

@filipsekulic
Copy link
Contributor Author

Hey @georgewrmarshall! Thank you!
You've got the point! I updated the PR description.

@coreyjanssen
Copy link
Contributor

@seaona @georgewrmarshall re: Capitalization, we should be using sentence case throughout

@georgewrmarshall
Copy link
Contributor

Thanks @coreyjanssen! I've created an issue #15039

Copy link
Contributor

@darkwing darkwing left a comment

Choose a reason for hiding this comment

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

Approved.

From a UX perspective, I wish we didn't send the user home, in the case that they want to add a handful of networks, but this is a huge new feature we should get out there ASAP. Well done!

@bschorchit
Copy link

Approved.

From a UX perspective, I wish we didn't send the user home, in the case that they want to add a handful of networks, but this is a huge new feature we should get out there ASAP. Well done!

Heey @darkwing, thank you for this UX feedback here! That was indeed the original design, but we learned during user testing that users were confused when they were brought back to the network list + from MetaMetrics data we found out that not that many users have multiple networks added (Of all users that have added custom networks in MM, 75% of them have only added 1 network) so we decided to change the original behavior to this.

@danjm danjm merged commit 43f7a44 into develop Jun 30, 2022
@danjm danjm deleted the integrate-flow-adding-custom-network branch June 30, 2022 16:19
@github-actions github-actions bot locked and limited conversation to collaborators Jun 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

needs-qa Label will automate into QA workspace

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a new feature: "Add custom network" (Add popular networks integration)