-
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
Simple Payments: gutenberg block UI #28169
Conversation
b3882eb
to
53eecd6
Compare
I recorded a screencast that highlights a few issues I noticed: https://cloudup.com/cM30s7LEbQd
|
53eecd6
to
3873de1
Compare
@roccotripaldi FYI: I tried to register this block using import JetpackBlockType from 'gutenberg/extensions/presets/jetpack/utils/jetpack-block-type';
const SimplePaymentsBlock = new JetpackBlockType( 'simple-payments', {
// ...
} );
SimplePaymentsBlock.register(); |
client/gutenberg/extensions/simple-payments/product-placeholder.jsx
Outdated
Show resolved
Hide resolved
41082c9
to
c0fe79e
Compare
This is pretty close to being ready. It's missing some error states that might be coming from the API but validations at the frontend already work. It's unclear to me if prices need to be limited to There might be some accessibility improvements we can still do. The block also loads even for simple plans; a mechanism to stop that happening is still in the works elsewhere. @brbrr which browser are you using? I couldn't replicate the alignment issue. |
Looks like there's a small bug where currency doesn't get set to default "USD" unless you change it to something else first. |
The idea was to trigger the error messages when we unfocus an unfilled block (kind of like a submit button with a form). Maybe when we refocus and start filling the fields, the message could/should disappear? |
formattedPrice: { | ||
type: 'string', | ||
default: '', | ||
}, | ||
multiple: { | ||
type: 'number', |
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.
Related: Automattic/jetpack#10402 (comment)
I'd like to isolate API concerns from component logic. Indicating this is a number is confusing, I'm happy to add toApi
/fromApi
as necessary.
11d63cf
to
039d927
Compare
Maintain .js extension so diff is clearer.
This was causing a warning. defaultValue is for uncontrolled components. With the Gutenberg default attribute value, the currency should be correctly defined.
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.
I tested this on a Jetpack site with Automattic/jetpack#10402 and it's working nicely.
I want to confirm Simple Payments in the classic editor continue to work as expected with the default changes, then let's ship and iterate!
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.
Simple payments continue to work as expected.
Let's wait for e2e and 🚢 🚢 🚢
Seems to be caused by styles leaking in from Calypso-Gutenberg, opened an issue: #28309 |
Adds basic UI for Simple payments Gutenberg block.
Screenshots
UI:
UI screaming warnings:
Preview in editor:
End result at the site:
Todo / known issues
paypal.com
>= 1.00
view.scss
— now it's just copied over from Jetpack plugin and we need very little from it for the previewTesting instructions
Test in Jetpack
Test in Calypso
Manual checking
Apply these patches and cross-test the block in different editors: