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
client/space usage tool: use scrollable labels for the selection bar
Adorian Doran9752a3c2ee25
diff --git a/apps/client/src/widgets/type_widgets/space_usage/selection.css b/apps/client/src/widgets/type_widgets/space_usage/selection.cssindex f07ac088b6..e90854cf9f 100644--- a/apps/client/src/widgets/type_widgets/space_usage/selection.css+++ b/apps/client/src/widgets/type_widgets/space_usage/selection.css@@ -39,39 +39,25 @@cursor: pointer;}-/*- * Where the note sits, as its ancestors' names. Scrolled by dragging it: a path is as long as it is,- * and cutting it short would take off the end that says which of several like-named notes this is.- * The bar itself is hidden, having no room of its own to take on a line this size.- */+/* Where the note sits, as its ancestors' names: the end of it is what says which of several+ like-named notes this is, so it is swiped to rather than cut off (see ScrollableLabel). */.space-usage-selection-path {grid-row: 1;grid-column: 1;- overflow-x: auto;color: var(--muted-text-color);font-size: 0.75em;line-height: 1.2;- white-space: nowrap;text-transform: uppercase;- scrollbar-width: none;}-.space-usage-selection-path::-webkit-scrollbar {- display: none;-}--/* The note itself, so it is the line the eye lands on. Cut short rather than scrolled: this is one- name, and its beginning is the part that identifies it. */+/* The note itself, so it is the line the eye lands on. */.space-usage-selection-name {grid-row: 2;grid-column: 1;margin-block-start: 4px;- overflow: hidden;font-size: 1.2em;font-weight: 500;line-height: 1.2;- white-space: nowrap;- text-overflow: ellipsis;}/* Set against both rows, being what the whole strip is about. */diff --git a/apps/client/src/widgets/type_widgets/space_usage/selection.tsx b/apps/client/src/widgets/type_widgets/space_usage/selection.tsxindex edef4f74a3..b20c0b3029 100644--- a/apps/client/src/widgets/type_widgets/space_usage/selection.tsx+++ b/apps/client/src/widgets/type_widgets/space_usage/selection.tsx@@ -7,6 +7,7 @@ import { useEffect, useState } from "preact/hooks";import froca from "../../../services/froca";import { t } from "../../../services/i18n";import { formatSize } from "../../../services/utils";+import ScrollableLabel from "../../react/ScrollableLabel";/*** A mark the user picked out of a chart: which one it is, what it stands for, and what can be done@@ -57,8 +58,28 @@ export default function SelectionStrip({ selection, containerRef }: {>{selection ? (<>- <span className="space-usage-selection-path">{path.join(" › ")}</span>- <span className="space-usage-selection-name">{name}</span>+ {/* Both lines are as long as what they name, and neither is worth cutting short:+ swiped along instead, with the fades saying where they carry on.++ The path walks itself: it is the line the reader did not ask for, and its own+ end — the note's parent — is the part that says which of several like-named+ notes this is. The name is left to be swiped, being what was tapped.++ Keyed on the mark, so a new one gets new labels rather than the last one's:+ each starts back at its beginning, with its walk to take and its swipe to be+ handed over by. Two marks can read exactly alike — siblings share a path — so+ the text is no sign that the item is still the same one. */}+ <ScrollableLabel+ key={`${selection.markId}/path`}+ className="space-usage-selection-path"+ autoScroll+ >+ {path.join(" › ")}+ </ScrollableLabel>+ <ScrollableLabel+ key={`${selection.markId}/name`}+ className="space-usage-selection-name"+ >{name}</ScrollableLabel><span className="space-usage-selection-size">{formatSize(selection.size)}</span></>) : (