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

Map Block: Mapbox Key Input Improvements #28730

Merged
merged 11 commits into from
Nov 21, 2018
Merged

Conversation

jeffersonrabb
Copy link
Contributor

Changes proposed in this Pull Request

This PR improves the initial screen of the Map block, before user has input their Mapbox key, in the following ways:

  1. New copy courtesy @mapk
  2. There is a SET TOKEN button that must be pressed after inputting the key. This replaces the rather awkward earlier approach that responded to the text field's input event. @melchoyce among others found this to be confusing UI.
  3. SET TOKEN button and input text field are disabled while a API calls are in flight.
  4. If you attempt to change the Access Token in the sidebar to an invalid key, you will get a notification that it is invalid but previously you would also be returned to the initial screen as if you had never input the token. Now, you get the notification but the key returns to its last good value and the block continues to function. @jeherve pointed this one out.
  5. All references to the key are now reamed Access Token which is Mapbox's language vs. Google's API Key. This comes courtesy of @oskosk.

Testing instructions

Create Map block, add key, verify flow. After key has been accepted, in sidebar set to an invalid key and UPDATE TOKEN. You should see error message but the token reverts to last good value and block functions. Verify copy changes and spelling, too.

JN link: https://jurassic.ninja/create/?gutenberg&gutenpack&shortlived&jetpack-beta&calypsobranch=update/map-key-management&branch=master

@matticbot
Copy link
Contributor

@jeffersonrabb jeffersonrabb self-assigned this Nov 20, 2018
@jeffersonrabb jeffersonrabb added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Nov 20, 2018
Copy link
Member

@sirreal sirreal left a comment

Choose a reason for hiding this comment

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

This works well. The biggest issue I have are the non-localized strings, everything else is minor.

client/gutenberg/extensions/map/edit.js Outdated Show resolved Hide resolved
client/gutenberg/extensions/map/edit.js Outdated Show resolved Hide resolved
client/gutenberg/extensions/map/edit.js Outdated Show resolved Hide resolved
@simison
Copy link
Member

simison commented Nov 20, 2018

I had a map block in a post from the previous PR and after refreshing the page I get:

image

image

HTML in each column is identical. After inserting a fresh block all is fine again. Just documenting for the record, it's quite normal that things like this happen between PRs.

@jeffersonrabb
Copy link
Contributor Author

HTML in each column is identical. After inserting a fresh block all is fine again. Just documenting for the record, it's quite normal that things like this happen between PRs.

Definitely true. This is largely because of the recent change to camelCase attributes. The newly renamed attributes don't match the saved block, hence the error. This was the main reason I wanted to get the camelCase PR merged first - to avoid lots of broken blocks with each new branch.

@simison
Copy link
Member

simison commented Nov 20, 2018

I'm getting this on Gutenberg master branch, Firefox, latest stable WordPress:

screenshot 2018-11-20 at 23 19 54

@simison simison added this to the Jetpack: 6.8 milestone Nov 20, 2018
@simison simison added the [Goal] Gutenberg Working towards full integration with Gutenberg label Nov 20, 2018
@jeffersonrabb
Copy link
Contributor Author

I'm getting this on Gutenberg master branch, Firefox, latest stable WordPress:

Nice spot. Fixed in e2acff7

@MichaelArestad
Copy link
Contributor

The copy is good to go after your most recent change. Nice work!

} );
},
result => {
this.onError( null, result.message );
Copy link
Contributor

Choose a reason for hiding this comment

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

is it normal that we always call this.onError?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this.onError should only be called if the API call fails. Is that what you're asking about?

<RawHTML>{ getAPIInstructions }</RawHTML>
<p>{ __( 'To use the map block, you need an Access Token.' ) }</p>
<p>
<ExternalLink href="https://www.mapbox.com">
Copy link
Member

Choose a reason for hiding this comment

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

What if we linked users directly to https://www.mapbox.com/account/ instead.
They would see a login page asking them to create an account.
But the access token would be easier to find.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@MichaelArestad what do you think?

@enejb
Copy link
Member

enejb commented Nov 21, 2018

The code looks great and it tested well.

I wonder if we could update the styles so that the contact form and the maps bock have similar styles when it comes to the place holder. cc: @MichaelArestad , @mapk
screen shot 2018-11-20 at 4 03 48 pm

@jeffersonrabb jeffersonrabb merged commit 0289c4c into master Nov 21, 2018
@MichaelArestad
Copy link
Contributor

@enejb I think there's a definite need for a common pattern for these. We will be exploring that in Phase 2,

@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Nov 21, 2018
@enejb enejb deleted the update/map-key-management branch November 21, 2018 00:10
@jeherve jeherve removed this from the Jetpack: 6.8 milestone Nov 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Goal] Gutenberg Working towards full integration with Gutenberg
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants