Skip to content

Commit 13e2ca4

Browse files
committed
fix issue 1334
1 parent a73b15b commit 13e2ca4

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/components/ChallengeEditor/index.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,16 +1239,8 @@ class ChallengeEditor extends Component {
12391239
* Check if current phase is active for edit
12401240
*/
12411241
isPhaseEditable (phaseIndex) {
1242-
const { challenge } = this.state
1243-
const { phases, currentPhaseNames } = challenge
1244-
1245-
let currentIndex = phases.findIndex((item) => {
1246-
return item.name !== 'Registration' && currentPhaseNames.includes(item.name) && item.isOpen
1247-
})
1248-
1249-
if (currentIndex === -1 || currentIndex > phaseIndex) return false
1250-
1251-
return true
1242+
const { phases } = this.state.challenge
1243+
return moment(phases[phaseIndex].scheduledEndDate).isAfter(moment())
12521244
}
12531245

12541246
render () {
@@ -1612,8 +1604,7 @@ class ChallengeEditor extends Component {
16121604
phase={phase}
16131605
phaseIndex={uuidv4()}
16141606
readOnly={false}
1615-
// isActive={this.isPhaseEditable(index)}
1616-
isActive
1607+
isActive={this.isPhaseEditable(index)}
16171608
onUpdatePhase={(item) => {
16181609
if ((item.startDate && !moment(item.startDate).isSame(phase.scheduledStartDate)) ||
16191610
(item.endDate && !moment(item.endDate).isSame(phase.scheduledEndDate))

0 commit comments

Comments
 (0)