Skip to content

Commit

Permalink
Remove ability for user to toggle sync status after pattern creation (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
glendaviesnz authored Jun 29, 2023
1 parent 95c4948 commit 47b60e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 25 deletions.
29 changes: 6 additions & 23 deletions packages/editor/src/components/post-sync-status/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
/**
* WordPress dependencies
*/
import { useSelect, useDispatch } from '@wordpress/data';
import { useSelect } from '@wordpress/data';
import { __ } from '@wordpress/i18n';
import { ToggleControl, PanelRow } from '@wordpress/components';
import { PanelRow } from '@wordpress/components';

/**
* Internal dependencies
*/
import { store as editorStore } from '../../store';

export default function PostSyncStatus() {
const { editPost } = useDispatch( editorStore );
const { meta, postType } = useSelect( ( select ) => {
const { getEditedPostAttribute } = select( editorStore );
return {
Expand All @@ -22,31 +21,15 @@ export default function PostSyncStatus() {
if ( postType !== 'wp_block' ) {
return null;
}
const onUpdateSync = ( syncStatus ) =>
editPost( {
meta: {
...meta,
sync_status: syncStatus === 'unsynced' ? syncStatus : null,
},
} );
const syncStatus = meta?.sync_status;
const isFullySynced = ! syncStatus;

return (
<PanelRow className="edit-post-sync-status">
<span>{ __( 'Syncing' ) }</span>
<ToggleControl
__nextHasNoMarginBottom
label={
isFullySynced ? __( 'Fully synced' ) : __( 'Not synced' )
}
checked={ isFullySynced }
onChange={ () => {
onUpdateSync(
syncStatus === 'unsynced' ? 'fully' : 'unsynced'
);
} }
/>
<span>{ __( 'Sync status' ) }</span>
<div>
{ isFullySynced ? __( 'Fully synced' ) : __( 'Not synced' ) }
</div>
</PanelRow>
);
}
4 changes: 2 additions & 2 deletions packages/editor/src/components/post-sync-status/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
flex-shrink: 0;
}

.components-base-control {
> div {
// Match padding on tertiary buttons for alignment.
padding-left: $grid-unit-15 * 0.5;
padding-left: $grid-unit-15;
}
}

0 comments on commit 47b60e5

Please sign in to comment.