diff --git a/editor/header/saved-state/index.js b/editor/header/saved-state/index.js index 0b5e16fe502377..1924d33b8b5f48 100644 --- a/editor/header/saved-state/index.js +++ b/editor/header/saved-state/index.js @@ -13,18 +13,28 @@ import Dashicon from 'components/dashicon'; * Internal dependencies */ import './style.scss'; -import { isEditedPostDirty } from '../../selectors'; +import { isEditedPostNew, isEditedPostDirty } from '../../selectors'; -function SavedState( { isDirty } ) { +function SavedState( { isNew, isDirty } ) { const classes = classNames( 'editor-saved-state', { + 'is-new': isNew, 'is-dirty': isDirty, } ); - const icon = isDirty - ? 'warning' - : 'saved'; - const text = isDirty - ? wp.i18n.__( 'Unsaved changes' ) - : wp.i18n.__( 'Saved' ); + + let icon, text; + if ( isNew && isDirty ) { + icon = 'warning'; + text = wp.i18n.__( 'New post with changes' ); + } else if ( isNew ) { + icon = 'edit'; + text = wp.i18n.__( 'New post' ); + } else if ( isDirty ) { + icon = 'warning'; + text = wp.i18n.__( 'Unsaved changes' ); + } else { + icon = 'saved'; + text = wp.i18n.__( 'Saved' ); + } return (
@@ -36,6 +46,7 @@ function SavedState( { isDirty } ) { export default connect( ( state ) => ( { + isNew: isEditedPostNew( state ), isDirty: isEditedPostDirty( state ), } ) )( SavedState ); diff --git a/editor/header/tools/publish-button.js b/editor/header/tools/publish-button.js index f20fef3a95a897..6eaacb891296fa 100644 --- a/editor/header/tools/publish-button.js +++ b/editor/header/tools/publish-button.js @@ -32,12 +32,11 @@ function PublishButton( { isRequesting, isError, requestIsNewPost, - onUpdate, - onSaveDraft, + onSave, } ) { const buttonEnabled = ! isRequesting; - let buttonText, saveCallback; + let buttonText; if ( isRequesting ) { buttonText = requestIsNewPost ? wp.i18n.__( 'Saving…' ) @@ -56,12 +55,6 @@ function PublishButton( { buttonText = wp.i18n.__( 'Save draft' ); } - if ( post && post.id ) { - saveCallback = onUpdate; - } else { - saveCallback = onSaveDraft; - } - const buttonDisabledHint = process.env.NODE_ENV === 'production' ? wp.i18n.__( 'The Save button is disabled during early alpha releases.' ) : null; @@ -70,7 +63,7 @@ function PublishButton( {