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

Address book send plus contact list #6914

Merged
merged 99 commits into from
Jul 31, 2019
Merged

Conversation

danjm
Copy link
Contributor

@danjm danjm commented Jul 25, 2019

Resolves #6365
Resolve #6585
Closes #6702, #6681

This PR includes all the work done #6681 and #6702. These PRs included the new address book send flow and much of the work for the contact list settings feature.

In addition to that work, this PR adds a number of changes and improvements have been made to the address book settings work, including:

  • correct header/sub-header names on all screens in address book settings, such that viewing profiles with and without nicknames will show appropriate headers
  • adds the "My Accounts" screen
  • changes the add button to the floating circular button
  • updates styles to match https://www.figma.com/proto/giaffk6qfl9eMMjoPFjJkGnt/Address-book?node-id=0%3A1&scaling=min-zoom, (the most significant change in that regard is to use the same contact list as used in the send screen)
  • adds ENS resolution (same as on the send screen) to the settings address book

Demo video here: https://streamable.com/lcdfd

@whymarrh @jennypollack @cjeria @bdresser

@danjm danjm requested review from Gudahtt and whymarrh as code owners July 25, 2019 14:58
@danjm danjm force-pushed the address-book-send-plus-contact-list branch from 2e24129 to fbb2fa9 Compare July 25, 2019 15:06
@danjm danjm force-pushed the address-book-send branch from 414ed87 to 4578c87 Compare July 25, 2019 15:08
@metamaskbot
Copy link
Collaborator

Builds ready [fbb2fa9]: chrome, firefox, edge, opera

@danjm danjm changed the base branch from address-book-send to develop July 25, 2019 15:56
Copy link
Contributor

@whymarrh whymarrh left a comment

Choose a reason for hiding this comment

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

A few changes. I'll take another look once a few of them have been implemented.

ui/app/components/ui/dialog/index.js Show resolved Hide resolved

if (query) {
if (!this.contactFuse) {
this.contactFuse = new Fuse(contacts, {
Copy link
Contributor

Choose a reason for hiding this comment

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

This might be better off attached to the class itself as a property so that we don't need to manage the state ourselves—as a property it would be created once when the class is constructed.

style: { color: '#dedede' },
onClick: () => this.handleInputEvent(),
}),
// !to && h(`i.fa.fa-caret-down.fa-lg.send-v2__to-autocomplete__down-caret`, {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: we can remove these lines

import Identicon from '../../../../components/ui/identicon'
import { CONTACT_LIST_ROUTE, CONTACT_EDIT_ROUTE } from '../../../../helpers/constants/routes'
import Button from '../../../../components/ui/button/button.component'
const copyToClipboard = require('copy-to-clipboard')
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: import copyToClipboard from 'copy-to-clipboard' maybe

}
}

// Calls the addressBookController to remove an existing address.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Can we use JSDoc here?

function getAddressBookEntryName (state, address) {
const entry = getAddressBookEntry(state, address) || state.metamask.identities[address]
const name = entry && entry.name !== '' ? entry.name : addressSlicer(address)
return name
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: inline this return statement

@@ -203,7 +208,26 @@ function conversionRateSelector (state) {
}

function getAddressBook (state) {
return state.metamask.addressBook
const network = state.metamask.network
const addressBookEntries = Object.entries(state.metamask.addressBook)
Copy link
Contributor

Choose a reason for hiding this comment

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

This can probably be Object.values and then filtered

backRoute = SETTINGS_ROUTE
}

const address = pathname.slice(-42)
Copy link
Contributor

Choose a reason for hiding this comment

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

Where does 42 come from?

Copy link
Contributor

Choose a reason for hiding this comment

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

We could instead treat pathname here as a URL component and split it on / and pick out the constituent parts which might be less fragile?

const copyToClipboard = require('copy-to-clipboard/index')
const ENS = require('ethjs-ens')
const networkMap = require('ethjs-ens/lib/network-map.json')
const log = require('loglevel')
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we translate all of these to ESM imports?

@whymarrh
Copy link
Contributor

Also we'll need to rebase this on the latest develop

@danjm
Copy link
Contributor Author

danjm commented Jul 26, 2019

@whymarrh Apart from the one comment I directly replied to, all of your comments are addressed in 305e96a1d

I also addressed all the other issues we found earlier while QAing in the following commits:
6653e60f4 Fix send screen contact searching after network switching
07ba4c2e3 Fix display of all recents after clicking 'Load More' in contact list
a53563491 Ensure add-contact component properly updates after QR code detection
d7e599ced Use keyCode to detect enter key in AddToAddressBookModal
1b709c0de Default alias state prop in AddToAddressBookModal to empty string
e81e902d4 Make the displayed and copied address in view-contact.component the checksummed address
4e122c3a5 Show resolved ens icon and address if exists (settings: add-contact.component)
3ccc5e8de Resolve send screen search for ensAddress to matching address book entry if it exists
d7c444f9b Switching networks when an ens address is shown on send form removes the ens address.

@danjm danjm mentioned this pull request Jul 26, 2019
3 tasks
@danjm danjm force-pushed the address-book-send-plus-contact-list branch from 305e96a to 88aa542 Compare July 26, 2019 00:29
@metamaskbot
Copy link
Collaborator

Builds ready [1fa7533]: chrome, firefox, edge, opera

@danjm danjm force-pushed the address-book-send-plus-contact-list branch from 1fa7533 to 4d8295f Compare July 26, 2019 02:47
@danjm
Copy link
Contributor Author

danjm commented Jul 26, 2019

Rebased onto develop

@danjm danjm force-pushed the address-book-send-plus-contact-list branch from 4d8295f to a8439a8 Compare July 26, 2019 03:41
@metamaskbot
Copy link
Collaborator

Builds ready [a8439a8]: chrome, firefox, edge, opera

@danjm danjm force-pushed the address-book-send-plus-contact-list branch from a8439a8 to 1b6430d Compare July 26, 2019 12:53
@metamaskbot
Copy link
Collaborator

Builds ready [1b6430d]: chrome, firefox, edge, opera

@danjm danjm mentioned this pull request Jul 26, 2019
@cjeria
Copy link
Contributor

cjeria commented Jul 30, 2019

Here's my design feedback for the address book.

ENS functionality

ENS error message copy

Can be made clearer by explicitly saying "ENS name not found on the current network. Try switching to Main Ethereum Network".

ENS address not displaying (bug)

Not sure what's going on but I have an ENS name that I've registered and set a resolver address (my full name) and the result is "0x..0x". As you can see it throw a check indicating that it recognizes this ENS name as an address, but it doesn't display the actual address under the name as I'd expect it to. Let me know if you need any more info to help debug this.

Contact list

Cancelling out of Edit Mode

When editing a contact there is a "save" and “cancel” button. The cancel button should take you out of “edit” mode, NOT take you back to the full contact list.

Memo

The memo is missing - I personally think it’s a nice feature to help add context to accounts, I’d push to add this in.

Current implementation

image

Designs (see specs in Figma file)
image

Fullscreen mode

I'd suggest we do a two-column layout as was done for networks in settings. I quickly hacked this screen together to get the idea across. let me know if you want me to provide more direction here.

image

I realize "My wallet accounts" is 3 levels deep, so I'd like to suggest we introduce breadcrumbs when we have a nav >2 levels deep in settings. Again, I just hacked these screens together, so let me know if you have any questions.
image

Designs are in here)

@danjm
Copy link
Contributor Author

danjm commented Jul 30, 2019

Thanks @cjeria

I am working on these changes now. One note regarding the bug with resolving your ens name.

It seems that there was some sort of error when you registered it. See the difference between https://etherscan.io/address/christianjeria.eth and https://etherscan.io/address/dinodan.eth for example, or between https://manager.ens.domains/name/christianjeria.eth and https://manager.ens.domains/name/dinodan.eth

If you go to https://etherscan.io/enslookup and enter your ens name, it looks like the address was previously in a different registrar but has not successfully registered in the new registrar.

For us in MetaMask, we should show an error when this happens instead of a 0x...0x address. I will make that change as well.

@metamaskbot
Copy link
Collaborator

Builds ready [b989bd3]: chrome, firefox, edge, opera

danjm added 20 commits July 31, 2019 15:22
…x; allow display of addressbook name in settings header
@whymarrh whymarrh force-pushed the address-book-send-plus-contact-list branch from 9ed68fe to 8ebdf9f Compare July 31, 2019 17:53
@metamaskbot
Copy link
Collaborator

Builds ready [8ebdf9f]: chrome, firefox, edge, opera

Copy link
Contributor

@whymarrh whymarrh left a comment

Choose a reason for hiding this comment

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

LGTM, I've reviewed, QA'd, and reviewed again ❤️

@metamaskbot
Copy link
Collaborator

Builds ready [e8baae8]: chrome, firefox, edge, opera

@danjm danjm merged commit e9c7df2 into develop Jul 31, 2019
@whymarrh whymarrh mentioned this pull request Jul 31, 2019
8 tasks
@danjm danjm deleted the address-book-send-plus-contact-list branch October 2, 2019 18:13
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.

Address Book Send Flow Address Book management screens
7 participants