-
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
Added logic & UI for creating zones, updating zones and deleting zones. #15722
Conversation
The console errors are fixed in a Marcin's PR, so just ignore them for now :) |
…ocations in the zone
Yeah, that was easy (i.e. stupid mistake). Fixed :)
Done :) |
Works now! |
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.
Looks good. Just one comment and otherwise it's ready to 🚢
|
||
const ShippingZoneHeader = ( { zone, site, onSave, translate } ) => { | ||
const ShippingZoneHeader = ( { zone, site, onSave, onDelete, translate, isBusy, canSave, isSaving } ) => { |
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.
isBusy
is not passed to this component and is only used in one place. Is it still needed?
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.
Nope, I renamed it to isSaving
and I messed that up in rebases/merges, good catch!
@@ -106,7 +107,9 @@ const ShippingZoneLocationList = ( { siteId, loaded, translate, locations, actio | |||
<ExtendedHeader | |||
label={ translate( 'Zone locations' ) } | |||
description={ translate( 'Define the places that are included in this zone.' ) } > | |||
<Button onClick={ onAddLocation } disabled={ ! loaded } >{ translate( 'Edit locations' ) }</Button> | |||
<Button onClick={ onAddLocation } disabled={ ! loaded } > | |||
{ isEmpty( locations ) ? translate( 'Add locations' ) : translate( 'Edit locations' ) } |
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.
Hi! I've found a possible matching string that has already been translated 46 times:
translate( 'Add Location' )
ES Score: 8
Help me improve these suggestions: react with 👎 if the suggestion doesn't make any sense, or with 👍 if it's a particularly good one (even if not implemented).
* Changed the shipping-zone-locations reducer code structure so it's easier to extend * Added saving the zone's locations when saving a zone * Refactored the actionList code a bit. * Update the state when the locations are finished saving. * Automatically orders all the shipping zones on save. (#15771)
Everything worked as expected! :) Couple of points; When adding a zone, the trash icon shouldn't be in the header bar.
"Correctly" should probably be "successfully" but tbh, I think "Shipping zone deleted" is adequate. Seeing it live, I don't think the zone name card is working very well. When creating a zone this shouldn't be the first thing you see, it's distracting/confusing. Instead how about we put the name card beneath locations / methods as a regular input, pre-populated based on the locations they choose. I think it needs a description as well. Something like this: |
👍 Agree with @jameskoster. |
The zone name should be in a new PR. I opened #15799 |
Thanks, Marcin. |
Done.
Done. Also, a small UX question: What should happen when you haven't modified anything and you click the
|
a) Instant success message only. We shouldn't ever disable Save buttons. This is inline with the rest of Calypso settings as well. Mainly because: people want the piece of mind that a Save button gives them even if they didn't make any change. I blame Microsoft Word :) |
@jameskoster I've pushed the changes you suggested. This is ready for a final review :) |
When creating a new shipping zone, the URL is `/store/:site/zone/new`. After the user hits "Save" and the server replies with the created zone, now the URL is updated to `/store/:site/zone/27` (or whatever ID the zone has). This is just a cosmetic change in the URL, without triggering any route-related code or re-rendering the page or anything.
👍 Looks good. |
Can we fix this: #15722 (comment) |
@kellychoffman I'd already fixed that in 5843047 . Are you still seeing |
Looks good. One minor language nitpick (sorry). When adding a zone could the success message be "Shipping zone added"? "Shipping zone saved" is fine for other occasions. |
Done! :) Now that Calypso is 💚 , I'm gonna merge this, if there's more stuff to do I'll open separate PRs. |
Fixes #14268 , fixes #14271
I've followed (i.e. shamelessly copied) @coderkevin code for products. This PR includes:
This PR does NOT include:
I found a weird behaviour of the
action-list
. If you don't change anything on the zone, and click theSave
button, nothing happens, because anactionList
with an empty list ofnextSteps
is created, and that doesn't trigger thesuccessAction
. In my mind, I would expect that thesuccessAction
would trigger immediately for those cases. What do you think Kevin?