@@ -37,19 +37,25 @@ import {
3737} from '../search-manager' ;
3838import LibraryContent , { ContentType } from './LibraryContent' ;
3939import { LibrarySidebar } from './library-sidebar' ;
40- import { SidebarBodyComponentId , useLibraryContext } from './common/context' ;
40+ import { useComponentPickerContext } from './common/context/ComponentPickerContext' ;
41+ import { useLibraryContext } from './common/context/LibraryContext' ;
42+ import { SidebarBodyComponentId , useSidebarContext } from './common/context/SidebarContext' ;
43+
4144import messages from './messages' ;
4245
4346const HeaderActions = ( ) => {
4447 const intl = useIntl ( ) ;
48+
49+ const { readOnly } = useLibraryContext ( ) ;
50+
4551 const {
46- componentPickerMode,
4752 openAddContentSidebar,
4853 openInfoSidebar,
4954 closeLibrarySidebar,
5055 sidebarComponentInfo,
51- readOnly,
52- } = useLibraryContext ( ) ;
56+ } = useSidebarContext ( ) ;
57+
58+ const { componentPickerMode } = useComponentPickerContext ( ) ;
5359
5460 const infoSidebarIsOpen = ( ) => (
5561 sidebarComponentInfo ?. type === SidebarBodyComponentId . Info
@@ -94,7 +100,8 @@ const HeaderActions = () => {
94100const SubHeaderTitle = ( { title } : { title : string } ) => {
95101 const intl = useIntl ( ) ;
96102
97- const { readOnly, componentPickerMode } = useLibraryContext ( ) ;
103+ const { readOnly } = useLibraryContext ( ) ;
104+ const { componentPickerMode } = useComponentPickerContext ( ) ;
98105
99106 const showReadOnlyBadge = readOnly && ! componentPickerMode ;
100107
@@ -127,16 +134,14 @@ const LibraryAuthoringPage = ({ returnToLibrarySelection }: LibraryAuthoringPage
127134 librariesV2Enabled,
128135 } = useStudioHome ( ) ;
129136
137+ const { componentPickerMode, restrictToLibrary } = useComponentPickerContext ( ) ;
130138 const {
131139 libraryId,
132140 libraryData,
133141 isLoadingLibraryData,
134- componentPickerMode,
135- restrictToLibrary,
136142 showOnlyPublished,
137- sidebarComponentInfo,
138- openInfoSidebar,
139143 } = useLibraryContext ( ) ;
144+ const { openInfoSidebar, sidebarComponentInfo } = useSidebarContext ( ) ;
140145
141146 const [ activeKey , setActiveKey ] = useState < ContentType | undefined > ( ContentType . home ) ;
142147
0 commit comments