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): use dedicated buttons for advanced settings actions
Elian Doranb3d01115445f
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex 3b166e3f04..c0cfe5f6be 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -1261,7 +1261,7 @@"title": "Consistency Checks","find_and_fix_label": "Find and fix consistency issues","find_and_fix_description": "Scan for and automatically repair any data consistency issues in the database.",- "find_and_fix_button": "Find and fix consistency issues",+ "find_and_fix_button": "Repair","finding_and_fixing_message": "Finding and fixing consistency issues...","issues_fixed_message": "Any consistency issue which may have been found is now fixed."},@@ -1270,11 +1270,11 @@"description": "Create an anonymized copy of your database for sharing with developers when debugging issues, without exposing personal data.","full_anonymization": "Full anonymization","full_anonymization_description": "Creates a copy of the database with all note content removed, leaving only structure and non-sensitive metadata. Safe for sharing online when debugging issues.",- "save_fully_anonymized_database": "Save fully anonymized database",+ "save_fully_anonymized_database": "Create","light_anonymization": "Light anonymization","light_anonymization_description": "Creates a copy with note content removed, but titles, attributes, and custom scripts/widgets remain. Provides more context for debugging.","choose_anonymization": "You can decide yourself if you want to provide a fully or lightly anonymized database. Even fully anonymized DB is very useful, however in some cases lightly anonymized database can speed up the process of bug identification and fixing.",- "save_lightly_anonymized_database": "Save lightly anonymized database",+ "save_lightly_anonymized_database": "Create","existing_anonymized_databases": "Existing anonymized databases","anonymized_databases_location": "Anonymized databases are stored in {{- anonymizedFolder}}.","download": "Download",@@ -1289,7 +1289,7 @@"title": "Database Integrity Check","check_integrity_label": "Check database integrity","check_integrity_description": "Verify that the database is not corrupted on the SQLite level.",- "check_button": "Check database integrity",+ "check_button": "Verify","checking_integrity": "Checking database integrity...","integrity_check_succeeded": "Integrity check succeeded - no problems found.","integrity_check_failed": "Integrity check failed: {{results}}"@@ -1298,10 +1298,10 @@"title": "Sync","force_full_sync_label": "Force full sync","force_full_sync_description": "Trigger a complete synchronization with the sync server, re-uploading all changes.",- "force_full_sync_button": "Force full sync",+ "force_full_sync_button": "Run","fill_entity_changes_label": "Fill entity changes","fill_entity_changes_description": "Rebuild entity change records. Use this if sync is missing some changes.",- "fill_entity_changes_button": "Fill entity changes records",+ "fill_entity_changes_button": "Rebuild","full_sync_triggered": "Full sync triggered","filling_entity_changes": "Filling entity changes rows...","sync_rows_filled_successfully": "Sync rows filled successfully",@@ -1316,7 +1316,7 @@"vacuum_label": "Vacuum database","vacuum_description": "Rebuild the database to reduce file size. No data will be changed.","description": "This will rebuild the database which will typically result in a smaller database file. No data will be actually changed.",- "button_text": "Vacuum database",+ "button_text": "Compact","vacuuming_database": "Vacuuming database...","database_vacuumed": "Database has been vacuumed"},diff --git a/apps/client/src/widgets/type_widgets/options/advanced.tsx b/apps/client/src/widgets/type_widgets/options/advanced.tsxindex f46ec3f733..3eea8f7ad3 100644--- a/apps/client/src/widgets/type_widgets/options/advanced.tsx+++ b/apps/client/src/widgets/type_widgets/options/advanced.tsx@@ -26,6 +26,7 @@ function AdvancedSyncOptions() {<OptionsRowWithButtonlabel={t("sync.force_full_sync_label")}description={t("sync.force_full_sync_description")}+ buttonText={t("sync.force_full_sync_button")}onClick={async () => {await server.post("sync/force-full-sync");toast.showMessage(t("sync.full_sync_triggered"));@@ -35,6 +36,7 @@ function AdvancedSyncOptions() {<OptionsRowWithButtonlabel={t("sync.fill_entity_changes_label")}description={t("sync.fill_entity_changes_description")}+ buttonText={t("sync.fill_entity_changes_button")}onClick={async () => {toast.showMessage(t("sync.filling_entity_changes"));await server.post("sync/fill-entity-changes");@@ -51,6 +53,7 @@ function DatabaseOptions() {<OptionsRowWithButtonlabel={t("database_integrity_check.check_integrity_label")}description={t("database_integrity_check.check_integrity_description")}+ buttonText={t("database_integrity_check.check_button")}onClick={async () => {toast.showMessage(t("database_integrity_check.checking_integrity"));@@ -67,6 +70,7 @@ function DatabaseOptions() {<OptionsRowWithButtonlabel={t("consistency_checks.find_and_fix_label")}description={t("consistency_checks.find_and_fix_description")}+ buttonText={t("consistency_checks.find_and_fix_button")}onClick={async () => {toast.showMessage(t("consistency_checks.finding_and_fixing_message"));await server.post("database/find-and-fix-consistency-issues");@@ -77,6 +81,7 @@ function DatabaseOptions() {<OptionsRowWithButtonlabel={t("vacuum_database.vacuum_label")}description={t("vacuum_database.vacuum_description")}+ buttonText={t("vacuum_database.button_text")}onClick={async () => {toast.showMessage(t("vacuum_database.vacuuming_database"));await server.post("database/vacuum-database");@@ -131,6 +136,7 @@ function DatabaseAnonymizationOptions() {<OptionsRowWithButtonlabel={t("database_anonymization.full_anonymization")}description={t("database_anonymization.full_anonymization_description")}+ buttonText={t("database_anonymization.save_fully_anonymized_database")}disabled={anonymizationInProgress}onClick={() => anonymize("full")}/>@@ -138,6 +144,7 @@ function DatabaseAnonymizationOptions() {<OptionsRowWithButtonlabel={t("database_anonymization.light_anonymization")}description={t("database_anonymization.light_anonymization_description")}+ buttonText={t("database_anonymization.save_lightly_anonymized_database")}disabled={anonymizationInProgress}onClick={() => anonymize("light")}/>diff --git a/apps/client/src/widgets/type_widgets/options/components/OptionsRow.tsx b/apps/client/src/widgets/type_widgets/options/components/OptionsRow.tsxindex 620c4d876e..ce47bbc3fa 100644--- a/apps/client/src/widgets/type_widgets/options/components/OptionsRow.tsx+++ b/apps/client/src/widgets/type_widgets/options/components/OptionsRow.tsx@@ -2,6 +2,7 @@ import "./OptionsRow.css";import { cloneElement, ComponentChildren, VNode } from "preact";+import Button from "../../../react/Button";import FormToggle from "../../../react/FormToggle";import { useUniqueName } from "../../../react/hooks";@@ -94,9 +95,30 @@ interface OptionsRowWithButtonProps {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;}-export function OptionsRowWithButton({ label, description, icon, disabled, onClick }: OptionsRowWithButtonProps) {+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 (<buttontype="button"