-
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
Hero Flow: Integrate video courses #58234
Conversation
Link to Calypso live: https://calypso.live?image=registry.a8c.com/calypso/app:build-23472 |
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: App Entrypoints (~50 bytes added 📈 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Sections (~149 bytes added 📈 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~7330 bytes added 📈 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
c501567
to
39b7022
Compare
Thanks @arthur791004 – I've added it to our board too so we can see where improvements to the component itself can be made. 👍 |
39b7022
to
66b5ec5
Compare
align-items: center; | ||
justify-content: space-between; | ||
font-size: $font-body-small; | ||
padding: 20px 24px; |
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.
auto format by prettier
66b5ec5
to
189f7ef
Compare
We're simplifying the props to the |
@kwight Okay! |
80db0ca
to
8f37535
Compare
3a538d3
to
f3f2a15
Compare
@ianstewart also mentioned that we shouldn't be calling it "Masterclass" – maybe "Watch some quick videos"? @provenself any opinions here? |
I'd go with: Learn the Basics
|
This seems to be working great! (Minus the wording change that Kirk mentioned.) One random thought - it seems to me like maybe the "Draft your first post" and "start writing" buttons should open in a new tab. As a user, I feel like I might want to be able to go back to the videos/hero flow and see what else was there (or check the videos while writing the post, etc.) |
I think it's a good point to let the user go back to see the video again. But it's also weird that the user would stop at here after they have completed the video. Thus, we only let the user see the footer bar to start writing or they can click the top-right button to draft a post. So I think it's okay to redirect to the post page at the current page. |
@kwight I've removed |
Oh sorry @arthur791004 , I wasn't clear – I meant remove For the copy, we should go with editorial's suggestion above. Otherwise, looking great – keen to get this out! |
Will we be able to ship to all languages all at once with this feature? Hopefully translations are already done since the feature has been on my home. Then there are just a few new translations in the Blogger Flow. |
const { updateUserCourseProgression } = useUpdateUserCourseProgressionMutation(); | ||
|
||
const initialUserCourseProgression = useMemo( () => course?.completions ?? [], [ course ] ); | ||
|
||
const [ userCourseProgression, setUserCourseProgression ] = useState( [] ); |
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.
We don't need initialUserCourseProgression
and userCourseProgression
anymore as the course would be updated whenever the video is marked as completed.
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.
React Query does have a section about optimistic updates, maybe we could be using something like that instead?
updatedUserCourseProgression[ videoData.slug ] = true; | ||
setUserCourseProgression( updatedUserCourseProgression ); | ||
updateUserCourseProgression( courseSlug, videoData.slug ); | ||
if ( ! completedVideoSlugs.includes( videoData.slug ) ) { |
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.
Only complete the course if it's incomplete
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.
Hooks 😵💫 😅
This change makes a lot of sense after reading through it. At first, I thought using useCourseData()
from within the step component was too powerful. It didn't really feel like the step needed ownership over the isCompleted
state and that a simple callback when the completed state changed would be enough. But what about if you close the completed course UI and reopen? Then we want <CoursesFooter>
to appear immediately. So a callback doesn't cut it.
So separation of concerns here into "data" and "UI" works well here.
Big change though so we should definitely make sure we loop Explorers back in. Whatever form the PR eventually takes, I think separating the concerns here is a good move 👍
queryClient.invalidateQueries( [ 'course-progression', args.courseSlug ] ); | ||
queryOptions.onSuccess?.( ...args ); | ||
onSuccess( data, variables, context ) { | ||
queryClient.invalidateQueries( [ 'courses', variables.courseSlug ] ); |
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 change looks good. If feels like the POST
could return the new progression data so we can update the local cache without using another GET
. This works though.
I'm a bit confused about how it was working before. I can't see what the old [ 'course-progression', args.courseSlug ]
query key was referring to.
const { updateUserCourseProgression } = useUpdateUserCourseProgressionMutation(); | ||
|
||
const initialUserCourseProgression = useMemo( () => course?.completions ?? [], [ course ] ); | ||
|
||
const [ userCourseProgression, setUserCourseProgression ] = useState( [] ); |
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.
React Query does have a section about optimistic updates, maybe we could be using something like that instead?
736beac
to
e2714cb
Compare
I saw that the best practice suggested that “Always refetch after error or success” by
I think there might be something wrong as the |
4d0b0fd
to
2d8afab
Compare
2d8afab
to
be2ea80
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.
This is looking good! 🎉
- The code is much cleaner now since there are no modifications to the VideoUI component.
- The flow tests fine:
- Back button works properly on desktop & mobile.
- Videos get marked as completed.
- When all videos are marked as complete the CTA appears.
- The links in the CTA are correct.
This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/7074284 Thank you @arthur791004 for including a screenshot in the description! This is really helpful for our translators. |
* Hero Flow: Integrate video courses * Setup Header and Footer * Adjust courses header style * Implement courses footer to handle the completion of courses * Turn on config for wpcalypso * Update copy * Enable to non-English users * Refine by review
Translation for this Pull Request has now been finished. |
Changes proposed in this Pull Request
signup/starting-point-courses
to control showing “Take the masterclass” starting point or not and now is only for English userNote that we should ensure the tracks event fired correctly in the Hero Flow.
Desktop
courses-step-demo.mov
Mobile
courses-step-demo-mobile.mov
Testing instructions
/start/setup-site/intent?siteSlug=<your_site>
Related to
Blogger Flow: Video UI branch from starting-point screen #58262