Skip to content
Snippets Groups Projects
Commit 758dd05f authored by Anca Ursachi's avatar Anca Ursachi
Browse files

refactor(submissionWizard): Move edit conditions in withProps.

parent 2ae10531
No related branches found
No related tags found
3 merge requests!222Sprint #26,!221Sprint #26 Update,!218fix(submissionWizard): Admin should not be able to edit manuscript via link in…
This commit is part of merge request !218. Comments created here will be created in the context of that merge request.
...@@ -50,8 +50,8 @@ import { onChange, onSubmit, setInitialValues, validate } from './utils' ...@@ -50,8 +50,8 @@ import { onChange, onSubmit, setInitialValues, validate } from './utils'
// #region wizard // #region wizard
const Wizard = ({ const Wizard = ({
step, step,
status,
history, history,
canEdit,
journal, journal,
prevStep, prevStep,
isEditMode, isEditMode,
...@@ -59,13 +59,12 @@ const Wizard = ({ ...@@ -59,13 +59,12 @@ const Wizard = ({
isFirstStep, isFirstStep,
handleSubmit, handleSubmit,
getButtonText, getButtonText,
isLastFragment,
isFilesFetching, isFilesFetching,
isAuthorsFetching, isAuthorsFetching,
journal: { manuscriptTypes = [] }, journal: { manuscriptTypes = [] },
...rest ...rest
}) => }) =>
isLastFragment && !(status === 'accepted' || status === 'rejected') ? ( canEdit ? (
<Root className="wizard-root"> <Root className="wizard-root">
<Steps currentStep={step}> <Steps currentStep={step}>
{wizardSteps.map(({ stepTitle }) => ( {wizardSteps.map(({ stepTitle }) => (
...@@ -193,6 +192,10 @@ export default compose( ...@@ -193,6 +192,10 @@ export default compose(
status: get(collection, 'status', ''), status: get(collection, 'status', ''),
}), }),
), ),
withProps(({ status, isLastFragment }) => ({
canEdit:
isLastFragment && !(status === 'accepted' || status === 'rejected'),
})),
withHandlers({ withHandlers({
getButtonText: ({ isLastStep, isEditMode }) => () => { getButtonText: ({ isLastStep, isEditMode }) => () => {
if (isEditMode && isLastStep) { if (isEditMode && isLastStep) {
......
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