diff --git a/src/course-home/data/__snapshots__/redux.test.js.snap b/src/course-home/data/__snapshots__/redux.test.js.snap index e6f2743fd5..3f405909ea 100644 --- a/src/course-home/data/__snapshots__/redux.test.js.snap +++ b/src/course-home/data/__snapshots__/redux.test.js.snap @@ -516,6 +516,7 @@ Object { "effortTime": 15, "icon": null, "id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@bcdabcdabcdabcdabcdabcdabcdabcd1", + "navigationDisabled": undefined, "sectionId": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@bcdabcdabcdabcdabcdabcdabcdabcd2", "showLink": true, "title": "Title of Sequence", diff --git a/src/course-home/data/api.js b/src/course-home/data/api.js index 963bdefc76..f733c571e7 100644 --- a/src/course-home/data/api.js +++ b/src/course-home/data/api.js @@ -152,6 +152,7 @@ export function normalizeOutlineBlocks(courseId, blocks) { // link in the outline (even though we ignore the given url and use an internal to ourselves). showLink: !!block.lms_web_url, title: block.display_name, + navigationDisabled: block.navigation_disabled, }; break; diff --git a/src/courseware/course/Course.jsx b/src/courseware/course/Course.jsx index abacc8bad6..a2ceb92201 100644 --- a/src/courseware/course/Course.jsx +++ b/src/courseware/course/Course.jsx @@ -37,6 +37,7 @@ const Course = ({ const sequence = useModel('sequences', sequenceId); const section = useModel('sections', sequence ? sequence.sectionId : null); const enableNewSidebar = getConfig().ENABLE_NEW_SIDEBAR; + const navigationDisabled = sequence?.navigationDisabled ?? false; const pageTitleBreadCrumbs = [ sequence, @@ -75,13 +76,17 @@ const Course = ({ {`${pageTitleBreadCrumbs.join(' | ')} | ${getConfig().SITE_NAME}`}
- + {!navigationDisabled && ( + <> + + + )} {shouldDisplayTriggers && ( <> { ); }); + it('removes breadcrumbs when navigation is disabled', async () => { + const sequenceBlocks = [Factory.build( + 'block', + { type: 'sequential', children: [] }, + { courseId: mockData.courseId }, + )]; + const sequenceMetadata = [Factory.build( + 'sequenceMetadata', + { navigation_disabled: true }, + { courseId: mockData.courseId, sequenceBlock: sequenceBlocks[0] }, + )]; + const testStore = await initializeTestStore({ sequenceBlocks, sequenceMetadata }, false); + const testData = { + ...mockData, + sequenceId: sequenceBlocks[0].id, + onNavigate: jest.fn(), + }; + render(, { store: testStore, wrapWithRouter: true }); + expect(screen.queryByRole('navigation', { name: 'breadcrumb' })).not.toBeInTheDocument(); + }); + it('displays first section celebration modal', async () => { const courseHomeMetadata = Factory.build('courseHomeMetadata', { celebrations: { firstSection: true } }); const testStore = await initializeTestStore({ courseHomeMetadata }, false); diff --git a/src/courseware/course/sequence/sequence-navigation/SequenceNavigation.jsx b/src/courseware/course/sequence/sequence-navigation/SequenceNavigation.jsx index df45753bc3..647b57943f 100644 --- a/src/courseware/course/sequence/sequence-navigation/SequenceNavigation.jsx +++ b/src/courseware/course/sequence/sequence-navigation/SequenceNavigation.jsx @@ -32,7 +32,12 @@ const SequenceNavigation = ({ }) => { const sequence = useModel('sequences', sequenceId); const { - isFirstUnit, isLastUnit, nextLink, previousLink, + isFirstUnit, + isLastUnit, + nextLink, + previousLink, + navigationDisabledPrevSequence, + navigationDisabledNextSequence, } = useSequenceNavigationMetadata(sequenceId, unitId); const { courseId, @@ -68,8 +73,7 @@ const SequenceNavigation = ({ const renderPreviousButton = () => { const disabled = isFirstUnit; const prevArrow = isRtl(getLocale()) ? ChevronRight : ChevronLeft; - - return ( + return !navigationDisabledPrevSequence && (