Skip to content
Snippets Groups Projects
Commit 4ea2cddf authored by Giannis Kopanas's avatar Giannis Kopanas
Browse files

fix(components): review page layout

parent 4385b58a
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@ import {
selectCurrentUser,
selectCollection,
selectFragments,
selectCurrentVersion,
selectLastSubmittedVersion,
selectFragment,
selectUser,
getReviewerFromUser,
......@@ -86,7 +86,7 @@ export default compose(
const project = selectCollection(state, match.params.project)
const versions = selectFragments(state, project.fragments)
const version = selectFragment(state, match.params.version)
const currentVersion = selectCurrentVersion(state, project)
const lastSubmitted = selectLastSubmittedVersion(state, project)[0]
let handlingEditors
const editors = state.teams.find(
......@@ -99,10 +99,10 @@ export default compose(
if (editors) {
handlingEditors = editors.members.map(id => selectUser(state, id))
}
const reviewer = getReviewerFromUser(project, currentVersion, currentUser)
const reviewer = getReviewerFromUser(project, lastSubmitted, currentUser)
return {
currentVersion,
lastSubmitted,
handlingEditors,
project,
reviewer,
......
......@@ -13,7 +13,7 @@ import Tabs from '../atoms/Tabs'
const ReviewLayout = ({
project,
versions,
currentVersion,
lastSubmitted,
handlingEditors,
reviewer,
valid,
......@@ -25,6 +25,7 @@ const ReviewLayout = ({
versions.forEach(version => {
let review
console.log(version.reviewers,reviewer)
if (version.reviewers) {
review = version.reviewers.find(
review => review.reviewer === reviewer._reviewer.id,
......@@ -67,13 +68,13 @@ const ReviewLayout = ({
}
}, [])
const review = currentVersion.reviewers.find(
const review = lastSubmitted.reviewers.find(
review => review.id === reviewer.id,
)
if (currentVersion.submitted && (!review || !review.submitted)) {
if (lastSubmitted.submitted && (!review || !review.submitted)) {
const submittedMoment = moment()
const key = currentVersion.id
const key = lastSubmitted.id
const label = submittedMoment.format('YYYY-MM-DD')
reviewSections.push({
......@@ -81,7 +82,7 @@ const ReviewLayout = ({
<div>
<ReviewMetadata
handlingEditors={handlingEditors}
version={currentVersion}
version={lastSubmitted}
/>
<ReviewForm
handleSubmit={handleSubmit}
......@@ -98,7 +99,7 @@ const ReviewLayout = ({
editorSections.push({
content: (
<SimpleEditor
content={currentVersion.source}
content={lastSubmitted.source}
editing="selection"
key={key}
layout="bare"
......
......@@ -13,9 +13,7 @@ export const newestDecidedFirst = items =>
)
export const newestSubmittedFirst = items =>
orderBy(
filter(items, data => data.subbmitted === undefined, ['created'], ['desc']),
)
orderBy(filter(items, data => !!data.submitted), ['submitted'], ['desc'])
export const selectCurrentUser = state =>
state.currentUser.isAuthenticated ? state.currentUser.user : null
......
......@@ -55,6 +55,7 @@ const Submit = ({
<CurrentVersion
{...formProps}
project={project}
readonly={false}
version={currentVersion}
/>
),
......
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