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 Jul 3, 2023
1 parent 2426d7d commit 4e6bf8d
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;
}
}

1 comment on commit 4e6bf8d

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 4e6bf8d.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5440693743
📝 Reported issues:

Please sign in to comment.