My Jetpack: Onboarding i3 - Init tab panel#43595
My Jetpack: Onboarding i3 - Init tab panel#43595manzoorwanijk merged 10 commits intofeature/my-jetpack/onboarding-i3from
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
robertsreberski
left a comment
There was a problem hiding this comment.
Works good, thanks for the quick implementation!
I'm leaving some of the feedback below; most urgent functional feedback is that we should probably explicitly mention which paths are supported by tab system - or revert to the default path if some custom not existing one is provided.
|
|
||
| export const MyJetpackRoutes = { | ||
| Home: '/', | ||
| Home: '/:tab', |
There was a problem hiding this comment.
Should we be more exhaustive here which options for tabs are available? As I understand, currently it might match anything other than defined paths?
There was a problem hiding this comment.
React Router does not support pattern matching here, but we can validate the value when using it.
| [ navigate, params.tab ] | ||
| ); | ||
|
|
||
| const tabRenderer = useCallback( ( tab: { name: string; title: string } ) => { |
There was a problem hiding this comment.
We can benefit from more explicit typing here.
There was a problem hiding this comment.
Do you have any suggestions about it?
| const navigate = useNavigate(); | ||
|
|
||
| const onTabSelect = useCallback( | ||
| ( tabName: string ) => { |
There was a problem hiding this comment.
We can benefit from more explicit typing here.
| return ( | ||
| <TabPanel | ||
| className={ styles[ 'tab-panel' ] } | ||
| initialTabName={ params.tab || 'overview' } |
There was a problem hiding this comment.
Should we perhaps also replace the path to /overview if the initial tab name is not provided?
Also, I would probably go for some globally defined constant "DEFAULT_INITIAL_TAB" instead of hardcoding it here in code.
There was a problem hiding this comment.
Yes, it defaults to /overview if nothing is provided or if an invalid tab name is supplied.
| tabs={ [ | ||
| { | ||
| name: 'overview', | ||
| title: __( 'Overview', 'jetpack-my-jetpack' ), | ||
| }, | ||
| { | ||
| name: 'products', | ||
| title: __( 'Products', 'jetpack-my-jetpack' ), | ||
| }, | ||
| { | ||
| name: 'help', | ||
| title: __( 'Help', 'jetpack-my-jetpack' ), | ||
| }, | ||
| ] } |
There was a problem hiding this comment.
Maybe it's better to define it as a variable outside of the component?
I also lack (type) connection between this array and tabComponentMap. It could be more exhaustive that options provided here should match the mapping and vice-versa.
There was a problem hiding this comment.
Maybe it's better to define it as a variable outside of the component?
That doesn't play nice with translations as the components update but the variable outside the component never updates/re-renders.
There was a problem hiding this comment.
I have extracted it to a function instead of a variable that works well with translations.
20aba9b to
557e310
Compare
…nboarding-i3-basic-tab-panel
robertsreberski
left a comment
There was a problem hiding this comment.
I believe it's almost there but still would recommend the routing to be more in sync with UI.
| if ( tabName !== params.section ) { | ||
| navigate( `/${ tabName }` ); | ||
| } |
There was a problem hiding this comment.
should we have a guard here, to prevent setting random tab names (and blank page)?
or better, use replaceState() to keep the url in sync? otherwise /blabla will display "Overview" page, while not critical - it's not perfect as well.
There was a problem hiding this comment.
But since we control the tabs, where will the random value come from?
There was a problem hiding this comment.
right, that's true! thanks, I think then the only case is if I input manually #/foobar
There was a problem hiding this comment.
the only case is if I input manually
#/foobar
That won't do anything because no route is registered corresponding that path
There was a problem hiding this comment.
I have fixed it in ae26423
You can see what happens if I update the URL manually. The key prop will reset the state when the URL is updated manually.
Screen.Recording.2025-05-26.at.7.02.34.PM.mov
| const initialTab = isValidMyJetpackSection( params.section ) | ||
| ? params.section | ||
| : MY_JETPACK_SECTION_OVERVIEW; |
There was a problem hiding this comment.
I believe we could have this value behind useState( () => return initialTab and maybe do replaceState() )
There was a problem hiding this comment.
Why? The URL should reflect immediately because TabPanel calls that onSelect with the initialTabName on mount and it in turn updates the URL accordingly. We don't need to manage any state here.
There was a problem hiding this comment.
alright, thanks for making it clear, what do you think about the replaceState() in case isValidMyJetpackSection() === false?
There was a problem hiding this comment.
It already happens, the URL is reflected immediately on mount. We don't need to perform any magic here.
Screen.Recording.2025-05-26.at.6.58.05.PM.mov
robertsreberski
left a comment
There was a problem hiding this comment.
Thanks, that is ready to be a base for all other PRs!
49b56b1
into
feature/my-jetpack/onboarding-i3
* Init * My Jetpack: Onboarding i3 - Initialize tab panel (#43595) * My Jetpack: Onboarding i3 - Init tab panel * Improve types and use constants and extractions * Add changelog to make CI happy * Create a shared tab content wrapper to share styling * Use "section" instead of tabs * Rename tab components to content components * Use correct headings * Decrease margins on smaller screens * Fix initial tab changed manually * My Jetpack: Onboarding i3 | Split the overview tab (#43632) * My Jetpack: Onboarding i3 | Split the overview tab * Fix separator position * My Jetpack: Onboarding i3 | Add help section (#43638) * My Jetpack: Onboarding i3 | Update help section * Remove double parenthesis * Thank you copilot * My Jetpack: Updating Products tab. (#43652) * Moving unowned products to the Products tab * Products tab header and spacing update * Moving owned and unowned products into a hook * changelog * Update projects/packages/my-jetpack/_inc/components/product-cards-section/style.module.scss RTL aware alternative Co-authored-by: Manzoor Wani <manzoorwani.jk@gmail.com> * Update projects/packages/my-jetpack/_inc/components/product-cards-section/style.module.scss RTL aware alternative Co-authored-by: Manzoor Wani <manzoorwani.jk@gmail.com> --------- Co-authored-by: Manzoor Wani <manzoorwani.jk@gmail.com> * My Jetpack: Tab filtering for admin role (#43675) * My Jetpack: Tab fitering for admin role * changelog * replacing permission check * My Jetpack: Onboarding i3 | Move Plan and Connection section to Overview tab (#43681) * My Jetpack: Onboarding i3 | Move Plan and Connection section to Overview tab * Remove unused styles * Fix unit tests * Fix E2E tests * Add changelog * Fix top border for the plan and connection section * Fix E2E test heading * Update E2E test string * Update connection owner message when author is not connected * Fix typo in changelog, thanks to copilot review. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Fix connection block for JN sites * Move Jetpack Manage upsell banner to Overview * Update banner messaging --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * My Jetpack: Onboarding i3 | Fix layout on wider screens (#43699) * My Jetpack: Update upsell banner for Automattic for Agencies (#43697) * Update Jetpack Manage banner to A4A * Fix Help section CTA styling * Remove redundant changelogs * Updating Products tab visibility based on owned products (#43720) * Remove repeated changelog * My Jetpack: Onboarding i3 | Update Products tab description copy (#43724) * Add tracks events for My Jetpack Tab Navigation (#43703) * Add jetpack_myjetpack_tab_click, jetpack_myjetpack_page_view (enhance), jetpack_myjetpack_help_request events * Merge and resolve conflict in my-jetpack-tab-panel/index.tsx Combined functionality from both branches: - Analytics tracking and session duration from HEAD - Product filtering logic from feature/my-jetpack/onboarding-i3 - Maintained all imports and hooks from both versions - Preserved the analytics event tracking while adding dynamic tab visibility 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Improve source tab definition on help tracking hook --------- Co-authored-by: Claude <noreply@anthropic.com> * My jetpack: Onboarding i3 | Fix layout and alignment issues (#43725) * Fix horizontal scrollable space * Fix Jetpack log and tabs aligment issues * Add changelog * OK Copilot * My Jetpack: Replace deprecated sass APIs with alternatives (#43726) --------- Co-authored-by: Grzegorz Chudzinski-Pawlowski <112354940+grzegorz-cp@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Robert Sreberski <robertsreberski@gmail.com> Co-authored-by: Claude <noreply@anthropic.com>
* Init * My Jetpack: Onboarding i3 - Initialize tab panel (#43595) * My Jetpack: Onboarding i3 - Init tab panel * Improve types and use constants and extractions * Add changelog to make CI happy * Create a shared tab content wrapper to share styling * Use "section" instead of tabs * Rename tab components to content components * Use correct headings * Decrease margins on smaller screens * Fix initial tab changed manually * My Jetpack: Onboarding i3 | Split the overview tab (#43632) * My Jetpack: Onboarding i3 | Split the overview tab * Fix separator position * My Jetpack: Onboarding i3 | Add help section (#43638) * My Jetpack: Onboarding i3 | Update help section * Remove double parenthesis * Thank you copilot * My Jetpack: Updating Products tab. (#43652) * Moving unowned products to the Products tab * Products tab header and spacing update * Moving owned and unowned products into a hook * changelog * Update projects/packages/my-jetpack/_inc/components/product-cards-section/style.module.scss RTL aware alternative Co-authored-by: Manzoor Wani <manzoorwani.jk@gmail.com> * Update projects/packages/my-jetpack/_inc/components/product-cards-section/style.module.scss RTL aware alternative Co-authored-by: Manzoor Wani <manzoorwani.jk@gmail.com> --------- Co-authored-by: Manzoor Wani <manzoorwani.jk@gmail.com> * My Jetpack: Tab filtering for admin role (#43675) * My Jetpack: Tab fitering for admin role * changelog * replacing permission check * My Jetpack: Onboarding i3 | Move Plan and Connection section to Overview tab (#43681) * My Jetpack: Onboarding i3 | Move Plan and Connection section to Overview tab * Remove unused styles * Fix unit tests * Fix E2E tests * Add changelog * Fix top border for the plan and connection section * Fix E2E test heading * Update E2E test string * Update connection owner message when author is not connected * Fix typo in changelog, thanks to copilot review. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Fix connection block for JN sites * Move Jetpack Manage upsell banner to Overview * Update banner messaging --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * My Jetpack: Onboarding i3 | Fix layout on wider screens (#43699) * My Jetpack: Update upsell banner for Automattic for Agencies (#43697) * Update Jetpack Manage banner to A4A * Fix Help section CTA styling * Remove redundant changelogs * Updating Products tab visibility based on owned products (#43720) * Remove repeated changelog * My Jetpack: Onboarding i3 | Update Products tab description copy (#43724) * Add tracks events for My Jetpack Tab Navigation (#43703) * Add jetpack_myjetpack_tab_click, jetpack_myjetpack_page_view (enhance), jetpack_myjetpack_help_request events * Merge and resolve conflict in my-jetpack-tab-panel/index.tsx Combined functionality from both branches: - Analytics tracking and session duration from HEAD - Product filtering logic from feature/my-jetpack/onboarding-i3 - Maintained all imports and hooks from both versions - Preserved the analytics event tracking while adding dynamic tab visibility 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Improve source tab definition on help tracking hook --------- Co-authored-by: Claude <noreply@anthropic.com> * My jetpack: Onboarding i3 | Fix layout and alignment issues (#43725) * Fix horizontal scrollable space * Fix Jetpack log and tabs aligment issues * Add changelog * OK Copilot * My Jetpack: Replace deprecated sass APIs with alternatives (#43726) --------- Co-authored-by: Grzegorz Chudzinski-Pawlowski <112354940+grzegorz-cp@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Robert Sreberski <robertsreberski@gmail.com> Co-authored-by: Claude <noreply@anthropic.com>
Completes MYJP-129
Proposed changes:
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
Screen.Recording.2025-05-23.at.5.22.06.PM.mov