Skip to content
Snippets Groups Projects
Commit 16eccfdc authored by Yannis Barlas's avatar Yannis Barlas
Browse files

prettier rest

parent 85dbf759
No related branches found
No related tags found
No related merge requests found
Showing
with 112 additions and 108 deletions
......@@ -4,9 +4,9 @@ import { withContext, getContext } from 'recompose'
export const JournalProvider = withContext(
{ journal: PropTypes.object },
({ journal }) => ({ journal })
({ journal }) => ({ journal }),
)(props => React.Children.only(props.children))
export const withJournal = getContext({
journal: PropTypes.object
journal: PropTypes.object,
})
......@@ -2,18 +2,16 @@ import { orderBy } from 'lodash'
export const newestFirst = items => orderBy(items, ['created'], ['desc'])
export const selectCurrentUser = state => state.currentUser.isAuthenticated
? state.currentUser.user
: null
export const selectCurrentUser = state =>
state.currentUser.isAuthenticated ? state.currentUser.user : null
// TODO: collections should be keyed by id
export const selectCollection = (state, id) => state.collections
.find(collection => collection.id === id)
export const selectCollection = (state, id) =>
state.collections.find(collection => collection.id === id)
// TODO: there shouldn't be any missing
export const selectFragments = (state, ids) => ids
.map(id => state.fragments[id])
.filter(fragment => fragment)
export const selectFragments = (state, ids) =>
ids.map(id => state.fragments[id]).filter(fragment => fragment)
export const selectFragment = (state, id) => state.fragments[id]
......@@ -25,13 +23,13 @@ export const getReviewerFromUser = (project, version, currentUser) => {
if (!project.reviewers || !version.reviewers) return null
const projectReviewer = project.reviewers.find(
reviewer => reviewer && reviewer.user === currentUser.id
reviewer => reviewer && reviewer.user === currentUser.id,
)
return version.reviewers.find(
reviewer => reviewer && reviewer.reviewer === projectReviewer.id
reviewer => reviewer && reviewer.reviewer === projectReviewer.id,
)
}
export const selectUser = (state, id) => state.users.users
.find(user => user.id === id)
export const selectUser = (state, id) =>
state.users.users.find(user => user.id === id)
......@@ -9,14 +9,10 @@ const StyleGuideRenderer = ({ title, children, toc }) => {
<h1 className={classes.title}>{title}</h1>
</header>
<nav className={classes.nav}>
{toc}
</nav>
<nav className={classes.nav}>{toc}</nav>
</div>
<div className={classes.content}>
{children}
</div>
<div className={classes.content}>{children}</div>
</div>
)
}
......
......@@ -11,21 +11,19 @@ import 'xpub-theme'
import classes from './Wrapper.local.scss'
const rootReducer = combineReducers({
form: formReducer
form: formReducer,
})
const store = createStore(
rootReducer,
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(),
)
const Wrapper = ({ children }) => (
<Provider store={store}>
<Router>
<JournalProvider journal={journal}>
<div className={classes.root}>
{children}
</div>
<div className={classes.root}>{children}</div>
</JournalProvider>
</Router>
</Provider>
......
module.exports = {
StyleGuideRenderer: require('./StyleGuideRenderer'),
Wrapper: require('./Wrapper')
Wrapper: require('./Wrapper'),
}
export default [
{
value: 'cognitive-psychology',
label: 'Cognitive Psychology'
label: 'Cognitive Psychology',
},
{
value: 'social-psychology',
label: 'Social Psychology'
label: 'Social Psychology',
},
{
value: 'personality-psychology',
label: 'Personality Psychology'
label: 'Personality Psychology',
},
{
value: 'developmental-psychology',
label: 'Developmental Psychology'
label: 'Developmental Psychology',
},
{
value: 'clinical-psychology',
label: 'Clinical Psychology'
label: 'Clinical Psychology',
},
{
value: 'organizational-behavior',
label: 'Organizational Behavior'
label: 'Organizational Behavior',
},
{
value: 'methodology',
label: 'Methodology and Research Practice'
label: 'Methodology and Research Practice',
},
]
export default [
{
value: 'original-research',
label: 'Original Research Report'
label: 'Original Research Report',
},
{
value: 'review',
label: 'Review'
label: 'Review',
},
{
value: 'opinion',
label: 'Opinion/Commentary'
label: 'Opinion/Commentary',
},
{
value: 'registered-report',
label: 'Registered Report'
label: 'Registered Report',
},
]
......@@ -2,21 +2,22 @@ export default {
accept: {
label: 'Accept',
color: 'green',
message: 'The submission has been accepted for publication'
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'
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'
message: 'The requested changes must be made before submission for review',
},
reject: {
label: 'Reject',
color: 'red',
message: 'The submission is not acceptable for publication'
message: 'The submission is not acceptable for publication',
},
}
......@@ -2,27 +2,27 @@ export default {
questions: [
{
id: 'openData',
legend: 'Data is open'
legend: 'Data is open',
},
{
id: 'previouslySubmitted',
legend: 'Previously submitted'
legend: 'Previously submitted',
},
{
id: 'openPeerReview',
legend: 'Open peer review'
legend: 'Open peer review',
},
{
id: 'streamlinedReview',
legend: 'Streamlined review'
legend: 'Streamlined review',
},
{
id: 'researchNexus',
legend: 'Submitted as part of the research nexus?'
legend: 'Submitted as part of the research nexus?',
},
{
id: 'preregistered',
legend: 'Pre-registered?'
}
]
legend: 'Pre-registered?',
},
],
}
......@@ -2,31 +2,31 @@ export default {
managingEditor: [
{
user: 1,
name: "Managing Editor One"
name: 'Managing Editor One',
},
{
user: 2,
name: "Managing Editor Two"
}
name: 'Managing Editor Two',
},
],
seniorEditor: [
{
user: 3,
name: "Senior Editor One"
name: 'Senior Editor One',
},
{
user: 4,
name: "Senior Editor Two"
}
name: 'Senior Editor Two',
},
],
handlingEditor: [
{
user: 5,
name: "Handling Editor One"
name: 'Handling Editor One',
},
{
user: 6,
name: "Handling Editor Two"
}
]
name: 'Handling Editor Two',
},
],
}
export default {
name: 'Example Journal',
issn: '1234-1234'
issn: '1234-1234',
}
......@@ -2,16 +2,16 @@ export default [
{
value: 'accept',
label: 'Accept',
color: 'green'
color: 'green',
},
{
value: 'revise',
label: 'Revise',
color: 'orange'
color: 'orange',
},
{
value: 'reject',
label: 'Reject',
color: 'red'
}
color: 'red',
},
]
export default [
{
id: 'submissions',
label: 'My Submissions'
}
label: 'My Submissions',
},
]
......@@ -11,14 +11,14 @@ module.exports = dir => {
/pubsweet-[^/]+\/src/,
/xpub-[^/]+\/src/,
/wax-[^/]+\/src/,
/@pubsweet\/[^/]+\/src/
/@pubsweet\/[^/]+\/src/,
]
return {
entry: './src/index.js',
output: {
filename: 'index.js',
path: path.join(dir, 'dist')
path: path.join(dir, 'dist'),
},
devtool: 'cheap-module-source-map',
watch: true,
......@@ -28,7 +28,7 @@ module.exports = dir => {
plugins: [
// mock constants
new webpack.DefinePlugin({
PUBSWEET_COMPONENTS: '[]'
PUBSWEET_COMPONENTS: '[]',
}),
],
module: {
......@@ -44,7 +44,7 @@ module.exports = dir => {
presets: [
[require('babel-preset-env'), { modules: false }],
require('babel-preset-react'),
require('babel-preset-stage-2')
require('babel-preset-stage-2'),
],
cacheDirectory: true,
},
......@@ -62,8 +62,8 @@ module.exports = dir => {
modules: true,
// sourceMap: true,
localIdentName: '[name]_[local]-[hash:base64:8]',
}
}
},
},
],
},
......@@ -80,19 +80,16 @@ module.exports = dir => {
importLoaders: 1,
// sourceMap: true,
localIdentName: '[name]_[local]-[hash:base64:8]',
}
},
},
'sass-loader'
'sass-loader',
],
},
// global CSS
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
use: ['style-loader', 'css-loader'],
},
// global SCSS
......@@ -107,8 +104,8 @@ module.exports = dir => {
// importLoaders: 1,
// }
// },
'sass-loader'
]
'sass-loader',
],
},
// Files
......@@ -117,11 +114,11 @@ module.exports = dir => {
loader: 'file-loader',
options: {
name: 'static/media/[name].[hash:8].[ext]',
}
}
]
}
]
}
},
},
],
},
],
},
}
}
......@@ -3,15 +3,11 @@ import Icon from './Icon'
import classes from './Attachment.local.scss'
const Attachment = ({ value }) => (
<a
download={value.name}
href={value.url}>
<a download={value.name} href={value.url}>
<span className={classes.icon}>
<Icon color="var(--color-primary)">paperclip</Icon>
</span>
<span className={classes.filename}>
{value.name}
</span>
<span className={classes.filename}>{value.name}</span>
</a>
)
......
......@@ -4,7 +4,9 @@ import classes from './Badge.local.scss'
const Badge = ({ count, label, plural }) => (
<span className={classes.root}>
<span className={classes.count}>{count}</span>
<span className={classes.label}>{plural && count !== 1 ? plural : label}</span>
<span className={classes.label}>
{plural && count !== 1 ? plural : label}
</span>
</span>
)
......
......@@ -2,16 +2,25 @@ import React from 'react'
import classnames from 'classnames'
import classes from './Button.local.scss'
const Button = ({ className, children, type = 'button', disabled, primary, onClick}) => (
const Button = ({
className,
children,
type = 'button',
disabled,
primary,
onClick,
}) => (
<button
className={classnames(className, classes.root, {
[classes.disabled]: disabled,
[classes.primary]: primary
[classes.primary]: primary,
})}
type={type}
disabled={disabled}
onClick={onClick}>{children}</button>
onClick={onClick}
>
{children}
</button>
)
export default Button
......@@ -2,10 +2,20 @@ import React from 'react'
import classnames from 'classnames'
import classes from './Checkbox.local.scss'
const Checkbox = ({ inline, name, value, label, checked, required, onChange }) => (
<label className={classnames(classes.root, {
[classes.inline]: inline
})}>
const Checkbox = ({
inline,
name,
value,
label,
checked,
required,
onChange,
}) => (
<label
className={classnames(classes.root, {
[classes.inline]: inline,
})}
>
<input
className={classes.input}
type="checkbox"
......@@ -13,7 +23,8 @@ const Checkbox = ({ inline, name, value, label, checked, required, onChange }) =
value={value}
checked={checked || false}
required={required}
onChange={onChange}/>
onChange={onChange}
/>
<span>{label}</span>
</label>
)
......
......@@ -6,9 +6,7 @@ const extension = ({ name }) => name.replace(/^.+\./, '')
const File = ({ value }) => (
<div className={classes.root}>
<div className={classes.icon}>
<div className={classes.extension}>
{extension(value)}
</div>
<div className={classes.extension}>{extension(value)}</div>
</div>
<div className={classes.name}>
......
......@@ -10,9 +10,7 @@ const Icon = ({ children, color = 'black', size = 24 }) => {
// select the icon
const icon = icons[name]
return (
<span className={classes.root}>{icon({ color, size })}</span>
)
return <span className={classes.root}>{icon({ color, size })}</span>
}
export default Icon
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment