From 580265ee7de43c4d2a447088034f06b810b17bf7 Mon Sep 17 00:00:00 2001
From: Alf Eaton <eaton.alf@gmail.com>
Date: Wed, 6 Sep 2017 10:13:08 +0100
Subject: [PATCH] Add JournalProvider to styleguide wrapper

---
 src/components/Wrapper.js              | 10 +++++---
 src/config/journal/article-sections.js | 30 ++++++++++++++++++++++++
 src/config/journal/article-types.js    | 18 +++++++++++++++
 src/config/journal/decisions.js        | 22 ++++++++++++++++++
 src/config/journal/declarations.js     | 28 ++++++++++++++++++++++
 src/config/journal/editors.js          | 32 ++++++++++++++++++++++++++
 src/config/journal/index.js            |  8 +++++++
 src/config/journal/metadata.js         |  4 ++++
 src/config/journal/recommendations.js  | 14 +++++++++++
 src/config/journal/roles.js            |  6 +++++
 src/config/journal/sections.js         |  6 +++++
 11 files changed, 175 insertions(+), 3 deletions(-)
 create mode 100644 src/config/journal/article-sections.js
 create mode 100644 src/config/journal/article-types.js
 create mode 100644 src/config/journal/decisions.js
 create mode 100644 src/config/journal/declarations.js
 create mode 100644 src/config/journal/editors.js
 create mode 100644 src/config/journal/index.js
 create mode 100644 src/config/journal/metadata.js
 create mode 100644 src/config/journal/recommendations.js
 create mode 100644 src/config/journal/roles.js
 create mode 100644 src/config/journal/sections.js

diff --git a/src/components/Wrapper.js b/src/components/Wrapper.js
index 26be4c621..78e610542 100644
--- a/src/components/Wrapper.js
+++ b/src/components/Wrapper.js
@@ -2,6 +2,8 @@ import React from 'react'
 import { Provider } from 'react-redux'
 import { reducer as formReducer } from 'redux-form'
 import { createStore, combineReducers } from 'redux'
+import { JournalProvider } from 'pubsweet-component-xpub-app'
+import journal from '../config/journal'
 
 import 'xpub-fonts'
 import classes from './Wrapper.local.scss'
@@ -14,9 +16,11 @@ const store = createStore(rootReducer)
 
 const Wrapper = ({ children }) => (
   <Provider store={store}>
-    <div className={classes.root}>
-      {children}
-    </div>
+    <JournalProvider journal={journal}>
+      <div className={classes.root}>
+        {children}
+      </div>
+    </JournalProvider>
   </Provider>
 )
 
diff --git a/src/config/journal/article-sections.js b/src/config/journal/article-sections.js
new file mode 100644
index 000000000..3f797b098
--- /dev/null
+++ b/src/config/journal/article-sections.js
@@ -0,0 +1,30 @@
+export default [
+  {
+    value: 'cognitive-psychology',
+    label: 'Cognitive Psychology'
+  },
+  {
+    value: 'social-psychology',
+    label: 'Social Psychology'
+  },
+  {
+    value: 'personality-psychology',
+    label: 'Personality Psychology'
+  },
+  {
+    value: 'developmental-psychology',
+    label: 'Developmental Psychology'
+  },
+  {
+    value: 'clinical-psychology',
+    label: 'Clinical Psychology'
+  },
+  {
+    value: 'organizational-behavior',
+    label: 'Organizational Behavior'
+  },
+  {
+    value: 'methodology',
+    label: 'Methodology and Research Practice'
+  },
+]
diff --git a/src/config/journal/article-types.js b/src/config/journal/article-types.js
new file mode 100644
index 000000000..9a456260f
--- /dev/null
+++ b/src/config/journal/article-types.js
@@ -0,0 +1,18 @@
+export default [
+  {
+    value: 'original-research',
+    label: 'Original Research Report'
+  },
+  {
+    value: 'review',
+    label: 'Review'
+  },
+  {
+    value: 'opinion',
+    label: 'Opinion/Commentary'
+  },
+  {
+    value: 'registered-report',
+    label: 'Registered Report'
+  },
+]
diff --git a/src/config/journal/decisions.js b/src/config/journal/decisions.js
new file mode 100644
index 000000000..7b9e6dabf
--- /dev/null
+++ b/src/config/journal/decisions.js
@@ -0,0 +1,22 @@
+export default {
+  accept: {
+    label: 'Accept',
+    color: 'green',
+    message: 'The submission has been accepted for publication'
+  },
+  minor: {
+    label: 'Minor revisions',
+    color: 'orange',
+    message: 'The submission will be accepted for publication after minor changes'
+  },
+  major: {
+    label: 'Major revisions',
+    color: 'yellow',
+    message: 'The requested changes must be made before submission for review'
+  },
+  reject: {
+    label: 'Reject',
+    color: 'red',
+    message: 'The submission is not acceptable for publication'
+  },
+}
diff --git a/src/config/journal/declarations.js b/src/config/journal/declarations.js
new file mode 100644
index 000000000..803db14ed
--- /dev/null
+++ b/src/config/journal/declarations.js
@@ -0,0 +1,28 @@
+export default {
+  questions: [
+    {
+      id: 'openData',
+      legend: 'Data is open'
+    },
+    {
+      id: 'previouslySubmitted',
+      legend: 'Previously submitted'
+    },
+    {
+      id: 'openPeerReview',
+      legend: 'Open peer review'
+    },
+    {
+      id: 'streamlinedReview',
+      legend: 'Streamlined review'
+    },
+    {
+      id: 'researchNexus',
+      legend: 'Submitted as part of the research nexus?'
+    },
+    {
+      id: 'preregistered',
+      legend: 'Pre-registered?'
+    }
+  ]
+}
diff --git a/src/config/journal/editors.js b/src/config/journal/editors.js
new file mode 100644
index 000000000..a3af69f0b
--- /dev/null
+++ b/src/config/journal/editors.js
@@ -0,0 +1,32 @@
+export default {
+  managingEditor: [
+    {
+      user: 1,
+      name: "Managing Editor One"
+    },
+    {
+      user: 2,
+      name: "Managing Editor Two"
+    }
+  ],
+  seniorEditor: [
+    {
+      user: 3,
+      name: "Senior Editor One"
+    },
+    {
+      user: 4,
+      name: "Senior Editor Two"
+    }
+  ],
+  handlingEditor: [
+    {
+      user: 5,
+      name: "Handling Editor One"
+    },
+    {
+      user: 6,
+      name: "Handling Editor Two"
+    }
+  ]
+}
diff --git a/src/config/journal/index.js b/src/config/journal/index.js
new file mode 100644
index 000000000..89df1dc34
--- /dev/null
+++ b/src/config/journal/index.js
@@ -0,0 +1,8 @@
+export { default as metadata } from './metadata'
+export { default as declarations } from './declarations'
+export { default as decisions } from './decisions'
+export { default as recommendations } from './recommendations'
+export { default as sections } from './sections'
+export { default as articleSections } from './article-sections'
+export { default as articleTypes } from './article-types'
+export { default as editors } from './editors'
diff --git a/src/config/journal/metadata.js b/src/config/journal/metadata.js
new file mode 100644
index 000000000..db9d6d8e0
--- /dev/null
+++ b/src/config/journal/metadata.js
@@ -0,0 +1,4 @@
+export default {
+  name: 'Example Journal',
+  issn: '1234-1234'
+}
diff --git a/src/config/journal/recommendations.js b/src/config/journal/recommendations.js
new file mode 100644
index 000000000..d297f484d
--- /dev/null
+++ b/src/config/journal/recommendations.js
@@ -0,0 +1,14 @@
+export default [
+  {
+    value: 'accept',
+    label: 'Accept',
+  },
+  {
+    value: 'revise',
+    label: 'Revise',
+  },
+  {
+    value: 'reject',
+    label: 'Reject',
+  }
+]
diff --git a/src/config/journal/roles.js b/src/config/journal/roles.js
new file mode 100644
index 000000000..174203074
--- /dev/null
+++ b/src/config/journal/roles.js
@@ -0,0 +1,6 @@
+export default {
+  author: 'Author',
+  seniorEditor: 'Senior Editor',
+  managingEditor: 'Managing Editor',
+  handlingEditor: 'Handling Editor',
+}
diff --git a/src/config/journal/sections.js b/src/config/journal/sections.js
new file mode 100644
index 000000000..419171898
--- /dev/null
+++ b/src/config/journal/sections.js
@@ -0,0 +1,6 @@
+export default [
+  {
+    id: 'submissions',
+    label: 'My Submissions'
+  }
+]
-- 
GitLab