| 1 |
/** |
| 2 |
* WordPress dependencies |
| 3 |
*/ |
| 4 |
import { sprintf, __ } from '@wordpress/i18n'; |
| 5 |
import { ExternalLink } from '@wordpress/components'; |
| 6 |
import { compose } from '@wordpress/compose'; |
| 7 |
import { withSelect } from '@wordpress/data'; |
| 8 |
import { Fragment } from '@wordpress/element'; |
| 9 |
|
| 10 |
/** |
| 11 |
* Internal dependencies |
| 12 |
*/ |
| 13 |
import PendingNoticeCheck from './check'; |
| 14 |
|
| 15 |
export function PendingNotice( { projectUrl, wrapper } ) { |
| 16 |
const Wrapper = wrapper || Fragment; |
| 17 |
|
| 18 |
return ( |
| 19 |
<PendingNoticeCheck> |
| 20 |
<Wrapper> |
| 21 |
<div> |
| 22 |
<p> |
| 23 |
{ __( |
| 24 |
'Listen to content saved as “Pending” in the BeyondWords dashboard.', |
| 25 |
'speechkit' |
| 26 |
) } |
| 27 |
</p> |
| 28 |
<ExternalLink href={ projectUrl }> |
| 29 |
{ __( 'BeyondWords dashboard.', 'speechkit' ) } |
| 30 |
</ExternalLink> |
| 31 |
</div> |
| 32 |
</Wrapper> |
| 33 |
</PendingNoticeCheck> |
| 34 |
); |
| 35 |
} |
| 36 |
|
| 37 |
export default compose( [ |
| 38 |
withSelect( ( select ) => { |
| 39 |
const { getEditedPostAttribute } = select( 'core/editor' ); |
| 40 |
|
| 41 |
const beyondwordsProjectId = |
| 42 |
getEditedPostAttribute( 'meta' ).beyondwords_project_id; |
| 43 |
const speechkitProjectId = |
| 44 |
getEditedPostAttribute( 'meta' ).speechkit_project_id; |
| 45 |
|
| 46 |
const projectId = beyondwordsProjectId || speechkitProjectId; |
| 47 |
|
| 48 |
const projectUrl = sprintf( |
| 49 |
'%1$s/dashboard/project/%2$d/content', |
| 50 |
process.env.BEYONDWORDS_DASHBOARD_URL, |
| 51 |
projectId |
| 52 |
); |
| 53 |
|
| 54 |
return { |
| 55 |
projectUrl, |
| 56 |
}; |
| 57 |
} ), |
| 58 |
] )( PendingNotice ); |
| 59 |
|