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(options): move single-section help button into the page title
Elian Doranc7487c00f45a
diff --git a/apps/client/src/widgets/type_widgets/options/components/OptionsPageHeader.tsx b/apps/client/src/widgets/type_widgets/options/components/OptionsPageHeader.tsxindex 92d0cd4f2b..bdef5baf0d 100644--- a/apps/client/src/widgets/type_widgets/options/components/OptionsPageHeader.tsx+++ b/apps/client/src/widgets/type_widgets/options/components/OptionsPageHeader.tsx@@ -3,6 +3,7 @@ import "./OptionsPageHeader.css";import { ComponentChildren } from "preact";import { useNoteContext } from "../../../react/hooks";+import HelpButton from "../../../react/HelpButton";interface OptionsPageHeaderProps {/**@@ -15,6 +16,11 @@ interface OptionsPageHeaderProps {* — e.g. the shortcuts page's filter/search box.*/below?: ComponentChildren;+ /**+ * In-app help page shown as a help button next to the title. Use this for single-section pages+ * where the help is page-level rather than scoped to one card.+ */+ helpUrl?: string;}/**@@ -27,7 +33,7 @@ interface OptionsPageHeaderProps {* for options pages. The sticky-bar styling differs per context (see the CSS), but each page owns its* header the same way in all of them.*/-export default function OptionsPageHeader({ actions, below }: OptionsPageHeaderProps) {+export default function OptionsPageHeader({ actions, below, helpUrl }: OptionsPageHeaderProps) {const { note } = useNoteContext();// Nothing to render: the note isn't available yet and the page provided no content.@@ -42,6 +48,7 @@ export default function OptionsPageHeader({ actions, below }: OptionsPageHeaderP<div className="options-page-header-titles"><span className={`options-page-header-icon ${note.getIcon()}`} aria-hidden="true" /><h2 className="options-page-header-title">{note.title}</h2>+ {helpUrl && <HelpButton helpPage={helpUrl} />}</div>)}{actions && <div className="options-page-header-actions">{actions}</div>}diff --git a/apps/client/src/widgets/type_widgets/options/etapi.tsx b/apps/client/src/widgets/type_widgets/options/etapi.tsxindex 8c8e35b049..28e7fbaa79 100644--- a/apps/client/src/widgets/type_widgets/options/etapi.tsx+++ b/apps/client/src/widgets/type_widgets/options/etapi.tsx@@ -54,10 +54,9 @@ export default function EtapiSettings() {return (<>- <OptionsPageHeader />+ <OptionsPageHeader helpUrl="pgxEVkzLl1OP" /><OptionsSectiondescription={t("etapi.description")}- helpUrl="pgxEVkzLl1OP"><TokenList tokens={tokens} />diff --git a/apps/client/src/widgets/type_widgets/options/sync.tsx b/apps/client/src/widgets/type_widgets/options/sync.tsxindex beb32f76d3..d0b1d93d3e 100644--- a/apps/client/src/widgets/type_widgets/options/sync.tsx+++ b/apps/client/src/widgets/type_widgets/options/sync.tsx@@ -14,7 +14,7 @@ import TimeSelector from "./components/TimeSelector";export default function SyncOptions() {return (<>- <OptionsPageHeader />+ <OptionsPageHeader helpUrl="cbkrhQjrkKrh" /><SyncConfiguration /></>);@@ -30,7 +30,7 @@ export function SyncConfiguration() {useEffect(() => setLocalProxy(syncProxy), [syncProxy]);return (- <OptionsSection helpUrl="cbkrhQjrkKrh">+ <OptionsSection><OptionsRow name="sync-server-host" label={t("sync_2.server_address")} description={t("sync_2.server_address_description")} stacked><FormTextBoxplaceholder="https://<host>:<port>"