/** * WordPress dependencies */ import { Button, Modal } from '@safe-wordpress/components'; import { useDispatch } from '@safe-wordpress/data'; import { _x } from '@safe-wordpress/i18n'; /** * External dependencies */ import { isEmpty } from '@nelio-content/utils'; /** * Internal dependencies */ import './style.scss'; import { store as NC_SOCIAL_EDITOR } from '../../../store'; import { useIsSaving, useFailureDescription } from '../../../hooks'; export const ErrorDialog = (): JSX.Element => { const isSaving = useIsSaving(); const error = useFailureDescription(); const { close, makeEditable, sendNow } = useDispatch( NC_SOCIAL_EDITOR ); return ( ! isSaving && close() } >
{ isEmpty( error ) ? ( <> { _x( 'An error occurred while attempting to share this social message.', 'text', 'nelio-content' ) } ) : ( <> { _x( 'Error!', 'text', 'nelio-content' ) } { ` ${ error }` } ) }
); };