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

Update Checkout block UI #117

Merged
merged 10 commits into from
Jun 12, 2024
Merged

Update Checkout block UI #117

merged 10 commits into from
Jun 12, 2024

Conversation

Dinwy
Copy link
Collaborator

@Dinwy Dinwy commented May 27, 2024

Changes

  1. Adjust Icons
  • Updated the appearance and alignment of credit card icons for a cleaner look.

image

  1. After merging Prevent rendering fields if should not; use hosted pages instead #118
  • Adjust icon position & show description when it is selected & has description.
  • Left is before, and the Right is after.
  1. Disable web_money visiable test
  • Since we don't support web money inline, the hosted field is not visible

@Dinwy Dinwy force-pushed the update/3.1.3FixUI branch 2 times, most recently from 5a516ac to 9db4630 Compare May 29, 2024 05:38
@Dinwy Dinwy changed the title WIP: Update Checkout block UI Update Checkout block UI Jun 3, 2024
@@ -51,7 +49,7 @@ const KomojuPaymentModule = (() => {
};
}

function submitFields(fields) {
async function submitFields(fields) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Great catch!

I just thought we need to carefully test both successful payments and failing payments, because making this function really async could change the timing this function returns, and thus could result in another timing issues. It's not blocking this PR but I expect you would double-check the behaviour manually. 🙏

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you for the check!

I've updated the submitFields function based on the feedback. I removed the unnecessary async keyword from the Promise constructor to clarify the function's control flow and error handling, which should help avoid any potential timing issues.

})
: null;
const description = window.wp.htmlEntities.decodeEntities(settings.description || window.wp.i18n.__('title', 'komoju_woocommerce'));
const descriptionDiv = createElement('div',
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we set descriptionDiv to null if description is falsy (i.e., zero-length string), maybe?

AIUI description can be empty, notably due to the default configurations for plugin versions <= 3.0.9. In such cases descriptoinDiv will be an empty <div>, which just adds a void blank line under the payment name - I fear that doesn't look good.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I set descriptionDiv to null when it is empty.
I also changed the server-side behaviour how it sets the description. Previously, it was setting default description when the description is empty. Now user are able to empty description.

Since description div & komojuField can be null, null checks have been added in the code too.

Copy link
Contributor

@makotom makotom left a comment

Choose a reason for hiding this comment

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

Generally LGTM, just left few opinionated comments. Feel free to ping me for a follow-up review!

Copy link
Contributor

@makotom makotom left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for this great work!

@makotom makotom merged commit de27fe2 into master Jun 12, 2024
4 checks passed
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.

2 participants