From b43d9029b72f3659570e52ae8cae6fa49398e7f0 Mon Sep 17 00:00:00 2001 From: Jillian Vogel Date: Thu, 26 Sep 2024 17:35:24 +0930 Subject: [PATCH] refactor: remove unused libraryId param --- src/library-authoring/LibraryAuthoringPage.tsx | 2 +- src/library-authoring/LibraryHome.tsx | 2 +- .../LibraryRecentlyModified.tsx | 16 ++-------------- .../collections/LibraryCollectionComponents.tsx | 4 ++-- .../collections/LibraryCollectionPage.tsx | 2 +- .../components/LibraryComponents.test.tsx | 2 +- .../components/LibraryComponents.tsx | 3 +-- 7 files changed, 9 insertions(+), 22 deletions(-) diff --git a/src/library-authoring/LibraryAuthoringPage.tsx b/src/library-authoring/LibraryAuthoringPage.tsx index 343bb94f62..15d20bf259 100644 --- a/src/library-authoring/LibraryAuthoringPage.tsx +++ b/src/library-authoring/LibraryAuthoringPage.tsx @@ -205,7 +205,7 @@ const LibraryAuthoringPage = () => { /> } + element={} /> handleTabChange(tabList.components)} > - + ) diff --git a/src/library-authoring/LibraryRecentlyModified.tsx b/src/library-authoring/LibraryRecentlyModified.tsx index 57828871ef..4ec5e0b9f7 100644 --- a/src/library-authoring/LibraryRecentlyModified.tsx +++ b/src/library-authoring/LibraryRecentlyModified.tsx @@ -8,10 +8,9 @@ import { type CollectionHit, type ContentHit, SearchSortOption } from '../search import LibrarySection, { LIBRARY_SECTION_PREVIEW_LIMIT } from './components/LibrarySection'; import messages from './messages'; import ComponentCard from './components/ComponentCard'; -import { useLibraryBlockTypes } from './data/apiHooks'; import CollectionCard from './components/CollectionCard'; -const RecentlyModified: React.FC<{ libraryId: string }> = ({ libraryId }) => { +const RecentlyModified = () => { const intl = useIntl(); const { hits, @@ -31,17 +30,6 @@ const RecentlyModified: React.FC<{ libraryId: string }> = ({ libraryId }) => { ...collectionList, ], ['modified'], ['desc']).slice(0, LIBRARY_SECTION_PREVIEW_LIMIT); - const { data: blockTypesData } = useLibraryBlockTypes(libraryId); - const blockTypes = useMemo(() => { - const result = {}; - if (blockTypesData) { - blockTypesData.forEach(blockType => { - result[blockType.blockType] = blockType; - }); - } - return result; - }, [blockTypesData]); - return componentCount > 0 ? ( = ({ libraryId }) extraFilter={`context_key = "${libraryId}"`} overrideSearchSortOrder={SearchSortOption.RECENTLY_MODIFIED} > - + ); diff --git a/src/library-authoring/collections/LibraryCollectionComponents.tsx b/src/library-authoring/collections/LibraryCollectionComponents.tsx index 5d870645c9..f9092722a6 100644 --- a/src/library-authoring/collections/LibraryCollectionComponents.tsx +++ b/src/library-authoring/collections/LibraryCollectionComponents.tsx @@ -6,7 +6,7 @@ import { LibraryComponents } from '../components'; import messages from './messages'; import { LibraryContext } from '../common/context'; -const LibraryCollectionComponents = ({ libraryId }: { libraryId: string }) => { +const LibraryCollectionComponents = () => { const { totalHits: componentCount, isFiltered } = useSearchContext(); const { openAddContentSidebar } = useContext(LibraryContext); @@ -25,7 +25,7 @@ const LibraryCollectionComponents = ({ libraryId }: { libraryId: string }) => { return (

Content ({componentCount})

- +
); }; diff --git a/src/library-authoring/collections/LibraryCollectionPage.tsx b/src/library-authoring/collections/LibraryCollectionPage.tsx index b2344a9b1f..e526441968 100644 --- a/src/library-authoring/collections/LibraryCollectionPage.tsx +++ b/src/library-authoring/collections/LibraryCollectionPage.tsx @@ -169,7 +169,7 @@ const LibraryCollectionPageInner = ({ libraryId }: { libraryId: string }) => {
- + diff --git a/src/library-authoring/components/LibraryComponents.test.tsx b/src/library-authoring/components/LibraryComponents.test.tsx index ed490b92d6..56b07dc953 100644 --- a/src/library-authoring/components/LibraryComponents.test.tsx +++ b/src/library-authoring/components/LibraryComponents.test.tsx @@ -95,7 +95,7 @@ const RootWrapper = (props) => ( - + diff --git a/src/library-authoring/components/LibraryComponents.tsx b/src/library-authoring/components/LibraryComponents.tsx index c91dbad55a..6e332b426c 100644 --- a/src/library-authoring/components/LibraryComponents.tsx +++ b/src/library-authoring/components/LibraryComponents.tsx @@ -9,7 +9,6 @@ import { LIBRARY_SECTION_PREVIEW_LIMIT } from './LibrarySection'; import { LibraryContext } from '../common/context'; type LibraryComponentsProps = { - libraryId: string, variant: 'full' | 'preview', }; @@ -20,7 +19,7 @@ type LibraryComponentsProps = { * - 'full': Show all components with Infinite scroll pagination. * - 'preview': Show first 4 components without pagination. */ -const LibraryComponents = ({ libraryId, variant }: LibraryComponentsProps) => { +const LibraryComponents = ({ variant }: LibraryComponentsProps) => { const { hits, totalHits: componentCount,