Skip to content

Commit

Permalink
refactor: remove unused libraryId param
Browse files Browse the repository at this point in the history
  • Loading branch information
pomegranited committed Sep 26, 2024
1 parent ccce44a commit b43d902
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/library-authoring/LibraryAuthoringPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ const LibraryAuthoringPage = () => {
/>
<Route
path={TabList.components}
element={<LibraryComponents libraryId={libraryId} variant="full" />}
element={<LibraryComponents variant="full" />}
/>
<Route
path={TabList.collections}
Expand Down
2 changes: 1 addition & 1 deletion src/library-authoring/LibraryHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const LibraryHome = ({ libraryId, tabList, handleTabChange } : LibraryHomeProps)
contentCount={componentCount}
viewAllAction={() => handleTabChange(tabList.components)}
>
<LibraryComponents libraryId={libraryId} variant="preview" />
<LibraryComponents variant="preview" />
</LibrarySection>
</>
)
Expand Down
16 changes: 2 additions & 14 deletions src/library-authoring/LibraryRecentlyModified.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
? (
<LibrarySection
Expand Down Expand Up @@ -82,7 +70,7 @@ const LibraryRecentlyModified: React.FC<{ libraryId: string }> = ({ libraryId })
extraFilter={`context_key = "${libraryId}"`}
overrideSearchSortOrder={SearchSortOption.RECENTLY_MODIFIED}
>
<RecentlyModified libraryId={libraryId} />
<RecentlyModified />
</SearchContextProvider>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -25,7 +25,7 @@ const LibraryCollectionComponents = ({ libraryId }: { libraryId: string }) => {
return (
<Stack direction="vertical" gap={3}>
<h3 className="text-gray">Content ({componentCount})</h3>
<LibraryComponents libraryId={libraryId} variant="full" />
<LibraryComponents variant="full" />
</Stack>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const LibraryCollectionPageInner = ({ libraryId }: { libraryId: string }) => {
<div className="flex-grow-1" />
<SearchSortWidget />
</div>
<LibraryCollectionComponents libraryId={libraryId} />
<LibraryCollectionComponents />
</Container>
<StudioFooter />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const RootWrapper = (props) => (
<IntlProvider locale="en" messages={{}}>
<QueryClientProvider client={queryClient}>
<SearchContextProvider>
<LibraryComponents libraryId="1" {...props} />
<LibraryComponents {...props} />
</SearchContextProvider>
</QueryClientProvider>
</IntlProvider>
Expand Down
3 changes: 1 addition & 2 deletions src/library-authoring/components/LibraryComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { LIBRARY_SECTION_PREVIEW_LIMIT } from './LibrarySection';
import { LibraryContext } from '../common/context';

type LibraryComponentsProps = {
libraryId: string,
variant: 'full' | 'preview',
};

Expand All @@ -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,
Expand Down

0 comments on commit b43d902

Please sign in to comment.