@@ -11,7 +11,7 @@ import {
1111 PluginPostPublishPanel ,
1212 PluginSidebar ,
1313 PluginSidebarMoreMenuItem ,
14- store as editorStore
14+ store as editorStore ,
1515} from '@wordpress/editor' ;
1616
1717import { useEffect } from '@wordpress/element' ;
@@ -36,121 +36,137 @@ const icon = (
3636 />
3737) ;
3838
39- const isPro = Number ( ropApiSettings . license_type ) > 0 ;
39+ const isPro = Number ( ropApiSettings . license_type ) > 0 ;
4040
4141const render = ( ) => {
42- const postType = useSelect ( select => select ( editorStore ) . getCurrentPostType ( ) , [ ] ) ;
43- const postStatus = useSelect ( select => select ( editorStore ) . getCurrentPostAttribute ( 'status' ) , [ ] ) ;
42+ const postType = useSelect (
43+ ( select ) => select ( editorStore ) . getCurrentPostType ( ) ,
44+ [ ]
45+ ) ;
46+ const postStatus = useSelect (
47+ ( select ) => select ( editorStore ) . getCurrentPostAttribute ( 'status' ) ,
48+ [ ]
49+ ) ;
4450
45- const [ meta , setMeta ] = useEntityProp ( 'postType' , postType , 'meta' ) ;
51+ const [ meta , setMeta ] = useEntityProp ( 'postType' , postType , 'meta' ) ;
4652
47- const updateMetaValue = ( keyOrObject , newValue ) => {
48- if ( typeof keyOrObject === 'object' && keyOrObject !== null ) {
49- setMeta ( { ...meta , ...keyOrObject } ) ;
53+ const updateMetaValue = ( keyOrObject , newValue ) => {
54+ if ( typeof keyOrObject === 'object' && keyOrObject !== null ) {
55+ setMeta ( { ...meta , ...keyOrObject } ) ;
5056 } else {
51- setMeta ( { ...meta , [ keyOrObject ] : newValue } ) ;
57+ setMeta ( { ...meta , [ keyOrObject ] : newValue } ) ;
5258 }
5359 } ;
5460
55- useEffect ( ( ) => {
56- if ( meta . rop_publish_now ) {
57- updateMetaValue ( 'rop_publish_now' , 'yes' ) ;
61+ useEffect ( ( ) => {
62+ if ( meta . rop_publish_now ) {
63+ updateMetaValue ( 'rop_publish_now' , 'yes' ) ;
5864 }
59- } , [ ] ) ;
65+ } , [ ] ) ;
6066
6167 return (
6268 < >
63- < PluginSidebarMoreMenuItem
64- target = "rop-sidebar"
65- icon = { icon }
66- >
67- { ropApiSettings . labels . general . plugin_name }
69+ < PluginSidebarMoreMenuItem target = "rop-sidebar" icon = { icon } >
70+ { ropApiSettings . labels . general . plugin_name }
6871 </ PluginSidebarMoreMenuItem >
6972
7073 < PluginSidebar
7174 name = "rop-sidebar"
72- icon = { icon }
73- title = { ropApiSettings . labels . general . plugin_name }
75+ icon = { icon }
76+ title = { ropApiSettings . labels . general . plugin_name }
7477 className = "revive-social-sidebar"
7578 >
76- { Boolean ( ropApiSettings . publish_now . instant_share_enabled ) && (
79+ { Boolean ( ropApiSettings . publish_now . instant_share_enabled ) && (
7780 < >
78- < PanelBody title = { ropApiSettings . labels . publish_now . instant_sharing } >
81+ < PanelBody
82+ title = {
83+ ropApiSettings . labels . publish_now
84+ . instant_sharing
85+ }
86+ >
7987 < InstantSharing
8088 screen = "pre-publish"
81- meta = { meta }
82- updateMetaValue = { updateMetaValue }
83- postStatus = { postStatus }
84- publishStatus = { meta . rop_publish_now_status }
89+ meta = { meta }
90+ updateMetaValue = { updateMetaValue }
91+ postStatus = { postStatus }
92+ publishStatus = { meta . rop_publish_now_status }
8593 />
8694 </ PanelBody >
8795
88- { postStatus === 'publish' && (
89- < PanelBody title = { ropApiSettings . labels . publish_now . manual_sharing } >
96+ { postStatus === 'publish' && (
97+ < PanelBody
98+ title = {
99+ ropApiSettings . labels . publish_now
100+ . manual_sharing
101+ }
102+ >
90103 < ManualSharing />
91104 </ PanelBody >
92- ) }
105+ ) }
93106 </ >
94- ) }
95-
96- { ( isPro && Boolean ( ropApiSettings . custom_messages ) ) && (
97- < Variations
98- meta = { meta }
99- updateMetaValue = { updateMetaValue }
100- />
101- ) }
102-
103- { ! isPro && (
104- < Upsell />
105- ) }
107+ ) }
108+
109+ { isPro && Boolean ( ropApiSettings . custom_messages ) && (
110+ < Variations meta = { meta } updateMetaValue = { updateMetaValue } />
111+ ) }
112+
113+ { ! isPro && < Upsell /> }
106114 </ PluginSidebar >
107115
108- { Boolean ( ropApiSettings . publish_now . instant_share_enabled ) && (
116+ { Boolean ( ropApiSettings . publish_now . instant_share_enabled ) && (
109117 < >
110118 < PluginPrePublishPanel
111- title = { ropApiSettings . labels . publish_now . instant_sharing }
112- isInitialOpen = { true }
113- icon = { icon }
119+ title = {
120+ ropApiSettings . labels . publish_now . instant_sharing
121+ }
122+ isInitialOpen = { true }
123+ icon = { icon }
114124 >
115125 < InstantSharing
116126 screen = "pre-publish"
117- meta = { meta }
118- updateMetaValue = { updateMetaValue }
119- postStatus = { postStatus }
120- publishStatus = { meta . rop_publish_now_status }
127+ meta = { meta }
128+ updateMetaValue = { updateMetaValue }
129+ postStatus = { postStatus }
130+ publishStatus = { meta . rop_publish_now_status }
121131 />
122132 </ PluginPrePublishPanel >
123133
124- { postStatus === 'publish' && (
134+ { postStatus === 'publish' && (
125135 < >
126136 < PluginPostPublishPanel
127- icon = { icon }
128- isInitialOpen = { true }
137+ icon = { icon }
138+ isInitialOpen = { true }
129139 >
130140 < InstantSharing
131141 screen = "post-publish"
132- meta = { meta }
133- updateMetaValue = { updateMetaValue }
134- postStatus = { postStatus }
135- publishStatus = { meta . rop_publish_now_status }
142+ meta = { meta }
143+ updateMetaValue = { updateMetaValue }
144+ postStatus = { postStatus }
145+ publishStatus = { meta . rop_publish_now_status }
136146 />
137147 </ PluginPostPublishPanel >
138148
139149 < PluginPostPublishPanel
140- title = { ropApiSettings . labels . publish_now . manual_sharing }
141- icon = { icon }
142- isInitialOpen = { true }
150+ title = {
151+ ropApiSettings . labels . publish_now
152+ . manual_sharing
153+ }
154+ icon = { icon }
155+ isInitialOpen = { true }
143156 >
144157 < ManualSharing />
145158 </ PluginPostPublishPanel >
146159 </ >
147- ) }
160+ ) }
148161 </ >
149- ) }
162+ ) }
150163 </ >
151164 ) ;
152165} ;
153166
154- if ( Boolean ( ropApiSettings . publish_now . instant_share_enabled ) || ( isPro && Boolean ( ropApiSettings . custom_messages ) ) ) {
155- registerPlugin ( 'revive-social' , { render } ) ;
167+ if (
168+ Boolean ( ropApiSettings . publish_now . instant_share_enabled ) ||
169+ ( isPro && Boolean ( ropApiSettings . custom_messages ) )
170+ ) {
171+ registerPlugin ( 'revive-social' , { render } ) ;
156172}
0 commit comments