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): let the sidebar note map grow into the tab's spare height
Elian Dorana0d8402b2aa8
diff --git a/apps/client/src/widgets/sidebar/NoteMap.css b/apps/client/src/widgets/sidebar/NoteMap.cssindex 3a8dca4b9c..1b26af8ead 100644--- a/apps/client/src/widgets/sidebar/NoteMap.css+++ b/apps/client/src/widgets/sidebar/NoteMap.css@@ -15,10 +15,23 @@}}+/*+ * How far the map may be squeezed by the cards around it — the height it used to be held at, and its+ * own header on top of that, the floor being the card's rather than the map's. A tab with every+ * section open shows the map it always did; what it no longer does is leave the room a collapsed+ * section gives back lying empty under the tab.+ */+#noteMap {+ --right-pane-grow-min-height: calc(300px + var(--right-pane-header-height));+}+.sidebar-note-map {/* Anchors the map's floating buttons (map type, fix nodes), same as the ribbon wrapper. */position: relative;- height: 300px;+ /* Fills the card, which is what takes a height (see NoteMap.tsx): the canvas is drawn to whatever+ this box is measured at, so the map follows the card without being told a size of its own. */+ flex: 1;+ min-height: 0;overflow: hidden;.note-map-container {diff --git a/apps/client/src/widgets/sidebar/NoteMap.tsx b/apps/client/src/widgets/sidebar/NoteMap.tsxindex 2e2ad4d5f4..0786a48c82 100644--- a/apps/client/src/widgets/sidebar/NoteMap.tsx+++ b/apps/client/src/widgets/sidebar/NoteMap.tsx@@ -22,6 +22,10 @@ import SidebarHelp from "./SidebarHelp";* Which map to draw is asked here too, rather than in the map's own floating overlay: a card of the* pane keeps its controls in its header, and a map this small has little room to stand buttons over.* The map reads the same label, so the two stay of one mind without being told.+ *+ * It grows, sharing the room the tab's lists leave over with the backlinks below them and taking all+ * of it where they are collapsed — a map is worth whatever height it is given, and there is no height+ * at which it is finished being read. Where it stops is in NoteMap.css.*/export default function NoteMap() {const { note, notePath } = useActiveNoteContext();@@ -50,6 +54,7 @@ export default function NoteMap() {/>)}</>}+ grownoPadding><LazyComponent loader={() => import("./NoteMapGraph.jsx")} />diff --git a/apps/client/src/widgets/sidebar/RightPanelContainer.tsx b/apps/client/src/widgets/sidebar/RightPanelContainer.tsxindex 104f417e1f..42dfe7c672 100644--- a/apps/client/src/widgets/sidebar/RightPanelContainer.tsx+++ b/apps/client/src/widgets/sidebar/RightPanelContainer.tsx@@ -217,8 +217,8 @@ function useItems(rightPaneVisible: boolean, widgetsByParent: WidgetsByParent):},{// The map goes above the lists rather than under them: it is the one card of the tab- // held to a height of its own, so the room the rest are measured for is what it leaves- // over — which reads as a heading over them rather than as a block wedged below.+ // that is a picture of the whole rather than a list of a part of it, which reads as a+ // heading over them rather than as a block wedged below.//// The card is rendered here and only the map within it loaded on demand (force-graph is// kept out of the boot bundle), so that the card stays a child of the tab body — seediff --git a/apps/client/src/widgets/sidebar/RightPanelWidget.tsx b/apps/client/src/widgets/sidebar/RightPanelWidget.tsxindex c6e9c8d669..0856b197b4 100644--- a/apps/client/src/widgets/sidebar/RightPanelWidget.tsx+++ b/apps/client/src/widgets/sidebar/RightPanelWidget.tsx@@ -38,8 +38,10 @@ interface RightPanelWidgetProps {* keeping to the height of the content. Use for the one widget a tab is really about — a note's own* attributes, its table of contents, the chat — so that the rest keep to their content around it.*- * At most one widget per tab should ask for it: they would otherwise share the leftover height- * between them. It lapses while the widget is collapsed, so the others move up to fill the room.+ * Two of them in a tab share the leftover height between them, each keeping its own floor — the+ * connections tab's map and backlinks, a PDF's outline and its pages. Ask for it once more than+ * that and none of them is left with room worth having. It lapses while the widget is collapsed,+ * so the others move up to fill the room.*/grow?: boolean;/**