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

First sprint ready

parent f464520c
...@@ -29,12 +29,7 @@ class Chapter extends React.PureComponent { ...@@ -29,12 +29,7 @@ class Chapter extends React.PureComponent {
} }
update(patch) { update(patch) {
const { book, update, chapter } = this.props const { book, update } = 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
}
update(book, patch) update(book, patch)
} }
...@@ -293,7 +288,7 @@ Chapter.defaultProps = { ...@@ -293,7 +288,7 @@ Chapter.defaultProps = {
export { Chapter as UnwrappedChapter } export { Chapter as UnwrappedChapter }
// const comparison = (nextProps, props) => { // 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 // combine them, as each chapter can be both a source and a target
......
...@@ -36,131 +36,14 @@ class ChapterSecondRow extends React.Component { ...@@ -36,131 +36,14 @@ class ChapterSecondRow extends React.Component {
updateStateList(name, index) { updateStateList(name, index) {
const { chapter, update } = this.props const { chapter, update } = this.props
if (name === 'clean_up') {
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 (index === 0) { if (index === 0) {
this.setState({ this.setState({
nextProgressValues: { nextProgressValues: {
type: name, type: name,
value: index, value: index,
}, },
modalType: 'cp-yes', modalType: 'author-no',
showModal: true, showModal: true,
}) })
} else if (index === 1) { } else if (index === 1) {
...@@ -169,30 +52,19 @@ class ChapterSecondRow extends React.Component { ...@@ -169,30 +52,19 @@ class ChapterSecondRow extends React.Component {
type: name, type: name,
value: index, value: index,
}, },
modalType: 'cp-no', modalType: 'author-yes',
showModal: true,
})
} else {
this.setState({
nextProgressValues: {
type: name,
value: index,
},
modalType: 'cp-no-author-yes',
showModal: true, showModal: true,
}) })
} }
} else if (name === 'page_check' && index === -1) { } else if (name === 'review' && index === 1) {
// if (index === -1) {
this.setState({ this.setState({
nextProgressValues: { nextProgressValues: {
type: name, type: name,
value: index, value: index,
}, },
modalType: 'cp-yes', modalType: 'author-no',
showModal: true, showModal: true,
}) })
// }
} else { } else {
const patch = { const patch = {
id: chapter.id, id: chapter.id,
...@@ -351,12 +223,14 @@ class ChapterSecondRow extends React.Component { ...@@ -351,12 +223,14 @@ class ChapterSecondRow extends React.Component {
update={update} update={update}
/> />
</Authorize> </Authorize>
<StateList <Authorize object={chapter} operation="can view stateList">
bookId={chapter.book} <StateList
currentValues={chapter.progress} bookId={chapter.book}
update={this.updateStateList} currentValues={chapter.progress}
values={this.progressValues} update={this.updateStateList}
/> values={this.progressValues}
/>
</Authorize>
<Authorize object={chapter} operation="can view alignmentTool"> <Authorize object={chapter} operation="can view alignmentTool">
<AlignmentTool <AlignmentTool
data={alignmentOptions} data={alignmentOptions}
......
...@@ -31,7 +31,8 @@ $black: #000; ...@@ -31,7 +31,8 @@ $black: #000;
font-family: 'Fira Sans Condensed'; font-family: 'Fira Sans Condensed';
font-size: 16px; font-size: 16px;
font-style: normal; font-style: normal;
left: 10px; // left: 10px;
margin: 0 10px;
position: relative; position: relative;
text-transform: uppercase; text-transform: uppercase;
} }
\ No newline at end of file
...@@ -31,7 +31,8 @@ $black: #000; ...@@ -31,7 +31,8 @@ $black: #000;
font-family: 'Fira Sans Condensed'; font-family: 'Fira Sans Condensed';
font-size: 16px; font-size: 16px;
font-style: normal; font-style: normal;
left: 10px; // left: 10px;
margin: 0 10px;
position: relative; position: relative;
text-transform: uppercase; text-transform: uppercase;
} }
...@@ -118,15 +118,16 @@ $upload-multiple: #b1b1b1; ...@@ -118,15 +118,16 @@ $upload-multiple: #b1b1b1;
.btnContainerButtons { .btnContainerButtons {
display: flex; display: flex;
flex-direction: row; // flex-direction: row;
justify-content: space-between; // justify-content: space-between;
min-width: 487px; // min-width: 487px;
} }
.lineUploading { .lineUploading {
border-top: 2px solid $line-grey; border-top: 2px solid $line-grey;
margin-right: 10px; margin-right: 10px;
width: 100%; // width: 100%;
flex-grow: 1;
} }
.multipleUploadContainer { .multipleUploadContainer {
...@@ -157,7 +158,8 @@ $upload-multiple: #b1b1b1; ...@@ -157,7 +158,8 @@ $upload-multiple: #b1b1b1;
font-family: 'Fira Sans Condensed'; font-family: 'Fira Sans Condensed';
font-size: 16px; font-size: 16px;
font-style: normal; font-style: normal;
left: 10px; // left: 10px;
margin: 0 10px;
position: relative; position: relative;
text-transform: uppercase; text-transform: uppercase;
} }
......
...@@ -161,19 +161,31 @@ export class Dashboard extends React.Component { ...@@ -161,19 +161,31 @@ export class Dashboard extends React.Component {
isProductionEditor(userId) { isProductionEditor(userId) {
const { teams, user } = this.props const { teams, user } = this.props
if (!user.admin) { if (!user.admin) {
const productionEditorTeams = filter(teams, { const productionEditorGlobal = filter(teams, {
teamType: 'productionEditor', teamType: 'productionEditor',
global: true,
}) })
const productionEditorMembership = productionEditorGlobal.map(team =>
const membership = productionEditorTeams.map(team =>
team.members.includes(userId), team.members.includes(userId),
) )
return productionEditorMembership.includes(true)
return membership.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 return false
} }
/* /*
Create the teams found in the config file for the given book. Create the teams found in the config file for the given book.
This should run either when a new book is created, This should run either when a new book is created,
...@@ -195,6 +207,9 @@ export class Dashboard extends React.Component { ...@@ -195,6 +207,9 @@ export class Dashboard extends React.Component {
) { ) {
members.push(user.id) members.push(user.id)
} }
if (this.isGloablAuthorEditor(user.id) && teamType === 'author') {
members.push(user.id)
}
} }
const newTeam = { const newTeam = {
members, members,
...@@ -346,4 +361,7 @@ function mapDispatchToProps(dispatch) { ...@@ -346,4 +361,7 @@ function mapDispatchToProps(dispatch) {
} }
} }
export default connect(mapStateToProps, mapDispatchToProps)(Dashboard) export default connect(
mapStateToProps,
mapDispatchToProps,
)(Dashboard)
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
"pubsweet-component-theme-editoria": "^0.0.4", "pubsweet-component-theme-editoria": "^0.0.4",
"pubsweet-component-users-manager": "1.0.0", "pubsweet-component-users-manager": "1.0.0",
"pubsweet-component-vivliostyle-viewer": "^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-editoria-authsome": "^1.0.1",
"pubsweet-server": "^7.2.0", "pubsweet-server": "^7.2.0",
"pubsweet-theme-plugin": "^0.0.3", "pubsweet-theme-plugin": "^0.0.3",
......
This diff is collapsed.
...@@ -62,6 +62,7 @@ const StyledSelect = styled(Select)` ...@@ -62,6 +62,7 @@ const StyledSelect = styled(Select)`
const PageHeading = styled.h2` const PageHeading = styled.h2`
margin: 0; margin: 0;
font-size: 36px;
padding: 0 calc(8px * 2); 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