-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Adding popular custom network integration #14557
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
Conversation
|
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. |
2e85a18 to
d355d10
Compare
ca65009 to
18c1cb9
Compare
Builds ready [0b58edf]Page Load Metrics (1750 ± 32 ms)
highlights:storybook
|
|
Verified by QA |
Builds ready [0b83142]Page Load Metrics (1704 ± 39 ms)
highlights:storybook
|
Builds ready [c36f1a8]Page Load Metrics (1818 ± 67 ms)
highlights:storybook
|
app/_locales/en/messages.json
Outdated
| "message": "Yes, let's try" | ||
| }, | ||
| "youHaveAddedAll": { | ||
| "message": "You've added all the popular networks. You can discover more networks $1 Or you can $2" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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 ''?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in: dc67e85
georgewrmarshall
left a comment
There was a problem hiding this 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:
| key="link" | ||
| className="add-network__edge-case-box__link" | ||
| href="https://chainlist.wtf/" | ||
| target="_blank" | ||
| rel="noreferrer" | ||
| > | ||
| {t('here')}. | ||
| </a>, | ||
| <Button | ||
| key="link" |
There was a problem hiding this comment.
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
| 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" |
There was a problem hiding this comment.
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'} |
There was a problem hiding this comment.
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.
metamask-extension/ui/pages/settings/experimental-tab/experimental-tab.constant.js
Lines 1 to 5 in ad1abaa
| export const THEME_TYPE = { | |
| LIGHT: 'light', | |
| DARK: 'dark', | |
| OS: 'os', | |
| }; |
Before
After
After adding DEFAULT to THEME_TYPE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in: dc67e85
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! 🙏
Builds ready [dc67e85]Page Load Metrics (1783 ± 53 ms)
highlights:storybook
|
Builds ready [8986581]Page Load Metrics (1835 ± 53 ms)
highlights:storybook
|
| if (child?.hide === true) { | ||
| return allChildren; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (child?.hide === true) { | |
| return allChildren; | |
| } | |
| if (child?.hide) { | |
| return allChildren; | |
| } |
| 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); |
There was a problem hiding this comment.
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);
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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
Builds ready [5d2b555]Page Load Metrics (1769 ± 63 ms)
highlights:storybook
|
Builds ready [f551831]Page Load Metrics (1894 ± 61 ms)
highlights:storybook
|
There was a problem hiding this 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?
Builds ready [13d5550]Page Load Metrics (1647 ± 41 ms)
highlights:storybook
|
57f24d9 to
a17ecfa
Compare
Builds ready [a17ecfa]Page Load Metrics (2054 ± 110 ms)
highlights:storybook
|
georgewrmarshall
left a comment
There was a problem hiding this 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
|
Hey @georgewrmarshall! Thank you! |
|
@seaona @georgewrmarshall re: Capitalization, we should be using sentence case throughout |
|
Thanks @coreyjanssen! I've created an issue #15039 |
darkwing
left a comment
There was a problem hiding this 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!
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. |











Explanation
Created a new feature for adding the popular custom networks. When enabled from the
Experimentaltab, 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
Settings.Experimentaltab.Show Custom Network List.Networkstab within theSettingsand then to click on the buttonAdd a network.Add Network.back (<)button which takes the user to theNetworksscreen. 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 linkLearn morewhich takes the user to the web-pageThe risks of connecting to an unknown network.NOTE: If the button
Add a network manuallyfrom 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.Addbutton. When clicked, the popup with the network information shows up. This popup hastooltips (i)which show information when hovered. Clicking on thescams and network security riskstakes the user to the web-pageUser Guide: Custom networks and sidechains. If a buttonView all detailsis clicked then the new, smaller popup shows up with the information about the network and this popup can be closed by simply clicking on theClosebutton orX.Cancelbutton which rejects the pending approval for adding the network and the user stays on the same page. If theApprovebutton is clicked, then the network will be added, the user will be taken to theHome pageand the new popup will show up.Switch to network_nameor click on theDismissbutton and later switch to that network.