import React from 'react';
import { observer } from 'mobx-react-lite';
import { MessageActionModal } from '../ActionModal';
import type { FieldActionsState } from '../../state/FieldActionsState';

interface Props {
  state: FieldActionsState;
}

function _SidePanelFieldActionsModal({ state }: Props) {
  const value = state.confirmModal.value;
  if (!value) {
    return null;
  }
  return (
    <MessageActionModal
      state={state.confirmModal}
      {...value}
      primaryButtonProps={{
        ...value.primaryButtonProps,
        disabled: state.deleteTask.status.isLoading,
      }}
    />
  );
}

const SidePanelFieldActionsModal = observer(_SidePanelFieldActionsModal);

export default SidePanelFieldActionsModal;
