-
Notifications
You must be signed in to change notification settings - Fork 2k
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 #27836
Map Block #27836
Conversation
@MichaelArestad, a few notes on your comments:
I changed the color palettes to use Theme colors, matching the Paragraph block background and others. 4af0541
Fixed in 6776046 On 10/12 @MichaelArestad found out a few issues that caused map markers to stop responding to clicks. These included multiple map blocks in one page, removing and re-adding map block without page refresh, opening a marker and closing the info window by clicking the X. These are now resolved in 4d91781
It looks like all of the media blocks (image|video|audio) have captions, but no others do. Atavist Maps do have a caption, which is styled differently, so in the interest of aiming for full visual parity I'll need some way to do this. Here are the options I can think of:
What do you think? |
Gutenberg
As of 042b55b |
This seems like the cleanest approach. I wonder if the caption could even be a separate block that's hidden for most users? |
Caption removed in 482b271. Note that if you have a pre-existing Map block you'll get errors and need to remove and replace. Since the block hasn't been released yet, seems like overkill to set up deprecation for the caption. |
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.
This is amazing work! I've left some comments, and questions, but I must admit this looks really impressive!
client/gutenberg/extensions/map-block/map-theme-picker/style.scss
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,49 @@ | |||
<?php |
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.
Ouch, a PHP plugin in Calypso. Doesn't seem to be the right place for this - if this was going in Jetpack, I'd suggest an accompanying PR in Jetpack instead. Then we wouldn't be needing any of it if we use the Jetpack blocks preset.
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.
This feels still an open question.
If the Atavist block should always depend on Jetpack, then it makes sense to move PHP to Jetpack as well. If it needs to work with both Jetpack and Atavist somewhere else without Jetpack, it gets more complicated.
cc @dmsnell
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.
Discussion here: p1537557809000100-slack-jetpack-gutenberg
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.
yeah 🤷♂️ we're playing around with it. there's no reason PHP can't live in Calypso's repo. I think it's worthwhile exploring but I don't have an answer.
client/gutenberg/extensions/shared/atavist/frontend-management.js
Outdated
Show resolved
Hide resolved
This will require Automattic/jetpack#10362 or similar for locales to work properly on the frontend. |
@@ -0,0 +1,49 @@ | |||
<?php |
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.
Is this code necessary? I though that Jetpack would determine when this code gets loaded.
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.
This file is actually unrelated to Jetpack. The Map block is going to be included in Jetpack but this (and other similar blocks) are also being included in a stand-alone plugin, and this .php
file relates to the plugin only.
… Refactor of Frontend Management's handling of block children to avoid altering the DOM. Refactor of view.js files with component and config as properties of a single object, for greater uniformity and less code in the preset view file.
…le point is shown at high magnification.
… defined. If so, do not add.
… testable.' Remove info window when number of map points change, to avoid leaving the window open after its marker has been deleted.
…Reduced the number of lines in the textarea in popups and worked on the popup offset, to keep the popup from being partially obscured in certain cases.
… category to "Jetpack".
Seems like Mapbox refers to the secret as Access tokens instead of keys. I found it confusing because I just read the placeholder text mildly. Although I copied what seemd to be my Default Public Token and the map just worked. Should we take this in consideration and update the terms to be consistent with each other ? It's properly referred to as "Access token" on the inspector controls (sidebar), above the text input for the token, but the buttons to remove or edit still refer to it as key. |
Holding on this until we determine which service we're using, but if we land on Mapbox I'll make sure this text change happens. |
Perhaps this PR could be merged and iterated further in smaller follow up PRs? It can be left out of the preset-files before we publish to NPM in case you don't want to include in Jetpack plugin yet. Just needs a rebase first and two tests are failing on Circle CI. |
@@ -1,5 +1,6 @@ | |||
[ | |||
"markdown", | |||
"publicize", | |||
"map", |
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.
Let's get this removed from the preset and rebased.
I assume this can now be closed, since the block was merged in #28498? |
Correct. I'm closing now. |
Changes proposed in this Pull Request
Preview
Screen capture: https://cloudup.com/ceQ6jKr5-R4
Atavist block example (this block is an adaptation of the Atavist version): https://wpmigration.atavist.com/maps-on-atavist
Testing instructions
Jurassic Ninja
Jetpack/Docker
try/google-maps-api-key
branch.wp-calypso
repo, checkoutatavist/map-block-v2
branch.wp-calypso
repo`:npm run sdk gutenberg client/gutenberg/extensions/presets/jetpack -- --output-dir=PATH_TO_JETPACK_REPO/jetpack/_inc/blocks
( replace PATH_TO_JETPACK_REPO with the path to your local Jetpack repo).Vagrant (No longer valid following changes to Google Maps API Key handling)
Some questions for discussion
1. The block uses browser Geolocation, if available. If no map markers are defined, the block will attempt to use the user's current location. This means that browser will ask for permission to access location, and it significantly slows the initial load. Is this a worthwhile feature? Or does the permission request seem invasive and the delay annoying? If we do opt to keep the feature, at minimum we'll need a loading screen.~~2. How should we handle the Google Maps API key? Currently an API key is hardcoded in the config file, but this is not a sustainable solution. Google requires that a valid key be used in all requests, which must be tied to a billing account. ~~
3. The library used to dynamically load the Google Maps script is
loadScript
. Because of this issue, importing the library causes errors so as a temporary fix I duplicated the library and placed it in the block directory here. After the issue is resolved, I should be able to remove the duplicate and import the original library.5. The sidebar includes the
Locations
component which allows editing of title/caption for all defined markers. The same editing is possible by clicking on markers on the map, which is the more "Gutenberg-esque" approach. I plan to remove the Locations component, unless people feel that both are necessary.6. The Map Theme Picker uses images of the themes. SDK builds fail if an image is included (issue here) so I am temporarily accessing those images from a public S3 bucket.
7. Any additional map styles we should include?
8. Should a future iteration of the block support other mapping services?