/*
*
* HomePage
*
*/
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { injectIntl } from 'react-intl';
import { bindActionCreators, compose } from 'redux';
import cn from 'classnames';
import { isEmpty, replace } from 'lodash';
// Design
import EditForm from 'components/EditForm';
import HeaderNav from 'components/HeaderNav';
import List from 'components/List';
import PluginHeader from 'components/PluginHeader';
import PopUpForm from 'components/PopUpForm';
// Utils
import injectReducer from 'utils/injectReducer';
import injectSaga from 'utils/injectSaga';
// Selectors
import selectHomePage from './selectors';
// Styles
import styles from './styles.scss';
// Actions
import {
deleteData,
fetchData,
onChange,
} from './actions';
import reducer from './reducer';
import saga from './saga';
export class HomePage extends React.Component {
componentDidMount() {
this.props.fetchData(this.props.match.params.settingType);
}
componentDidUpdate(prevProps) {
if (prevProps.match.params.settingType !== this.props.match.params.settingType) {
this.props.fetchData(this.props.match.params.settingType);
}
}
handleButtonClick = () => {
if (this.props.match.params.settingType === 'roles') {
this.props.history.push(`${this.props.location.pathname}/create`);
} else {
this.props.history.push(`${this.props.location.pathname}#add::${this.props.match.params.settingType}`);
}
}
pluginHeaderActions = [
{
label: 'users-permissions.EditPage.cancel',
kind: 'secondary',
onClick: () => console.log('cancel'),
type: 'button',
},
{
kind: 'primary',
label: 'users-permissions.EditPage.submit',
onClick: () => console.log('submit'),
type: 'submit',
},
];
render() {
const headerActions = this.props.match.params.settingType === 'advanced-settings' && this.props.showButtons ?
this.pluginHeaderActions : [];
const noButtonList = this.props.match.params.settingType === 'email-templates';
const component = this.props.match.params.settingType === 'advanced-settings' ?
);
const hashArray = replace(this.props.location.hash, '#', '').split('::');
return (