diff --git a/src/library-authoring/components/CollectionCard.test.tsx b/src/library-authoring/components/CollectionCard.test.tsx index cc353312e6..a3be58151f 100644 --- a/src/library-authoring/components/CollectionCard.test.tsx +++ b/src/library-authoring/components/CollectionCard.test.tsx @@ -17,6 +17,7 @@ const CollectionHitSample: CollectionHit = { }, created: 1722434322294, modified: 1722434322294, + numChildren: 2, tags: {}, }; @@ -32,7 +33,8 @@ describe('', () => { it('should render the card with title and description', () => { render(); - expect(screen.getByText('Collection Display Formated Name')).toBeInTheDocument(); - expect(screen.getByText('Collection description')).toBeInTheDocument(); + expect(screen.queryByText('Collection Display Formated Name')).toBeInTheDocument(); + expect(screen.queryByText('Collection description')).toBeInTheDocument(); + expect(screen.queryByText('Collection (2)')).toBeInTheDocument(); }); }); diff --git a/src/library-authoring/components/CollectionCard.tsx b/src/library-authoring/components/CollectionCard.tsx index 477a264e4a..3968a7d681 100644 --- a/src/library-authoring/components/CollectionCard.tsx +++ b/src/library-authoring/components/CollectionCard.tsx @@ -21,8 +21,13 @@ const CollectionCard = ({ collectionHit } : CollectionCardProps) => { type, formatted, tags, + numChildren, } = collectionHit; const { displayName = '', description = '' } = formatted; + const blockTypeDisplayName = numChildren ? intl.formatMessage( + messages.collectionTypeWithCount, + { numChildren }, + ) : intl.formatMessage(messages.collectionType); return ( { /> )} - blockTypeDisplayName={intl.formatMessage(messages.collectionType)} + blockTypeDisplayName={blockTypeDisplayName} openInfoSidebar={() => {}} /> ); diff --git a/src/library-authoring/components/messages.ts b/src/library-authoring/components/messages.ts index 344a35b8aa..e801f7ec0b 100644 --- a/src/library-authoring/components/messages.ts +++ b/src/library-authoring/components/messages.ts @@ -16,6 +16,11 @@ const messages = defineMessages({ defaultMessage: 'Collection', description: 'Collection type text', }, + collectionTypeWithCount: { + id: 'course-authoring.library-authoring.collection.type-with-count', + defaultMessage: 'Collection ({numChildren})', + description: 'Collection type text with children count', + }, menuEdit: { id: 'course-authoring.library-authoring.component.menu.edit', defaultMessage: 'Edit', diff --git a/src/search-manager/data/api.ts b/src/search-manager/data/api.ts index 8c4cf183d3..6dbb805e74 100644 --- a/src/search-manager/data/api.ts +++ b/src/search-manager/data/api.ts @@ -135,7 +135,7 @@ export interface ContentHit extends BaseContentHit { */ export interface CollectionHit extends BaseContentHit { description: string; - componentCount?: number; + numChildren?: number; } /**