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

Unify masterbars in Simple and Atomic Default sites (take 3) #38419

Merged
merged 3 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: changed

Nav Redesign: Use Core admin bar for Simple and Atomic Default-view sites
22 changes: 11 additions & 11 deletions projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,6 @@ public static function load_features() {
\Marketplace_Products_Updater::init();
\Automattic\Jetpack\Classic_Theme_Helper\Main::init();
\Automattic\Jetpack\Classic_Theme_Helper\Featured_Content::setup();

// Only load the Calypsoify and Masterbar features on WoA sites.
if ( class_exists( '\Automattic\Jetpack\Status\Host' ) && ( new \Automattic\Jetpack\Status\Host() )->is_woa_site() ) {
\Automattic\Jetpack\Calypsoify\Jetpack_Calypsoify::get_instance();
// This is temporary. After we cleanup Masterbar on WPCOM we should load Masterbar for Simple sites too.
\Automattic\Jetpack\Masterbar\Main::init();
}
// Gets autoloaded from the Scheduled_Updates package.
if ( class_exists( 'Automattic\Jetpack\Scheduled_Updates' ) ) {
Scheduled_Updates::init();
}
}

/**
Expand All @@ -141,6 +130,17 @@ public static function load_wpcom_user_features() {
require_once __DIR__ . '/features/wpcom-sidebar-notice/wpcom-sidebar-notice.php';
require_once __DIR__ . '/features/wpcom-site-management-widget/class-wpcom-site-management-widget.php';
require_once __DIR__ . '/features/wpcom-themes/wpcom-themes.php';

// Only load the Calypsoify and Masterbar features on WoA sites.
if ( class_exists( '\Automattic\Jetpack\Status\Host' ) && ( new \Automattic\Jetpack\Status\Host() )->is_woa_site() ) {
\Automattic\Jetpack\Calypsoify\Jetpack_Calypsoify::get_instance();
// This is temporary. After we cleanup Masterbar on WPCOM we should load Masterbar for Simple sites too.
\Automattic\Jetpack\Masterbar\Main::init();
}
// Gets autoloaded from the Scheduled_Updates package.
if ( class_exists( 'Automattic\Jetpack\Scheduled_Updates' ) ) {
Scheduled_Updates::init();
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ function wpcom_enqueue_admin_bar_assets() {
add_action( 'admin_bar_menu', 'wpcom_enqueue_admin_bar_assets' );

/**
* Repurposes the WP logo as a link to /sites.
* Replaces the WP logo as a link to /sites.
*
* @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar core object.
*/
function wpcom_repurpose_wp_logo_as_all_sites_menu( $wp_admin_bar ) {
function wpcom_replace_wp_logo_with_wpcom_all_sites_menu( $wp_admin_bar ) {
foreach ( $wp_admin_bar->get_nodes() as $node ) {
if ( $node->parent === 'wp-logo' || $node->parent === 'wp-logo-external' ) {
$wp_admin_bar->remove_node( $node->id );
Expand All @@ -75,7 +75,7 @@ function wpcom_repurpose_wp_logo_as_all_sites_menu( $wp_admin_bar ) {
$wp_admin_bar->remove_node( 'wp-logo' );
$wp_admin_bar->add_node(
array(
'id' => 'wp-logo',
'id' => 'wpcom-logo',
'title' => '<span class="ab-icon" aria-hidden="true"></span><span class="screen-reader-text">' .
/* translators: Hidden accessibility text. */
__( 'All Sites', 'jetpack-mu-wpcom' ) .
Expand All @@ -87,7 +87,7 @@ function wpcom_repurpose_wp_logo_as_all_sites_menu( $wp_admin_bar ) {
)
);
}
add_action( 'admin_bar_menu', 'wpcom_repurpose_wp_logo_as_all_sites_menu', 11 );
add_action( 'admin_bar_menu', 'wpcom_replace_wp_logo_with_wpcom_all_sites_menu', 11 );

/**
* Adds the Reader menu.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Always shows WP logo (All Sites)
*/
#wpadminbar li#wp-admin-bar-wp-logo {
#wpadminbar li#wp-admin-bar-wpcom-logo {
display: block !important;
}

Expand All @@ -17,7 +17,13 @@
/**
* WP logo menu
*/
#wpadminbar #wp-admin-bar-wp-logo>.ab-item .ab-icon:before {
#wpadminbar #wp-admin-bar-wpcom-logo>.ab-item .ab-icon {
width: 15px;
Copy link
Member

Choose a reason for hiding this comment

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

@media (max-width: 782px) {
width: revert;
}
}
#wpadminbar #wp-admin-bar-wpcom-logo>.ab-item .ab-icon:before {
display: flex;
content: "";
width: 20px;
Expand All @@ -27,6 +33,7 @@
mask-image: url("data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iZ3JpZGljb24gZ3JpZGljb25zLW15LXNpdGVzIiBoZWlnaHQ9IjI0IiB3aWR0aD0iMjQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDI0IDI0Ij48Zz48cGF0aCBkPSJNMTIgMkM2LjQ3NyAyIDIgNi40NzcgMiAxMnM0LjQ3NyAxMCAxMCAxMCAxMC00LjQ3NyAxMC0xMFMxNy41MjMgMiAxMiAyek0zLjUgMTJjMC0xLjIzMi4yNjQtMi40MDIuNzM2LTMuNDU5TDguMjkxIDE5LjY1QTguNSA4LjUgMCAwMTMuNSAxMnptOC41IDguNTAxYy0uODM0IDAtMS42NC0uMTIyLTIuNDAxLS4zNDZsMi41NTEtNy40MTEgMi42MTMgNy4xNThhLjcxOC43MTggMCAwMC4wNjEuMTE3IDguNDk3IDguNDk3IDAgMDEtMi44MjQuNDgyem0xLjE3Mi0xMi40ODZjLjUxMi0uMDI3Ljk3My0uMDgxLjk3My0uMDgxLjQ1OC0uMDU0LjQwNC0uNzI3LS4wNTQtLjcwMSAwIDAtMS4zNzcuMTA4LTIuMjY2LjEwOC0uODM1IDAtMi4yMzktLjEwOC0yLjIzOS0uMTA4LS40NTktLjAyNi0uNTEyLjY3NC0uMDU0LjcwMSAwIDAgLjQzNC4wNTQuODkyLjA4MWwxLjMyNCAzLjYyOS0xLjg2IDUuNTc5LTMuMDk2LTkuMjA4Yy41MTItLjAyNy45NzMtLjA4MS45NzMtLjA4MS40NTgtLjA1NC40MDMtLjcyNy0uMDU1LS43MDEgMCAwLTEuMzc2LjEwOC0yLjI2NS4xMDgtLjE2IDAtLjM0Ny0uMDA0LS41NDctLjAxQTguNDkxIDguNDkxIDAgMDExMiAzLjVjMi4yMTMgMCA0LjIyOC44NDYgNS43NCAyLjIzMi0uMDM3LS4wMDItLjA3Mi0uMDA3LS4xMS0uMDA3LS44MzUgMC0xLjQyNy43MjctMS40MjcgMS41MDkgMCAuNzAxLjQwNCAxLjI5My44MzUgMS45OTQuMzIzLjU2Ni43MDEgMS4yOTMuNzAxIDIuMzQ0IDAgLjcyNy0uMjggMS41NzItLjY0NyAyLjc0OGwtLjg0OCAyLjgzMy0zLjA3Mi05LjEzOHptMy4xMDEgMTEuMzMybDIuNTk2LTcuNTA2Yy40ODUtMS4yMTMuNjQ2LTIuMTgyLjY0Ni0zLjA0NSAwLS4zMTMtLjAyMS0uNjAzLS4wNTctLjg3NEE4LjQ1NSA4LjQ1NSAwIDAxMjAuNSAxMmE4LjQ5MyA4LjQ5MyAwIDAxLTQuMjI3IDcuMzQ3eiIvPjwvZz48L3N2Zz4=");
mask-position: center;
mask-repeat: no-repeat;
top: 2px;
Copy link
Member

Choose a reason for hiding this comment

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


@media (max-width: 782px) {
width: 36px;
Expand Down
4 changes: 4 additions & 0 deletions projects/packages/masterbar/changelog/feat-unify-masterbar-3
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: changed

Nav Redesign: Use Core admin bar for Simple and Atomic Default-view sites
2 changes: 1 addition & 1 deletion projects/packages/masterbar/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"extra": {
"autotagger": true,
"branch-alias": {
"dev-trunk": "0.4.x-dev"
"dev-trunk": "0.5.x-dev"
},
"changelogger": {
"link-template": "https://github.com/Automattic/jetpack-masterbar/compare/v${old}...v${new}"
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/masterbar/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@automattic/jetpack-masterbar",
"version": "0.4.1-alpha",
"version": "0.5.0-alpha",
"description": "The WordPress.com Toolbar feature replaces the default admin bar and offers quick links to the Reader, all your sites, your WordPress.com profile, and notifications.",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/masterbar/#readme",
"bugs": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,9 @@ public function should_link_to_wp_admin() {
* @return void
*/
public function inject_core_mobile_toggle() {
if ( defined( 'WPCOM_ADMIN_BAR_UNIFICATION' ) && WPCOM_ADMIN_BAR_UNIFICATION ) {
return;
}
echo '<span id="wp-admin-bar-menu-toggle" style="display: none!important">';
}

Expand Down
6 changes: 3 additions & 3 deletions projects/packages/masterbar/src/class-main.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
class Main {

const PACKAGE_VERSION = '0.4.1-alpha';
const PACKAGE_VERSION = '0.5.0-alpha';

/**
* Initializer.
Expand All @@ -29,13 +29,13 @@ public static function init() {

new Admin_Color_Schemes();

if ( ( defined( 'WPCOM_ADMIN_BAR_UNIFICATION' ) && WPCOM_ADMIN_BAR_UNIFICATION ) || get_option( 'wpcom_admin_interface' ) === 'wp-admin' ) {
if ( get_option( 'wpcom_admin_interface' ) === 'wp-admin' ) {
return;
}

$host = new Host();

if ( ! $host->is_wpcom_simple() ) {
if ( ! $host->is_wpcom_simple() && ! ( defined( 'WPCOM_ADMIN_BAR_UNIFICATION' ) && WPCOM_ADMIN_BAR_UNIFICATION ) ) {
new Masterbar();
}

Expand Down
5 changes: 5 additions & 0 deletions projects/plugins/jetpack/changelog/feat-unify-masterbar-3
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: other
Comment: Updated composer.lock.


4 changes: 2 additions & 2 deletions projects/plugins/jetpack/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


4 changes: 2 additions & 2 deletions projects/plugins/mu-wpcom-plugin/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions projects/plugins/wpcomsh/changelog/feat-unify-masterbar-3
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


4 changes: 2 additions & 2 deletions projects/plugins/wpcomsh/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading