LYS - Update toolbar store link text (#47315)

* Update toolbar store link

"Preview store" when coming soon mode is enabled
"View store" when the site is set to live

* Add changefile(s) from automation for the following project(s): woocommerce

* Fix broken test

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Moon 2024-05-10 23:00:41 +12:00 committed by GitHub
parent a8cf226987
commit 0873ed47c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 1 deletions

View File

@ -46,6 +46,7 @@ import { getUrlParams } from '~/utils';
import { useActiveSetupTasklist } from '~/task-lists';
import { getSegmentsFromPath } from '~/utils/url-helpers';
import { FeedbackIcon } from '~/products/images/feedback-icon';
import { useLaunchYourStore } from '~/launch-your-store';
const HelpPanel = lazy( () =>
import( /* webpackChunkName: "activity-panels-help" */ './panels/help' )
@ -72,6 +73,7 @@ export const ActivityPanel = ( { isEmbedded, query } ) => {
const hasExtendedNotifications = Boolean( fills?.length );
const { updateUserPreferences, ...userData } = useUserPreferences();
const activeSetupList = useActiveSetupTasklist();
const { comingSoon } = useLaunchYourStore();
const closePanel = () => {
setIsPanelClosing( true );
@ -372,7 +374,11 @@ export const ActivityPanel = ( { isEmbedded, query } ) => {
const previewStore = {
name: 'previewStore',
title: __( 'Preview store', 'woocommerce' ),
title:
( comingSoon === 'yes' &&
__( 'Preview store', 'woocommerce' ) ) ||
( comingSoon === 'no' && __( 'View store', 'woocommerce' ) ) ||
'',
visible: isHomescreen() && query.task !== 'appearance',
onClick: () => {
window.open( getAdminSetting( 'shopUrl' ) );

View File

@ -32,6 +32,14 @@ jest.mock( '@woocommerce/admin-layout', () => {
};
} );
jest.mock( '~/launch-your-store', () => ( {
useLaunchYourStore: jest.fn( () => ( {
comingSoon: 'yes',
launchYourStoreEnabled: true,
isLoading: true,
} ) ),
} ) );
jest.mock( '@woocommerce/data', () => ( {
...jest.requireActual( '@woocommerce/data' ),
useUser: jest.fn().mockReturnValue( { currentUserCan: () => true } ),

View File

@ -0,0 +1,4 @@
Significance: minor
Type: update
Updated the toolbar's store link based on the site's visibility settings.