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(note_bars/collection): add a help button
Elian Doranc76ff2d371dc
diff --git a/apps/client/src/widgets/FloatingButtonsDefinitions.tsx b/apps/client/src/widgets/FloatingButtonsDefinitions.tsxindex 1c7a904a9d..171ea2fa80 100644--- a/apps/client/src/widgets/FloatingButtonsDefinitions.tsx+++ b/apps/client/src/widgets/FloatingButtonsDefinitions.tsx@@ -300,8 +300,9 @@ function ExportImageButtons({ note, triggerEvent, isDefaultViewMode }: FloatingBfunction InAppHelpButton({ note }: FloatingButtonContext) {const helpUrl = getHelpUrlForNote(note);+ const isEnabled = !!helpUrl && (!isNewLayout || (note?.type !== "book"));- return !!helpUrl && (+ return isEnabled && (<FloatingButtonicon="bx bx-help-circle"text={t("help-button.title")}diff --git a/apps/client/src/widgets/note_bars/CollectionProperties.tsx b/apps/client/src/widgets/note_bars/CollectionProperties.tsxindex ab74b43243..17e4242246 100644--- a/apps/client/src/widgets/note_bars/CollectionProperties.tsx+++ b/apps/client/src/widgets/note_bars/CollectionProperties.tsx@@ -12,6 +12,9 @@ import Icon from "../react/Icon";import { ParentComponent } from "../react/react_utils";import { bookPropertiesConfig, BookProperty, ButtonProperty, CheckBoxProperty, ComboBoxItem, ComboBoxProperty, NumberProperty, SplitButtonProperty } from "../ribbon/collection-properties-config";import { useViewType, VIEW_TYPE_MAPPINGS } from "../ribbon/CollectionPropertiesTab";+import ActionButton from "../react/ActionButton";+import { getHelpUrlForNote } from "../../services/in_app_help";+import { openInAppHelpFromUrl } from "../../services/utils";const ICON_MAPPINGS: Record<ViewTypeOptions, string> = {grid: "bx bxs-grid",@@ -28,13 +31,15 @@ export default function CollectionProperties({ note }: { note: FNote }) {return (<>- <ViewTypeSwitcher note={note} viewType={viewType} setViewType={setViewType} />+ <ViewTypeSwitcher viewType={viewType} setViewType={setViewType} /><ViewOptions note={note} viewType={viewType} />+ <div className="spacer" />+ <HelpButton note={note} /></>);}-function ViewTypeSwitcher({ note, viewType, setViewType }: { note: FNote, viewType: ViewTypeOptions, setViewType: (newValue: ViewTypeOptions) => void }) {+function ViewTypeSwitcher({ viewType, setViewType }: { viewType: ViewTypeOptions, setViewType: (newValue: ViewTypeOptions) => void }) {return (<Dropdowntext={<>@@ -187,7 +192,7 @@ function ComboBoxPropertyView({ note, property }: { note: FNote, property: Combo}})}</FormDropdownSubmenu>- )+ );}function CheckBoxPropertyView({ note, property }: { note: FNote, property: CheckBoxProperty }) {@@ -202,3 +207,14 @@ function CheckBoxPropertyView({ note, property }: { note: FNote, property: Check);}+function HelpButton({ note }: { note: FNote }) {+ const helpUrl = getHelpUrlForNote(note);++ return (helpUrl && (+ <ActionButton+ icon="bx bx-help-circle"+ onClick={(() => openInAppHelpFromUrl(helpUrl))}+ text={t("help-button.title")}+ />+ ));+}diff --git a/apps/client/src/widgets/note_title.css b/apps/client/src/widgets/note_title.cssindex 0d9912b339..79734e9288 100644--- a/apps/client/src/widgets/note_title.css+++ b/apps/client/src/widgets/note_title.css@@ -38,12 +38,18 @@ body.experimental-feature-new-layout {}.title-details {+ padding-inline-end: 16px;+.dropdown-menu {input.form-control {padding: 2px 8px;margin-left: 1em;}}++ .spacer {+ flex-grow: 1;+ }}.title-row {