Skip to content

Build your personal knowledge base with Trilium Notes

feat(options): give each settings page a title header

Elian Doran87a5411e84db
diff --git a/apps/client/src/widgets/dialogs/OptionsDialog.css b/apps/client/src/widgets/dialogs/OptionsDialog.css
index 877ad56fe4..d8a1c33ada 100644
--- a/apps/client/src/widgets/dialogs/OptionsDialog.css
+++ b/apps/client/src/widgets/dialogs/OptionsDialog.css
@@ -37,68 +37,6 @@ body.desktop .modal.options-dialog .modal-main > .modal-header {
margin: auto;
}
-/* Page title banner at the top of the content area. The outer bar spans the full content width and
- sticks to the top of the scrolling body (with the modal background painted behind it so cards
- scroll cleanly beneath); the inner row aligns with the centered option cards. Reuses the
- quick-edit popup's title-row look: the page icon sits in a circular badge (same --note-icon-*
- theme tokens as the popup's note icon) beside the page title. */
-.modal.options-dialog .options-page-header {
- position: sticky;
- top: 0;
- z-index: 1;
- background: var(--modal-background-color);
- border-bottom: 1px solid var(--main-border-color);
-}
-
-.modal.options-dialog .options-page-header-inner {
- display: flex;
- align-items: center;
- gap: 12px;
- max-width: var(--options-card-max-width);
- margin: 0 auto;
- /* Leave room for the floating window buttons and breathing space around the title. */
- padding: 14px 0;
-}
-
-.modal.options-dialog .options-page-header-icon {
- --badge-size: 40px;
-
- position: relative;
- flex: 0 0 auto;
- display: inline-flex;
- align-items: center;
- justify-content: center;
- width: var(--badge-size);
- height: var(--badge-size);
- font-size: 22px;
- line-height: 1;
-}
-
-/* The glyph, painted above the circle. */
-.modal.options-dialog .options-page-header-icon::before {
- position: relative;
- z-index: 1;
- color: var(--note-icon-color);
-}
-
-/* The circular background behind the glyph. */
-.modal.options-dialog .options-page-header-icon::after {
- content: "";
- position: absolute;
- inset: 0;
- border-radius: 50%;
- background: var(--note-icon-background-color);
-}
-
-.modal.options-dialog .options-page-header-title {
- margin: 0;
- font-size: 1.4rem;
- font-weight: 600;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
-}
-
/* The dialog fills the full mobile page (isFullPageOnMobile), so the body stretches instead of
using the fixed desktop height. Applies to both the master-detail and the tablet layout. */
body.mobile .modal.options-dialog .modal-body {
@@ -271,3 +209,7 @@ body[dir=rtl].mobile .modal.options-dialog.mobile-master-detail.mobile-transitio
white-space: nowrap;
text-overflow: ellipsis;
}
+
+.modal.options-dialog .options-page-header {
+ margin-bottom: 2em;
+}
diff --git a/apps/client/src/widgets/dialogs/OptionsDialog.tsx b/apps/client/src/widgets/dialogs/OptionsDialog.tsx
index ed2de35133..85112b379a 100644
--- a/apps/client/src/widgets/dialogs/OptionsDialog.tsx
+++ b/apps/client/src/widgets/dialogs/OptionsDialog.tsx
@@ -13,6 +13,7 @@ import FormList, { FormListItem } from "../react/FormList";
import { useChildNotes, useContainedLinkNavigation, useMobileMasterDetail, useNoteContext, useTriliumEvent } from "../react/hooks";
import Modal from "../react/Modal";
import { NoteContextContext, ParentComponent } from "../react/react_utils";
+import { ShowOptionsPageTitleContext } from "../type_widgets/options/components/OptionsPageHeader";
import SettingsNavigation from "../type_widgets/options/components/SettingsNavigation";
/** The settings page shown when no specific section was requested and none was viewed yet this session. */
@@ -62,44 +63,48 @@ export default function OptionsDialog() {
return (
<NoteContextContext.Provider value={noteContext}>
- <Modal
- modalRef={modalRef}
- title={t("options.title")}
- header={isMasterDetail && (mobileView === "page" ? <MobilePageHeader onBack={() => switchMobileView("list")} /> : <MobilePageHeader />)}
- sidebar={isMasterDetail ? undefined : <SettingsSidebar />}
- isFullPageOnMobile
- customTitleBarButtons={!isMobile ? [{
- iconClassName: "bx-expand-alt",
- title: t("popup-editor.maximize"),
- onClick: async () => {
- if (!noteContext.noteId) return;
- const { noteId, hoistedNoteId } = noteContext;
- await appContext.tabManager.openInNewTab(noteId, hoistedNoteId, true);
- setShown(false);
- }
- }] : undefined}
- className="options-dialog"
- size="lg"
- show={shown}
- onHidden={() => {
+ {/* On desktop/tablet the dialog hides the note's own title, so each settings page renders
+ its title in its OptionsPageHeader. In the mobile master-detail flow the modal header
+ shows the title instead, so the page header there contributes only its actions. */}
+ <ShowOptionsPageTitleContext.Provider value={!isMasterDetail}>
+ <Modal
+ modalRef={modalRef}
+ title={t("options.title")}
+ header={isMasterDetail && (mobileView === "page" ? <MobilePageHeader onBack={() => switchMobileView("list")} /> : <MobilePageHeader />)}
+ sidebar={isMasterDetail ? undefined : <SettingsSidebar />}
+ isFullPageOnMobile
+ customTitleBarButtons={!isMobile ? [{
+ iconClassName: "bx-expand-alt",
+ title: t("popup-editor.maximize"),
+ onClick: async () => {
+ if (!noteContext.noteId) return;
+ const { noteId, hoistedNoteId } = noteContext;
+ await appContext.tabManager.openInNewTab(noteId, hoistedNoteId, true);
+ setShown(false);
+ }
+ }] : undefined}
+ className="options-dialog"
+ size="lg"
+ show={shown}
+ onHidden={() => {
// Remember the settings page in view so the next open lands on it.
- if (noteContext.noteId) {
- setLastSection(noteContext.noteId);
- }
- setShown(false);
- }}
- >
- {isMasterDetail && (
- <div className="options-mobile-nav">
- <MobileSettingsList onSelect={(noteId) => {
- void noteContext.setNote(noteId, { keepActiveDialog: true });
- switchMobileView("page");
- }} />
- </div>
- )}
- {!isMasterDetail && <OptionsPageHeader />}
- <NoteDetail />
- </Modal>
+ if (noteContext.noteId) {
+ setLastSection(noteContext.noteId);
+ }
+ setShown(false);
+ }}
+ >
+ {isMasterDetail && (
+ <div className="options-mobile-nav">
+ <MobileSettingsList onSelect={(noteId) => {
+ void noteContext.setNote(noteId, { keepActiveDialog: true });
+ switchMobileView("page");
+ }} />
+ </div>
+ )}
+ <NoteDetail />
+ </Modal>
+ </ShowOptionsPageTitleContext.Provider>
</NoteContextContext.Provider>
);
}
@@ -171,26 +176,6 @@ function MobileSettingsList({ onSelect }: { onSelect: (noteId: string) => void }
);
}
-/**
- * The title banner shown at the top of the content area on desktop and tablet layouts, where the
- * page title isn't otherwise visible (the modal header only carries the window buttons). It mirrors
- * the quick-edit popup's title row — the page's icon in a circular badge beside the title — but is
- * purely decorative since settings pages aren't user-editable. On the mobile master-detail flow the
- * page title already lives in the modal header (see {@link MobilePageHeader}), so this is omitted.
- */
-function OptionsPageHeader() {
- const { note } = useNoteContext();
- if (!note) return null;
- return (
- <div className="options-page-header">
- <div className="options-page-header-inner">
- <span className={`options-page-header-icon ${note.getIcon()}`} aria-hidden="true" />
- <h2 className="options-page-header-title">{note.title}</h2>
- </div>
- </div>
- );
-}
-
/**
* Replaces the static "Options" title on mobile. In the page view it shows a back button returning
* to the master list followed by the title of the page in view; in the list view a decorative
diff --git a/apps/client/src/widgets/type_widgets/options/advanced.tsx b/apps/client/src/widgets/type_widgets/options/advanced.tsx
index 3eea8f7ad3..7b8a92e7bf 100644
--- a/apps/client/src/widgets/type_widgets/options/advanced.tsx
+++ b/apps/client/src/widgets/type_widgets/options/advanced.tsx
@@ -8,11 +8,13 @@ import toast from "../../../services/toast";
import FormText from "../../react/FormText";
import { useTriliumOptionJson } from "../../react/hooks";
import DatabaseFileList from "./components/DatabaseFileList";
+import OptionsPageHeader from "./components/OptionsPageHeader";
import { OptionsRowWithButton, OptionsRowWithToggle } from "./components/OptionsRow";
import OptionsSection from "./components/OptionsSection";
export default function AdvancedSettings() {
return <>
+ <OptionsPageHeader />
<DatabaseOptions />
<DatabaseAnonymizationOptions />
<ExperimentalOptions />
diff --git a/apps/client/src/widgets/type_widgets/options/appearance.tsx b/apps/client/src/widgets/type_widgets/options/appearance.tsx
index 9475dae590..ca38720a23 100644
--- a/apps/client/src/widgets/type_widgets/options/appearance.tsx
+++ b/apps/client/src/widgets/type_widgets/options/appearance.tsx
@@ -18,6 +18,7 @@ import { useTriliumOption, useTriliumOptionBool } from "../../react/hooks";
import Icon from "../../react/Icon";
import Modal from "../../react/Modal";
import Slider from "../../react/Slider";
+import OptionsPageHeader from "./components/OptionsPageHeader";
import OptionsRow, { OptionsRowWithToggle } from "./components/OptionsRow";
import OptionsSection from "./components/OptionsSection";
import PlatformIndicator from "./components/PlatformIndicator";
@@ -125,6 +126,7 @@ const FONT_FAMILIES: FontGroup[] = [
export default function AppearanceSettings() {
return (
<>
+ <OptionsPageHeader />
<UserInterface />
<Fonts />
{isElectron() && <ElectronIntegration /> }
diff --git a/apps/client/src/widgets/type_widgets/options/backup.tsx b/apps/client/src/widgets/type_widgets/options/backup.tsx
index 9f1aa017c2..53a99030ba 100644
--- a/apps/client/src/widgets/type_widgets/options/backup.tsx
+++ b/apps/client/src/widgets/type_widgets/options/backup.tsx
@@ -7,6 +7,7 @@ import toast from "../../../services/toast";
import Button from "../../react/Button";
import { useTriliumOptionBool } from "../../react/hooks";
import DatabaseFileList from "./components/DatabaseFileList";
+import OptionsPageHeader from "./components/OptionsPageHeader";
import OptionsRow, { OptionsRowWithToggle } from "./components/OptionsRow";
import OptionsSection from "./components/OptionsSection";
@@ -25,6 +26,7 @@ export default function BackupSettings() {
return (
<>
+ <OptionsPageHeader />
<BackupConfiguration />
<BackupList backups={backups} backupFolderPath={backupFolderPath} refreshCallback={refreshBackups} />
</>
diff --git a/apps/client/src/widgets/type_widgets/options/code_notes.tsx b/apps/client/src/widgets/type_widgets/options/code_notes.tsx
index 8c11cf04b9..3feffad338 100644
--- a/apps/client/src/widgets/type_widgets/options/code_notes.tsx
+++ b/apps/client/src/widgets/type_widgets/options/code_notes.tsx
@@ -9,6 +9,7 @@ import { FormTextBoxWithUnit } from "../../react/FormTextBox";
import { useColorScheme, useTriliumOption, useTriliumOptionBool } from "../../react/hooks";
import { CODE_THEME_DEFAULT_PREFIX as DEFAULT_PREFIX } from "../constants";
import { CodeMimeTypesList } from "./code_mime_types_list";
+import OptionsPageHeader from "./components/OptionsPageHeader";
import OptionsRow, { OptionsRowWithToggle } from "./components/OptionsRow";
import OptionsSection from "./components/OptionsSection";
import ThemeModeSelector from "./components/ThemeModeSelector";
@@ -22,6 +23,7 @@ export default function CodeNoteSettings() {
return (
<>
+ <OptionsPageHeader />
<Editor wordWrapping={codeLineWrapEnabled} setWordWrapping={setCodeLineWrapEnabled} />
<Appearance wordWrapping={codeLineWrapEnabled} indentSize={parseInt(codeNoteTabWidth) || 4} />
<CodeMimeTypes />
diff --git a/apps/client/src/widgets/type_widgets/options/components/OptionsPageHeader.css b/apps/client/src/widgets/type_widgets/options/components/OptionsPageHeader.css
new file mode 100644
index 0000000000..087381d0d4
--- /dev/null
+++ b/apps/client/src/widgets/type_widgets/options/components/OptionsPageHeader.css
@@ -0,0 +1,90 @@
+.options-page-header-inner {
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+ max-width: var(--options-card-max-width);
+ margin: 0 auto;
+}
+
+/* Title row: the page title/icon and the page's primary actions side by side. */
+.options-page-header-main {
+ display: flex;
+ align-items: center;
+ gap: 16px;
+}
+
+.options-page-header-titles {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ flex: 0 0 auto;
+}
+
+/* Circular icon badge, reusing the quick-edit popup's note-icon theme tokens: the glyph (::before)
+ is painted above a circular background (::after). */
+.options-page-header-icon {
+ --badge-size: 40px;
+
+ position: relative;
+ flex: 0 0 auto;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ width: var(--badge-size);
+ height: var(--badge-size);
+ font-size: 22px;
+ line-height: 1;
+}
+
+.options-page-header-icon::before {
+ position: relative;
+ z-index: 1;
+ color: var(--note-icon-color);
+}
+
+.options-page-header-icon::after {
+ content: "";
+ position: absolute;
+ inset: 0;
+ border-radius: 50%;
+ background: var(--note-icon-background-color);
+}
+
+.options-page-header-title {
+ margin: 0;
+ font-size: 1.4rem;
+ /* Match the note's own title chrome (input.note-title, which inherits the normal body weight)
+ shown when the page is opened standalone, rather than the browser's bold <h2> default. */
+ font-weight: normal;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+}
+
+.options-page-header-actions {
+ flex: 1 1 auto;
+ min-width: 0;
+}
+
+/* In the settings dialog: a full-width bar that sticks to the top of the scrolling body, painted
+ with the modal background so cards scroll cleanly beneath it. */
+.modal.options-dialog .options-page-header {
+ position: sticky;
+ top: 0;
+ z-index: 1;
+ background: var(--modal-background-color);
+ border-bottom: 1px solid var(--main-border-color);
+ padding-block: 10px;
+}
+
+/* Standalone (page opened in a tab): the note's own title chrome already shows the title, so this is
+ just the actions bar. Keep it sticky to the content with the main background. */
+.note-split.options .options-page-header {
+ position: sticky;
+ top: 0;
+ z-index: 1;
+ background: var(--main-background-color);
+ border-bottom: 1px solid var(--main-border-color);
+ padding-block: 8px;
+ margin-bottom: 1em;
+}
diff --git a/apps/client/src/widgets/type_widgets/options/components/OptionsPageHeader.tsx b/apps/client/src/widgets/type_widgets/options/components/OptionsPageHeader.tsx
new file mode 100644
index 0000000000..82ab24c5f8
--- /dev/null
+++ b/apps/client/src/widgets/type_widgets/options/components/OptionsPageHeader.tsx
@@ -0,0 +1,64 @@
+import "./OptionsPageHeader.css";
+
+import { ComponentChildren, createContext } from "preact";
+import { useContext } from "preact/hooks";
+
+import { useNoteContext } from "../../../react/hooks";
+
+/**
+ * Whether an options page's header should render the page title and icon. The settings dialog sets
+ * this to `true` on desktop/tablet, where it hides the note's own title chrome and the page header
+ * is the only place the title appears. It stays `false` standalone (the note's normal title chrome
+ * already shows the title) and in the dialog's mobile master-detail flow (the modal header shows it
+ * there), so the header renders only its actions in those cases.
+ */
+export const ShowOptionsPageTitleContext = createContext(false);
+
+interface OptionsPageHeaderProps {
+ /**
+ * Page-specific controls shown on the title row — e.g. a master enable toggle or, for the
+ * shortcuts page, the conflicts badge and reset buttons.
+ */
+ actions?: ComponentChildren;
+ /**
+ * Content shown on its own full-width row beneath the title row but still inside the header bar
+ * — e.g. the shortcuts page's filter/search box.
+ */
+ below?: ComponentChildren;
+}
+
+/**
+ * The header banner an options page renders at the top of its content. It shows the page title and
+ * icon (when {@link ShowOptionsPageTitleContext} is set) beside any page-defined
+ * {@link OptionsPageHeaderProps.actions}, with optional {@link OptionsPageHeaderProps.below} content
+ * on a full-width row underneath. The same component is used in the settings dialog (where it sticks
+ * to the top as a full-width bar — see the `.modal.options-dialog` styling) and standalone in a tab
+ * (`.note-split.options`), so each page owns its header in both contexts.
+ */
+export default function OptionsPageHeader({ actions, below }: OptionsPageHeaderProps) {
+ const { note } = useNoteContext();
+ const showTitle = useContext(ShowOptionsPageTitleContext);
+ const titleNote = showTitle ? note : null;
+
+ // Nothing to render: no title belongs here and the page provided no content.
+ if (!titleNote && !actions && !below) return null;
+
+ return (
+ <div className="options-page-header">
+ <div className="options-page-header-inner">
+ {(titleNote || actions) && (
+ <div className="options-page-header-main">
+ {titleNote && (
+ <div className="options-page-header-titles">
+ <span className={`options-page-header-icon ${titleNote.getIcon()}`} aria-hidden="true" />
+ <h2 className="options-page-header-title">{titleNote.title}</h2>
+ </div>
+ )}
+ {actions && <div className="options-page-header-actions">{actions}</div>}
+ </div>
+ )}
+ {below && <div className="options-page-header-below">{below}</div>}
+ </div>
+ </div>
+ );
+}
diff --git a/apps/client/src/widgets/type_widgets/options/desktop.tsx b/apps/client/src/widgets/type_widgets/options/desktop.tsx
index 7f95178001..331f30bc08 100644
--- a/apps/client/src/widgets/type_widgets/options/desktop.tsx
+++ b/apps/client/src/widgets/type_widgets/options/desktop.tsx
@@ -6,6 +6,7 @@ import { Badge } from "../../react/Badge";
import FormTextBox from "../../react/FormTextBox";
import { useTriliumOption, useTriliumOptionBool } from "../../react/hooks";
import NoItems from "../../react/NoItems";
+import OptionsPageHeader from "./components/OptionsPageHeader";
import OptionsRow, { OptionsRowWithToggle } from "./components/OptionsRow";
import OptionsSection from "./components/OptionsSection";
@@ -15,14 +16,18 @@ export default function DesktopSettings() {
// spellcheck page.
if (!isElectron()) {
return (
- <OptionsSection>
- <NoItems text={t("desktop.web_placeholder")} icon="bx bx-desktop" />
- </OptionsSection>
+ <>
+ <OptionsPageHeader />
+ <OptionsSection>
+ <NoItems text={t("desktop.web_placeholder")} icon="bx bx-desktop" />
+ </OptionsSection>
+ </>
);
}
return (
<>
+ <OptionsPageHeader />
<TrayOptionsSettings />
<StartupSettings />
<SearchEngineSettings />
diff --git a/apps/client/src/widgets/type_widgets/options/etapi.tsx b/apps/client/src/widgets/type_widgets/options/etapi.tsx
index 328e62b196..3cf06a7ab5 100644
--- a/apps/client/src/widgets/type_widgets/options/etapi.tsx
+++ b/apps/client/src/widgets/type_widgets/options/etapi.tsx
@@ -10,6 +10,7 @@ import ActionButton from "../../react/ActionButton";
import Button from "../../react/Button";
import { useTriliumEvent } from "../../react/hooks";
import NoItems from "../../react/NoItems";
+import OptionsPageHeader from "./components/OptionsPageHeader";
import OptionsRow from "./components/OptionsRow";
import OptionsSection from "./components/OptionsSection";
@@ -52,22 +53,25 @@ export default function EtapiSettings() {
}, []);
return (
- <OptionsSection
- title={t("etapi.title")}
- description={t("etapi.description")}
- helpUrl="pgxEVkzLl1OP"
- >
- <TokenList tokens={tokens} />
-
- <OptionsRow name="create-etapi-token" centered>
- <Button
- name="create-etapi-token-button"
- size="micro" icon="bx bx-plus"
- text={t("etapi.create_token")}
- onClick={createTokenCallback}
- />
- </OptionsRow>
- </OptionsSection>
+ <>
+ <OptionsPageHeader />
+ <OptionsSection
+ title={t("etapi.title")}
+ description={t("etapi.description")}
+ helpUrl="pgxEVkzLl1OP"
+ >
+ <TokenList tokens={tokens} />
+
+ <OptionsRow name="create-etapi-token" centered>
+ <Button
+ name="create-etapi-token-button"
+ size="micro" icon="bx bx-plus"
+ text={t("etapi.create_token")}
+ onClick={createTokenCallback}
+ />
+ </OptionsRow>
+ </OptionsSection>
+ </>
);
}
diff --git a/apps/client/src/widgets/type_widgets/options/i18n.tsx b/apps/client/src/widgets/type_widgets/options/i18n.tsx
index 4809adc3e0..af4133fcd2 100644
--- a/apps/client/src/widgets/type_widgets/options/i18n.tsx
+++ b/apps/client/src/widgets/type_widgets/options/i18n.tsx
@@ -1,6 +1,7 @@
import { useMemo } from "preact/hooks";
import { getAvailableLocales, t } from "../../../services/i18n";
import FormSelect from "../../react/FormSelect";
+import OptionsPageHeader from "./components/OptionsPageHeader";
import OptionsRow from "./components/OptionsRow";
import OptionsSection from "./components/OptionsSection";
import { useTriliumOption, useTriliumOptionJson } from "../../react/hooks";
@@ -15,6 +16,7 @@ import { LocaleSelector } from "./components/LocaleSelector";
export default function InternationalizationOptions() {
return (
<>
+ <OptionsPageHeader />
<LocalizationOptions />
<ContentLanguages />
{isElectron() && (
diff --git a/apps/client/src/widgets/type_widgets/options/llm.tsx b/apps/client/src/widgets/type_widgets/options/llm.tsx
index 03d6bd2b29..0ab5ae2fb4 100644
--- a/apps/client/src/widgets/type_widgets/options/llm.tsx
+++ b/apps/client/src/widgets/type_widgets/options/llm.tsx
@@ -8,6 +8,7 @@ import Button from "../../react/Button";
import FormTextBox from "../../react/FormTextBox";
import { useTriliumOption, useTriliumOptionBool } from "../../react/hooks";
import NoItems from "../../react/NoItems";
+import OptionsPageHeader from "./components/OptionsPageHeader";
import OptionsRow, { OptionsRowWithToggle } from "./components/OptionsRow";
import OptionsSection from "./components/OptionsSection";
import AddProviderModal, { type LlmProviderConfig, PROVIDER_TYPES } from "./llm/AddProviderModal";
@@ -17,14 +18,18 @@ export default function LlmSettings() {
if (isStandalone) {
return (
- <OptionsSection title={t("llm.settings_title")}>
- <NoItems icon="bx bx-bot" text={t("llm.not_available_in_standalone")} />
- </OptionsSection>
+ <>
+ <OptionsPageHeader />
+ <OptionsSection title={t("llm.settings_title")}>
+ <NoItems icon="bx bx-bot" text={t("llm.not_available_in_standalone")} />
+ </OptionsSection>
+ </>
);
}
return (
<>
+ <OptionsPageHeader />
<OptionsSection
title={t("llm.settings_title")}
description={t("llm.settings_description")}
diff --git a/apps/client/src/widgets/type_widgets/options/media.tsx b/apps/client/src/widgets/type_widgets/options/media.tsx
index c3791d71e4..5de9c4dbbd 100644
--- a/apps/client/src/widgets/type_widgets/options/media.tsx
+++ b/apps/client/src/widgets/type_widgets/options/media.tsx
@@ -7,6 +7,7 @@ import { isElectron } from "../../../services/utils";
import { FormTextBoxWithUnit } from "../../react/FormTextBox";
import { useTriliumOption, useTriliumOptionBool } from "../../react/hooks";
import Slider from "../../react/Slider";
+import OptionsPageHeader from "./components/OptionsPageHeader";
import OptionsRow, { OptionsRowWithToggle } from "./components/OptionsRow";
import OptionsSection from "./components/OptionsSection";
import RelatedSettings from "./components/RelatedSettings";
@@ -14,6 +15,7 @@ import RelatedSettings from "./components/RelatedSettings";
export default function MediaSettings() {
return (
<>
+ <OptionsPageHeader />
<ImageSettings />
<OcrSettings />
</>
diff --git a/apps/client/src/widgets/type_widgets/options/multi_factor_authentication.tsx b/apps/client/src/widgets/type_widgets/options/multi_factor_authentication.tsx
index bc8fb5b733..08d4e1ff09 100644
--- a/apps/client/src/widgets/type_widgets/options/multi_factor_authentication.tsx
+++ b/apps/client/src/widgets/type_widgets/options/multi_factor_authentication.tsx
@@ -1,6 +1,7 @@
import { Trans } from "react-i18next"
import { t } from "../../../services/i18n"
import FormText from "../../react/FormText"
+import OptionsPageHeader from "./components/OptionsPageHeader"
import OptionsSection from "./components/OptionsSection"
import FormCheckbox from "../../react/FormCheckbox"
import { useTriliumOption, useTriliumOptionBool } from "../../react/hooks"
@@ -21,11 +22,15 @@ export default function MultiFactorAuthenticationSettings() {
return (!isElectron()
? (
<>
+ <OptionsPageHeader />
<EnableMultiFactor mfaEnabled={mfaEnabled} setMfaEnabled={setMfaEnabled} />
{ mfaEnabled && <MultiFactorMethod /> }
</>
) : (
- <FormText>{t("multi_factor_authentication.electron_disabled")}</FormText>
+ <>
+ <OptionsPageHeader />
+ <FormText>{t("multi_factor_authentication.electron_disabled")}</FormText>
+ </>
)
)
}
diff --git a/apps/client/src/widgets/type_widgets/options/other.tsx b/apps/client/src/widgets/type_widgets/options/other.tsx
index 24965a8ebb..4fe1673dd4 100644
--- a/apps/client/src/widgets/type_widgets/options/other.tsx
+++ b/apps/client/src/widgets/type_widgets/options/other.tsx
@@ -9,6 +9,7 @@ import Button from "../../react/Button";
import FormText from "../../react/FormText";
import { FormTextBoxWithUnit } from "../../react/FormTextBox";
import { useTriliumOption, useTriliumOptionBool, useTriliumOptionJson } from "../../react/hooks";
+import OptionsPageHeader from "./components/OptionsPageHeader";
import OptionsRow, { OptionsRowWithButton, OptionsRowWithToggle } from "./components/OptionsRow";
import OptionsSection from "./components/OptionsSection";
import TimeSelector from "./components/TimeSelector";
@@ -16,6 +17,7 @@ import TimeSelector from "./components/TimeSelector";
export default function OtherSettings() {
return (
<>
+ <OptionsPageHeader />
<SearchSettings />
<NoteErasureTimeout />
<AttachmentErasureTimeout />
diff --git a/apps/client/src/widgets/type_widgets/options/password.tsx b/apps/client/src/widgets/type_widgets/options/password.tsx
index 9e5e8a0f7a..a631e6a5e0 100644
--- a/apps/client/src/widgets/type_widgets/options/password.tsx
+++ b/apps/client/src/widgets/type_widgets/options/password.tsx
@@ -6,6 +6,7 @@ import toast from "../../../services/toast";
import Button from "../../react/Button";
import FormGroup from "../../react/FormGroup";
import FormTextBox from "../../react/FormTextBox";
+import OptionsPageHeader from "./components/OptionsPageHeader";
import OptionsSection from "./components/OptionsSection";
import OptionsRow, { OptionsRowWithButton } from "./components/OptionsRow";
import protected_session_holder from "../../../services/protected_session_holder";
@@ -17,6 +18,7 @@ import Modal from "../../react/Modal";
export default function PasswordSettings() {
return (
<>
+ <OptionsPageHeader />
<ChangePassword />
<ProtectedSessionTimeout />
</>
diff --git a/apps/client/src/widgets/type_widgets/options/security.tsx b/apps/client/src/widgets/type_widgets/options/security.tsx
index 2eb82b8631..3ce9579776 100644
--- a/apps/client/src/widgets/type_widgets/options/security.tsx
+++ b/apps/client/src/widgets/type_widgets/options/security.tsx
@@ -5,6 +5,7 @@ import { isElectron, restartDesktopApp } from "../../../services/utils";
import Button from "../../react/Button";
import Collapsible from "../../react/Collapsible";
import { useTriliumOptionBool } from "../../react/hooks";
+import OptionsPageHeader from "./components/OptionsPageHeader";
import OptionsRow, { OptionsRowWithToggle } from "./components/OptionsRow";
import OptionsSection from "./components/OptionsSection";
@@ -23,6 +24,7 @@ export default function SecuritySettings() {
return (
<>
+ <OptionsPageHeader />
<BackendScriptingSettings
liveValue={liveBackendScripting}
pendingValue={pendingBackendScripting}
diff --git a/apps/client/src/widgets/type_widgets/options/shortcuts.css b/apps/client/src/widgets/type_widgets/options/shortcuts.css
index e2d7b3704b..a300a9d45a 100644
--- a/apps/client/src/widgets/type_widgets/options/shortcuts.css
+++ b/apps/client/src/widgets/type_widgets/options/shortcuts.css
@@ -1,58 +1,50 @@
-.shortcuts-options-section {
- > header {
- position: sticky;
- top: 0;
- left: 0;
- right: 0;
- background: var(--main-background-color);
- padding-block: 0.5em;
- border-bottom: 1px solid var(--main-border-color);
- margin-bottom: 1em;
- display: flex;
- flex-direction: column;
- gap: 1em;
-
- .shortcut-header-row {
- display: flex;
- align-items: center;
- gap: 0.5em;
-
- &:first-of-type {
- margin-inline-end: 3em;
- justify-content: flex-end;
- }
-
- /* Search row (last): the search box grows so the filter button sits at the trailing edge. */
- &.shortcut-header-row:last-child > :first-child {
- flex: 1;
- }
- }
+/* The shortcuts page feeds its controls into its OptionsPageHeader: the conflicts badge and reset
+ buttons on the title row, the filter/search box on the full-width row beneath. The sticky bar,
+ background and bottom border come from the header itself. */
+.shortcut-header-buttons {
+ display: flex;
+ align-items: center;
+ gap: 0.5em;
+ justify-content: flex-end;
+ /* Keep the reset buttons clear of the dialog's window buttons (top-right). */
+ margin-inline-end: 3em;
+
+ /* Prominent danger badge flagging that conflicts exist; click to filter to them. Pushed to the
+ leading edge of the row, away from the buttons. */
+ .shortcut-conflicts-badge {
+ flex: 0 0 auto;
+ margin-inline-end: auto;
+ --color: var(--icon-button-danger-color, #d9534f);
+ }
+ /* While the conflicts filter is active, fill the outline badge solid. */
+ .shortcut-conflicts-badge.active {
+ background-color: var(--color);
+ color: white;
+ }
+}
- .dropdown {
- flex: 0 0 auto;
- }
+.shortcut-header-filter {
+ display: flex;
+ align-items: center;
+ gap: 0.5em;
- /* Highlight the filter button while a filter is applied. */
- .icon-action.active {
- color: var(--link-color);
- }
+ /* The search box grows so the filter button sits at the trailing edge. */
+ > :first-child {
+ flex: 1;
+ }
- /* Prominent danger badge flagging that conflicts exist; click to filter to them.
- Pushed to the trailing edge of the second row, away from the buttons. */
- .shortcut-conflicts-badge {
- flex: 0 0 auto;
- margin-inline-end: auto;
- --color: var(--icon-button-danger-color, #d9534f);
- }
+ .dropdown {
+ flex: 0 0 auto;
+ }
- /* While the conflicts filter is active, fill the outline badge solid. */
- .shortcut-conflicts-badge.active {
- background-color: var(--color);
- color: white;
- }
+ /* Highlight the filter button while a filter is applied. */
+ .icon-action.active {
+ color: var(--link-color);
}
+}
+.shortcuts-options-section {
.shortcut-modified-indicator {
display: inline-block;
width: 0.5em;
diff --git a/apps/client/src/widgets/type_widgets/options/shortcuts.tsx b/apps/client/src/widgets/type_widgets/options/shortcuts.tsx
index 7cbc43e564..2c373e9504 100644
--- a/apps/client/src/widgets/type_widgets/options/shortcuts.tsx
+++ b/apps/client/src/widgets/type_widgets/options/shortcuts.tsx
@@ -21,6 +21,7 @@ import FormTextBox from "../../react/FormTextBox";
import { useStaticTooltip, useTriliumEvent } from "../../react/hooks";
import { TooltipIcon } from "../../react/Icon";
import NoItems from "../../react/NoItems";
+import OptionsPageHeader from "./components/OptionsPageHeader";
import OptionsRow from "./components/OptionsRow";
import OptionsSection from "./components/OptionsSection";
@@ -112,10 +113,11 @@ export default function ShortcutSettings() {
.filter((group) => group.actions.length > 0);
return (
- <div className="shortcuts-options-section">
- <header>
- <div class="shortcut-header-row">
- {conflictCount > 0 &&
+ <>
+ <OptionsPageHeader
+ actions={
+ <div className="shortcut-header-buttons">
+ {conflictCount > 0 &&
<Badge
className={`shortcut-conflicts-badge ${activeFilter === "conflicts" ? "active" : ""}`}
icon="bx bx-error-circle"
@@ -124,72 +126,77 @@ export default function ShortcutSettings() {
outline
onClick={() => setActiveFilter(activeFilter === "conflicts" ? null : "conflicts")}
/>}
- <Button
- text={t("shortcuts.reload_app")}
- onClick={reloadFrontendApp}
- size="micro"
- />
- <Button
- text={t("shortcuts.set_all_to_default")}
- onClick={resetShortcuts}
- size="micro"
- />
- </div>
- <div class="shortcut-header-row">
- <FormTextBox
- placeholder={t("shortcuts.type_text_to_filter")}
- currentValue={filter} onChange={(value) => setFilter(value)}
- />
- <Dropdown
- buttonClassName={`bx bx-filter-alt ${activeFilter ? "active" : ""}`}
- hideToggleArrow
- noSelectButtonStyle
- noDropdownListStyle
- iconAction
- title={t("shortcuts.filter")}
- dropdownRef={filterDropdownRef}
- dropdownContainerClassName={isMobile() ? "mobile-bottom-menu" : undefined}
- >
- <FilterContent
- activeFilter={activeFilter}
- onSelect={selectFilter}
- conflictCount={conflictCount}
- globalCount={globalCount}
- modifiedCount={modifiedCount}
+ <Button
+ text={t("shortcuts.reload_app")}
+ onClick={reloadFrontendApp}
+ size="micro"
/>
- </Dropdown>
- </div>
- </header>
-
- {filteredGroups.length > 0
- ? filteredGroups.map((group) => (
- <OptionsSection key={group.title} title={group.title}>
- {group.actions.map((action) => (
- <ShortcutRow key={action.actionName} action={action} conflicts={conflicts.get(action.actionName)} />
- ))}
- </OptionsSection>
- ))
- : filter
- ? (
- <NoItems
- icon="bx bx-filter-alt"
- text={t("shortcuts.no_results", { filter })}
+ <Button
+ text={t("shortcuts.set_all_to_default")}
+ onClick={resetShortcuts}
+ size="micro"
/>
- )
- : activeFilter === "conflicts" && conflictCount === 0
- ? (
- <NoItems
- icon="bx bx-check-circle"
- text={t("shortcuts.no_conflicts")}
+ </div>
+ }
+ below={
+ <div className="shortcut-header-filter">
+ <FormTextBox
+ placeholder={t("shortcuts.type_text_to_filter")}
+ currentValue={filter} onChange={(value) => setFilter(value)}
+ />
+ <Dropdown
+ buttonClassName={`bx bx-filter-alt ${activeFilter ? "active" : ""}`}
+ hideToggleArrow
+ noSelectButtonStyle
+ noDropdownListStyle
+ iconAction
+ title={t("shortcuts.filter")}
+ dropdownRef={filterDropdownRef}
+ dropdownContainerClassName={isMobile() ? "mobile-bottom-menu" : undefined}
+ >
+ <FilterContent
+ activeFilter={activeFilter}
+ onSelect={selectFilter}
+ conflictCount={conflictCount}
+ globalCount={globalCount}
+ modifiedCount={modifiedCount}
/>
- )
- : (
+ </Dropdown>
+ </div>
+ }
+ />
+
+ <div className="shortcuts-options-section">
+ {filteredGroups.length > 0
+ ? filteredGroups.map((group) => (
+ <OptionsSection key={group.title} title={group.title}>
+ {group.actions.map((action) => (
+ <ShortcutRow key={action.actionName} action={action} conflicts={conflicts.get(action.actionName)} />
+ ))}
+ </OptionsSection>
+ ))
+ : filter
+ ? (
<NoItems
icon="bx bx-filter-alt"
- text={t("shortcuts.no_matches")}
+ text={t("shortcuts.no_results", { filter })}
/>
- )}
- </div>
+ )
+ : activeFilter === "conflicts" && conflictCount === 0
+ ? (
+ <NoItems
+ icon="bx bx-check-circle"
+ text={t("shortcuts.no_conflicts")}
+ />
+ )
+ : (
+ <NoItems
+ icon="bx bx-filter-alt"
+ text={t("shortcuts.no_matches")}
+ />
+ )}
+ </div>
+ </>
);
}
diff --git a/apps/client/src/widgets/type_widgets/options/spellcheck.tsx b/apps/client/src/widgets/type_widgets/options/spellcheck.tsx
index 4689db1e31..582c5f1236 100644
--- a/apps/client/src/widgets/type_widgets/options/spellcheck.tsx
+++ b/apps/client/src/widgets/type_widgets/options/spellcheck.tsx
@@ -8,14 +8,25 @@ import FormText from "../../react/FormText";
import { useTriliumOption, useTriliumOptionBool } from "../../react/hooks";
import NoItems from "../../react/NoItems";
import CheckboxList from "./components/CheckboxList";
+import OptionsPageHeader from "./components/OptionsPageHeader";
import OptionsRow, { OptionsRowWithToggle } from "./components/OptionsRow";
import OptionsSection from "./components/OptionsSection";
export default function SpellcheckSettings() {
if (isElectron()) {
- return <ElectronSpellcheckSettings />;
+ return (
+ <>
+ <OptionsPageHeader />
+ <ElectronSpellcheckSettings />
+ </>
+ );
}
- return <WebSpellcheckSettings />;
+ return (
+ <>
+ <OptionsPageHeader />
+ <WebSpellcheckSettings />
+ </>
+ );
}
interface SpellcheckLanguage {
diff --git a/apps/client/src/widgets/type_widgets/options/sync.tsx b/apps/client/src/widgets/type_widgets/options/sync.tsx
index 5e0b9b0acc..beb32f76d3 100644
--- a/apps/client/src/widgets/type_widgets/options/sync.tsx
+++ b/apps/client/src/widgets/type_widgets/options/sync.tsx
@@ -6,12 +6,18 @@ import server from "../../../services/server";
import toast from "../../../services/toast";
import FormTextBox from "../../react/FormTextBox";
import { useTriliumOption } from "../../react/hooks";
+import OptionsPageHeader from "./components/OptionsPageHeader";
import OptionsRow, { OptionsRowWithButton } from "./components/OptionsRow";
import OptionsSection from "./components/OptionsSection";
import TimeSelector from "./components/TimeSelector";
export default function SyncOptions() {
- return <SyncConfiguration />;
+ return (
+ <>
+ <OptionsPageHeader />
+ <SyncConfiguration />
+ </>
+ );
}
export function SyncConfiguration() {
diff --git a/apps/client/src/widgets/type_widgets/options/text_notes.tsx b/apps/client/src/widgets/type_widgets/options/text_notes.tsx
index ef7a482955..9e5b16dea2 100644
--- a/apps/client/src/widgets/type_widgets/options/text_notes.tsx
+++ b/apps/client/src/widgets/type_widgets/options/text_notes.tsx
@@ -17,6 +17,7 @@ import FormText from "../../react/FormText";
import FormTextBox, { FormTextBoxWithUnit } from "../../react/FormTextBox";
import { useColorScheme, useTriliumOption, useTriliumOptionBool } from "../../react/hooks";
import { getHtml } from "../../react/RawHtml";
+import OptionsPageHeader from "./components/OptionsPageHeader";
import OptionsRow, { OptionsRowWithToggle } from "./components/OptionsRow";
import OptionsSection from "./components/OptionsSection";
import RadioWithIllustration from "./components/RadioWithIllustration";
@@ -29,6 +30,7 @@ const isNewLayout = isExperimentalFeatureEnabled("new-layout");
export default function TextNoteSettings() {
return (
<>
+ <OptionsPageHeader />
<FormattingToolbar />
<EditorFeatures />
<Editor />