diff --git a/src/components/EditorRightPanel.tsx b/src/components/EditorRightPanel.tsx index e0eafd36..4b229c10 100644 --- a/src/components/EditorRightPanel.tsx +++ b/src/components/EditorRightPanel.tsx @@ -110,7 +110,7 @@ export function EditorRightPanel({ onUpdateFrontmatter={onUpdateFrontmatter} onDeleteProperty={onDeleteProperty} onAddProperty={onAddProperty} - onCreateMissingType={onCreateMissingType as ((path: string, missingType: string, nextTypeName: string) => Promise) | undefined} + onCreateMissingType={onCreateMissingType} onCreateAndOpenNote={onCreateAndOpenNote} onInitializeProperties={onInitializeProperties} onToggleRawEditor={onToggleRawEditor} diff --git a/src/components/Inspector.tsx b/src/components/Inspector.tsx index 25901892..f4499484 100644 --- a/src/components/Inspector.tsx +++ b/src/components/Inspector.tsx @@ -32,7 +32,7 @@ interface InspectorProps { onUpdateFrontmatter?: (path: string, key: string, value: FrontmatterValue) => Promise onDeleteProperty?: (path: string, key: string) => Promise onAddProperty?: (path: string, key: string, value: FrontmatterValue) => Promise - onCreateMissingType?: (path: string, missingType: string, nextTypeName: string) => Promise + onCreateMissingType?: (path: string, missingType: string, nextTypeName: string) => Promise onCreateAndOpenNote?: (title: string) => Promise onInitializeProperties?: (path: string) => void onToggleRawEditor?: () => void @@ -71,7 +71,7 @@ function ValidFrontmatterPanels({ onUpdateProperty?: (key: string, value: FrontmatterValue) => void onDeleteProperty?: (key: string) => void onAddProperty?: (key: string, value: FrontmatterValue) => void - onCreateMissingType?: (typeName: string) => Promise + onCreateMissingType?: (typeName: string) => Promise }) { return ( <> @@ -134,7 +134,7 @@ function PrimaryInspectorPanel({ onUpdateProperty?: (key: string, value: FrontmatterValue) => void onDeleteProperty?: (key: string) => void onAddProperty?: (key: string, value: FrontmatterValue) => void - onCreateMissingType?: (typeName: string) => Promise + onCreateMissingType?: (typeName: string) => Promise }) { if (frontmatterState === 'valid') { return ( @@ -162,12 +162,10 @@ function PrimaryInspectorPanel({ return onInitializeProperties ? onInitializeProperties(entry.path)} /> : null } -export function Inspector({ - collapsed, - onToggle, +function InspectorBody({ entry, - content, entries, + content, gitHistory, vaultPath, onNavigate, @@ -179,7 +177,7 @@ export function Inspector({ onCreateAndOpenNote, onInitializeProperties, onToggleRawEditor, -}: InspectorProps) { +}: Omit) { const referencedBy = useReferencedBy(entry, entries) const backlinks = useBacklinks(entry, entries, referencedBy) const frontmatter = useMemo(() => parseFrontmatter(content), [content]) @@ -198,40 +196,46 @@ export function Inspector({ onCreateMissingType, }) + if (!entry) { + return + } + + return ( + <> + + {backlinks.length > 0 && } + + + + {gitHistory.length > 0 && } + + + ) +} + +export function Inspector({ collapsed, onToggle, ...bodyProps }: InspectorProps) { return (