Skip to content

Build your personal knowledge base with Trilium Notes

feat(client): show note paths in the connections tab

Elian Doranb127bc9121b1
diff --git a/apps/client/src/widgets/sidebar/NotePaths.tsx b/apps/client/src/widgets/sidebar/NotePaths.tsx
new file mode 100644
index 0000000000..26903eae5c
--- /dev/null
+++ b/apps/client/src/widgets/sidebar/NotePaths.tsx
@@ -0,0 +1,17 @@
+import { t } from "../../services/i18n";
+import { useActiveNoteContext } from "../react/hooks";
+// The paths list is shared with the ribbon's note paths tab and the status bar's badge;
+// only the framing differs here.
+import { NotePathsWidget, useSortedNotePaths } from "../ribbon/NotePathsTab";
+import RightPanelWidget from "./RightPanelWidget";
+
+export default function NotePaths() {
+ const { note, notePath, hoistedNoteId } = useActiveNoteContext();
+ const sortedNotePaths = useSortedNotePaths(note, hoistedNoteId);
+
+ return (
+ <RightPanelWidget id="notePaths" title={t("note_paths.title")}>
+ <NotePathsWidget sortedNotePaths={sortedNotePaths} currentNotePath={notePath} />
+ </RightPanelWidget>
+ );
+}
diff --git a/apps/client/src/widgets/sidebar/RightPanelContainer.tsx b/apps/client/src/widgets/sidebar/RightPanelContainer.tsx
index c7da815cfd..29e9720267 100644
--- a/apps/client/src/widgets/sidebar/RightPanelContainer.tsx
+++ b/apps/client/src/widgets/sidebar/RightPanelContainer.tsx
@@ -23,6 +23,7 @@ import AttributeList from "./AttributeList";
import Backlinks from "./Backlinks";
import ChatHighlightsList from "./ChatHighlightsList";
import HighlightsList from "./HighlightsList";
+import NotePaths from "./NotePaths";
import PdfAnnotations from "./pdf/PdfAnnotations";
import PdfAttachments from "./pdf/PdfAttachments";
import PdfLayers from "./pdf/PdfLayers";
@@ -185,6 +186,13 @@ function useItems(rightPaneVisible: boolean, widgetsByParent: WidgetsByParent):
enabled: !!note,
tab: "attributes"
},
+ {
+ // Where the note sits in the tree, above what points at it: placements first, then the
+ // backlinks below take whatever height is left.
+ el: <NotePaths />,
+ enabled: !!note,
+ tab: "connections"
+ },
{
el: <Backlinks />,
enabled: !!note,