Skip to content

Build your personal knowledge base with Trilium Notes

feat(options): use dedicated buttons across remaining settings pages

Elian Doranff39e8372d80
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index c0cfe5f6be..46434dccb6 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -1461,7 +1461,8 @@
"erase_attachments_after": "Erase unused attachments after",
"erase_attachments_after_description": "Time before unused attachments are permanently erased.",
"manual_erasing_description": "Trigger erasing manually, ignoring the timeout above.",
- "erase_unused_attachments_now": "Erase unused attachments now",
+ "erase_unused_attachments_now": "Erase unused attachments",
+ "erase_now_button": "Erase now",
"unused_attachments_erased": "Unused attachments have been erased."
},
"network_connections": {
@@ -1475,7 +1476,8 @@
"erase_notes_after": "Erase notes after",
"erase_notes_after_description": "Time before deleted notes are permanently erased.",
"manual_erasing_description": "Trigger erasing manually, ignoring the timeout above.",
- "erase_deleted_notes_now": "Erase deleted notes now",
+ "erase_deleted_notes_now": "Erase deleted notes",
+ "erase_now_button": "Erase now",
"deleted_notes_erased": "Deleted notes have been erased."
},
"revisions_snapshot": {
@@ -1493,8 +1495,9 @@
"note_revisions_snapshot_limit_description_short": "Max revisions per note. Use -1 for unlimited, 0 to disable.",
"snapshot_number_limit_label": "Maximum revisions",
"snapshot_number_limit_unit": "snapshots",
- "erase_excess_revision_snapshots": "Erase excess revision snapshots now",
+ "erase_excess_revision_snapshots": "Erase excess revision snapshots",
"erase_excess_revision_snapshots_description": "Delete revisions exceeding the limit for all notes.",
+ "erase_now_button": "Erase now",
"erase_excess_revision_snapshots_prompt": "Excess revision snapshots have been erased."
},
"search": {
@@ -1670,8 +1673,10 @@
"new_password_confirmation": "New password confirmation",
"change_password": "Change password",
"change_password_description": "Update your current password",
+ "change_password_button": "Update",
"reset_password": "Reset password",
"reset_password_description": "Permanently lose access to protected notes",
+ "reset_password_button": "Reset",
"cancel": "Cancel",
"protected_session_timeout": "Protected Session",
"protected_session_timeout_description": "Time of inactivity before the session is cleared from browser memory. See",
@@ -1772,7 +1777,7 @@
"help": "Help",
"test_title": "Test Connection",
"test_description": "Test the connection to the sync server. If not initialized, this will set up syncing.",
- "test_button": "Test sync",
+ "test_button": "Test",
"handshake_failed": "Sync server handshake failed, error: {{message}}"
},
"api_log": {
diff --git a/apps/client/src/widgets/type_widgets/options/appearance.tsx b/apps/client/src/widgets/type_widgets/options/appearance.tsx
index 56803ac926..9475dae590 100644
--- a/apps/client/src/widgets/type_widgets/options/appearance.tsx
+++ b/apps/client/src/widgets/type_widgets/options/appearance.tsx
@@ -10,7 +10,7 @@ import { t } from "../../../services/i18n";
import server from "../../../services/server";
import { isElectron, isMobile, reloadFrontendApp, restartDesktopApp } from "../../../services/utils";
import { VerticalLayoutIcon } from "../../buttons/global_menu";
-import { ButtonGroup } from "../../react/Button";
+import Button, { ButtonGroup } from "../../react/Button";
import Dropdown from "../../react/Dropdown";
import FormList, { FormListHeader, FormListItem } from "../../react/FormList";
import { FormTextBoxWithUnit } from "../../react/FormTextBox";
@@ -18,7 +18,7 @@ import { useTriliumOption, useTriliumOptionBool } from "../../react/hooks";
import Icon from "../../react/Icon";
import Modal from "../../react/Modal";
import Slider from "../../react/Slider";
-import OptionsRow, { OptionsRowWithButton, OptionsRowWithToggle } from "./components/OptionsRow";
+import OptionsRow, { OptionsRowWithToggle } from "./components/OptionsRow";
import OptionsSection from "./components/OptionsSection";
import PlatformIndicator from "./components/PlatformIndicator";
import RadioWithIllustration from "./components/RadioWithIllustration";
@@ -622,11 +622,14 @@ function ElectronIntegration() {
disabled={nativeTitleBarVisible || !backgroundEffectsSupported}
/>
- <OptionsRowWithButton
- label={t("electron_integration.restart-app-button")}
- icon="bx bx-refresh"
- onClick={restartDesktopApp}
- />
+ <OptionsRow name="restart-app" centered>
+ <Button
+ name="restart-app-button"
+ text={t("electron_integration.restart-app-button")}
+ icon="bx-refresh"
+ onClick={restartDesktopApp}
+ />
+ </OptionsRow>
</OptionsSection>
);
}
diff --git a/apps/client/src/widgets/type_widgets/options/components/OptionsRow.tsx b/apps/client/src/widgets/type_widgets/options/components/OptionsRow.tsx
index ce47bbc3fa..d915deab21 100644
--- a/apps/client/src/widgets/type_widgets/options/components/OptionsRow.tsx
+++ b/apps/client/src/widgets/type_widgets/options/components/OptionsRow.tsx
@@ -92,50 +92,28 @@ export function OptionsRowWithToggle({ name, label, description, currentValue, o
interface OptionsRowWithButtonProps {
label: string;
description?: string;
+ /** Icon for the action button, in {@link Button} format (e.g. `bx-refresh`, without the leading `bx `). */
icon?: string;
disabled?: boolean;
onClick: () => void;
- /**
- * The label of the action button. When set, the row renders as passive label/description text
- * with a discrete button on the right — the intuitive pattern. When omitted, the whole row is
- * clickable instead (legacy). In button mode `icon` is forwarded to the {@link Button}, so it
- * must be in `Button` format (e.g. `bx-refresh`, without the leading `bx `).
- */
- buttonText?: string;
+ /** Label of the action button shown on the right of the row. */
+ buttonText: string;
}
+/**
+ * A settings row with passive label/description text and a discrete action button on the right.
+ * The button — not the whole row — is the affordance, which reads more clearly as clickable.
+ */
export function OptionsRowWithButton({ label, description, icon, disabled, onClick, buttonText }: OptionsRowWithButtonProps) {
- if (buttonText) {
- return (
- <div className="option-row">
- <div className="option-row-label">
- <label>{label}</label>
- {description && <small className="option-row-description">{description}</small>}
- </div>
- <div className="option-row-input">
- <Button text={buttonText} icon={icon} disabled={disabled} onClick={onClick} />
- </div>
- </div>
- );
- }
-
return (
- <button
- type="button"
- className="option-row option-row-link"
- onClick={onClick}
- disabled={disabled}
- aria-label={label}
- >
+ <div className="option-row">
<div className="option-row-label">
- <span style={{ cursor: "pointer" }}>{label}</span>
+ <label>{label}</label>
{description && <small className="option-row-description">{description}</small>}
</div>
- {icon && (
- <div className="option-row-input">
- <span className={icon} />
- </div>
- )}
- </button>
+ <div className="option-row-input">
+ <Button text={buttonText} icon={icon} disabled={disabled} onClick={onClick} />
+ </div>
+ </div>
);
}
diff --git a/apps/client/src/widgets/type_widgets/options/other.tsx b/apps/client/src/widgets/type_widgets/options/other.tsx
index bc12a017e6..24965a8ebb 100644
--- a/apps/client/src/widgets/type_widgets/options/other.tsx
+++ b/apps/client/src/widgets/type_widgets/options/other.tsx
@@ -67,6 +67,7 @@ function NoteErasureTimeout() {
<OptionsRowWithButton
label={t("note_erasure_timeout.erase_deleted_notes_now")}
description={t("note_erasure_timeout.manual_erasing_description")}
+ buttonText={t("note_erasure_timeout.erase_now_button")}
onClick={() => {
server.post("notes/erase-deleted-notes-now").then(() => {
toast.showMessage(t("note_erasure_timeout.deleted_notes_erased"));
@@ -92,6 +93,7 @@ function AttachmentErasureTimeout() {
<OptionsRowWithButton
label={t("attachment_erasure_timeout.erase_unused_attachments_now")}
description={t("attachment_erasure_timeout.manual_erasing_description")}
+ buttonText={t("attachment_erasure_timeout.erase_now_button")}
onClick={() => {
server.post("notes/erase-unused-attachments-now").then(() => {
toast.showMessage(t("attachment_erasure_timeout.unused_attachments_erased"));
@@ -132,6 +134,7 @@ function RevisionSettings() {
<OptionsRowWithButton
label={t("revisions_snapshot_limit.erase_excess_revision_snapshots")}
description={t("revisions_snapshot_limit.erase_excess_revision_snapshots_description")}
+ buttonText={t("revisions_snapshot_limit.erase_now_button")}
onClick={async () => {
await server.post("revisions/erase-all-excess-revisions");
toast.showMessage(t("revisions_snapshot_limit.erase_excess_revision_snapshots_prompt"));
diff --git a/apps/client/src/widgets/type_widgets/options/password.tsx b/apps/client/src/widgets/type_widgets/options/password.tsx
index 69e1037cfe..9e5e8a0f7a 100644
--- a/apps/client/src/widgets/type_widgets/options/password.tsx
+++ b/apps/client/src/widgets/type_widgets/options/password.tsx
@@ -31,14 +31,14 @@ function ChangePassword() {
<OptionsRowWithButton
label={t("password.change_password")}
description={t("password.change_password_description")}
- icon="bx bx-chevron-right"
+ buttonText={t("password.change_password_button")}
onClick={() => setShowModal(true)}
/>
<OptionsRowWithButton
label={t("password.reset_password")}
description={t("password.reset_password_description")}
- icon="bx bx-chevron-right"
+ buttonText={t("password.reset_password_button")}
onClick={async () => {
if (!await dialog.confirm(t("password.reset_confirmation"))) {
return;
diff --git a/apps/client/src/widgets/type_widgets/options/sync.tsx b/apps/client/src/widgets/type_widgets/options/sync.tsx
index 3463d6f205..5e0b9b0acc 100644
--- a/apps/client/src/widgets/type_widgets/options/sync.tsx
+++ b/apps/client/src/widgets/type_widgets/options/sync.tsx
@@ -53,8 +53,9 @@ export function SyncConfiguration() {
</OptionsRow>
<OptionsRowWithButton
- label={t("sync_2.test_button")}
+ label={t("sync_2.test_title")}
description={t("sync_2.test_description")}
+ buttonText={t("sync_2.test_button")}
onClick={async () => {
await Promise.all([
setSyncServerHost(localHost),