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

Consolidate connected account alerts #8802

Merged
merged 15 commits into from
Jun 15, 2020

Conversation

rekmarks
Copy link
Member

@rekmarks rekmarks commented Jun 12, 2020

Screenshot

Consolidates the two former connected account alerts into one, and updates it to use the ConnectedAccountsList component.

Summary

  • Consolidates switch-to-connected alert into unconnected-account-alert
    • Use ConnectedAccountsList to implement new designs
    • Handle both connecting the currently selected account and switching to connected accounts
  • Extract ConnectedAccountPermissions from ConnectedAccountsList folder
    • This is now used in the ConnectedAccounts component instead of ConnectedAccountsList, in the Popover footer
  • Various updates to ConnectedAccountsList and other components to support these changes
    • ConnectedAccountsList is functionally identical to develop

Open Questions

  • Currently, the alert can open on e.g. permissions and transactions confirmations in the popup. Is that what we want?

@rekmarks rekmarks added the DO-NOT-MERGE Pull requests that should not be merged label Jun 12, 2020
@rekmarks rekmarks force-pushed the consolidate-connected-account-alerts branch 3 times, most recently from b3257a1 to c1c561c Compare June 13, 2020 20:21
Comment on lines 30 to 43
shouldRenderListOptions: (props, propName, componentName) => {
if (props[propName]) {
if (typeof props[propName] !== 'boolean') {
return new Error(
`${componentName}: '${propName}' must be a boolean if provided.`
)
}
if (!props['removePermittedAccount']) {
return new Error(
`${componentName}: '${propName}' requires 'removePermittedAccount'.`
)
}
}
},
Copy link
Member Author

Choose a reason for hiding this comment

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

removePermittedAccount is used in disconnectAccount, which is only called if the list item options are rendered. So, if shouldRenderListOptions === true, removePermittedAccount must be provided. Otherwise, we don't care.

I'm not completely happy with this solution, but it works. I'm very open to suggestions!

@rekmarks rekmarks force-pushed the consolidate-connected-account-alerts branch from ddb5a21 to 6db7890 Compare June 13, 2020 20:53
@rekmarks rekmarks removed the DO-NOT-MERGE Pull requests that should not be merged label Jun 13, 2020
@rekmarks rekmarks marked this pull request as ready for review June 13, 2020 21:03
@rekmarks rekmarks requested review from kumavis and a team as code owners June 13, 2020 21:03
@metamaskbot
Copy link
Collaborator

Builds ready [6db7890]
Page Load Metrics (1189 ± 68 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaintNaNNaNNaNNaNNaN
domContentLoaded9331454118614168
load9421460118914168
domInteractive9331454118514168

@metamaskbot
Copy link
Collaborator

Builds ready [2532b89]
Page Load Metrics (651 ± 24 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint318545199
domContentLoaded6088396495125
load6108406515124
domInteractive6088386495125

/**
* Checks whether a URL-like value (object or string) is an extension URL.
*
* @param {string | URL | object} urlLike - The URL-like value to test.
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Why make this function more complicated than it needs to be? We only ever pass in a string.

Copy link
Member Author

Choose a reason for hiding this comment

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

activeTab is not a string, but an object with a protocol property, much like a URL object.

Copy link
Member Author

@rekmarks rekmarks Jun 15, 2020

Choose a reason for hiding this comment

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

Of course, knowing that, we could simply pass it the protocol string of that object. I'm fine with that if you prefer.

Copy link
Member

Choose a reason for hiding this comment

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

Or the origin, which is what we used to be comparing against.

It doesn't really matter. Just that it's nice to avoid branches if possible, and it's nice to have clearer type signatures.

@metamaskbot
Copy link
Collaborator

Builds ready [c78e377]
Page Load Metrics (644 ± 11 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint297636105
domContentLoaded5976796432311
load5996806442311
domInteractive5976786422311

@rekmarks
Copy link
Member Author

:only-child selectors fixed in: bb9bb6a

@metamaskbot
Copy link
Collaborator

Builds ready [bb9bb6a]
Page Load Metrics (871 ± 57 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint39114722612
domContentLoaded487118286911857
load489118587111857
domInteractive487118286911857

@metamaskbot
Copy link
Collaborator

Builds ready [ef4aabe]
Page Load Metrics (694 ± 39 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint308239115
domContentLoaded4548646928139
load4568666948139
domInteractive4538646928139

Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

@rekmarks rekmarks merged commit 4dfe4e7 into develop Jun 15, 2020
@rekmarks rekmarks deleted the consolidate-connected-account-alerts branch June 15, 2020 19:08
Gudahtt added a commit that referenced this pull request Jun 16, 2020
* origin/develop: (58 commits)
  Fix site icon fallback letter (#8815)
  add hover style to list-item (#8813)
  Fix site icon size (#8814)
  Consolidate connected account alerts (#8802)
  lowercase web3
  Use markdown-to-jsx@6.11.4 (#8809)
  Update app/_locales/en/messages.json
  Update app/_locales/en/messages.json
  also remove 'dapp' from descriptions
  remove all user-facing instances of 'dapp'
  update button styling on home/asset page (#8800)
  Fix handling of permissions of removed accounts (#8803)
  Clear permssions during createNewVaultAndRestore (#8804)
  Hide token transfers on ETH asset page (#8799)
  Fix account name editing (#8801)
  Fix connect flow account list height (#8798)
  Update color of menu item icons (#8797)
  Update "Connected accounts" empty description (#8796)
  Stop reporting failed transactions to Sentry (#8795)
  Omit state snapshot from Sentry errors (#8794)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants