From 2eb0705f00c72304c9a82ca7241ce1a24e2bbc5e Mon Sep 17 00:00:00 2001 From: lucaronin Date: Tue, 17 Feb 2026 18:21:20 +0100 Subject: [PATCH] feat: show type label on relationship items in Inspector Each related note in the Relationships section now displays the note title on the left and the type label on the right. Co-Authored-By: Claude Opus 4.6 --- src/components/Inspector.tsx | 44 ++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/src/components/Inspector.tsx b/src/components/Inspector.tsx index 16e1d554..66c43003 100644 --- a/src/components/Inspector.tsx +++ b/src/components/Inspector.tsx @@ -42,28 +42,44 @@ function wikilinkTarget(ref: string): string { return pipeIdx !== -1 ? inner.slice(0, pipeIdx) : inner } -function RelationshipGroup({ label, refs, onNavigate }: { label: string; refs: string[]; onNavigate: (target: string) => void }) { +function resolveRefType(ref: string, entries: VaultEntry[]): string | undefined { + const target = wikilinkTarget(ref) + const match = entries.find((e) => { + const stem = e.path.replace(/^.*\/Laputa\//, '').replace(/\.md$/, '') + if (stem === target) return true + const fileStem = e.filename.replace(/\.md$/, '') + if (fileStem === target.split('/').pop()) return true + return false + }) + return match?.isA +} + +function RelationshipGroup({ label, refs, entries, onNavigate }: { label: string; refs: string[]; entries: VaultEntry[]; onNavigate: (target: string) => void }) { if (refs.length === 0) return null return (
{label}
- {refs.map((ref, idx) => ( - - ))} + {refs.map((ref, idx) => { + const refType = resolveRefType(ref, entries) + return ( + + ) + })}
) } -function DynamicRelationshipsPanel({ frontmatter, onNavigate }: { frontmatter: ParsedFrontmatter; onNavigate: (target: string) => void }) { +function DynamicRelationshipsPanel({ frontmatter, entries, onNavigate }: { frontmatter: ParsedFrontmatter; entries: VaultEntry[]; onNavigate: (target: string) => void }) { const relationshipEntries = useMemo(() => { return Object.entries(frontmatter) .filter(([key, value]) => RELATIONSHIP_KEYS.has(key) || containsWikilinks(value)) @@ -83,7 +99,7 @@ function DynamicRelationshipsPanel({ frontmatter, onNavigate }: { frontmatter: P

No relationships

) : ( relationshipEntries.map(({ key, refs }) => ( - + )) )}