From be8e558829eb34c019fcf7119c27a5d211e100ec Mon Sep 17 00:00:00 2001 From: okmttdhr Date: Fri, 9 Jun 2023 12:47:18 +0900 Subject: [PATCH] Fix the save button label for BTP --- .../src/components/save-button/index.js | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/packages/edit-site/src/components/save-button/index.js b/packages/edit-site/src/components/save-button/index.js index 01a8972fc2331..ecf8585e6599f 100644 --- a/packages/edit-site/src/components/save-button/index.js +++ b/packages/edit-site/src/components/save-button/index.js @@ -39,21 +39,24 @@ export default function SaveButton( { const disabled = isSaving || ! activateSaveEnabled; const getLabel = () => { + if ( isPreviewingTheme() ) { + if ( isSaving ) { + return __( 'Activating' ); + } else if ( disabled ) { + return __( 'Saved' ); + } else if ( isDirty ) { + return __( 'Activate & Save' ); + } + return __( 'Activate' ); + } + if ( isSaving ) { return __( 'Saving' ); - } - if ( disabled ) { + } else if ( disabled ) { return __( 'Saved' ); + } else if ( defaultLabel ) { + return defaultLabel; } - - if ( defaultLabel ) return defaultLabel; - - if ( isPreviewingTheme() && isDirty ) { - return __( 'Activate & Save' ); - } else if ( isPreviewingTheme() ) { - return __( 'Activate' ); - } - return __( 'Save' ); }; const label = getLabel();