import { connect } from 'react-redux';

import { withRouter } from 'react-router';
import app from 'store/app';
import generic from 'store/generic';
import { StoreState } from 'store/rootReducer';
import genericApollo from 'store/genericApollo';
import VirtualTable from './VirtualTable';

const mapStateToProps = (state: StoreState) => ({
  meta: state.generic.meta,
});

const mapDispatchToProps = {
  dialogShow: app.actions.dialog.show.action,
  resetDetail: generic.actions.detail.reset.action,
  deleteItem: generic.actions.delete.request.action,
  loadApollo: genericApollo.actions.detail.request.action,
  deleteApollo: genericApollo.actions.delete.request.action,
  update: generic.actions.fastUpdate.request.action,
  updateApollo: genericApollo.actions.update.request.action,
  setMeta: generic.actions.setMeta.action,
};

const Wrapped = connect(mapStateToProps, mapDispatchToProps)(VirtualTable);

export default withRouter(Wrapped);
