Skip to content

Commit

Permalink
feat: add comments to splice blockTypesArray code
Browse files Browse the repository at this point in the history
Co-authored-by: Jillian <[email protected]>
  • Loading branch information
rpenido and pomegranited authored Sep 26, 2024
1 parent 3d37dee commit 7786528
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/library-authoring/collections/CollectionDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ const CollectionStatsWidget = ({ collection }: CollectionStatsWidgetProps) => {
.sort((a, b) => b.count - a.count);

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

if (totalBlocksCount === 0) {
Expand Down

0 comments on commit 7786528

Please sign in to comment.