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(attributes): say a run holds nothing where nothing else does
Elian Doran6a91f9fb198c
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex fda7bb58b3..0007870e3d 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -802,6 +802,7 @@"placeholder": "Type the labels and relations here"},"attribute_list_panel": {+ "no_attributes": "No attributes","section_owned": "Owned","section_inherited": "Inherited","section_definitions": "Definitions",diff --git a/apps/client/src/widgets/sidebar/AttributeList.mobile.spec.tsx b/apps/client/src/widgets/sidebar/AttributeList.mobile.spec.tsxindex 4cfdd7e12a..a701de8bc2 100644--- a/apps/client/src/widgets/sidebar/AttributeList.mobile.spec.tsx+++ b/apps/client/src/widgets/sidebar/AttributeList.mobile.spec.tsx@@ -89,6 +89,18 @@ describe("AttributeList on a phone", () => {expect(container.querySelector(".attribute-add-row")).toBeNull();});+ it("says a run holds nothing, which a pointer's runs leave to the add row beneath them", () => {+ renderPanel(buildNote({ id: "phone-bare-run", title: "Bare" }));++ // The card would otherwise stand empty and say nothing: a phone keeps what is done to a run+ // in the card's header, so there is no add row inside it to imply the run is waiting to be+ // filled. AttributeList.spec asserts the other half — that a pointer gets no such notice.+ expect(container.querySelectorAll(".attribute-row")).toHaveLength(0);+ expect(section("attributes-owned").querySelector(".no-items")).not.toBeNull();+ // Only the note's own run is ever shown empty; the rest are left out when they hold nothing.+ expect(sectionIds()).toEqual([ "attributes-owned" ]);+ });+it("offers pasting from the first card's header, which is a phone's only way to it", async () => {// Nothing copied, nothing offered — as the row menu and the selection's bar do.renderPanel(noteWithRuns());diff --git a/apps/client/src/widgets/sidebar/AttributeList.tsx b/apps/client/src/widgets/sidebar/AttributeList.tsxindex b09f8b4905..0fa30d6d29 100644--- a/apps/client/src/widgets/sidebar/AttributeList.tsx+++ b/apps/client/src/widgets/sidebar/AttributeList.tsx@@ -26,6 +26,7 @@ import HelpButton from "../react/HelpButton";import { useActiveNoteContext, useTriliumEvent, useTriliumOptionJson } from "../react/hooks";import Icon from "../react/Icon";import { DetailPane, MasterPane, useMasterDetail, useMasterDetailPage } from "../react/master_detail";+import NoItems from "../react/NoItems";import NoteLink from "../react/NoteLink";import { ParentComponent } from "../react/react_utils";import { ATTRIBUTE_HELP_PAGE } from "../ribbon/components/AttributeHelp";@@ -804,6 +805,17 @@ export default function AttributeList() {{...panelProps}>{run.rows}++ {/* A run holding nothing says so here, where a pointer's does not: there,+ the count says the run is empty and the add row beneath it says what+ there is to do about it, so a third telling would be one too many. A+ phone has no add row — a card keeps what is done to it in its header —+ which leaves an empty run as an empty card, saying nothing at all. Only+ the note's own attributes can be shown empty; every other run is left+ out entirely when it holds nothing. */}+ {run.count === 0 && (+ <NoItems icon="bx bx-hash" text={t("attribute_list_panel.no_attributes")} />+ )}</div></AttributeSection>))}