Commit 0b2a4c2e authored by Alexandros Georgantas's avatar Alexandros Georgantas

Merge branch 'first-sprint' into 'master'

First sprint

See merge request !1
parents f464520c e2d55bca
{
"name": "pubsweet-component-bookbuilder",
"version": "1.1.0",
"name": "pubsweet-component-bookbuilder-booksprints",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
......
......@@ -29,12 +29,7 @@ class Chapter extends React.PureComponent {
}
update(patch) {
const { book, update, chapter } = this.props
// SHOULD BE REMOVED. This automaticaly sets track changes on for the case
// or review in progress
if (patch.progress.review === 0 && chapter.trackChanges === false) {
patch.trackChanges = true
}
const { book, update } = this.props
update(book, patch)
}
......@@ -293,7 +288,7 @@ Chapter.defaultProps = {
export { Chapter as UnwrappedChapter }
// const comparison = (nextProps, props) => {
// return nextProps.chapter.id === props.chapter.id && nextProps.chapter.index === props.chapter.index
// return nextProps.chapter.id === props.chapter.id && nextProps.chapter.index === props.chapter.index
// }
// combine them, as each chapter can be both a source and a target
......
......@@ -36,131 +36,14 @@ class ChapterSecondRow extends React.Component {
updateStateList(name, index) {
const { chapter, update } = this.props
if (name === 'file_prep' && (index === -1 || index === 0)) {
if (chapter.progress.edit === 0 || chapter.progress.clean_up === 0) {
this.setState({
nextProgressValues: {
type: name,
value: index,
},
modalType: 'cp-no',
showModal: true,
})
} else if (chapter.progress.review === 0) {
this.setState({
nextProgressValues: {
type: name,
value: index,
},
modalType: 'author-no',
showModal: true,
})
} else {
this.setState({
nextProgressValues: {
type: name,
value: index,
},
modalType: 'cp-no-author-no',
showModal: true,
})
}
} else if (name === 'file_prep' && index === 1) {
this.setState({
nextProgressValues: {
type: name,
value: index,
},
modalType: 'cp-yes',
showModal: true,
})
} else if (name === 'edit') {
if (index === 1) {
this.setState({
nextProgressValues: {
type: name,
value: index,
},
modalType: 'cp-no-author-yes',
showModal: true,
})
} else if (index === 0) {
if (chapter.progress.review === 0) {
this.setState({
nextProgressValues: {
type: name,
value: index,
},
modalType: 'cp-yes-author-no',
showModal: true,
})
} else {
this.setState({
nextProgressValues: {
type: name,
value: index,
},
modalType: 'cp-yes',
showModal: true,
})
}
} else if (chapter.progress.review === 0) {
this.setState({
nextProgressValues: {
type: name,
value: index,
},
modalType: 'cp-no-author-no',
showModal: true,
})
} else {
this.setState({
nextProgressValues: {
type: name,
value: index,
},
modalType: 'cp-no',
showModal: true,
})
}
} else if (name === 'review') {
if (index === 0) {
this.setState({
nextProgressValues: {
type: name,
value: index,
},
modalType: 'cp-no-author-yes',
showModal: true,
})
} else if (index === 1) {
this.setState({
nextProgressValues: {
type: name,
value: index,
},
modalType: 'cp-yes-author-no',
showModal: true,
})
} else {
this.setState({
nextProgressValues: {
type: name,
value: index,
},
modalType: 'cp-yes-author-no',
showModal: true,
})
}
} else if (name === 'clean_up') {
if (name === 'clean_up') {
if (index === 0) {
this.setState({
nextProgressValues: {
type: name,
value: index,
},
modalType: 'cp-yes',
modalType: 'author-no',
showModal: true,
})
} else if (index === 1) {
......@@ -169,30 +52,19 @@ class ChapterSecondRow extends React.Component {
type: name,
value: index,
},
modalType: 'cp-no',
showModal: true,
})
} else {
this.setState({
nextProgressValues: {
type: name,
value: index,
},
modalType: 'cp-no-author-yes',
modalType: 'author-yes',
showModal: true,
})
}
} else if (name === 'page_check' && index === -1) {
// if (index === -1) {
} else if (name === 'review' && index === 1) {
this.setState({
nextProgressValues: {
type: name,
value: index,
},
modalType: 'cp-yes',
modalType: 'author-no',
showModal: true,
})
// }
} else {
const patch = {
id: chapter.id,
......@@ -351,12 +223,14 @@ class ChapterSecondRow extends React.Component {
update={update}
/>
</Authorize>
<StateList
bookId={chapter.book}
currentValues={chapter.progress}
update={this.updateStateList}
values={this.progressValues}
/>
<Authorize object={chapter} operation="can view stateList">
<StateList
bookId={chapter.book}
currentValues={chapter.progress}
update={this.updateStateList}
values={this.progressValues}
/>
</Authorize>
<Authorize object={chapter} operation="can view alignmentTool">
<AlignmentTool
data={alignmentOptions}
......
......@@ -31,7 +31,8 @@ $black: #000;
font-family: 'Fira Sans Condensed';
font-size: 16px;
font-style: normal;
left: 10px;
// left: 10px;
margin: 0 10px;
position: relative;
text-transform: uppercase;
}
\ No newline at end of file
......@@ -31,7 +31,8 @@ $black: #000;
font-family: 'Fira Sans Condensed';
font-size: 16px;
font-style: normal;
left: 10px;
// left: 10px;
margin: 0 10px;
position: relative;
text-transform: uppercase;
}
......@@ -118,15 +118,16 @@ $upload-multiple: #b1b1b1;
.btnContainerButtons {
display: flex;
flex-direction: row;
justify-content: space-between;
min-width: 487px;
// flex-direction: row;
// justify-content: space-between;
// min-width: 487px;
}
.lineUploading {
border-top: 2px solid $line-grey;
margin-right: 10px;
width: 100%;
// width: 100%;
flex-grow: 1;
}
.multipleUploadContainer {
......@@ -157,7 +158,8 @@ $upload-multiple: #b1b1b1;
font-family: 'Fira Sans Condensed';
font-size: 16px;
font-style: normal;
left: 10px;
// left: 10px;
margin: 0 10px;
position: relative;
text-transform: uppercase;
}
......
{
"name": "pubsweet-component-editoria-dashboard",
"version": "0.1.1",
"name": "pubsweet-component-editoria-dashboard-booksprints",
"version": "1.0.0",
"description": "The application dashboard for the Editoria project.",
"main": "index.js",
"scripts": {
......
......@@ -161,19 +161,31 @@ export class Dashboard extends React.Component {
isProductionEditor(userId) {
const { teams, user } = this.props
if (!user.admin) {
const productionEditorTeams = filter(teams, {
const productionEditorGlobal = filter(teams, {
teamType: 'productionEditor',
global: true,
})
const membership = productionEditorTeams.map(team =>
const productionEditorMembership = productionEditorGlobal.map(team =>
team.members.includes(userId),
)
return membership.includes(true)
return productionEditorMembership.includes(true)
}
return false
}
isGloablAuthorEditor(userId) {
const { teams, user } = this.props
if (!user.admin) {
const authorGlobal = filter(teams, {
teamType: 'author',
global: true,
})
const authorMembership = authorGlobal.map(team =>
team.members.includes(userId),
)
return authorMembership.includes(true)
}
return false
}
/*
Create the teams found in the config file for the given book.
This should run either when a new book is created,
......@@ -195,6 +207,9 @@ export class Dashboard extends React.Component {
) {
members.push(user.id)
}
if (this.isGloablAuthorEditor(user.id) && teamType === 'author') {
members.push(user.id)
}
}
const newTeam = {
members,
......@@ -346,4 +361,7 @@ function mapDispatchToProps(dispatch) {
}
}
export default connect(mapStateToProps, mapDispatchToProps)(Dashboard)
export default connect(
mapStateToProps,
mapDispatchToProps,
)(Dashboard)
......@@ -16,8 +16,8 @@ import Wax from 'pubsweet-component-wax/src/WaxPubsweet'
import WithConfig from 'pubsweet-component-wax/src/WithConfig'
// Editoria
import BookBuilder from 'pubsweet-component-bookbuilder/src/BookBuilder'
import Dashboard from 'pubsweet-component-editoria-dashboard/src/Dashboard'
import BookBuilder from 'pubsweet-component-bookbuilder-booksprints/src/BookBuilder'
import Dashboard from 'pubsweet-component-editoria-dashboard-booksprints/src/Dashboard'
import Manage from 'pubsweet-component-manage/Manage'
import Navigation from './components/Navigation/Navigation'
import PrivateRoute from './components/PrivateRoute'
......
{
"name": "Editoria",
"name": "Editoria_BookSprints",
"description": "An application for managing book production flows",
"private": true,
"keywords": [
......@@ -13,7 +13,7 @@
],
"repository": {
"type": "git",
"url": "https://gitlab.coko.foundation/editoria/editoria"
"url": "https://gitlab.coko.foundation/editoria/booksprints"
},
"homepage": "https://editoria.pub/",
"license": "MIT",
......@@ -32,8 +32,9 @@
"prop-types": "^15.6.0",
"pubsweet": "^2.2.8",
"pubsweet-client": "^2.5.5",
"pubsweet-component-bookbuilder": "^1.1.0",
"pubsweet-component-editoria-dashboard": "^0.1.1",
"pubsweet-component-bookbuilder-booksprints": "^1.0.0",
"pubsweet-component-booksprints-globalteams": "^0.1.0",
"pubsweet-component-editoria-dashboard-booksprints": "^1.0.0",
"pubsweet-component-epub": "^0.3.1",
"pubsweet-component-epub-frontend": "^0.1.3",
"pubsweet-component-ink-backend": "^0.1.1",
......@@ -48,8 +49,8 @@
"pubsweet-component-theme-editoria": "^0.0.4",
"pubsweet-component-users-manager": "1.0.0",
"pubsweet-component-vivliostyle-viewer": "^1.0.0",
"pubsweet-component-wax": "^0.6.7",
"pubsweet-editoria-authsome": "^1.0.1",
"pubsweet-component-wax": "^0.6.10",
"pubsweet-editoria-booksprints-authsome": "^1.0.0",
"pubsweet-server": "^7.2.0",
"pubsweet-theme-plugin": "^0.0.3",
"react": "^16.2.0",
......
This diff is collapsed.
......@@ -18,15 +18,15 @@
"editoria-common": "^0.1.1",
"font-awesome": "4.7.0",
"formik": "^0.11.11",
"styled-components": "^3.3.0",
"lodash": "4.17.4",
"pubsweet-client": "^2.5.5",
"react-select": "^2.0.0",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-redux": "5.0.4",
"react-router-dom": "4.2.2",
"redux": "3.7.2"
"react-select": "^2.0.0",
"redux": "3.7.2",
"styled-components": "^3.3.0"
},
"devDependencies": {
"babel-core": "^6.26.0",
......
......@@ -62,6 +62,7 @@ const StyledSelect = styled(Select)`
const PageHeading = styled.h2`
margin: 0;
font-size: 36px;
padding: 0 calc(8px * 2);
`
......@@ -173,7 +174,7 @@ class GlobalTeamsManager extends Component {
return item.value
}),
}))
console.log('data', data)
const promises = data.map(team => updateTeam(team))
Promise.all(promises).then(res => {
......
import React, { Component } from 'react'
import Select from 'react-select'
import { sortBy, key } from 'lodash'
// import PropTypes from 'prop-types'
import { bindActionCreators } from 'redux'
// import Authorize from 'pubsweet-client/src/helpers/Authorize'
import { connect } from 'react-redux'
// TODO -- clean up this import
import Actions from 'pubsweet-client/src/actions'
// const options = [
// { value: 'chocolate', label: 'Chocolate' },
// { value: 'strawberry', label: 'Strawberry' },
// { value: 'vanilla', label: 'Vanilla' },
// ]
const TeamHeading = props => {
const { name, type } = props
return <label htmlFor={type}>{name}</label>
}
const TeamSection = props => {
const { name, setFieldValue, type, users, value } = props
// console.log(props)
const options = users
? users.map(user => ({
label: user.username,
value: user.id,
}))
: []
const selectValue = value.map(user => {
if (!user.label && !user.value)
return {
label: user.username,
value: user.id,
}
return user
})
const handleChange = newValue => {
// console.log('here: new val', newValue)
// setFieldValue(type, newValue)
}
return (
<div>
<TeamHeading name={name} type={type} />
<Select
id={type}
isMulti
onChange={this.handleChange}
options={options}
value={selectValue}
/>
</div>
)
}
const TeamManagerForm = props => {
const { setFieldValue, teams, users, values } = props
// console.log(props)
const handleUpdate = (e) => {
e.preventDefault()
console.log(e)
}
return (
<form>
{teams.map(team => (
<TeamSection
key={team.id}
name={team.name}
setFieldValue={setFieldValue}
type={team.teamType}
users={users}
value={values[team.teamType]}
/>
))}
<button onSubmit={handleUpdate} type="submit">
Save
</button>
</form>
)
}
class GlobalTeamsManager extends Component {
state = {
selectedOption: null,
ready: false,
}
componentWillMount() {
const { getUsers, getTeams } = this.props.actions
Promise.all([getUsers(), getTeams()]).then(values => {
this.setState({ ready: true })
})
}
componentDidMount() {}
handleChange = selectedOption => {
this.setState({ selectedOption })
console.log(`Option selected:`, selectedOption)
}
render() {
const { selectedOption, ready } = this.state
console.log('props', this.props)
const { users, teams } = this.props
// let options
if (!ready) return null
const infoMessage = 'Your teams have been successfully updated'
const initialValues = {}
let globalTeams = teams.filter(team => team.global)
globalTeams.forEach(team => {
initialValues[team.teamType] = team.members
})
globalTeams = sortBy(globalTeams, 'name')
return (
<div>
<h1>Global Teams</h1>
<TeamManagerForm teams={globalTeams} users={users} values={initialValues} />
</div>
)
}
}
GlobalTeamsManager.defaultProps = {
teams: null,
users: null,
}
function mapStateToProps(state, { match }) {
const { users, teams } = state
return {
users: users.users,
teams,
}
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators(Actions, dispatch),
}
}
export default connect(
mapStateToProps,
mapDispatchToProps,
)(GlobalTeamsManager)
......@@ -11056,9 +11056,9 @@ pubsweet-component-users-manager@1.0.0:
react-redux "^5.0.6"
redux "^3.7.2"
pubsweet-component-wax@^0.6.7:
version "0.6.7"
resolved "https://registry.yarnpkg.com/pubsweet-component-wax/-/pubsweet-component-wax-0.6.7.tgz#8b7348343324d4d8a69905cec9f5e0a9b14d7a32"
pubsweet-component-wax@^0.6.10:
version "0.6.10"
resolved "https://registry.yarnpkg.com/pubsweet-component-wax/-/pubsweet-component-wax-0.6.10.tgz#58328c670692f83ccd25890eb18f125486c066b9"
dependencies:
lodash "4.17.4"
pubsweet-client "^2.5.5"
......@@ -11066,13 +11066,7 @@ pubsweet-component-wax@^0.6.7:
react-dom "^16.2.0"
react-redux "5.0.4"
redux "3.6.0"
wax-editor-react "^0.2.5"
pubsweet-editoria-authsome@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/pubsweet-editoria-authsome/-/pubsweet-editoria-authsome-1.0.1.tgz#3b65574772809833873bbb6a15698b36c3ce415e"
dependencies:
authsome "^0.1.0"
wax-editor-react "^0.2.6"
pubsweet-server@^7.1.0, pubsweet-server@^7.2.0:
version "7.2.0"
......@@ -14767,24 +14761,24 @@ watchpack@^1.3.1, watchpack@^1.4.0:
graceful-fs "^4.1.2"
neo-async "^2.5.0"
wax-editor-core@^0.6.4:
version "0.6.4"
resolved "https://registry.yarnpkg.com/wax-editor-core/-/wax-editor-core-0.6.4.tgz#21ab96dbc2b5ce5e54d6fa27826f541f28883a0e"
wax-editor-core@^0.6.5:
version "0.6.5"
resolved "https://registry.yarnpkg.com/wax-editor-core/-/wax-editor-core-0.6.5.tgz#fae9e39840d2a84da7f4f694317b642e7905a461"
dependencies:
codemirror "^5.38.0"
font-awesome "^4.7.0"
lodash "^4.17.4"
substance "1.0.0-beta.6.5"
wax-editor-react@^0.2.5:
version "0.2.5"
resolved "https://registry.yarnpkg.com/wax-editor-react/-/wax-editor-react-0.2.5.tgz#c622c0558932c9dee2a94973f66752242d8b97d4"
wax-editor-react@^0.2.6:
version "0.2.6"
resolved "https://registry.yarnpkg.com/wax-editor-react/-/wax-editor-react-0.2.6.tgz#c499427e447d24ad29e9fbd78e2b1f35558cf2b3"
dependencies:
lodash "^4.17.4"
react "^16.2.0"
react-dom "^16.2.0"
react-router-dom "^4.2.2"
wax-editor-core "^0.6.4"
wax-editor-core "^0.6.5"
wbuf@^1.1.0, wbuf@^1.7.2:
version "1.7.3"
......
Markdown is supported
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