| 1 |
import { ErrorMessage } from '@agent/components/ErrorMessage'; |
| 2 |
import { workflows } from '@agent/workflows/workflows'; |
| 3 |
import { __ } from '@wordpress/i18n'; |
| 4 |
|
| 5 |
export const WorkflowComponent = ({ message }) => { |
| 6 |
const Component = workflows.find((w) => w.id === message.details.id) |
| 7 |
?.whenFinished?.component; |
| 8 |
|
| 9 |
if (!Component) return <ErrorM />; |
| 10 |
return <Component {...message.details} />; |
| 11 |
}; |
| 12 |
|
| 13 |
const ErrorM = () => ( |
| 14 |
<ErrorMessage> |
| 15 |
<div className="text-sm"> |
| 16 |
<div className="font-semibold"> |
| 17 |
{__('Component not available', 'extendify-local')} |
| 18 |
</div> |
| 19 |
<div className=""> |
| 20 |
{ |
| 21 |
// translators: This is for when a component doesn't exist |
| 22 |
__( |
| 23 |
'It may have been removed or is not available for your account.', |
| 24 |
'extendify-local', |
| 25 |
) |
| 26 |
} |
| 27 |
</div> |
| 28 |
</div> |
| 29 |
</ErrorMessage> |
| 30 |
); |
| 31 |
|