Skip to content

Commit

Permalink
initial commit - moving controls for background image into dedicated …
Browse files Browse the repository at this point in the history
…component. Moving styles. This is in preparation for adding colors and other background controls later.
  • Loading branch information
ramonjd committed Sep 13, 2024
1 parent 982e752 commit 71517b4
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ export function useDefaultViewsWithItemCounts( { postType } ) {
return [];
}

// If there are no records, return the default views with no counts.
if ( ! records ) {
return defaultViews;
}

const counts = {
all: totalItems,
drafts: records.filter( ( record ) => record.status === 'draft' )
.length,
future: records.filter( ( record ) => record.status === 'future' )
Expand All @@ -101,6 +101,9 @@ export function useDefaultViewsWithItemCounts( { postType } ) {
.length,
};

// All items excluding trashed items as per the default "all" status query.
counts.all = totalItems ? totalItems - counts.trash : 0;

// Filter out views with > 0 item counts.
return defaultViews.map( ( _view ) => {
_view.count = counts[ _view.slug ];
Expand Down

0 comments on commit 71517b4

Please sign in to comment.