2016-11-23 16:23:32 -02:00
|
|
|
import React, { Component, PropTypes } from 'react';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { SIMPLE, EDITORIAL_WORKFLOW } from '../constants/publishModes';
|
|
|
|
import history from '../routing/history';
|
2016-11-02 12:25:43 -02:00
|
|
|
import UnpublishedEntriesPanel from './editorialWorkflow/UnpublishedEntriesPanel';
|
|
|
|
import styles from './breakpoints.css';
|
|
|
|
|
|
|
|
|
2016-11-23 16:23:32 -02:00
|
|
|
class DashboardPage extends Component {
|
|
|
|
componentWillMount() {
|
|
|
|
if (this.props.publishMode === SIMPLE) {
|
|
|
|
history.push(`/collections/${ this.props.firstCollection }`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div className={styles.root}>
|
|
|
|
<h1>Dashboard</h1>
|
|
|
|
<UnpublishedEntriesPanel />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2016-11-02 12:25:43 -02:00
|
|
|
}
|
2016-11-23 16:23:32 -02:00
|
|
|
|
|
|
|
DashboardPage.propTypes = {
|
|
|
|
firstCollection: PropTypes.string,
|
|
|
|
publishMode: PropTypes.oneOf([SIMPLE, EDITORIAL_WORKFLOW]),
|
|
|
|
};
|
|
|
|
|
|
|
|
function mapStateToProps(state) {
|
|
|
|
const { config, collections } = state;
|
|
|
|
return {
|
|
|
|
firstCollection: collections.first().get('name'),
|
|
|
|
publishMode: config.get('publish_mode'),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export default connect(mapStateToProps)(DashboardPage);
|