-
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
Checklist: Unify WordPress.com checklist and banner #26764
Conversation
f3027cf
to
e20eb5f
Compare
298628a
to
da105ac
Compare
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.
Explored different approach in da105ac
I'd love some feedback if anyone has great ideas here.
client/my-sites/checklist/main.jsx
Outdated
'contact_page_updated', | ||
'post_published', | ||
'custom_domain_registered', | ||
].includes( taskId ) || task.completed === true |
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.
Ugh… this defeats the whole purpose.
Server returns more Tasks than are in the Checklist. We don't want to report incomplete when we aren't rendering some server-reported tasks (we can't complete them!)
Documenting that I considered only querying the tasks we're interested in, but this is a bit fragile and has its own issues. Where does filtering happen? API does not currently support it, data-layer |
client/components/checklist/index.js
Outdated
const count = Children.map( children, child => child.props.completed ).reduce( | ||
( acc, completed ) => ( true === completed ? acc + 1 : acc ), | ||
const completedCount = Children.toArray( children ).reduce( | ||
( count, task ) => ( true === task.props.completed ? count + 1 : count ), |
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.
Would it make sense to use countBy()
instead of reduce()
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.
It might, but I'm not familiar with countBy
. If you want to rewrite to a simpler countBy
, please feel free 👍
client/my-sites/checklist/wpcom-checklist/checklist-banner-task.js
Outdated
Show resolved
Hide resolved
client/my-sites/checklist/wpcom-checklist/checklist-banner-task.js
Outdated
Show resolved
Hide resolved
Noting for posterity/future me: As discussed on a video call, I find However, I've blocked the JP checklist long enough with my architectural requests, and this PR makes things already a lot better, so I rest my case 😄 |
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.
Left a few notes, but overall, LGTM!
I'm putting this on hold, it needs a rebase and some rethinking since #26758 landed. |
client/my-sites/checklist/wpcom-checklist/checklist-banner-task.js
Outdated
Show resolved
Hide resolved
client/my-sites/checklist/wpcom-checklist/checklist-banner-task.js
Outdated
Show resolved
Hide resolved
This is what I get from copy-pasta |
Knee jerk reaction– GIVE ME THIS: https://eslint.org/docs/rules/no-implicit-globals (related context WordPress/gutenberg#9266) |
FTR (from a Slack convo with Jon): While there is a Edit: jinx |
@sirreal yeah, this has burned us more than a few times. |
Tested instructions from #26758 and it continues to perform as expected. No obvious regressions there. |
There's another regression after #26867 that I'm fixing. The banner is only showing when |
Changed in #26867, regression introduced during rebase.
I've fixed some regressions that had been introduced during rebase which lost changes from #26721 and #26867. It would be good for reviewers to test instructions from those PRs for regressions. This is working well now in my testing. |
I restructured in order to be able to remove some eslint namespace ignores. I've gone through all the commentary and this should be ready for review. |
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.
Tested:
- Jetpack site
- No
ChecklistBanner
- 6 tasks
- No
- WP.com site without
designType
- No
ChecklistBanner
- 7 tasks
- No
- WP.com site with
designType
set toblog
-
ChecklistBanner
displayed - 9 tasks
- 'About Page' and 'First Post' links point to correct destinations after completion
-
🎉 🎈 🎆
const location = 'banner' === this.props.viewMode ? 'checklist_banner' : 'checklist_show'; | ||
|
||
this.props.recordTracksEvent( 'calypso_checklist_task_start', { | ||
checklist_name: 'jetpack', |
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 a regression, should be new_blog
.
Fix in #27304
This PR continues separation of state and declarative structure work outlined in #26216.
Inspired by suggestions from @ockham, the Checklist is declared once in idiomatic React JSX, and can be rendered as a checklist of tasks or a banner (see
viewMode
prop).ChecklistShow
, responsible only for rendering the WordPress.com checklist, has been removed.onboardingChecklist
has been removed, and is now JSX inWpcomChecklist
.ChecklistBanner
has been removed and replaced by<WpcomChecklist viewMode="banner" />
.ChecklistMain
renders theWpcomChecklist
and some surrounding UI. Clean up its usage of task status for calculating completion.mergeObjectIntoArrayById
util which is no longer needed and related tests