import PropTypes from 'prop-types';
import React from 'react';
import { connect } from 'react-redux';
import Helmet from 'react-helmet';
import { bindActionCreators } from 'redux';
import { FormattedMessage } from 'react-intl';
import { createStructuredSelector } from 'reselect';
import makeSelectDashboard from './selectors';
import messages from './messages';
// eslint-disable-next-line
import { UserIsAuthenticated } from '../../../utils/authWrapper';
import * as actions from './actions';
import BreadCrumbs from '../../v2Components/BreadCrumbs/index';
export class Dashboard extends React.Component { // eslint-disable-line react/prefer-stateless-function
  render() {
    const breadCrumbLocations = [
      {
        text: <FormattedMessage {...messages.header} />,
        url: '',
        disabled: true,
      },
    ];
    return (
      <div>
        <FormattedMessage {...messages.header}>{(message) => (<Helmet
          title={message}
          meta={[
            { name: 'description', content: <FormattedMessage {...messages.header}/> },
          ]}
        />)}
        </FormattedMessage>
        <BreadCrumbs locations={breadCrumbLocations} />
      </div>
    );
  }
}

Dashboard.propTypes = {
  actions: PropTypes.object,
};

const mapStateToProps = createStructuredSelector({
  Dashboard: makeSelectDashboard(),
});


function mapDispatchToProps(dispatch) {
  return {
    actions: bindActionCreators(actions, dispatch),
  };
}

export default UserIsAuthenticated(connect(mapStateToProps, mapDispatchToProps)(Dashboard));
