import React from 'react'; import { __ } from '@wordpress/i18n'; import { decodeEntities } from '@wordpress/html-entities'; import { useStateValue } from '../../store/store'; import Button from '../../components/button/button'; import './style.scss'; import { getSupportLink } from '../../utils/functions'; const ErrorScreen = () => { const [ { importErrorMessages, currentIndex, tryAgainCount, templateId }, dispatch, ] = useStateValue(); const supportLink = getSupportLink( templateId, importErrorMessages.errorText ); const tryAgain = () => { dispatch( { type: 'set', // Reset errors. importErrorMessages: {}, importErrorResponse: [], importError: false, // Try again count. tryAgainCount: tryAgainCount + 1, // Reset import flags. xmlImportDone: false, resetData: [], importStart: false, importEnd: false, importPercent: 0, requiredPluginsDone: false, notInstalledList: [], notActivatedList: [], // Go to previous step. currentIndex: currentIndex - 1, } ); }; const solutionHeading = (
{ importErrorMessages.primaryText }
) }{ importErrorMessages.errorText }
) } { importErrorMessages.errorText && 'object' === typeof importErrorMessages.errorText && ({ JSON.stringify( importErrorMessages.errorText, undefined, 2 ) }
{ decodeEntities( __( 'Please report this error ', 'astra-sites' ) ) } { 'here' } { decodeEntities( __( ' so we can fix it.', 'astra-sites' ) ) }
> ) ) }