blob: 81735c48d609b0eb619f4edf5d23280507e5ba1f (
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
46
47
48
49
50
51
|
/**
* Publicize sharing panel component.
*
* Displays Publicize notifications if no
* services are connected or displays form if
* services are connected.
*/
/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import { compose } from '@wordpress/compose';
import { Fragment } from '@wordpress/element';
import { withDispatch, withSelect } from '@wordpress/data';
/**
* Internal dependencies
*/
import PublicizeConnectionVerify from './connection-verify';
import PublicizeForm from './form';
import PublicizeSettingsButton from './settings-button';
const PublicizePanel = ( { connections, refreshConnections } ) => (
<Fragment>
{ connections && connections.some( connection => connection.enabled ) && (
<PublicizeConnectionVerify />
) }
<div>
{ __( "Connect and select the accounts where you'd like to share your post.", 'jetpack' ) }
</div>
{ connections && connections.length > 0 && (
<PublicizeForm refreshCallback={ refreshConnections } />
) }
{ connections && 0 === connections.length && (
<PublicizeSettingsButton
className="jetpack-publicize-add-connection-wrapper"
refreshCallback={ refreshConnections }
/>
) }
</Fragment>
);
export default compose( [
withSelect( select => ( {
connections: select( 'core/editor' ).getEditedPostAttribute( 'jetpack_publicize_connections' ),
} ) ),
withDispatch( dispatch => ( {
refreshConnections: dispatch( 'core/editor' ).refreshPost,
} ) ),
] )( PublicizePanel );
|