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

Hero Flow: Integrate video courses #58234

Merged
merged 8 commits into from
Jan 5, 2022
Merged

Conversation

arthur791004
Copy link
Contributor

@arthur791004 arthur791004 commented Nov 18, 2021

Changes proposed in this Pull Request

  • Use signup/starting-point-courses to control showing “Take the masterclass” starting point or not and now is only for English user
  • Add “Watching Blogging videos” into the list of the starting point
    image
  • Integrate the video UI but keep the navigation bar of the signup framework.

Note 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

  • Go to /start/setup-site/intent?siteSlug=<your_site>
  • Select write intent
  • Fill out the site options
  • Select “Take the masterclass” as starting point
  • Check the following things:
    • Video UI show correctly.
    • The “Back” button works correctly
    • “Draft your post” button works correctly
    • The footer shows after you complete the courses. Clicking the “start writing” button makes you complete the flow and land on the editor
    • Ensure the tracks event works correctly

Related to

Blogger Flow: Video UI branch from starting-point screen #58262

@github-actions
Copy link

github-actions bot commented Nov 18, 2021

@matticbot
Copy link
Contributor

matticbot commented Nov 18, 2021

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

App Entrypoints (~50 bytes added 📈 [gzipped])

name                   parsed_size           gzip_size
entry-main                  +150 B  (+0.0%)      +50 B  (+0.0%)
entry-login                 +150 B  (+0.0%)      +50 B  (+0.0%)
entry-gutenboarding         +150 B  (+0.0%)      +50 B  (+0.0%)
entry-domains-landing       +150 B  (+0.0%)      +50 B  (+0.0%)
entry-browsehappy           +150 B  (+0.2%)      +50 B  (+0.2%)

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])

name             parsed_size           gzip_size
signup               +1906 B  (+0.5%)      +66 B  (+0.1%)
home                  +782 B  (+0.1%)      +60 B  (+0.0%)
jetpack-connect        +39 B  (+0.0%)      +14 B  (+0.0%)
accept-invite          +39 B  (+0.0%)      +14 B  (+0.0%)
plans                  +29 B  (+0.0%)      +13 B  (+0.0%)
domains                +29 B  (+0.0%)      +10 B  (+0.0%)
checkout               +29 B  (+0.0%)      +10 B  (+0.0%)

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])

name                                                  parsed_size           gzip_size
async-load-signup-steps-courses                          +79747 B    (new)   +25391 B    (new)
async-load-signup-steps-starting-point                     +603 B  (+0.8%)     +165 B  (+0.7%)
async-load-signup-steps-intent                             +268 B  (+0.3%)      +54 B  (+0.2%)
async-load-signup-steps-site-options                       +258 B  (+0.3%)      +47 B  (+0.2%)
async-load-signup-steps-design-picker                      +258 B  (+0.3%)      +47 B  (+0.1%)
async-load-signup-steps-woocommerce-install-transfer        +34 B  (+0.0%)      +16 B  (+0.1%)
async-load-signup-steps-woocommerce-install-confirm         +34 B  (+0.0%)      +14 B  (+0.0%)
async-load-signup-steps-user                                +34 B  (+0.0%)      +13 B  (+0.0%)
async-load-signup-steps-theme-selection                     +34 B  (+0.0%)      +15 B  (+0.0%)
async-load-signup-steps-test-step                           +34 B  (+0.0%)      +16 B  (+0.1%)
async-load-signup-steps-survey                              +34 B  (+0.0%)      +17 B  (+0.1%)
async-load-signup-steps-site-type                           +34 B  (+0.0%)      +16 B  (+0.1%)
async-load-signup-steps-site-topic                          +34 B  (+0.0%)      +15 B  (+0.1%)
async-load-signup-steps-site-title                          +34 B  (+0.0%)      +14 B  (+0.1%)
async-load-signup-steps-site-style                          +34 B  (+0.0%)      +17 B  (+0.1%)
async-load-signup-steps-site-picker                         +34 B  (+0.0%)      +14 B  (+0.0%)
async-load-signup-steps-site-or-domain                      +34 B  (+0.0%)      +15 B  (+0.1%)
async-load-signup-steps-site-info-collection                +34 B  (+0.0%)      +16 B  (+0.0%)
async-load-signup-steps-site                                +34 B  (+0.0%)      +14 B  (+0.0%)
async-load-signup-steps-rewind-were-backing                 +34 B  (+0.0%)      +13 B  (+0.1%)
async-load-signup-steps-rewind-migrate                      +34 B  (+0.0%)      +15 B  (+0.1%)
async-load-signup-steps-rewind-form-creds                   +34 B  (+0.0%)      +16 B  (+0.0%)
async-load-signup-steps-reader-landing                      +34 B  (+0.0%)      +15 B  (+0.1%)
async-load-signup-steps-plans-atomic-store                  +34 B  (+0.0%)      +17 B  (+0.0%)
async-load-signup-steps-plans                               +34 B  (+0.0%)      +14 B  (+0.0%)
async-load-signup-steps-passwordless                        +34 B  (+0.0%)      +15 B  (+0.1%)
async-load-signup-steps-p2-site                             +34 B  (+0.0%)      +14 B  (+0.0%)
async-load-signup-steps-p2-get-started                      +34 B  (+0.0%)      +13 B  (+0.1%)
async-load-signup-steps-p2-details                          +34 B  (+0.0%)      +15 B  (+0.1%)
async-load-signup-steps-import-from                         +34 B  (+0.0%)      +14 B  (+0.0%)
async-load-signup-steps-import                              +34 B  (+0.0%)      +13 B  (+0.0%)
async-load-signup-steps-emails                              +34 B  (+0.0%)      +15 B  (+0.1%)
async-load-signup-steps-domains                             +34 B  (+0.0%)      +12 B  (+0.0%)
async-load-signup-steps-difm-design-picker                  +34 B  (+0.0%)      +14 B  (+0.1%)
async-load-signup-steps-creds-permission                    +34 B  (+0.0%)      +15 B  (+0.0%)
async-load-signup-steps-creds-confirm                       +34 B  (+0.0%)      +16 B  (+0.1%)
async-load-signup-steps-creds-complete                      +34 B  (+0.0%)      +15 B  (+0.1%)
async-load-signup-steps-clone-start                         +34 B  (+0.0%)      +18 B  (+0.1%)
async-load-signup-steps-clone-ready                         +34 B  (+0.0%)      +14 B  (+0.0%)
async-load-signup-steps-clone-point                         +34 B  (+0.0%)      +15 B  (+0.0%)
async-load-signup-steps-clone-jetpack                       +34 B  (+0.0%)      +14 B  (+0.1%)
async-load-signup-steps-clone-destination                   +34 B  (+0.0%)      +13 B  (+0.0%)
async-load-signup-steps-clone-credentials                   +34 B  (+0.0%)      +15 B  (+0.0%)
async-load-signup-steps-clone-cloning                       +34 B  (+0.0%)      +14 B  (+0.1%)
async-load-signup-steps-about                               +34 B  (+0.0%)      +15 B  (+0.0%)
async-load-calypso-blocks-editor-checkout-modal             +29 B  (+0.0%)      +10 B  (+0.0%)

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.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@kwight
Copy link
Contributor

kwight commented Nov 22, 2021

Thanks @arthur791004 – I've added it to our board too so we can see where improvements to the component itself can be made. 👍

align-items: center;
justify-content: space-between;
font-size: $font-body-small;
padding: 20px 24px;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

auto format by prettier

@arthur791004 arthur791004 requested a review from a team November 23, 2021 08:21
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Nov 23, 2021
@arthur791004 arthur791004 changed the title WIP Hero Flow: Integrate video courses Hero Flow: Integrate video courses Nov 23, 2021
@kwight
Copy link
Contributor

kwight commented Nov 23, 2021

We're simplifying the props to the <VideosUi /> component and changing how the header and footer variations are handled – let's hold off on much more here until we can make some progress. Thanks for putting this together so quickly @arthur791004 , it's super helpful for us to work from and see where we've got to go! ✨

@arthur791004
Copy link
Contributor Author

@kwight Okay!

@arthur791004 arthur791004 changed the title Hero Flow: Integrate video courses [On hold] Hero Flow: Integrate video courses Nov 24, 2021
@arthur791004 arthur791004 force-pushed the feat/hero-flow-video-courses branch 2 times, most recently from 80db0ca to 8f37535 Compare November 26, 2021 08:31
@arthur791004 arthur791004 changed the title [On hold] Hero Flow: Integrate video courses Hero Flow: Integrate video courses Dec 3, 2021
@arthur791004 arthur791004 force-pushed the feat/hero-flow-video-courses branch 2 times, most recently from 3a538d3 to f3f2a15 Compare December 6, 2021 08:29
@kwight
Copy link
Contributor

kwight commented Dec 6, 2021

On a quick first look:

  • style-video-bar.scss is being removed, so no need for changes there,
  • the header and footer components have already been added and tested.

@kwight
Copy link
Contributor

kwight commented Dec 6, 2021

@ianstewart also mentioned that we shouldn't be calling it "Masterclass" – maybe "Watch some quick videos"? @provenself any opinions here?

@provenself
Copy link

provenself commented Dec 6, 2021

I'd go with:

Learn the Basics
Get started fast with our video primer

@ianstewart also mentioned that we shouldn't be calling it "Masterclass" – maybe "Watch some quick videos"? @provenself any opinions here?

@blackjackkent
Copy link
Contributor

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.)

@arthur791004
Copy link
Contributor Author

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.

@arthur791004
Copy link
Contributor Author

@kwight I've removed style-video-bar.scss and update the copy!

@kwight
Copy link
Contributor

kwight commented Dec 7, 2021

I've removed style-video-bar.scss and update the copy!

Oh sorry @arthur791004 , I wasn't clear – I meant remove style-video-bar.scss changes from the PR, not to remove the file completely (we'll need a separate PR where we verify that everything remaining in it is handled elsewhere).

For the copy, we should go with editorial's suggestion above.

Otherwise, looking great – keen to get this out!

@autumnfjeld
Copy link
Contributor

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( [] );
Copy link
Contributor Author

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.

Copy link
Member

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 ) ) {
Copy link
Contributor Author

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

Copy link
Member

@p-jackson p-jackson left a 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 👍

client/data/courses/use-course-query.js Outdated Show resolved Hide resolved
queryClient.invalidateQueries( [ 'course-progression', args.courseSlug ] );
queryOptions.onSuccess?.( ...args );
onSuccess( data, variables, context ) {
queryClient.invalidateQueries( [ 'courses', variables.courseSlug ] );
Copy link
Member

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.

client/data/courses/use-course-data.ts Outdated Show resolved Hide resolved
const { updateUserCourseProgression } = useUpdateUserCourseProgressionMutation();

const initialUserCourseProgression = useMemo( () => course?.completions ?? [], [ course ] );

const [ userCourseProgression, setUserCourseProgression ] = useState( [] );
Copy link
Member

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?

@arthur791004
Copy link
Contributor Author

arthur791004 commented Dec 22, 2021

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 saw that the best practice suggested that “Always refetch after error or success” by onSettled function even though they also update the local query data manually. I think we can keep it simple to re-fetch here as we don't update the course data often

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.

I think there might be something wrong as the courseSlug doesn't exist in args 😅

client/components/videos-ui/index.jsx Outdated Show resolved Hide resolved
client/data/courses/types.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@andres-blanco andres-blanco left a 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.

@arthur791004 arthur791004 merged commit 0334e54 into trunk Jan 5, 2022
@arthur791004 arthur791004 deleted the feat/hero-flow-video-courses branch January 5, 2022 05:36
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jan 5, 2022
@a8ci18n
Copy link

a8ci18n commented Jan 5, 2022

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.

gius80 pushed a commit that referenced this pull request Jan 7, 2022
* 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
@a8ci18n
Copy link

a8ci18n commented Jan 14, 2022

Translation for this Pull Request has now been finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants