Skip to content

Build your personal knowledge base with Trilium Notes

client/cleanup tool: add some tooltips

Adorian Doran30d9f8f4bb73
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index 1ae226e984..d3aa0088fb 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -2901,7 +2901,9 @@
"cleanup_unused_attachments": "Erase unused attachments",
"cleanup_revision_snapshots": "Erase revision snapshots",
"cleanup_snapshots_to_keep": "Revision snapshots to keep",
+ "cleanup_snapshots_to_keep_help": "How many revision snapshots are spared for each note, counting back from the most recent one. 0 erases the entire revision history.",
"cleanup_keep_named": "Keep named revisions",
+ "cleanup_keep_named_help": "Revisions that you have named are always kept, regardless of how many there are, in addition to the snapshot count spared for each note.",
"cleanup_cancel": "Cancel",
"cleanup_clean": "Clean",
"cleanup_confirm": "This permanently deletes the selected data. It cannot be undone.",
diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/cleanup_dialog.spec.tsx b/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/cleanup_dialog.spec.tsx
index df54c3fa16..61c8f7d989 100644
--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/cleanup_dialog.spec.tsx
+++ b/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/cleanup_dialog.spec.tsx
@@ -219,6 +219,11 @@ describe("showCleanupDialog", () => {
]);
expect(document.body.querySelector<HTMLInputElement>(".cleanup-item-number")?.value).toBe("2");
expect(cleanButton()?.disabled).toBe(false);
+
+ // Both qualifiers leave something open that their label cannot answer — how the count is
+ // reckoned, and against what — so each carries the explanation beside its title.
+ expect(nestedRows().map((row) => !!row.querySelector(".cleanup-item-title .contextual-help")))
+ .toEqual([ true, true ]);
});
it("weighs the offer against everything reclaimable, and writes each pick back", async () => {
diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/cleanup_dialog.tsx b/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/cleanup_dialog.tsx
index c56a40167b..5e7c3f0367 100644
--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/cleanup_dialog.tsx
+++ b/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/cleanup_dialog.tsx
@@ -13,6 +13,7 @@ import { ExtendedAdmonition } from "../../../../react/Admonition";
import Button from "../../../../react/Button";
import { Card, CardSection } from "../../../../react/Card";
import DonutChart, { type DonutRing } from "../../../../react/charts/DonutChart";
+import ContextualHelp from "../../../../react/ContextualHelp";
import FormTextBox from "../../../../react/FormTextBox";
import FormToggle from "../../../../react/FormToggle";
import { useTriliumOptionJson } from "../../../../react/hooks";
@@ -215,7 +216,12 @@ function CleanupDialog({ onFinished }: { onFinished: (reclaimed: number | null)
subSectionsVisible={item.id === "revisionSnapshots" && options.revisionSnapshots}
subSections={item.id === "revisionSnapshots" ? [
<CardSection key="snapshots-to-keep" className="cleanup-item cleanup-item-nested">
- <span className="cleanup-item-title">{t("space_usage.cleanup_snapshots_to_keep")}</span>
+ {/* Inside the title rather than beside it: the title takes the row's
+ slack, so an icon of its own would be carried off to the control. */}
+ <span className="cleanup-item-title">
+ {t("space_usage.cleanup_snapshots_to_keep")}
+ <ContextualHelp helpMessage={t("space_usage.cleanup_snapshots_to_keep_help")} />
+ </span>
<FormTextBox
className="cleanup-item-number"
type="number"
@@ -225,7 +231,10 @@ function CleanupDialog({ onFinished }: { onFinished: (reclaimed: number | null)
/>
</CardSection>,
<CardSection key="keep-named" className="cleanup-item cleanup-item-nested">
- <span className="cleanup-item-title">{t("space_usage.cleanup_keep_named")}</span>
+ <span className="cleanup-item-title">
+ {t("space_usage.cleanup_keep_named")}
+ <ContextualHelp helpMessage={t("space_usage.cleanup_keep_named_help")} />
+ </span>
<FormToggle
currentValue={options.keepNamedSnapshots}
onChange={(value) => update({ keepNamedSnapshots: value })}