Re-enable the celebration modal (#123)

It got accidentally disabled during a refactor.

Also, try a little harder to make sure it doesn't re-appear during
the same browsing session.
This commit is contained in:
Michael Terry
2020-07-24 13:02:50 -04:00
committed by GitHub
parent 175675da55
commit 5ac49610da
3 changed files with 32 additions and 4 deletions

View File

@@ -17,6 +17,7 @@ import {
import { TabPage } from '../tab-page';
import Course from './course';
import { handleNextSectionCelebration } from './course/celebration';
const checkExamRedirect = memoize((sequenceStatus, sequence) => {
if (sequenceStatus === 'loaded') {
@@ -125,15 +126,28 @@ class CoursewareContainer extends Component {
}
handleNextSequenceClick = () => {
const { nextSequence, courseId } = this.props;
const {
course,
courseId,
nextSequence,
sequence,
sequenceId,
} = this.props;
if (nextSequence !== null) {
let nextUnitId = null;
if (nextSequence.unitIds.length > 0) {
const nextUnitId = nextSequence.unitIds[0];
[nextUnitId] = nextSequence.unitIds;
history.push(`/course/${courseId}/${nextSequence.id}/${nextUnitId}`);
} else {
// Some sequences have no units. This will show a blank page with prev/next buttons.
history.push(`/course/${courseId}/${nextSequence.id}`);
}
const celebrateFirstSection = course && course.celebrations && course.celebrations.firstSection;
if (celebrateFirstSection && sequence.sectionId !== nextSequence.sectionId) {
handleNextSectionCelebration(sequenceId, nextSequence.id, nextUnitId);
}
}
}