Commit 5798fddb authored by Alexandros Georgantas's avatar Alexandros Georgantas

First sprint ready

parent f464520c
......@@ -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;
}
......
......@@ -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)
......@@ -48,7 +48,7 @@
"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-component-wax": "^0.6.8",
"pubsweet-editoria-authsome": "^1.0.1",
"pubsweet-server": "^7.2.0",
"pubsweet-theme-plugin": "^0.0.3",
......
This diff is collapsed.
......@@ -62,6 +62,7 @@ const StyledSelect = styled(Select)`
const PageHeading = styled.h2`
margin: 0;
font-size: 36px;
padding: 0 calc(8px * 2);
`
......
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