diff --git a/src/components/NoteList.tsx b/src/components/NoteList.tsx index b7f8f119..36044d56 100644 --- a/src/components/NoteList.tsx +++ b/src/components/NoteList.tsx @@ -215,6 +215,7 @@ function NoteListInner({ entries, selection, selectedNote, allContent, modifiedF const [collapsedGroups, setCollapsedGroups] = useState>(new Set()) const isEntityView = selection.kind === 'entity' + const isSectionGroup = selection.kind === 'sectionGroup' const toggleGroup = useCallback((label: string) => { setCollapsedGroups((prev) => { @@ -225,6 +226,13 @@ function NoteListInner({ entries, selection, selectedNote, allContent, modifiedF }) }, []) + // Find the type document for this section group (e.g., type/project.md for "Project") + const typeDocument = useMemo(() => { + if (!isSectionGroup) return null + const typeName = (selection as { kind: 'sectionGroup'; type: string }).type + return entries.find((e) => e.isA === 'Type' && e.title === typeName) ?? null + }, [isSectionGroup, selection, entries]) + const entityGroups = useMemo( () => isEntityView ? buildRelationshipGroups(selection.entry, entries, allContent) : [], [isEntityView, selection, entries, allContent] @@ -308,12 +316,77 @@ function NoteListInner({ entries, selection, selectedNote, allContent, modifiedF ) }, [selectedNote?.path, onSelectNote]) + const renderPinnedView = useCallback((entity: VaultEntry, groups: RelationshipGroup[]) => { + const entityTypeColor = getTypeColor(entity.isA) + const entityLightColor = getTypeLightColor(entity.isA) + const EntityIcon = getTypeIcon(entity.isA) + return ( +
+ {/* Prominent card */} +
onSelectNote(entity)} + > + +
+ {entity.title} +
+
+ {entity.snippet} +
+
+ {relativeDate(getDisplayDate(entity))} +
+
+ + {/* Relationship groups */} + {groups.length === 0 ? ( +
+ {query ? 'No matching items' : 'No related items'} +
+ ) : ( + groups.map((group) => { + const isGroupCollapsed = collapsedGroups.has(group.label) + return ( +
+ + {!isGroupCollapsed && group.entries.map((groupEntry) => renderItem(groupEntry))} +
+ ) + }) + )} +
+ ) + }, [onSelectNote, query, collapsedGroups, toggleGroup, renderItem]) + return (
{/* Header */}

- {isEntityView ? selection.entry.title : 'Notes'} + {isEntityView ? selection.entry.title : (typeDocument ? typeDocument.title : 'Notes')}

- {!isCollapsed && group.entries.map((entry) => renderItem(entry))} -
- ) - }) - )} -
- ) - })() : ( - searched.length === 0 ? ( -
No notes found
- ) : ( - { - const entry = searched[index] - return entry ? renderItem(entry) : null - }} - /> - ) + )} + {searched.length === 0 ? ( +
No notes found
+ ) : ( + searched.map((entry) => renderItem(entry)) + )} +
)}