Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(client): show backlinks in the connections tab
Elian Doranf52c95aadbb0
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex 5c6920924d..c3c5d535ba 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -3236,6 +3236,7 @@"dock": "Dock panel","close": "Close panel","custom_widget_go_to_source": "Go to source code",+ "backlinks": "Backlinks","tab_outline": "Outline","tab_attributes": "Attributes","tab_connections": "Connections",diff --git a/apps/client/src/widgets/sidebar/Backlinks.tsx b/apps/client/src/widgets/sidebar/Backlinks.tsxnew file mode 100644index 0000000000..89bf0d1133--- /dev/null+++ b/apps/client/src/widgets/sidebar/Backlinks.tsx@@ -0,0 +1,22 @@+import { t } from "../../services/i18n";+// The list itself is shared with the status bar's backlinks badge; only the framing differs here.+import { BacklinksList } from "../FloatingButtonsDefinitions";+import { useActiveNoteContext } from "../react/hooks";+import RightPanelWidget from "./RightPanelWidget";++export default function Backlinks() {+ const { note } = useActiveNoteContext();++ return (+ <RightPanelWidget id="backlinks" title={t("right_pane.backlinks")} grow>+ {note && (+ // The classes the shared list's card styling hangs off (see ../Backlinks.css).+ <div class="tn-backlinks-widget">+ <ul class="backlinks-items">+ <BacklinksList note={note} />+ </ul>+ </div>+ )}+ </RightPanelWidget>+ );+}diff --git a/apps/client/src/widgets/sidebar/RightPanelContainer.tsx b/apps/client/src/widgets/sidebar/RightPanelContainer.tsxindex 4298c6c356..c7da815cfd 100644--- a/apps/client/src/widgets/sidebar/RightPanelContainer.tsx+++ b/apps/client/src/widgets/sidebar/RightPanelContainer.tsx@@ -20,6 +20,7 @@ import NoItems from "../react/NoItems";import { PaneMode, usePaneMode, usePeekDismiss } from "../react/peek_pane";import LegacyRightPanelWidget from "../right_panel_widget";import AttributeList from "./AttributeList";+import Backlinks from "./Backlinks";import ChatHighlightsList from "./ChatHighlightsList";import HighlightsList from "./HighlightsList";import PdfAnnotations from "./pdf/PdfAnnotations";@@ -184,6 +185,11 @@ function useItems(rightPaneVisible: boolean, widgetsByParent: WidgetsByParent):enabled: !!note,tab: "attributes"},+ {+ el: <Backlinks />,+ enabled: !!note,+ tab: "connections"+ },{el: <TableOfContents />,enabled: (noteType === "text" || noteType === "doc" || isPdf || noteType === "llmChat" || !!note?.isMarkdown()),