()
+ typeCounts.set(null, searched.length) // "All" count
+ for (const entry of searched) {
+ if (entry.isA) {
+ typeCounts.set(entry.isA, (typeCounts.get(entry.isA) ?? 0) + 1)
+ }
+ }
+
// Type filter pills
const displayed = typeFilter
? searched.filter((e) => e.isA === typeFilter)
@@ -156,15 +165,21 @@ export function NoteList({ entries, selection, selectedNote, allContent, onSelec
/>
- {TYPE_PILLS.map(({ label, type }) => (
-
- ))}
+ {TYPE_PILLS.filter(({ type }) => {
+ const count = typeCounts.get(type) ?? 0
+ return type === null || count > 0
+ }).map(({ label, type }) => {
+ const count = typeCounts.get(type) ?? 0
+ return (
+
+ )
+ })}
{displayed.length === 0 ? (