Skip to content

Build your personal knowledge base with Trilium Notes

feat(client): carry the sidebar's ? into the attributes pane

Elian Dorand9b5b721e2eb
diff --git a/apps/client/src/services/in_app_help.ts b/apps/client/src/services/in_app_help.ts
index a77cb1aabf..407388be49 100644
--- a/apps/client/src/services/in_app_help.ts
+++ b/apps/client/src/services/in_app_help.ts
@@ -34,6 +34,9 @@ export const byBookType: Record<ViewTypeOptions, string | null> = {
dashboard: "IF7Q6I9x7zuw"
};
+/** In-app help note describing labels and relations. */
+export const ATTRIBUTE_HELP_PAGE = "zEY4DaJG4YT5";
+
/** What one card of the right sidebar offers when its `?` is pressed. */
export interface SidebarSectionHelp {
/** In-app help note the "Open help page" link at the foot of the popup goes to. */
@@ -52,6 +55,20 @@ export interface SidebarSectionHelp {
* for whichever tab happens to be on show, and then pick one of those pages out of several.
*/
export const bySidebarSection = {
+ attributes: {
+ helpPage: ATTRIBUTE_HELP_PAGE,
+ paragraphs: [ "sidebar_help.attributes_what", "sidebar_help.attributes_inheritable" ]
+ },
+ "attributes-inherited": {
+ // Attribute Inheritance, covering both ways one reaches a note it isn't set on.
+ helpPage: "bwZpz2ajCEwO",
+ paragraphs: [ "sidebar_help.attributes_inherited_what", "sidebar_help.attributes_inherited_source" ]
+ },
+ "attributes-definitions": {
+ // Promoted Attributes, where a definition is set out and what promoting it does.
+ helpPage: "OFXdgB2nNk1F",
+ paragraphs: [ "sidebar_help.attributes_definitions_what", "sidebar_help.attributes_definitions_promoted" ]
+ },
noteMap: {
// Note Map (Link map, Tree map).
helpPage: "BCkXAVs63Ttv",
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index 630d70e909..f226cdd2d8 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -1389,6 +1389,12 @@
"no_similar_notes_found": "No similar notes found."
},
"sidebar_help": {
+ "attributes_what": "The labels and relations set on this note itself. A label tags the note with a name and, if you like, a value; a relation points it at another note.",
+ "attributes_inheritable": "Marking one inheritable passes it down the whole subtree under the note, where it is listed as inherited rather than owned.",
+ "attributes_inherited_what": "Labels and relations reaching this note from elsewhere: an inheritable one set on a note above it, or one carried in by a template.",
+ "attributes_inherited_source": "They are read-only here. Each row names the note it comes from, which is where it can be changed or removed.",
+ "attributes_definitions_what": "A definition is the schema behind an attribute name: what kind of value it takes, whether it may be given more than once, and whether it is promoted.",
+ "attributes_definitions_promoted": "A promoted attribute is shown on the note itself as a form field rather than being left to this panel. Definitions usually arrive from a template, and each row names the note it lives on.",
"note_map_what": "A map of what this note connects to. The link map draws the internal links and relations going in and out of it; the tree map draws where it sits in the note tree. The switcher in this header chooses between the two.",
"note_map_interaction": "Hovering a note brings its own connections forward and fades the rest. The expand button opens the same map at the size of the window.",
"note_paths_what": "A note can sit in more than one place in the note tree at once, and each of those places is listed here as a path.",
diff --git a/apps/client/src/widgets/layout/StatusBar.tsx b/apps/client/src/widgets/layout/StatusBar.tsx
index 55debf2679..1716f222d4 100644
--- a/apps/client/src/widgets/layout/StatusBar.tsx
+++ b/apps/client/src/widgets/layout/StatusBar.tsx
@@ -12,6 +12,7 @@ import NoteContext from "../../components/note_context";
import FNote from "../../entities/fnote";
import attributes from "../../services/attributes";
import { t } from "../../services/i18n";
+import { ATTRIBUTE_HELP_PAGE } from "../../services/in_app_help";
import { ViewScope } from "../../services/link";
import { NOTE_TYPES } from "../../services/note_types";
import server from "../../services/server";
@@ -27,7 +28,7 @@ import LinkButton from "../react/LinkButton";
import { ParentComponent } from "../react/react_utils";
import { ContentLanguagesModal, NoteTypeCodeNoteList, NoteTypeOptionsModal, useLanguageSwitcher, useMimeTypes } from "../ribbon/BasicPropertiesTab";
import AttributeEditor, { AttributeEditorImperativeHandlers } from "../ribbon/components/AttributeEditor";
-import AttributeHelp, { ATTRIBUTE_HELP_PAGE } from "../ribbon/components/AttributeHelp";
+import AttributeHelp from "../ribbon/components/AttributeHelp";
import InheritedAttributesTab from "../ribbon/InheritedAttributesTab";
import { NoteSizeWidget, useNoteMetadata } from "../ribbon/NoteInfoTab";
import { useSortedNotePaths } from "../ribbon/NotePathsTab";
diff --git a/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx b/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx
index 8818e852d9..5191e145c9 100644
--- a/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx
+++ b/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx
@@ -16,6 +16,7 @@ import attribute_renderer from "../../../services/attribute_renderer";
import attributes, { isBuiltinAttribute } from "../../../services/attributes";
import froca from "../../../services/froca";
import { t } from "../../../services/i18n";
+import { ATTRIBUTE_HELP_PAGE } from "../../../services/in_app_help";
import link from "../../../services/link";
import note_autocomplete, { Suggestion } from "../../../services/note_autocomplete";
import note_create from "../../../services/note_create";
@@ -27,7 +28,7 @@ import ActionButton from "../../react/ActionButton";
import CKEditor, { CKEditorApi } from "../../react/CKEditor";
import HelpDropdown from "../../react/HelpDropdown";
import { useLegacyImperativeHandlers, useLegacyWidget, useTriliumEvent } from "../../react/hooks";
-import AttributeHelp, { ATTRIBUTE_HELP_PAGE } from "./AttributeHelp";
+import AttributeHelp from "./AttributeHelp";
type AttributeCommandNames = FilteredCommandNames<CommandData>;
diff --git a/apps/client/src/widgets/ribbon/components/AttributeHelp.tsx b/apps/client/src/widgets/ribbon/components/AttributeHelp.tsx
index e04b2f0c0d..bfea90dba5 100644
--- a/apps/client/src/widgets/ribbon/components/AttributeHelp.tsx
+++ b/apps/client/src/widgets/ribbon/components/AttributeHelp.tsx
@@ -3,9 +3,6 @@ import "./AttributeHelp.css";
import { t } from "../../../services/i18n";
import { RawHtmlBlock } from "../../react/RawHtml";
-/** In-app help note describing labels and relations. */
-export const ATTRIBUTE_HELP_PAGE = "zEY4DaJG4YT5";
-
/**
* Quick reference on how to type attributes into the attribute editor. Rendered inside a
* `HelpDropdown`, either the editor's own `?` button or the attributes panel's one in the new layout.
diff --git a/apps/client/src/widgets/sidebar/AttributeList.tsx b/apps/client/src/widgets/sidebar/AttributeList.tsx
index 73285fb4f1..68976c3687 100644
--- a/apps/client/src/widgets/sidebar/AttributeList.tsx
+++ b/apps/client/src/widgets/sidebar/AttributeList.tsx
@@ -19,18 +19,17 @@ import { AttributeDetail, AttributeDetailOpts, AttributeForm, AttrType, DEFINITI
import { ColorChip, renderLabelValue } from "../attribute_widgets/label_value_display";
import ActionButton from "../react/ActionButton";
import { FormListItem } from "../react/FormList";
-import HelpButton from "../react/HelpButton";
import { useActiveNoteContext, useTriliumEvent } 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";
import OptionsSection from "../type_widgets/options/components/OptionsSection";
import AttributeCreationEditor from "./AttributeCreationEditor";
import AttributeValueEditor, { resolveValueField } from "./AttributeValueEditor";
import RightPanelWidget, { CollapsibleWidgets } from "./RightPanelWidget";
+import SidebarHelp from "./SidebarHelp";
/**
* The note's attributes as a list, one row per attribute: the kind (label, relation, or either's
@@ -375,7 +374,7 @@ export default function AttributeList() {
grow
buttons={note && (
<>
- <HelpButton helpPage={ATTRIBUTE_HELP_PAGE} />
+ <SidebarHelp section="attributes" />
<AddAttributeButton
text={t("attribute_editor.add_a_new_attribute")}
attrTypes={ALL_ATTRIBUTE_KINDS}
@@ -407,6 +406,7 @@ export default function AttributeList() {
<AttributeSection
id="attributes-inherited"
title={t("attribute_list_panel.inherited", { count: sections.inherited.length })}
+ buttons={<SidebarHelp section="attributes-inherited" />}
>
<div class="attribute-list-panel align-values-end" onClick={commit}>
<AttributeRowList rows={sections.inherited} {...rowProps} />
@@ -418,13 +418,16 @@ export default function AttributeList() {
<AttributeSection
id="attributes-definitions"
title={t("attribute_list_panel.definitions", { count: sections.definitions.length })}
- buttons={note && (
- <AddAttributeButton
- text={t("attribute_list_panel.add_definition")}
- attrTypes={DEFINITION_KINDS}
- onSelect={addAttribute}
- />
- )}
+ buttons={<>
+ <SidebarHelp section="attributes-definitions" />
+ {note && (
+ <AddAttributeButton
+ text={t("attribute_list_panel.add_definition")}
+ attrTypes={DEFINITION_KINDS}
+ onSelect={addAttribute}
+ />
+ )}
+ </>}
>
<div class="attribute-list-panel" onClick={commit}>
<AttributeRowList rows={sections.definitions} {...rowProps} />