feat(breadcrumb): option to hide archived notes

This commit is contained in:
Elian Doran 2025-12-16 16:00:23 +02:00
parent 3a4cff6529
commit 193c9d8fa6
No known key found for this signature in database
3 changed files with 36 additions and 2 deletions

View File

@ -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",

View File

@ -82,4 +82,9 @@
padding: 0 10px;
width: 200px;
}
& > .filler {
flex-grow: 1;
height: 23px;
}
}

View File

@ -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