-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathindex.js
44 lines (41 loc) · 1.13 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* WordPress dependencies
*/
import { sprintf, _n } from '@wordpress/i18n';
import { Button } from '@wordpress/components';
import { withSelect } from '@wordpress/data';
import { backup } from '@wordpress/icons';
import { addQueryArgs } from '@wordpress/url';
/**
* Internal dependencies
*/
import PostLastRevisionCheck from './check';
import { store as editorStore } from '../../store';
function LastRevision( { lastRevisionId, revisionsCount } ) {
return (
<PostLastRevisionCheck>
<Button
href={ addQueryArgs( 'revision.php', {
revision: lastRevisionId,
gutenberg: true,
} ) }
className="editor-post-last-revision__title"
icon={ backup }
>
{ sprintf(
/* translators: %d: number of revisions */
_n( '%d Revision', '%d Revisions', revisionsCount ),
revisionsCount
) }
</Button>
</PostLastRevisionCheck>
);
}
export default withSelect( ( select ) => {
const { getCurrentPostLastRevisionId, getCurrentPostRevisionsCount } =
select( editorStore );
return {
lastRevisionId: getCurrentPostLastRevisionId(),
revisionsCount: getCurrentPostRevisionsCount(),
};
} )( LastRevision );