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
chore(options/sync): floating help button
Elian Doran4baa22a01a93
diff --git a/apps/client/src/stylesheets/theme-next/pages.css b/apps/client/src/stylesheets/theme-next/pages.cssindex 42a831bae7..487fa70141 100644--- a/apps/client/src/stylesheets/theme-next/pages.css+++ b/apps/client/src/stylesheets/theme-next/pages.css@@ -221,6 +221,23 @@ body.desktop .options-section:not(.tn-no-card) {margin-inline-start: calc(-1 * var(--options-card-padding));}+.options-section:not(.tn-no-card) .options-section-header {+ display: flex;+ justify-content: space-between;+ align-items: flex-start;+ margin-top: calc(-1 * var(--options-card-padding) - var(--options-title-font-size) - var(--options-title-offset));+ margin-inline: calc(-1 * var(--options-card-padding));+ margin-bottom: calc(var(--options-title-offset) + var(--options-card-padding));+}++.options-section:not(.tn-no-card) .options-section-header h4 {+ margin: 0 !important;+}++.options-section:not(.tn-no-card) .options-section-header .icon-action {+ margin-inline-start: auto;+}+.options-section:not(.tn-no-card) h5 {font-size: var(--options-title-font-size);font-weight: bold;diff --git a/apps/client/src/widgets/type_widgets/options/components/OptionsSection.tsx b/apps/client/src/widgets/type_widgets/options/components/OptionsSection.tsxindex ce42b66e36..18c86e7d2f 100644--- a/apps/client/src/widgets/type_widgets/options/components/OptionsSection.tsx+++ b/apps/client/src/widgets/type_widgets/options/components/OptionsSection.tsx@@ -1,5 +1,7 @@import type { ComponentChildren } from "preact";import { CSSProperties } from "preact/compat";+import { openInAppHelpFromUrl } from "../../../../services/utils";+import ActionButton from "../../../react/ActionButton";interface OptionsSectionProps {title?: ComponentChildren;@@ -7,12 +9,24 @@ interface OptionsSectionProps {noCard?: boolean;style?: CSSProperties;className?: string;+ helpUrl?: string;}-export default function OptionsSection({ title, children, noCard, className, ...rest }: OptionsSectionProps) {+export default function OptionsSection({ title, children, noCard, className, helpUrl, ...rest }: OptionsSectionProps) {return (<div className={`options-section ${noCard ? "tn-no-card" : ""} ${className ?? ""}`} {...rest}>- {title && <h4>{title}</h4>}+ {(title || helpUrl) && (+ <div className="options-section-header">+ {title && <h4>{title}</h4>}+ {helpUrl && (+ <ActionButton+ icon="bx bx-help-circle"+ text="Help"+ onClick={() => openInAppHelpFromUrl(helpUrl)}+ />+ )}+ </div>+ )}{children}</div>);diff --git a/apps/client/src/widgets/type_widgets/options/sync.tsx b/apps/client/src/widgets/type_widgets/options/sync.tsxindex 68c68c99bf..8c0b813de8 100644--- a/apps/client/src/widgets/type_widgets/options/sync.tsx+++ b/apps/client/src/widgets/type_widgets/options/sync.tsx@@ -4,7 +4,6 @@ import { useRef } from "preact/hooks";import { t } from "../../../services/i18n";import server from "../../../services/server";import toast from "../../../services/toast";-import { openInAppHelpFromUrl } from "../../../services/utils";import Button from "../../react/Button";import FormTextBox from "../../react/FormTextBox";import { useTriliumOptions } from "../../react/hooks";@@ -22,7 +21,7 @@ export function SyncConfiguration() {const syncProxy = useRef(options.syncProxy);return (- <OptionsSection>+ <OptionsSection helpUrl="cbkrhQjrkKrh"><form onSubmit={(e) => {setOptions({syncServerHost: syncServerHost.current,@@ -45,10 +44,7 @@ export function SyncConfiguration() {</OptionsRow><OptionsRow name="save-sync-config" centered>- <div style={{ display: "flex", gap: "8px" }}>- <Button text={t("sync_2.save")} kind="primary" />- <Button text={t("sync_2.help")} onClick={() => openInAppHelpFromUrl("cbkrhQjrkKrh")} />- </div>+ <Button text={t("sync_2.save")} kind="primary" /></OptionsRow></form>