-
Notifications
You must be signed in to change notification settings - Fork 45
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
feat(donate-block): hide buttons if only one frequency is available #1853
Conversation
Hmm, I'm a bit hesitant about this — it seems too easy for a publisher to accidentally set up something where their description doesn't match the behavior, i.e. a donation block is set to weekly, and the publisher mistakenly adds copy above it saying "Make a one-time donation." Even if the user notices that it's actually recurring in the checkout flow, they might feel mislead and abandon the donation. What do you think about this idea: in cases where only one frequency is selected, that title is expanded to "Make a {frequency} donation."? That way it's more clear, but removes the risk of mislabeling a recurring product. |
@kevinzweerink – the original request from a publisher was to hide the label. WDYT about making this an option? Then a publisher can hide the label (as an explicit step) and add their own using e.g. a paragraph block above the Donate block? |
Sure, we could do that. I don't love this direction in general because I feel like it introduces more hidden functionality to the donation block, which already features a lot of configuration options that you have to know to look for. At this stage I'm not sure it makes sense to revisit the general approach though. If we want to go ahead and implement this, here's a mockup of where I think the control should live — I would make it a toggle that appears under the tier options when only one tier is selected; this way it's clear which label will be removed. |
Hi Adam and Kevin. I was invited by Claudiu to get up to speed on a number of Newspack products and dev environment in order to help out as needed. He recommended I give a review to a number of PRs, including this one. I'll provide my review here if it helps in anyway 😃 Overall I think this is a tough one. I understand publishers wanting to remove an unneeded label when there is only one "tab", but I also understand that it could cause a publisher to accidentally sell a frequency that the user doesn't see. How about the following: I noticed there are other configurations of the Donate Block that already show a "redundant" frequency in both the tab and in the content area. Please see these two screenshots: So maybe this same "redundancy" can be applied to the following layouts. This way, if there is only one tab/label and it is auto-hidden, the user can still see the frequency in the content box. Please see these 3 mockups: In the end, my thoughts would be to do:
I hope this might help :-) Thanks! |
Thanks @ronchambers ! I like the idea. WDYT @kevinzweerink ? |
Thanks @ronchambers! I've applied your suggestions. |
@adekbadek - Thanks for these changes. If you ever need me to QA/review sooner, feel free to let me know a deadline or ping me on slack too :-) Overall I really like the new "per month" and "per year" labels on all the different styles. And I really like the new sentence "Donation amount per month" and "Donation amount per year". I also noticed that a single-tab will disappear when there is only one tab. Awesome! I have two pieces of feedback:
|
Good catch! Fixed in bbed5ad
I'm not a fan of how this looks. I think it's fine to assume that a donation is a one-time donation. |
Nice, I retested and bug is fixed. As for adding "one-time" or "once", personally I think something is needed since users and publishers "could" get confused, but I also think what you said is reasonable in that most people would probably assume a donation is "one-time" unless stated otherwise. So cool with me either way :-) |
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 the functionality and it works as described. I did not do a code review - I just tested via the wp-admin / blocks editor.
@adekbadek is this ready to merge? |
Sorry, forgot about this one. It would use a code review on top of QA. I've asked @ronchambers on Slack. |
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.
webpack.config.js
Outdated
const pathToBlock = [__dirname, 'src', 'blocks', block] | ||
let viewScriptPath = path.join( ...pathToBlock, 'view.js' ); | ||
let fileExists = fs.existsSync( viewScriptPath ) | ||
if (!fileExists) { | ||
// Try TS. | ||
viewScriptPath = path.join( ...pathToBlock, 'view.ts' ); | ||
fileExists = fs.existsSync( viewScriptPath ) | ||
} | ||
if ( fileExists ) { |
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.
There's some inconsistent spacing and missing ;
here.
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.
Fixed in f40d831
@@ -0,0 +1,53 @@ | |||
/** |
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.
Did we change our linting rules? This file does not follow our usual practices.
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.
There's something odd indeed, stemming from #1774. When I format the code of a file untouched by the changes here, with the npm script, it does make edits. For example:
$ ./node_modules/.bin/newspack-scripts wp-scripts lint-js ./src/blocks/author-list/edit.js
-> no errors, linting is ok
$ ./node_modules/.bin/newspack-scripts wp-scripts format ./src/blocks/author-list/edit.js
-> edits are made to the file
$ ./node_modules/.bin/newspack-scripts wp-scripts lint-js ./src/blocks/author-list/edit.js
-> still no linting errors, despite the fact that the file is edited and all formatting changed
But that's not something introduced by this PR, so it's a subject for another discussion.
I can't reproduce: Can you make sure that the CSS is rebuild and this CSS applied (via the inspector)? |
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.
Thanks, @adekbadek! Not sure what happened there, it's rendering fine now.
Hey @, good job getting this PR merged! 🎉 Now, the Please check if this PR needs to be included in the "Upcoming Changes" and "Release Notes" doc. If it doesn't, simply remove the label. If it does, please add an entry to our shared document, with screenshots and testing instructions if applicable, then remove the label. Thank you! ❤️ |
🎉 This PR is included in version 4.4.0-alpha.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [4.4.0](v4.3.7...v4.4.0) (2024-11-25) ### Bug Fixes * revert "feat(homepage-articles): rename block and reorganise settings ([#1943](#1943))" ([#1971](#1971)) ([fb161b9](fb161b9)) ### Features * add Bluesky support to the Author Profile, List blocks ([#1969](#1969)) ([f1c29ab](f1c29ab)) * **donate-block:** hide buttons if only one frequency is available ([#1853](#1853)) ([043591e](043591e)) * **homepage-articles:** rename block and reorganise settings ([#1943](#1943)) ([1af11a4](1af11a4))
🎉 This PR is included in version 4.4.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
All Submissions:
Changes proposed in this Pull Request:
If the Donate block is set to render just one frequency, the frequency buttons section should not be displayed.
Instead, a frequency label is added, if applicable.
How to test the changes in this Pull Request:
trunk
, insert Donate blocks (see below for a copy-paste)Blocks code for testing
Other information: