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

Admin Bar: Make it consistent between Calypso and WP Admin regardless of the value of Admin Interface Style #38362

Merged
merged 4 commits into from
Jul 17, 2024

Conversation

arthur791004
Copy link
Contributor

@arthur791004 arthur791004 commented Jul 17, 2024

Fixes https://github.com/Automattic/dotcom-forge/issues/8314
Fixes https://github.com/Automattic/dotcom-forge/issues/8311

Proposed changes:

  • We want to make the admin bar consistent everywhere, so this PR adds the flag WPCOM_ADMIN_BAR_UNIFICATION to determine whether to display the consistent admin bar. If the flag is true, we should not initialize the custom Masterbar and avoid the CSS concat for the color schemes due to the loading CSS priority.

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

Does this pull request change what data or activity we track or use?

Testing instructions:

  • Apply changes to your site, either atomic or simple
  • Apply D155493-code to your simple site
  • Check the admin bar on both WP Admin and Calypso
  • Change the value of the Admin Interface Style
  • The admin bar should be always the same

@arthur791004 arthur791004 self-assigned this Jul 17, 2024
Copy link
Contributor

github-actions bot commented Jul 17, 2024

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WordPress.com Simple site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin, and enable the feat/unify-masterbar branch.

    • For jetpack-mu-wpcom changes, also add define( 'JETPACK_MU_WPCOM_LOAD_VIA_BETA_PLUGIN', true ); to your wp-config.php file.
  • To test on Simple, run the following command on your sandbox:

    bin/jetpack-downloader test jetpack feat/unify-masterbar
    
    bin/jetpack-downloader test jetpack-mu-wpcom-plugin feat/unify-masterbar
    

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions bot added [Feature] Masterbar WordPress.com Toolbar and Dashboard customizations [mu wpcom Feature] Wpcom Admin Bar [Package] Jetpack mu wpcom WordPress.com Features [Package] Masterbar labels Jul 17, 2024
Copy link
Contributor

github-actions bot commented Jul 17, 2024

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

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 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Once your PR is ready for review, check one last time that all required checks appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team Review" label and ask someone from your team review the code. Once reviewed, it can then be merged.
If you need an extra review from someone familiar with the codebase, you can update the labels from "[Status] Needs Team Review" to "[Status] Needs Review", and in that case Jetpack Approvers will do a final review of your PR.


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen daily.
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly. The next release is scheduled for August 6, 2024 (scheduled code freeze on August 5, 2024).

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Mu Wpcom plugin:

  • Next scheduled release: August 6, 2024.
  • Scheduled code freeze: July 29, 2024.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Wpcomsh plugin:

  • Next scheduled release: August 6, 2024.
  • Scheduled code freeze: July 29, 2024.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@github-actions github-actions bot added the [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! label Jul 17, 2024
@arthur791004 arthur791004 requested review from a team and mmtr July 17, 2024 07:19
@arthur791004 arthur791004 added [Status] Needs Team Review and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Jul 17, 2024
Copy link
Contributor

@fushar fushar left a comment

Choose a reason for hiding this comment

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

If WPCOM_ADMIN_BAR_UNIFICATION is always true, why do we need the flag? 🤔

@github-actions github-actions bot added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] mu wpcom jetpack-mu-wpcom plugin [Plugin] Wpcomsh labels Jul 17, 2024
@arthur791004
Copy link
Contributor Author

If WPCOM_ADMIN_BAR_UNIFICATION is always true, why do we need the flag? 🤔

We need the flag for the simple sites to disable the custom admin bar as the feature is composed of jetpack-mu-wpcom & wpcom.

Also, the value is always true on the sites with the mu-wpcom plugin but the master bar is a standalone package. We cannot ensure it's always loaded with mu-wpcom plugin. Maybe it's always true but I'd prefer to clean up the codebase in the follow-up PRs.

@mmtr
Copy link
Member

mmtr commented Jul 17, 2024

Not sure if I'm missing anything, but I'm getting this weird bar on my Simple site:

Screenshot 2024-07-17 at 10 33 07

These are the steps I followed in my sandbox:

arc patch D155493
bin/jetpack-downloader test jetpack feat/unify-masterbar
bin/jetpack-downloader test jetpack-mu-wpcom-plugin feat/unify-masterbar

The bin/jetpack-downloader commands asked me if I wanted to checkout trunk which I declined.

@arthur791004
Copy link
Contributor Author

arthur791004 commented Jul 17, 2024

Not sure if I'm missing anything, but I'm getting this weird bar on my Simple site:

I found this issue on the frontend page and just addressed it. The flag, WPCOM_ADMIN_BAR_UNIFICATION, didn't work well because it's defined after the plugins are loaded... But I'm unsure why it worked well on wp-admin when I was testing 😓

Could you check it again by applying the latest D155493?

@mmtr
Copy link
Member

mmtr commented Jul 17, 2024

Looks much better now! I think there is an issue with mobile viewports, since the avatar is now missing:

Before After
Screenshot 2024-07-17 at 11 22 14 Screenshot 2024-07-17 at 11 22 02

@mmtr
Copy link
Member

mmtr commented Jul 17, 2024

All these menus link to /wp-admin pages, despite my site using the default interface. I don't think this is expected, becase the same menus in Calypso link to Calypso pages.

Screenshot 2024-07-17 at 11 24 40

Similarly, I think the "Edit profile" and "Logout" menus when hovering the avatar should link to Calypso pages.

@mmtr
Copy link
Member

mmtr commented Jul 17, 2024

When visiting the frontend of a P2 site, the masterbar now has a "My Sites" menu which I don't know if it's expected:

Screenshot 2024-07-17 at 11 37 30

@arthur791004
Copy link
Contributor Author

hmmm... Let me think about how to replace links 🤔

Copy link
Contributor

@fushar fushar left a comment

Choose a reason for hiding this comment

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

@arthur791004 This is looking really nice, thanks! I tested and I found the same issues as @mmtr above. Other than that, I think this is good to go.

When visiting the frontend of a P2 site, the masterbar now has a "My Sites" menu which I don't know if it's expected

No, I don't think this is expected. We should hide it.

All these menus link to /wp-admin pages, despite my site using the default interface. I don't think this is expected, because the same menus in Calypso link to Calypso pages.

Hmmmm.... good point. 🥲

@arthur791004
Copy link
Contributor Author

When visiting the frontend of a P2 site, the masterbar now has a "My Sites" menu which I don't know if it's expected:

The menu is added by the wp_admin_bar_my_sites_menu and it's for super admin. So, I think it's fine.

@arthur791004
Copy link
Contributor Author

There are 2 ways to replace the URL, and I'll continue on it tomorrow

  • Get the node by id -> replace the URL -> remove the node and add it back
  • Create another WPCOM_Admin_Bar class extends the WP_Admin_Bar and override the add_node function to replace the URL

Copy link
Contributor

@lupus2k lupus2k left a comment

Choose a reason for hiding this comment

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

It works great on Atomic:

Mobile

Before After
image image

Desktop

Before

image

After

Screencast.from.2024-07-17.11-18-02.mp4

@lupus2k
Copy link
Contributor

lupus2k commented Jul 17, 2024

On Simple + Classic interface it keeps showing the old bar on wp-admin pages:

Default + wp-admin Classic + wp-admin
image image

On the other hand, the Mobile view on Calypso doesn't show like in wp-admin:
image

Copy link
Contributor

@lupus2k lupus2k left a comment

Choose a reason for hiding this comment

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

Atomic verified here

Simple

Classic + Calypso

image
image

Default + Calypso

image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Masterbar WordPress.com Toolbar and Dashboard customizations [mu wpcom Feature] Wpcom Admin Bar [Package] Jetpack mu wpcom WordPress.com Features [Package] Masterbar [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] mu wpcom jetpack-mu-wpcom plugin [Plugin] Wpcomsh
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants