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

Master Bar: Add Launch Button #98918

Merged
merged 1 commit into from
Jan 27, 2025
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
22 changes: 22 additions & 0 deletions client/layout/masterbar/logged-in.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ import isNotificationsOpen from 'calypso/state/selectors/is-notifications-open';
import isAtomicSite from 'calypso/state/selectors/is-site-automated-transfer';
import isSiteMigrationActiveRoute from 'calypso/state/selectors/is-site-migration-active-route';
import isSiteMigrationInProgress from 'calypso/state/selectors/is-site-migration-in-progress';
import getIsUnlaunchedSite from 'calypso/state/selectors/is-unlaunched-site';
import { updateSiteMigrationMeta } from 'calypso/state/sites/actions';
import { launchSiteOrRedirectToLaunchSignupFlow } from 'calypso/state/sites/launch/actions';
import { isTrialExpired } from 'calypso/state/sites/plans/selectors/trials/trials-expiration';
import {
getSiteSlug,
Expand Down Expand Up @@ -412,6 +414,23 @@ class MasterbarLoggedIn extends Component {
);
}

renderLaunchButton() {
const { isUnlaunchedSite, siteId, translate } = this.props;

if ( ! isUnlaunchedSite ) {
return null;
}

return (
<Item
className="masterbar__item-launch-site"
onClick={ () => this.props.launchSiteOrRedirectToLaunchSignupFlow( siteId ) }
>
{ translate( 'Launch site' ) }
</Item>
);
}

renderProfileMenu() {
const { translate, user } = this.props;
const profileActions = [
Expand Down Expand Up @@ -600,6 +619,7 @@ class MasterbarLoggedIn extends Component {
{ this.renderSiteMenu() }
{ this.renderSiteActionMenu() }
{ this.renderLanguageSwitcher() }
{ this.renderLaunchButton() }
</div>
<div className="masterbar__section masterbar__section--right">
{ this.renderCart() }
Expand Down Expand Up @@ -655,6 +675,7 @@ export default connect(
isSiteTrialExpired: isTrialExpired( state, siteId ),
newPostUrl: getEditorUrl( state, siteId, null, 'post' ),
newPageUrl: getEditorUrl( state, siteId, null, 'page' ),
isUnlaunchedSite: getIsUnlaunchedSite( state, siteId ),
};
},
{
Expand All @@ -664,5 +685,6 @@ export default connect(
activateNextLayoutFocus,
savePreference,
redirectToLogout,
launchSiteOrRedirectToLaunchSignupFlow,
}
)( localize( MasterbarLoggedIn ) );
5 changes: 5 additions & 0 deletions client/layout/masterbar/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,11 @@ body.is-mobile-app-view {
}
}

.masterbar__item-launch-site {
cursor: pointer;
background-color: var(--wp-admin-theme-color);
}

.masterbar__item-logo {
flex: 0 0 auto;
padding: 0 0 0 8px;
Expand Down
Loading