import { connect } from 'umi';
import SupplyInfoComponent from '../../../components/CommonElementEvent/SupplyInfo';

function SupplyInfo({ dispatch, app, content }) {
  function removePane(changePanes, currentPane) {
    dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
  }

  function removeModalPan(changePanes) {
    dispatch({ type: 'app/removeModalPane', payload: { changePanes } });
  }

  function addPane(pane) {
    dispatch({ type: 'app/addPane', payload: { pane } });
  }

  const supplyInfoProps = {
    dispatch,
    app,
    content,
    onAddPane: addPane,
    onRemovePane: removePane,
    onRemoveModalPane: removeModalPan,
  };

  return (
    <SupplyInfoComponent {...supplyInfoProps} />
  );
}

export default connect(({ app, content }) =>
  ({ app, content }))(SupplyInfo);
