Skip to content

Build your personal knowledge base with Trilium Notes

feat(breadcrumb): option to hide archived notes

Elian Doran193c9d8fa616
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index db876bee0e..10a3cb8cb7 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -2149,7 +2149,8 @@
"hoisted_badge_title": "Unhoist",
"workspace_badge": "Workspace",
"scroll_to_top_title": "Jump to the beginning of the note",
- "create_new_note": "Create new child note"
+ "create_new_note": "Create new child note",
+ "empty_hide_archived_notes": "Hide archived notes"
},
"breadcrumb_badges": {
"read_only_explicit": "Read-only",
diff --git a/apps/client/src/widgets/layout/Breadcrumb.css b/apps/client/src/widgets/layout/Breadcrumb.css
index 76d5095c00..947f8266e3 100644
--- a/apps/client/src/widgets/layout/Breadcrumb.css
+++ b/apps/client/src/widgets/layout/Breadcrumb.css
@@ -82,4 +82,9 @@
padding: 0 10px;
width: 200px;
}
+
+ & > .filler {
+ flex-grow: 1;
+ height: 23px;
+ }
}
diff --git a/apps/client/src/widgets/layout/Breadcrumb.tsx b/apps/client/src/widgets/layout/Breadcrumb.tsx
index aeb0d8d233..f51ab8fdc6 100644
--- a/apps/client/src/widgets/layout/Breadcrumb.tsx
+++ b/apps/client/src/widgets/layout/Breadcrumb.tsx
@@ -19,6 +19,7 @@ import froca from "../../services/froca";
import hoisted_note from "../../services/hoisted_note";
import { t } from "../../services/i18n";
import note_create from "../../services/note_create";
+import options from "../../services/options";
import tree from "../../services/tree";
import ActionButton from "../react/ActionButton";
import { Badge } from "../react/Badge";
@@ -67,6 +68,11 @@ export default function Breadcrumb() {
</Fragment>
))
)}
+
+ <div
+ className="filler"
+ onContextMenu={buildEmptyAreaContextMenu()}
+ />
</div>
);
}
@@ -277,7 +283,7 @@ function useNotePaths() {
};
}
-//#region Context menu
+//#region Note Context menu
function buildContextMenu(notePath: string, parentComponent: Component | null) {
return async (e: MouseEvent) => {
e.preventDefault();
@@ -398,3 +404,25 @@ function buildContextMenu(notePath: string, parentComponent: Component | null) {
};
}
//#endregion
+
+//#region Empty context menu
+function buildEmptyAreaContextMenu() {
+ return (e: MouseEvent) => {
+ const hideArchivedNotes = (options.get("hideArchivedNotes_main") === "true");
+
+ e.preventDefault();
+ contextMenu.show({
+ items: [
+ {
+ title: t("breadcrumb.empty_hide_archived_notes"),
+ handler: () => options.save("hideArchivedNotes_main", !hideArchivedNotes ? "true" : "false"),
+ checked: hideArchivedNotes
+ }
+ ],
+ x: e.pageX,
+ y: e.pageY,
+ selectMenuItemHandler: () => {}
+ });
+ };
+}
+//#endregion