1- import { FormattedMessage } from '@edx/frontend-platform/i18n' ;
1+ import { FormattedMessage , useIntl } from '@edx/frontend-platform/i18n' ;
22import {
3- ActionRow , Badge , Icon , Stack , useToggle ,
3+ ActionRow , Badge , Button , Icon , Stack , useToggle ,
44} from '@openedx/paragon' ;
5- import { Description } from '@openedx/paragon/icons' ;
5+ import { Add , Description } from '@openedx/paragon/icons' ;
66import { useQueryClient } from '@tanstack/react-query' ;
77import classNames from 'classnames' ;
88import { useEffect , useState } from 'react' ;
@@ -22,8 +22,10 @@ import { libraryAuthoringQueryKeys, useContainerChildren } from '../data/apiHook
2222import { LibraryBlock } from '../LibraryBlock' ;
2323import { useLibraryRoutes } from '../routes' ;
2424import messages from './messages' ;
25+ import { useSidebarContext } from '../common/context/SidebarContext' ;
2526
2627export const LibraryUnitBlocks = ( ) => {
28+ const intl = useIntl ( ) ;
2729 const [ orderedBlocks , setOrderedBlocks ] = useState < LibraryBlockMetadata [ ] > ( [ ] ) ;
2830 const [ isManageTagsDrawerOpen , openManageTagsDrawer , closeManageTagsDrawer ] = useToggle ( false ) ;
2931 const { navigateTo } = useLibraryRoutes ( ) ;
@@ -33,9 +35,14 @@ export const LibraryUnitBlocks = () => {
3335 unitId,
3436 showOnlyPublished,
3537 componentId,
38+ readOnly,
3639 setComponentId,
3740 } = useLibraryContext ( ) ;
3841
42+ const {
43+ openAddContentSidebar,
44+ } = useSidebarContext ( ) ;
45+
3946 const queryClient = useQueryClient ( ) ;
4047 const {
4148 data : blocks ,
@@ -128,6 +135,31 @@ export const LibraryUnitBlocks = () => {
128135 < DraggableList itemList = { orderedBlocks } setState = { setOrderedBlocks } updateOrder = { handleReorder } >
129136 { renderedBlocks }
130137 </ DraggableList >
138+ < div className = "d-flex" >
139+ < div className = "w-100 mr-2" >
140+ < Button
141+ className = "ml-2"
142+ iconBefore = { Add }
143+ variant = "outline-primary rounded-0"
144+ disabled = { readOnly }
145+ onClick = { openAddContentSidebar }
146+ block
147+ >
148+ { intl . formatMessage ( messages . newContentButton ) }
149+ </ Button >
150+ </ div >
151+ < div className = "w-100 ml-2" >
152+ < Button
153+ className = "ml-2"
154+ iconBefore = { Add }
155+ variant = "outline-primary rounded-0"
156+ disabled
157+ block
158+ >
159+ { intl . formatMessage ( messages . addExistingContentButton ) }
160+ </ Button >
161+ </ div >
162+ </ div >
131163 < ContentTagsDrawerSheet
132164 id = { componentId }
133165 onClose = { onTagSidebarClose }
0 commit comments