import { connect } from 'react-redux';
import app from 'store/app';
import generic from 'store/generic';
import cms from 'store/cms';

import { StoreState } from 'store/rootReducer';
import PageCmsForm from './PageCmsForm';

const mapStateToProps = (state: StoreState): Record<string, any> => ({
  copy: state.cms.copy,
  user: state.account.profile && state.account.profile.data,
});

const mapDispatchToProps = {
  dialogSuccess: app.actions.dialog.success.action,
  dialogError: app.actions.dialog.error.action,
  dialogShow: app.actions.dialog.show.action,
  upload: generic.actions.upload.request.action,
  copyContent: cms.actions.copyContent.action,
  sideMenuShow: app.actions.sideMenu.show.action,
  sideMenuHide: app.actions.sideMenu.hide.action,
};

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

export default Wrapped;
