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
client/collections/board: tweak the column menu
Adorian Doran0a316a7248bb
diff --git a/apps/client/src/widgets/collections/board/context_menu.spec.ts b/apps/client/src/widgets/collections/board/context_menu.spec.tsindex 6e379cdbc6..216cfce3e6 100644--- a/apps/client/src/widgets/collections/board/context_menu.spec.ts+++ b/apps/client/src/widgets/collections/board/context_menu.spec.ts@@ -235,14 +235,24 @@ describe("Board column context menu", () => {setInboxNested: vi.fn(async () => {})} as unknown as BoardApi;- const items = openMenu(api, { value: "", columns: [ "", "To Do" ], index: 0 });- const nesting = items.find(item =>- item && "uiIcon" in item && item.uiIcon === "bx bx-subdirectory-right");- if (!nesting || !("handler" in nesting)) throw new Error("expected a nesting entry");+ const entryOf = (nested: boolean) => {+ const found = openMenu(api, { value: "", columns: [ "", "To Do" ], index: 0, nested })+ .find(item => item && "uiIcon" in item+ && item.uiIcon === "bx bx-subdirectory-right");+ if (!found || !("handler" in found)) throw new Error("expected a nesting entry");+ return found;+ };- expect(nesting).toMatchObject({ checked: false });- nesting.handler?.(nesting, {} as never);- expect(api.setInboxNested).toHaveBeenCalledWith(true);+ // The check sits after the title, the entry keeping its own icon ahead of it.+ const unchecked = entryOf(false);+ expect("trailingIcon" in unchecked && unchecked.trailingIcon).toBeUndefined();+ unchecked.handler?.(unchecked, {} as never);+ expect(api.setInboxNested).toHaveBeenLastCalledWith(true);++ const checked = entryOf(true);+ expect("trailingIcon" in checked && checked.trailingIcon).toBe("bx bx-check");+ checked.handler?.(checked, {} as never);+ expect(api.setInboxNested).toHaveBeenLastCalledWith(false);});it("orders the entries, keeping the safe way out ahead of deleting", () => {diff --git a/apps/client/src/widgets/collections/board/context_menu.ts b/apps/client/src/widgets/collections/board/context_menu.tsindex 262f899146..a927eadeb6 100644--- a/apps/client/src/widgets/collections/board/context_menu.ts+++ b/apps/client/src/widgets/collections/board/context_menu.ts@@ -73,7 +73,8 @@ export function openColumnContextMenu(api: Api, event: ContextMenuEvent, column:...(isInbox ? [ {title: t("board_view.inbox-nested"),uiIcon: "bx bx-subdirectory-right",- checked: !!column.nested,+ // At the trailing edge, so the entry keeps its own icon in front.+ trailingIcon: column.nested ? "bx bx-check" : undefined,handler: () => api.setInboxNested(!column.nested)} ] : []),{