/* eslint-disable react/jsx-no-bind */ import { observer } from 'mobx-react-lite'; import type { FC } from 'react'; import { useStatus } from 'stores/calculation/statuses/hooks'; import type { Elements } from '../config/map-actions'; import type { ElementsProps } from '../types/elements-props'; type BuilderProps = { elementName: Elements; actionName: string; }; export default function buildAction(Component: FC, { elementName, actionName }: BuilderProps) { return observer((props) => { const status = useStatus(elementName); return ( import(`process/${actionName}`).then((m) => m.default())} {...props} /> ); }); }