diff --git a/src/renderer/components/Sidebar/Sidebar.tsx b/src/renderer/components/Sidebar/Sidebar.tsx index d61edaa..d387c84 100644 --- a/src/renderer/components/Sidebar/Sidebar.tsx +++ b/src/renderer/components/Sidebar/Sidebar.tsx @@ -360,14 +360,15 @@ const PostsList: React.FC = () => { }; // Determine which posts to display - const displayPosts = searchResults ?? filteredPosts ?? posts; - const isFiltered = searchResults !== null || filteredPosts !== null; + // Filters only apply to published/archived posts — drafts are always shown unfiltered + const filteredDisplayPosts = searchResults ?? filteredPosts ?? null; + const isFiltered = filteredDisplayPosts !== null; const hasActiveFilters = searchQuery || selectedYear || selectedTags.length > 0 || selectedCategories.length > 0; const groupedPosts = { - draft: displayPosts.filter(p => p.status === 'draft'), - published: displayPosts.filter(p => p.status === 'published'), - archived: displayPosts.filter(p => p.status === 'archived'), + draft: posts.filter(p => p.status === 'draft'), + published: (filteredDisplayPosts ?? posts).filter(p => p.status === 'published'), + archived: (filteredDisplayPosts ?? posts).filter(p => p.status === 'archived'), }; const clearAllFilters = () => { @@ -436,7 +437,7 @@ const PostsList: React.FC = () => { {hasActiveFilters && (
- {displayPosts.length} result{displayPosts.length !== 1 ? 's' : ''} + {groupedPosts.published.length + groupedPosts.archived.length} result{groupedPosts.published.length + groupedPosts.archived.length !== 1 ? 's' : ''} {searchQuery && ` for "${searchQuery}"`}
)} - {displayPosts.length === 0 && !isFiltered && ( + {posts.length === 0 && !isFiltered && (

No posts yet

)} - {displayPosts.length === 0 && isFiltered && ( + {groupedPosts.published.length === 0 && groupedPosts.archived.length === 0 && isFiltered && (

No matching posts