From 7d99677acd747205535f681035dd66678e9f1457 Mon Sep 17 00:00:00 2001
From: Kristin Aoki <42981026+KristinAoki@users.noreply.github.com>
Date: Wed, 17 Jul 2024 23:05:43 -0400
Subject: [PATCH] feat: plugin slot to show non course content on next button
click (#1412)
---
src/courseware/course/sequence/Sequence.jsx | 10 +++-
.../SequenceNavigation.jsx | 58 +++++++++++++++----
2 files changed, 56 insertions(+), 12 deletions(-)
diff --git a/src/courseware/course/sequence/Sequence.jsx b/src/courseware/course/sequence/Sequence.jsx
index 686aea1764..9d7c0c4e7b 100644
--- a/src/courseware/course/sequence/Sequence.jsx
+++ b/src/courseware/course/sequence/Sequence.jsx
@@ -9,6 +9,7 @@ import {
import { useIntl } from '@edx/frontend-platform/i18n';
import { useSelector } from 'react-redux';
import SequenceExamWrapper from '@edx/frontend-lib-special-exams';
+import { useToggle } from '@openedx/paragon';
import PageLoading from '@src/generic/PageLoading';
import { useModel } from '@src/generic/model-store';
@@ -37,6 +38,7 @@ const Sequence = ({
previousSequenceHandler,
}) => {
const intl = useIntl();
+ const [isOpen, open, close] = useToggle();
const {
canAccessProctoredExams,
license,
@@ -51,7 +53,6 @@ const Sequence = ({
const sequenceStatus = useSelector(state => state.courseware.sequenceStatus);
const sequenceMightBeUnit = useSelector(state => state.courseware.sequenceMightBeUnit);
const { enableNavigationSidebar: isEnabledOutlineSidebar } = useSelector(getCoursewareOutlineSidebarSettings);
-
const handleNext = () => {
const nextIndex = sequence.unitIds.indexOf(unitId) + 1;
const newUnitId = sequence.unitIds[nextIndex];
@@ -185,6 +186,13 @@ const Sequence = ({
logEvent('edx.ui.lms.sequence.previous_selected', 'top');
handlePrevious();
}}
+ {...{
+ nextSequenceHandler,
+ handleNavigate,
+ isOpen,
+ open,
+ close,
+ }}
/>
)}
diff --git a/src/courseware/course/sequence/sequence-navigation/SequenceNavigation.jsx b/src/courseware/course/sequence/sequence-navigation/SequenceNavigation.jsx
index caa3f2b7c5..3b16312d62 100644
--- a/src/courseware/course/sequence/sequence-navigation/SequenceNavigation.jsx
+++ b/src/courseware/course/sequence/sequence-navigation/SequenceNavigation.jsx
@@ -10,8 +10,9 @@ import {
isRtl,
getLocale,
} from '@edx/frontend-platform/i18n';
-
+import { PluginSlot } from '@openedx/frontend-plugin-framework';
import { useSelector } from 'react-redux';
+
import { GetCourseExitNavigation } from '../../course-exit';
import UnitButton from './UnitButton';
import SequenceNavigationTabs from './SequenceNavigationTabs';
@@ -29,6 +30,11 @@ const SequenceNavigation = ({
onNavigate,
nextHandler,
previousHandler,
+ nextSequenceHandler,
+ handleNavigate,
+ isOpen,
+ open,
+ close,
}) => {
const sequence = useModel('sequences', sequenceId);
const {
@@ -95,17 +101,37 @@ const SequenceNavigation = ({
const nextArrow = isRtl(getLocale()) ? ChevronLeft : ChevronRight;
return navigationDisabledNextSequence || (
-
+
+
);
};
@@ -126,11 +152,21 @@ SequenceNavigation.propTypes = {
onNavigate: PropTypes.func.isRequired,
nextHandler: PropTypes.func.isRequired,
previousHandler: PropTypes.func.isRequired,
+ close: PropTypes.func,
+ open: PropTypes.func,
+ isOpen: PropTypes.bool,
+ handleNavigate: PropTypes.func,
+ nextSequenceHandler: PropTypes.func,
};
SequenceNavigation.defaultProps = {
className: null,
unitId: null,
+ close: null,
+ open: null,
+ isOpen: false,
+ handleNavigate: null,
+ nextSequenceHandler: null,
};
export default injectIntl(SequenceNavigation);