Skip to content

Build your personal knowledge base with Trilium Notes

client/cleanup tool: tweak the UI

Adorian Doran3a5bea895142
diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/cleanup_dialog.css b/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/cleanup_dialog.css
index b4ff623127..dade99fa32 100644
--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/cleanup_dialog.css
+++ b/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/cleanup_dialog.css
@@ -1,8 +1,8 @@
.modal.space-usage-cleanup-dialog {
- /* One per item, shared by its ring segment and its legend swatch: a legend is only a legend
- while the two are the same paint. Mixed into the theme surface like the browse donut's
- semantic colors, but at a higher share — three colors have to be told apart here, and the
- swatches are a few pixels wide. */
+ /* One color per item, worn by its ring segment and by the legend swatch naming it, so those two
+ are always the same paint. Softened into the theme surface like the browse donut's semantic
+ colors, which is why nothing else takes it: mostly-surface reads fine as an arc and has too
+ little contrast for text. */
--cleanup-deleted-color: color-mix(in srgb, var(--accented-background-color) 55%, #d9645b 45%);
--cleanup-attachments-color: color-mix(in srgb, var(--accented-background-color) 55%, #d9a93d 45%);
--cleanup-revisions-color: color-mix(in srgb, var(--accented-background-color) 55%, #8f959c 45%);
@@ -96,24 +96,26 @@
gap: 10px;
}
- .cleanup-item-swatch {
- flex: 0 0 auto;
- width: 4px;
- height: 1.2em;
- border-radius: 2px;
- background: var(--cleanup-swatch-color);
+ /* Carried by the row, so that everything in it is painted from one declaration rather than each
+ part naming its own item. */
+ .cleanup-item-deletedEntities {
+ --cleanup-item-color: var(--cleanup-deleted-color);
}
- .cleanup-swatch-deletedEntities {
- --cleanup-swatch-color: var(--cleanup-deleted-color);
+ .cleanup-item-unusedAttachments {
+ --cleanup-item-color: var(--cleanup-attachments-color);
}
- .cleanup-swatch-unusedAttachments {
- --cleanup-swatch-color: var(--cleanup-attachments-color);
+ .cleanup-item-revisionSnapshots {
+ --cleanup-item-color: var(--cleanup-revisions-color);
}
- .cleanup-swatch-revisionSnapshots {
- --cleanup-swatch-color: var(--cleanup-revisions-color);
+ .cleanup-item-swatch {
+ flex: 0 0 auto;
+ width: 4px;
+ height: 1.2em;
+ border-radius: 2px;
+ background: var(--cleanup-item-color);
}
/* Takes the slack, so the size and the switch stay at the trailing edge whatever the title —
@@ -123,8 +125,12 @@
white-space: nowrap;
}
+ /* Muted rather than the item's color: the swatch beside it already says which item the figure
+ belongs to, and that color at chart strength is mostly surface — too little contrast to carry
+ text, as trying it showed. */
.cleanup-item-size {
flex: 0 0 auto;
+ margin-inline-start: 12px;
color: var(--muted-text-color);
font-weight: 600;
white-space: nowrap;
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 300cbea0ed..701c570854 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
@@ -90,12 +90,14 @@ describe("CleanupDialog", () => {
const sizes = rows().map((row) => row.querySelector(".cleanup-item-size")?.textContent);
expect(sizes).toEqual([ formatSize(3000), formatSize(2000), formatSize(5000) ]);
- // A swatch per row, each its own color, so the list doubles as the ring's legend.
- expect(rows().map((row) => row.querySelector(".cleanup-item-swatch")?.className)).toEqual([
- "cleanup-item-swatch cleanup-swatch-deletedEntities",
- "cleanup-item-swatch cleanup-swatch-unusedAttachments",
- "cleanup-item-swatch cleanup-swatch-revisionSnapshots"
+ // Each row names its item, which is what carries the color its swatch and its amount are
+ // both painted from — so the list doubles as the ring's legend.
+ expect(rows().map((row) => row.className)).toEqual([
+ "tn-card-section cleanup-item cleanup-item-deletedEntities",
+ "tn-card-section cleanup-item cleanup-item-unusedAttachments",
+ "tn-card-section cleanup-item cleanup-item-revisionSnapshots"
]);
+ expect(rows().every((row) => row.querySelector(".cleanup-item-swatch"))).toBe(true);
expect(rows().every((row) => row.querySelector(".switch-toggle"))).toBe(true);
});
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 9277f503f5..aa5ca1f9a6 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
@@ -88,7 +88,9 @@ export default function CleanupDialog({ show, onHidden, estimates }: CleanupDial
{CLEANUP_ITEMS.map((item) => (
<CardSection
key={item.id}
- className="cleanup-item"
+ // The item modifier carries its color, which the swatch and the amount
+ // inside the row are both painted from.
+ className={`cleanup-item cleanup-item-${item.id}`}
// Only the revision item has any: they qualify how far its trimming goes, so
// they are beside the point until it is actually being run.
subSectionsVisible={item.id === "revisionSnapshots" && picked.revisionSnapshots}
@@ -109,7 +111,7 @@ export default function CleanupDialog({ show, onHidden, estimates }: CleanupDial
</CardSection>
] : undefined}
>
- <span className={`cleanup-item-swatch cleanup-swatch-${item.id}`} aria-hidden="true" />
+ <span className="cleanup-item-swatch" aria-hidden="true" />
<span className="cleanup-item-title">{t(item.labelKey)}</span>
<span className="cleanup-item-size">{formatSize(estimates[item.id])}</span>
<FormToggle