blob: 16d9b8b7f6628ff15069b62ce803c98700445a0a (
plain)
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
45
|
/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import { Component } from '@wordpress/element';
import { get } from 'lodash';
import { PanelBody } from '@wordpress/components';
import { withSelect } from '@wordpress/data';
/**
* Internal dependencies
*/
import ClipboardInput from '../../shared/clipboard-input';
import JetpackPluginSidebar from '../../shared/jetpack-plugin-sidebar';
export const name = 'shortlinks';
export const settings = {
render: () => <Shortlinks />,
};
class ShortlinksPanel extends Component {
render() {
const { shortlink } = this.props;
if ( ! shortlink ) {
return null;
}
return (
<JetpackPluginSidebar>
<PanelBody title={ __( 'Shortlink', 'jetpack' ) } className="jetpack-shortlinks__panel">
<ClipboardInput link={ shortlink } />
</PanelBody>
</JetpackPluginSidebar>
);
}
}
const Shortlinks = withSelect( select => {
const currentPost = select( 'core/editor' ).getCurrentPost();
return {
shortlink: get( currentPost, 'jetpack_shortlink', '' ),
};
} )( ShortlinksPanel );
|