diff --git a/src/components/UnpublishedListing.js b/src/components/UnpublishedListing.js
new file mode 100644
index 00000000..0ef0cdfa
--- /dev/null
+++ b/src/components/UnpublishedListing.js
@@ -0,0 +1,45 @@
+import React from 'react';
+import ImmutablePropTypes from 'react-immutable-proptypes';
+import { Card } from './UI';
+import { statusDescriptions } from '../constants/publishModes';
+
+export default class UnpublishedListing extends React.Component {
+ renderColumn(entries) {
+ if (!entries) return;
+ return (
+
+ {entries.map(entry => {
+ return {entry.getIn(['data', 'title'])}
;
+ }
+ )}
+
+ );
+ }
+
+ render() {
+ const { entries } = this.props;
+ const columns = entries.entrySeq().map(([key, currEntries]) => (
+
+
{statusDescriptions.get(key)}
+ {this.renderColumn(currEntries)}
+
+ ));
+
+ return (
+
+ {columns}
+
+ );
+ }
+}
+
+UnpublishedListing.propTypes = {
+ entries: ImmutablePropTypes.map,
+};
+
+
+
+
+
Drafts
+ Cool Recipe
+
diff --git a/src/containers/EditorialWorkflowHoC.js b/src/containers/EditorialWorkflowHoC.js
index 3c626d85..a7ffcc74 100644
--- a/src/containers/EditorialWorkflowHoC.js
+++ b/src/containers/EditorialWorkflowHoC.js
@@ -1,9 +1,12 @@
import React, { PropTypes } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
+import { Map } from 'immutable';
import { init, loadUnpublishedEntries } from '../actions/editorialWorkflow';
import { selectUnpublishedEntries } from '../reducers';
-import { EDITORIAL_WORKFLOW } from '../constants/publishModes';
+import { EDITORIAL_WORKFLOW, status } from '../constants/publishModes';
+import UnpublishedListing from '../components/UnpublishedListing';
import { connect } from 'react-redux';
+import _ from 'lodash';
export default function EditorialWorkflow(WrappedComponent) {
class EditorialWorkflow extends WrappedComponent {
@@ -18,12 +21,12 @@ export default function EditorialWorkflow(WrappedComponent) {
}
render() {
- const { isEditorialWorkflow } = this.props;
+ const { isEditorialWorkflow, unpublishedEntries } = this.props;
if (!isEditorialWorkflow) return super.render();
return (
-
HOC
+
{super.render()}
);
@@ -33,7 +36,7 @@ export default function EditorialWorkflow(WrappedComponent) {
EditorialWorkflow.propTypes = {
dispatch: PropTypes.func.isRequired,
isEditorialWorkflow: PropTypes.bool.isRequired,
- unpublishedEntries: ImmutablePropTypes.list,
+ unpublishedEntries: ImmutablePropTypes.map,
};
function mapStateToProps(state) {
@@ -42,7 +45,9 @@ export default function EditorialWorkflow(WrappedComponent) {
const returnObj = { isEditorialWorkflow };
if (isEditorialWorkflow) {
- returnObj.unpublishedEntries = selectUnpublishedEntries(state, 'draft');
+ returnObj.unpublishedEntries = _.reduce(status, (acc, currStatus) => {
+ return acc.set(currStatus, selectUnpublishedEntries(state, currStatus));
+ }, Map());
}
return returnObj;
diff --git a/src/reducers/editorialWorkflow.js b/src/reducers/editorialWorkflow.js
index 10307bfd..95cf9e28 100644
--- a/src/reducers/editorialWorkflow.js
+++ b/src/reducers/editorialWorkflow.js
@@ -28,13 +28,22 @@ const unpublishedEntries = (state = null, action) => {
};
export const selectUnpublishedEntry = (state, status, slug) => (
- state.getIn(['entities', `${status}.${slug}`], null)
+ state.getIn(['entities', `${status}.${slug}`])
);
export const selectUnpublishedEntries = (state, status) => {
if (!state) return;
const slugs = state.getIn(['pages', 'ids']);
- return slugs && slugs.map((slug) => selectUnpublishedEntry(state, status, slug));
+
+ return slugs && slugs.reduce((acc, slug) => {
+ const entry = selectUnpublishedEntry(state, status, slug);
+ if (entry) {
+ return acc.push(entry);
+ } else {
+ return acc;
+ }
+ }, List());
};
+
export default unpublishedEntries;