1- import { useState , useEffect , useCallback } from 'react' ;
1+ import { useState , useEffect } from 'react' ;
22import { useIntl } from '@edx/frontend-platform/i18n' ;
33import {
44 Container ,
55 Row ,
66 TransitionReplace ,
77 Toast ,
8- StandardModal ,
98 Button ,
109 ActionRow ,
1110} from '@openedx/paragon' ;
@@ -32,14 +31,11 @@ import { UnlinkModal } from '@src/generic/unlink-modal';
3231import AlertMessage from '@src/generic/alert-message' ;
3332import getPageHeadTitle from '@src/generic/utils' ;
3433import CourseOutlineHeaderActionsSlot from '@src/plugin-slots/CourseOutlineHeaderActionsSlot' ;
35- import { ContainerType } from '@src/generic/key-utils' ;
36- import { LibraryAndComponentPicker , SelectedComponent } from '@src/library-authoring' ;
37- import { ContentType } from '@src/library-authoring/routes' ;
3834import { NOTIFICATION_MESSAGES } from '@src/constants' ;
39- import { COMPONENT_TYPES } from '@src/generic/block-type-utils/constants' ;
4035import { XBlock } from '@src/data/types' ;
4136import { useCourseAuthoringContext } from '@src/CourseAuthoringContext' ;
4237import LegacyLibContentBlockAlert from '@src/course-libraries/LegacyLibContentBlockAlert' ;
38+ import { ContainerType } from '@src/generic/key-utils' ;
4339import {
4440 getCurrentItem ,
4541 getProctoredExamsFlag ,
@@ -75,14 +71,13 @@ const CourseOutline = () => {
7571 const location = useLocation ( ) ;
7672 const {
7773 courseId,
78- handleAddSubsectionFromLibrary ,
79- handleAddUnitFromLibrary ,
80- handleAddSectionFromLibrary ,
81- handleNewSectionSubmit ,
74+ courseUsageKey ,
75+ handleAddSubsection ,
76+ handleAddUnit ,
77+ handleAddSection ,
8278 } = useCourseAuthoringContext ( ) ;
8379
8480 const {
85- courseUsageKey,
8681 courseName,
8782 savingStatus,
8883 statusBarData,
@@ -114,9 +109,6 @@ const CourseOutline = () => {
114109 headerNavigationsActions,
115110 openEnableHighlightsModal,
116111 closeEnableHighlightsModal,
117- isAddLibrarySectionModalOpen,
118- openAddLibrarySectionModal,
119- closeAddLibrarySectionModal,
120112 handleEnableHighlightsSubmit,
121113 handleInternetConnectionFailed,
122114 handleOpenHighlightsModal,
@@ -243,16 +235,6 @@ const CourseOutline = () => {
243235 }
244236 } ;
245237
246- const handleSelectLibrarySection = useCallback ( ( selectedSection : SelectedComponent ) => {
247- handleAddSectionFromLibrary . mutateAsync ( {
248- type : COMPONENT_TYPES . libraryV2 ,
249- category : ContainerType . Chapter ,
250- parentLocator : courseUsageKey ,
251- libraryContentKey : selectedSection . usageKey ,
252- } ) ;
253- closeAddLibrarySectionModal ( ) ;
254- } , [ closeAddLibrarySectionModal , handleAddSectionFromLibrary . mutateAsync , courseId , courseUsageKey ] ) ;
255-
256238 useEffect ( ( ) => {
257239 setSections ( sectionsList ) ;
258240 } , [ sectionsList ] ) ;
@@ -489,19 +471,19 @@ const CourseOutline = () => {
489471 </ DraggableList >
490472 { courseActions . childAddable && (
491473 < OutlineAddChildButtons
492- handleNewButtonClick = { handleNewSectionSubmit }
493- handleUseFromLibraryClick = { openAddLibrarySectionModal }
494474 childType = { ContainerType . Section }
475+ parentLocator = { courseUsageKey }
476+ parentTitle = { courseName }
495477 />
496478 ) }
497479 </ >
498480 ) : (
499481 < EmptyPlaceholder >
500482 { courseActions . childAddable && (
501483 < OutlineAddChildButtons
502- handleNewButtonClick = { handleNewSectionSubmit }
503- handleUseFromLibraryClick = { openAddLibrarySectionModal }
504484 childType = { ContainerType . Section }
485+ parentLocator = { courseUsageKey }
486+ parentTitle = { courseName }
505487 btnVariant = "primary"
506488 btnClasses = "mt-1"
507489 />
@@ -558,30 +540,15 @@ const CourseOutline = () => {
558540 close = { closeUnlinkModal }
559541 onUnlinkSubmit = { handleUnlinkItemSubmit }
560542 />
561- < StandardModal
562- title = { intl . formatMessage ( messages . sectionPickerModalTitle ) }
563- isOpen = { isAddLibrarySectionModalOpen }
564- onClose = { closeAddLibrarySectionModal }
565- isOverflowVisible = { false }
566- size = "xl"
567- >
568- < LibraryAndComponentPicker
569- showOnlyPublished
570- extraFilter = { [ 'block_type = "section"' ] }
571- componentPickerMode = "single"
572- onComponentSelected = { handleSelectLibrarySection }
573- visibleTabs = { [ ContentType . sections ] }
574- />
575- </ StandardModal >
576543 </ Container >
577544 < div className = "alert-toast" >
578545 < ProcessingNotification
579546 // Show processing toast if any mutation is running
580547 isShow = {
581548 isShowProcessingNotification
582- || handleAddUnitFromLibrary . isPending
583- || handleAddSubsectionFromLibrary . isPending
584- || handleAddSectionFromLibrary . isPending
549+ || handleAddUnit . isPending
550+ || handleAddSubsection . isPending
551+ || handleAddSection . isPending
585552 }
586553 // HACK: Use saving as default title till we have a need for better messages
587554 title = { processingNotificationTitle || NOTIFICATION_MESSAGES . saving }
0 commit comments