diff --git a/hypha/static_src/src/app/src/containers/DisplayPanel/index.js b/hypha/static_src/src/app/src/containers/DisplayPanel/index.js index bfa0d8fb7347f95e67a2377536d5dc59091955f0..259d3dc487fcb441b5aed62754c707f6f5c8f90c 100644 --- a/hypha/static_src/src/app/src/containers/DisplayPanel/index.js +++ b/hypha/static_src/src/app/src/containers/DisplayPanel/index.js @@ -15,7 +15,6 @@ import CurrentSubmissionDisplay from '@containers/CurrentSubmissionDisplay' import ReviewInformation from '@containers/ReviewInformation' import ScreeningOutcome from '@containers/ScreeningOutcome' import AddNoteForm from '@containers/AddNoteForm' -import EditNoteForm from '@containers/EditNoteForm' import NoteListing from '@containers/NoteListing' import StatusActions from '@containers/StatusActions' import Tabber, {Tab} from '@components/Tabber' @@ -69,10 +68,7 @@ const DisplayPanel = props => { </Tab>, <Tab button="Notes" key="note"> <NoteListing submissionID={submissionID} /> - {isEditing ? ( - <EditNoteForm submissionID={submissionID}/> - - ) : ( + {isEditing ? null : ( <AddNoteForm submissionID={submissionID} /> )} </Tab> diff --git a/hypha/static_src/src/app/src/containers/NoteListing.js b/hypha/static_src/src/app/src/containers/NoteListing.js index f6b9771bdaa6611434e19fadf578cdc7d0766ec7..56e723f0f6170083fa06c229ffe10654e015b2f2 100644 --- a/hypha/static_src/src/app/src/containers/NoteListing.js +++ b/hypha/static_src/src/app/src/containers/NoteListing.js @@ -14,6 +14,7 @@ import { getNotesFetchState, getDraftNoteForSubmission, } from '@selectors/notes'; +import EditNoteForm from "../containers/EditNoteForm"; const NoteListing = ({ loadNotes, submissionID, notes, isErrored, errorMessage, isLoading, editing, editNote }) => { @@ -49,17 +50,38 @@ const NoteListing = ({ loadNotes, submissionID, notes, isErrored, errorMessage, : null ) - return <NoteListingItem - author={note.user} - timestamp={date} - key={`note-${note.id}`} - message={note.message} - submissionID={submissionID} - disabled={!!editing} - editable={note.editable} - edited={edited} - handleEditNote={() => editNote(note.id, note.message, submissionID)} - />; + return editing ? ( + editing.id === note.id ? ( + <EditNoteForm submissionID={submissionID} /> + ) : ( + <NoteListingItem + author={note.user} + timestamp={date} + key={`note-${note.id}`} + message={note.message} + submissionID={submissionID} + disabled={!!editing} + editable={note.editable} + edited={edited} + handleEditNote={() => + editNote(note.id, note.message, submissionID) + } + /> + ) + ) : ( + <NoteListingItem + author={note.user} + timestamp={date} + key={`note-${note.id}`} + message={note.message} + submissionID={submissionID} + disabled={!!editing} + editable={note.editable} + edited={edited} + handleEditNote={() => editNote(note.id, note.message, submissionID)} + /> + ); + } return (