11import { useState , useEffect , useCallback } from 'react' ;
22import { useIntl } from '@edx/frontend-platform/i18n' ;
3+ import { getConfig } from '@edx/frontend-platform' ;
34import {
45 Container ,
56 Layout ,
67 Row ,
78 TransitionReplace ,
89 Toast ,
910 StandardModal ,
11+ Button ,
12+ ActionRow ,
1013} from '@openedx/paragon' ;
1114import { Helmet } from 'react-helmet' ;
12- import { CheckCircle as CheckCircleIcon } from '@openedx/paragon/icons' ;
15+ import { CheckCircle as CheckCircleIcon , CloseFullscreen , OpenInFull } from '@openedx/paragon/icons' ;
1316import { useSelector } from 'react-redux' ;
1417import {
1518 arrayMove ,
@@ -44,7 +47,6 @@ import {
4447 getTimedExamsFlag ,
4548} from './data/selectors' ;
4649import { COURSE_BLOCK_NAMES } from './constants' ;
47- import StatusBar from './status-bar/StatusBar' ;
4850import EnableHighlightsModal from './enable-highlights-modal/EnableHighlightsModal' ;
4951import SectionCard from './section-card/SectionCard' ;
5052import SubsectionCard from './subsection-card/SubsectionCard' ;
@@ -61,9 +63,12 @@ import {
6163} from './drag-helper/utils' ;
6264import { useCourseOutline } from './hooks' ;
6365import messages from './messages' ;
66+ import headerMessages from './header-navigations/messages' ;
6467import { getTagsExportFile } from './data/api' ;
6568import OutlineAddChildButtons from './OutlineAddChildButtons' ;
6669import { SidebarProvider } from './common/context/SidebarContext' ;
70+ import { StatusBar } from './status-bar/StatusBar' ;
71+ import { LegacyStatusBar } from './status-bar/LegacyStatusBar' ;
6772
6873const CourseOutline = ( ) => {
6974 const intl = useIntl ( ) ;
@@ -142,6 +147,9 @@ const CourseOutline = () => {
142147 resetScrollState,
143148 } = useCourseOutline ( { courseId } ) ;
144149
150+ // Show the new actions bar if it is enabled in the configuration.
151+ // This is a temporary flag until the new design feature is fully implemented.
152+ const showNewActionsBar = getConfig ( ) . ENABLE_COURSE_OUTLINE_NEW_DESIGN ?. toString ( ) . toLowerCase ( ) === 'true' ;
145153 // Use `setToastMessage` to show the toast.
146154 const [ toastMessage , setToastMessage ] = useState < string | null > ( null ) ;
147155
@@ -315,8 +323,9 @@ const CourseOutline = () => {
315323 ) : null }
316324 </ TransitionReplace >
317325 < SubHeader
318- title = { intl . formatMessage ( messages . headingTitle ) }
326+ title = { courseName }
319327 subtitle = { intl . formatMessage ( messages . headingSubtitle ) }
328+ hideBorder
320329 headerActions = { (
321330 < CourseOutlineHeaderActionsSlot
322331 isReIndexShow = { isReIndexShow }
@@ -330,6 +339,23 @@ const CourseOutline = () => {
330339 />
331340 ) }
332341 />
342+ { showNewActionsBar
343+ ? (
344+ < StatusBar
345+ courseId = { courseId }
346+ isLoading = { isLoading }
347+ statusBarData = { statusBarData }
348+ />
349+ ) : (
350+ < LegacyStatusBar
351+ courseId = { courseId }
352+ isLoading = { isLoading }
353+ statusBarData = { statusBarData }
354+ openEnableHighlightsModal = { openEnableHighlightsModal }
355+ handleVideoSharingOptionChange = { handleVideoSharingOptionChange }
356+ />
357+ ) }
358+ < hr className = "mt-4 mb-0 w-100 text-light-400" />
333359 < Layout
334360 lg = { [ { span : 9 } , { span : 3 } ] }
335361 md = { [ { span : 9 } , { span : 3 } ] }
@@ -340,14 +366,24 @@ const CourseOutline = () => {
340366 < Layout . Element >
341367 < article >
342368 < div >
369+ { showNewActionsBar && (
370+ < ActionRow className = "mt-3" >
371+ { Boolean ( sectionsList . length ) && (
372+ < Button
373+ variant = "outline-primary"
374+ id = "expand-collapse-all-button"
375+ data-testid = "expand-collapse-all-button"
376+ iconBefore = { isSectionsExpanded ? CloseFullscreen : OpenInFull }
377+ onClick = { headerNavigationsActions . handleExpandAll }
378+ >
379+ { isSectionsExpanded
380+ ? intl . formatMessage ( headerMessages . collapseAllButton )
381+ : intl . formatMessage ( headerMessages . expandAllButton ) }
382+ </ Button >
383+ ) }
384+ </ ActionRow >
385+ ) }
343386 < section className = "course-outline-section" >
344- < StatusBar
345- courseId = { courseId }
346- isLoading = { isLoading }
347- statusBarData = { statusBarData }
348- openEnableHighlightsModal = { openEnableHighlightsModal }
349- handleVideoSharingOptionChange = { handleVideoSharingOptionChange }
350- />
351387 { ! errors ?. outlineIndexApi && (
352388 < div className = "pt-4" >
353389 { sections . length ? (
0 commit comments