Skip to content

Commit 7786528

Browse files
feat: add comments to splice blockTypesArray code
Co-authored-by: Jillian <[email protected]>
1 parent 3d37dee commit 7786528

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/library-authoring/collections/CollectionDetails.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ const CollectionStatsWidget = ({ collection }: CollectionStatsWidgetProps) => {
5555
.sort((a, b) => b.count - a.count);
5656

5757
const totalBlocksCount = blockTypesArray.reduce((acc, { count }) => acc + count, 0);
58-
const otherBlocks = blockTypesArray.splice(3);
58+
// Show the top 3 block type counts individually, and splice the remaining block types together under "Other".
59+
const numBlockTypesShown = 3;
60+
const otherBlocks = blockTypesArray.splice(numBlockTypesShown);
5961
const otherBlocksCount = otherBlocks.reduce((acc, { count }) => acc + count, 0);
6062

6163
if (totalBlocksCount === 0) {

0 commit comments

Comments
 (0)