@wordpress/editor
Version:
Enhanced block editor for WordPress posts.
8 lines (7 loc) • 2.13 kB
Source Map (JSON)
{
"version": 3,
"sources": ["../../../src/components/post-sync-status/index.js"],
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport PostPanelRow from '../post-panel-row';\nimport { store as editorStore } from '../../store';\n\n/**\n * Renders the sync status of a post.\n *\n * @return {React.ReactNode} The rendered sync status component.\n */\nexport default function PostSyncStatus() {\n\tconst { syncStatus, postType } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst meta = getEditedPostAttribute( 'meta' );\n\n\t\t// When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.\n\t\tconst currentSyncStatus =\n\t\t\tmeta?.wp_pattern_sync_status === 'unsynced'\n\t\t\t\t? 'unsynced'\n\t\t\t\t: getEditedPostAttribute( 'wp_pattern_sync_status' );\n\n\t\treturn {\n\t\t\tsyncStatus: currentSyncStatus,\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t};\n\t} );\n\n\tif ( postType !== 'wp_block' ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostPanelRow label={ __( 'Sync status' ) }>\n\t\t\t<div className=\"editor-post-sync-status__value\">\n\t\t\t\t{ syncStatus === 'unsynced'\n\t\t\t\t\t? _x( 'Not synced', 'pattern (singular)' )\n\t\t\t\t\t: _x( 'Synced', 'pattern (singular)' ) }\n\t\t\t</div>\n\t\t</PostPanelRow>\n\t);\n}\n"],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA0B;AAC1B,kBAAuB;AAKvB,4BAAyB;AACzB,mBAAqC;AA8BlC;AAvBY,SAAR,iBAAkC;AACxC,QAAM,EAAE,YAAY,SAAS,QAAI,uBAAW,CAAE,WAAY;AACzD,UAAM,EAAE,uBAAuB,IAAI,OAAQ,aAAAA,KAAY;AACvD,UAAM,OAAO,uBAAwB,MAAO;AAG5C,UAAM,oBACL,MAAM,2BAA2B,aAC9B,aACA,uBAAwB,wBAAyB;AAErD,WAAO;AAAA,MACN,YAAY;AAAA,MACZ,UAAU,uBAAwB,MAAO;AAAA,IAC1C;AAAA,EACD,CAAE;AAEF,MAAK,aAAa,YAAa;AAC9B,WAAO;AAAA,EACR;AAEA,SACC,4CAAC,sBAAAC,SAAA,EAAa,WAAQ,gBAAI,aAAc,GACvC,sDAAC,SAAI,WAAU,kCACZ,yBAAe,iBACd,gBAAI,cAAc,oBAAqB,QACvC,gBAAI,UAAU,oBAAqB,GACvC,GACD;AAEF;",
"names": ["editorStore", "PostPanelRow"]
}