import { connect } from 'umi';
import EmployeeInfoComponent from '../../../components/CommonElementEvent/EmployeeInfo';

function Employee({ 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 employeeProps = {
    app,
    content,
    dispatch,
    onAddPane: addPane,
    onRemovePane: removePane,
    onRemoveModalPane: removeModalPan,
  };

  return (
    <EmployeeInfoComponent {...employeeProps} />
  );
}

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