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

Show breadcrumbs in individual theme header #94038

Merged
merged 6 commits into from
Sep 9, 2024

Conversation

allilevine
Copy link
Member

@allilevine allilevine commented Aug 29, 2024

Fixes #92645

Proposed Changes

  • Use the NavigationHeader component for individual themes.
  • Update the Breadcrumb and NavigationHeader components to take an onClick prop.
Before After
Screen Shot 2024-08-29 at 4 21 34 PM Screen Shot 2024-08-29 at 4 21 43 PM

Why are these changes being made?

  • To keep the page header consistent with other pages, especially the theme showcase and individual plugin pages.

Testing Instructions

  • Go to /themes.
  • Click on a theme.
  • Verify that the breadcrumb text is correct (Themes > title of the theme).
  • Use the header to navigate back to Themes.
  • Repeat at site level (Appearance > Themes).
  • Repeat while logged out.
  • Test at different screen sizes.
  • Regression test another page with breadcrumbs, like Stats and individual Plugins pages.

Known issue: there's some variation in padding on the page. I'm aligning with the theme title.

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@matticbot
Copy link
Contributor

matticbot commented Aug 29, 2024

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • notifications
  • odyssey-stats
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug add/theme-header-breadcrumbs on your sandbox.

@matticbot
Copy link
Contributor

matticbot commented Aug 29, 2024

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

App Entrypoints (~619 bytes removed 📉 [gzipped])

name                   parsed_size           gzip_size
entry-stepper              -1269 B  (-0.1%)     -479 B  (-0.1%)
entry-main                 -1269 B  (-0.1%)     -499 B  (-0.1%)
entry-subscriptions         -580 B  (-0.0%)     -195 B  (-0.0%)
entry-login                 -580 B  (-0.0%)     -277 B  (-0.1%)
entry-domains-landing       -580 B  (-0.1%)     -277 B  (-0.1%)
entry-browsehappy           -580 B  (-0.3%)     -277 B  (-0.4%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Sections (~25884 bytes added 📈 [gzipped])

name                                parsed_size           gzip_size
theme                                  +16548 B  (+2.3%)    +3739 B  (+1.7%)
link-in-bio-tld-flow                     -798 B  (-0.0%)      -67 B  (-0.0%)
update-design-flow                       -760 B  (-0.1%)      -34 B  (-0.0%)
signup                                   -760 B  (-0.3%)      -56 B  (-0.1%)
themes                                   -387 B  (-0.0%)     -494 B  (-0.2%)
plugins                                  -216 B  (-0.0%)     -970 B  (-0.1%)
jetpack-cloud-plugin-management          -216 B  (-0.0%)     -970 B  (-0.2%)
checkout                                 -215 B  (-0.0%)    -1164 B  (-0.2%)
readymade-template-flow                  +196 B  (+0.1%)    +1040 B  (+3.4%)
home                                     -178 B  (-0.0%)      -91 B  (-0.0%)
domains                                  +176 B  (+0.0%)     +404 B  (+0.1%)
devdocs                                  -176 B  (-0.1%)      -39 B  (-0.1%)
plans                                    +160 B  (+0.0%)     +416 B  (+0.1%)
marketplace                              -101 B  (-0.0%)     -853 B  (-0.3%)
write-flow                                -38 B  (-0.0%)      -11 B  (-0.0%)
videopress-flow                           -38 B  (-0.0%)      -11 B  (-0.0%)
build-flow                                -38 B  (-0.0%)      -11 B  (-0.0%)
staging-site                              -20 B  (-0.0%)       -6 B  (-0.0%)
settings-security                         -20 B  (-0.0%)       -1 B  (-0.0%)
settings-podcast                          -20 B  (-0.0%)       -6 B  (-0.0%)
settings-performance                      -20 B  (-0.0%)       +0 B
settings                                  -20 B  (-0.0%)       -6 B  (-0.0%)
posts-custom                              -20 B  (-0.0%)     -186 B  (-0.1%)
posts                                     -20 B  (-0.0%)     -186 B  (-0.1%)
media                                     -20 B  (-0.0%)       -5 B  (-0.0%)
marketing                                 -20 B  (-0.0%)       +0 B
hosting                                   -20 B  (-0.0%)      -65 B  (-0.0%)
earn                                      -20 B  (-0.0%)       -8 B  (-0.0%)
activity                                  -20 B  (-0.0%)       -1 B  (-0.0%)
woocommerce-installation                  +18 B  (+0.0%)      +10 B  (+0.0%)
subscribers                               +18 B  (+0.0%)       +4 B  (+0.0%)
stats                                     +18 B  (+0.0%)       +4 B  (+0.0%)
sites-dashboard                           +18 B  (+0.0%)       +6 B  (+0.0%)
site-purchases                            +18 B  (+0.0%)       +4 B  (+0.0%)
site-monitoring                           +18 B  (+0.0%)       +6 B  (+0.0%)
site-logs                                 +18 B  (+0.0%)       +6 B  (+0.0%)
site-blocks                               +18 B  (+0.0%)      +10 B  (+0.0%)
settings-writing                          +18 B  (+0.0%)      +10 B  (+0.0%)
settings-reading                          +18 B  (+0.0%)      +10 B  (+0.0%)
settings-newsletter                       +18 B  (+0.0%)      +10 B  (+0.0%)
settings-jetpack                          +18 B  (+0.0%)      +10 B  (+0.0%)
settings-discussion                       +18 B  (+0.0%)      +10 B  (+0.0%)
security                                  +18 B  (+0.0%)       +8 B  (+0.0%)
scan                                      +18 B  (+0.0%)      +10 B  (+0.0%)
reader                                    +18 B  (+0.0%)      +39 B  (+0.0%)
purchases                                 +18 B  (+0.0%)       +4 B  (+0.0%)
privacy                                   +18 B  (+0.0%)      +10 B  (+0.0%)
people                                    +18 B  (+0.0%)      +10 B  (+0.0%)
pages                                     +18 B  (+0.0%)      +10 B  (+0.0%)
notification-settings                     +18 B  (+0.0%)      +10 B  (+0.0%)
me                                        +18 B  (+0.0%)      +10 B  (+0.0%)
jetpack-cloud-settings                    +18 B  (+0.0%)      +10 B  (+0.0%)
jetpack-cloud-partner-portal              +18 B  (+0.0%)       +6 B  (+0.0%)
jetpack-cloud-agency-sites-v2             +18 B  (+0.0%)       +6 B  (+0.0%)
import                                    +18 B  (+0.0%)      +10 B  (+0.0%)
hosting-features                          +18 B  (+0.0%)       +6 B  (+0.0%)
help                                      +18 B  (+0.0%)      +10 B  (+0.0%)
google-my-business                        +18 B  (+0.0%)      +10 B  (+0.0%)
github-deployments                        +18 B  (+0.0%)       +6 B  (+0.0%)
export                                    +18 B  (+0.0%)      +10 B  (+0.0%)
email                                     +18 B  (+0.0%)      +66 B  (+0.0%)
developer                                 +18 B  (+0.0%)      +10 B  (+0.0%)
comments                                  +18 B  (+0.0%)      +10 B  (+0.0%)
backup                                    +18 B  (+0.0%)       +6 B  (+0.0%)
add-ons                                   +18 B  (+0.0%)      +10 B  (+0.0%)
account-close                             +18 B  (+0.0%)      +10 B  (+0.0%)
account                                   +18 B  (+0.0%)       +9 B  (+0.0%)
a8c-for-agencies-team                     +18 B  (+0.0%)       +6 B  (+0.0%)
a8c-for-agencies-sites                    +18 B  (+0.0%)       +6 B  (+0.0%)
a8c-for-agencies-settings                 +18 B  (+0.0%)      +10 B  (+0.0%)
a8c-for-agencies-referrals                +18 B  (+0.0%)       +6 B  (+0.0%)
a8c-for-agencies-purchases                +18 B  (+0.0%)      +10 B  (+0.0%)
a8c-for-agencies-plugins                  +18 B  (+0.0%)      +10 B  (+0.0%)
a8c-for-agencies-partner-directory        +18 B  (+0.0%)      +10 B  (+0.0%)
a8c-for-agencies-overview                 +18 B  (+0.0%)       +6 B  (+0.0%)
a8c-for-agencies-migrations               +18 B  (+0.0%)      +10 B  (+0.0%)
a8c-for-agencies-marketplace              +18 B  (+0.0%)      +10 B  (+0.0%)
a8c-for-agencies-landing                  +18 B  (+0.0%)      +10 B  (+0.0%)
a8c-for-agencies-client                   +18 B  (+0.0%)       +6 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 (~963 bytes removed 📉 [gzipped])

name                                                                              parsed_size           gzip_size
async-load-design-blocks                                                               -302 B  (-0.0%)     -952 B  (-0.1%)
async-load-signup-steps-theme-selection                                                -264 B  (-0.1%)     -788 B  (-0.7%)
async-load-signup-steps-design-picker                                                  -208 B  (-0.4%)      -36 B  (-0.2%)
async-load-automattic-help-center                                                      -196 B  (-0.0%)     -863 B  (-0.5%)
async-load-calypso-reader-sidebar                                                       -38 B  (-0.0%)      -11 B  (-0.0%)
async-load-calypso-post-editor-editor-media-modal                                       -38 B  (-0.0%)      -14 B  (-0.0%)
async-load-calypso-my-sites-stats-summary                                               -38 B  (-0.1%)       -9 B  (-0.1%)
async-load-calypso-my-sites-current-site-notice                                         -38 B  (-0.1%)      -13 B  (-0.1%)
async-load-calypso-components-web-preview-component                                     -38 B  (-0.0%)      -11 B  (-0.0%)
async-load-calypso-blocks-jitm-templates-sidebar-banner                                 -38 B  (-0.1%)      -12 B  (-0.1%)
async-load-calypso-blocks-jitm-templates-notice                                         -38 B  (-0.1%)      -12 B  (-0.1%)
async-load-calypso-blocks-jitm-templates-default                                        -38 B  (-0.1%)      -11 B  (-0.1%)
async-load-signup-steps-page-picker                                                     -19 B  (-0.0%)      -52 B  (-0.0%)
async-load-purchase-modal-wrapper                                                       -19 B  (-0.0%)      -39 B  (-0.0%)
async-load-my-sites-checkout-purchase-modal-is-eligible-for-one-click-checkou...        -19 B  (-0.0%)      -45 B  (-0.0%)
async-load-store-app-store-stats                                                        +18 B  (+0.0%)      +10 B  (+0.0%)
async-load-design-playground                                                            +18 B  (+0.0%)      +34 B  (+0.0%)
async-load-design                                                                       +18 B  (+0.0%)      +31 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.

@allilevine allilevine marked this pull request as ready for review August 29, 2024 20:28
@allilevine allilevine self-assigned this Aug 29, 2024
Copy link
Contributor

@eoigal eoigal left a comment

Choose a reason for hiding this comment

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

I think there is excess padding in the Appearance> Themes > Theme page
Screenshot 2024-08-30 at 10 41 21

@allilevine
Copy link
Member Author

I think there is excess padding in the Appearance> Themes > Theme page

@eoigal Thanks! The default top padding on layout__content is 79px. That plus NavigationHeader 24px top padding does look excessive, though I'm not sure what the standard is. I decided to match the individual Plugins page with 47px: 4213ee7

Screen Shot 2024-08-30 at 9 49 54 AM

cc @javierarce in case you have a recommendation.

@javierarce
Copy link

I decided to match the individual Plugins page with 47px:

@allilevine that was a good solution.

I think we had a proposal to set the vertical distance to 24px, but since that would require changing at least the Plugins and the Domains pages, I think it's better to align Themes with Plugins for now.

@allilevine
Copy link
Member Author

I think we had a proposal to set the vertical distance to 24px, but since that would require changing at least the Plugins and the Domains pages, I think it's better to align Themes with Plugins for now.

Thank you!

@allilevine
Copy link
Member Author

I realized there's other paths to the theme page I need to allow for here. Putting this back in progress.

@allilevine allilevine force-pushed the add/theme-header-breadcrumbs branch from 4213ee7 to 09fcb97 Compare September 5, 2024 20:32
const { backPath, locale, isLoggedIn, themeId } = this.props;
this.props.recordTracksEvent( 'calypso_theme_sheet_back_click', { theme_name: themeId } );

// Use history back when coming from customize your store screen.
Copy link
Member Author

Choose a reason for hiding this comment

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

Asked about removing this here: p1725572262533179-slack-C01SFMVEYAK

Copy link
Member Author

Choose a reason for hiding this comment

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

Confirmed: p1725630569410769/1725572262.533179-slack-C01SFMVEYAK

}

page( localizeThemesPath( backPath, locale, ! isLoggedIn ) );
return localizeThemesPath( backPath, locale, ! isLoggedIn );
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm returning a path for the breadcrumb instead of redirecting the page.

@@ -61,7 +61,7 @@ const StyledGridicon = styled( Gridicon )`
color: var( --color-neutral-10 );
`;

const HelpBuble = styled( InfoPopover )`
const HelpBubble = styled( InfoPopover )`
Copy link
Member Author

Choose a reason for hiding this comment

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

Fixing a typo.

@@ -127,11 +132,13 @@ const Breadcrumb: React.FunctionComponent< Props > = ( props ) => {

return (
<StyledUl className="breadcrumbs">
{ items.map( ( item: { href?: string; label: string }, index: Key ) => (
{ items.map( ( item: Item, index: Key ) => (
Copy link
Member Author

Choose a reason for hiding this comment

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

Replacing the type here with the type already defined above.


page( localizeThemesPath( backPath, locale, ! isLoggedIn ) );
handleBackLinkClick = () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

I added this function for the Tracks event.

@allilevine allilevine added the [Status] String Freeze Add the [Status] String Freeze label to your PR to ensure new strings are translated before merging label Sep 6, 2024
@@ -1540,6 +1536,11 @@ class ThemeSheet extends Component {
'is-removed': isRemoved,
} );

const navigationItems = [
{ label: translate( 'Themes' ), href: this.getBackLink(), onClick: this.handleBackLinkClick },
Copy link
Member Author

Choose a reason for hiding this comment

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

I wonder if "Back to themes" was better language for screen readers. But this matches "Plugins."

@allilevine allilevine requested a review from eoigal September 6, 2024 15:49
@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 Sep 6, 2024
@allilevine allilevine requested a review from a team September 6, 2024 15:49
Copy link
Member

@DustyReagan DustyReagan left a comment

Choose a reason for hiding this comment

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

It looks good and works well. I noticed two things, but I don't think they're blockers.

/plugins on mobile view uses "< Back" instead of breadcrumbs. I'm not sure if we want to copy that behavior.
Screenshot 2024-09-06 at 5 00 47 PM

The header has some extra margin at a specific width. See video:

Screen.Recording.2024-09-06.at.4.56.21.PM.mov

@allilevine allilevine force-pushed the add/theme-header-breadcrumbs branch from bb8f8b2 to b63f448 Compare September 9, 2024 13:54
@allilevine
Copy link
Member Author

@DustyReagan Thanks for catching these!

/plugins on mobile view uses "< Back" instead of breadcrumbs. I'm not sure if we want to copy that behavior.

I noticed this but it comes from the compactBreadcrumb navigation header prop, which depends on breakpoint hooks. I can't use hooks in a class component, so I'd prefer to open a follow-up to look into it.

The header has some extra margin at a specific width. See video:

I pushed a change to fix this! If you can re-review I'd appreciate it. 🙏

I also noticed that there was a .is-mobile-app-view rule to hide the previous header on mobile apps. The Plugins header isn't hidden for apps, though. So that needs some investigation to find out whether it should be visible in the apps.

Copy link
Member

@DustyReagan DustyReagan left a comment

Choose a reason for hiding this comment

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

I retested the new commit, and it looks good to me!

@allilevine allilevine merged commit 53acd87 into trunk Sep 9, 2024
12 checks passed
@allilevine allilevine deleted the add/theme-header-breadcrumbs branch September 9, 2024 19:52
@github-actions github-actions bot removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Status] String Freeze Add the [Status] String Freeze label to your PR to ensure new strings are translated before merging labels Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Themes global view - adapt theme preview for content frame.
5 participants