diff --git a/src/components/ChallengeEditor/LastSaved-Display/index.js b/src/components/ChallengeEditor/LastSaved-Display/index.js index e3bb47b0..e654a731 100644 --- a/src/components/ChallengeEditor/LastSaved-Display/index.js +++ b/src/components/ChallengeEditor/LastSaved-Display/index.js @@ -10,6 +10,6 @@ const LastSavedDisplay = ({ timeLastSaved }) => LastSavedDisplay.propTypes = { - timeLastSaved: PropTypes.string.isRequired + timeLastSaved: PropTypes.string } export default LastSavedDisplay diff --git a/src/components/Track/index.js b/src/components/Track/index.js index 999106e2..b9127b49 100644 --- a/src/components/Track/index.js +++ b/src/components/Track/index.js @@ -25,7 +25,7 @@ Track.defaultProps = { } Track.propTypes = { - type: PropTypes.object.isRequired, + type: PropTypes.object, isActive: PropTypes.bool, disabled: PropTypes.bool, onUpdateOthers: PropTypes.func.isRequired diff --git a/src/containers/ChallengeEditor/index.js b/src/containers/ChallengeEditor/index.js index 5d4ee1df..f000a2c6 100644 --- a/src/containers/ChallengeEditor/index.js +++ b/src/containers/ChallengeEditor/index.js @@ -34,6 +34,11 @@ import { connect } from 'react-redux' import { SUBMITTER_ROLE_UUID } from '../../config/constants' class ChallengeEditor extends Component { + constructor (props) { + super(props) + const mountedWithCreatePage = props.match.path.endsWith('/new') + this.state = { mountedWithCreatePage } + } componentDidMount () { const { match, @@ -144,6 +149,7 @@ class ChallengeEditor extends Component { replaceResourceInRole // members } = this.props + const { mountedWithCreatePage } = this.state if (isProjectLoading || isLoading) return const challengeId = _.get(match.params, 'challengeId', null) if (challengeId && (!challengeDetails || !challengeDetails.id)) { @@ -157,7 +163,8 @@ class ChallengeEditor extends Component { handle: submitters[0].memberHandle } } - const enableEdit = true // this.isEditable() + const enableEdit = this.isEditable() + const isCreatePage = this.props.match.path.endsWith('/new') return
)) } /> - { !enableEdit &&
You don't have access to edit the challenge
} - { enableEdit && You don't have access to edit the challenge
} + { (mountedWithCreatePage || enableEdit) && ((