File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ import { useLibraryContext } from '../common/context/LibraryContext';
2929import { PickLibraryContentModal } from './PickLibraryContentModal' ;
3030import { blockTypes } from '../../editors/data/constants/app' ;
3131
32+ import { ContentType as LibraryContentTypes } from '../routes' ;
3233import genericMessages from '../generic/messages' ;
3334import messages from './messages' ;
3435import type { BlockTypeMetadata } from '../data/api' ;
@@ -115,6 +116,9 @@ const AddContentView = ({
115116 blockType : 'libraryContent' ,
116117 } ;
117118
119+ const extraFilter = unitId ? [ 'NOT block_type = "unit"' , 'NOT type = "collections"' ] : undefined ;
120+ const visibleTabs = unitId ? [ LibraryContentTypes . components ] : undefined ;
121+
118122 return (
119123 < >
120124 { ( collectionId || unitId ) && componentPicker && (
@@ -124,6 +128,8 @@ const AddContentView = ({
124128 < PickLibraryContentModal
125129 isOpen = { isAddLibraryContentModalOpen }
126130 onClose = { closeAddLibraryContentModal }
131+ extraFilter = { extraFilter }
132+ visibleTabs = { visibleTabs }
127133 />
128134 </ >
129135 ) }
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { useLibraryContext } from '../common/context/LibraryContext';
77import type { SelectedComponent } from '../common/context/ComponentPickerContext' ;
88import { useAddItemsToCollection , useAddComponentsToContainer } from '../data/apiHooks' ;
99import genericMessages from '../generic/messages' ;
10+ import type { ContentType } from '../routes' ;
1011import messages from './messages' ;
1112
1213interface PickLibraryContentModalFooterProps {
@@ -33,12 +34,14 @@ interface PickLibraryContentModalProps {
3334 isOpen : boolean ;
3435 onClose : ( ) => void ;
3536 extraFilter ?: string [ ] ;
37+ visibleTabs ?: ContentType [ ] ,
3638}
3739
3840export const PickLibraryContentModal : React . FC < PickLibraryContentModalProps > = ( {
3941 isOpen,
4042 onClose,
4143 extraFilter,
44+ visibleTabs,
4245} ) => {
4346 const intl = useIntl ( ) ;
4447
@@ -110,6 +113,7 @@ export const PickLibraryContentModal: React.FC<PickLibraryContentModalProps> = (
110113 componentPickerMode = "multiple"
111114 onChangeComponentSelection = { setSelectedComponents }
112115 extraFilter = { extraFilter }
116+ visibleTabs = { visibleTabs }
113117 />
114118 </ StandardModal >
115119 ) ;
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ import {
2828 useUpdateXBlockFields ,
2929} from '../data/apiHooks' ;
3030import { LibraryBlock } from '../LibraryBlock' ;
31- import { useLibraryRoutes } from '../routes' ;
31+ import { useLibraryRoutes , ContentType } from '../routes' ;
3232import messages from './messages' ;
3333import { useSidebarContext } from '../common/context/SidebarContext' ;
3434import { ToastContext } from '../../generic/toast-context' ;
@@ -275,7 +275,8 @@ export const LibraryUnitBlocks = ({ preview }: LibraryUnitBlocksProps) => {
275275 < PickLibraryContentModal
276276 isOpen = { isAddLibraryContentModalOpen }
277277 onClose = { closeAddLibraryContentModal }
278- extraFilter = { [ 'NOT block_type = "unit"' ] }
278+ extraFilter = { [ 'NOT block_type = "unit"' , 'NOT type = "collection"' ] }
279+ visibleTabs = { [ ContentType . components ] }
279280 />
280281 </ div >
281282 </ div >
You can’t perform that action at this time.
0 commit comments