Skip to content

Build your personal knowledge base with Trilium Notes

client/collections/board: tweak menus

Adorian Doranf2278c64841a
diff --git a/apps/client/src/widgets/collections/board/card_toolbar.css b/apps/client/src/widgets/collections/board/card_toolbar.css
index b39756a3fd..dba71fd9df 100644
--- a/apps/client/src/widgets/collections/board/card_toolbar.css
+++ b/apps/client/src/widgets/collections/board/card_toolbar.css
@@ -85,9 +85,3 @@
border-end-end-radius: 0;
}
}
-
-/* The list's plus sits at its foot, so the head is the same glyph turned over. */
-.board-view-container .board-card-toolbar .board-insert-above-button::before {
- display: inline-block;
- transform: scaleY(-1);
-}
diff --git a/apps/client/src/widgets/collections/board/card_toolbar.tsx b/apps/client/src/widgets/collections/board/card_toolbar.tsx
index 13d97a31ee..2ea4a8c63c 100644
--- a/apps/client/src/widgets/collections/board/card_toolbar.tsx
+++ b/apps/client/src/widgets/collections/board/card_toolbar.tsx
@@ -114,7 +114,8 @@ export default function CardToolbar({
<OverlayControlButton
title={t("board_view.insert-above")}
icon="bx-list-plus"
- className="board-insert-above-button"
+ // The list's plus sits at its foot, so the head is the glyph turned over.
+ className="bx-flip-vertical"
onClick={onInsertAbove}
/>
<OverlayControlButton
diff --git a/apps/client/src/widgets/collections/board/context_menu.spec.ts b/apps/client/src/widgets/collections/board/context_menu.spec.ts
index 216cfce3e6..b0a4bcc394 100644
--- a/apps/client/src/widgets/collections/board/context_menu.spec.ts
+++ b/apps/client/src/widgets/collections/board/context_menu.spec.ts
@@ -260,7 +260,7 @@ describe("Board column context menu", () => {
expect(titled.map(item => "uiIcon" in item ? item.uiIcon : undefined))
.toEqual([
"bx bx-edit-alt", "bx bx-copy",
- "bx bx-plus", "bx bx-link", "bx bx-columns",
+ "bx bx-plus", "bx bx-folder-open", "bx bx-columns",
"bx bx-collapse-horizontal", "bx bx-lock-alt", "bx bx-sort-alt-2",
"bx bx-tachometer",
"bx bx-horizontal-left",
@@ -381,7 +381,7 @@ describe("Board column context menu", () => {
vi.spyOn(dialog, "chooseNote").mockResolvedValue("pickedNote");
const entry = openMenu(api)
- .find(item => item && "uiIcon" in item && item.uiIcon === "bx bx-link");
+ .find(item => item && "uiIcon" in item && item.uiIcon === "bx bx-folder-open");
if (!entry || !("handler" in entry)) throw new Error("expected an add-existing entry");
await entry.handler?.(entry, {} as never);
@@ -393,7 +393,7 @@ describe("Board column context menu", () => {
vi.spyOn(dialog, "chooseNote").mockResolvedValue(null);
const entry = openMenu(api)
- .find(item => item && "uiIcon" in item && item.uiIcon === "bx bx-link");
+ .find(item => item && "uiIcon" in item && item.uiIcon === "bx bx-folder-open");
if (!entry || !("handler" in entry)) throw new Error("expected an add-existing entry");
await entry.handler?.(entry, {} as never);
@@ -409,7 +409,7 @@ describe("Board column context menu", () => {
expect(byIcon("bx bx-edit-alt")).toMatchObject({ shortcut: "F2" });
expect(byIcon("bx bx-trash")).toMatchObject({ shortcut: "Delete" });
// Nothing claims a key it does not answer for.
- expect(byIcon("bx bx-link")).not.toHaveProperty("shortcut");
+ expect(byIcon("bx bx-folder-open")).not.toHaveProperty("shortcut");
const submenu = byIcon("bx bx-columns");
const children = submenu && "items" in submenu ? submenu.items ?? [] : [];
@@ -559,7 +559,8 @@ describe("Board item context menu", () => {
const insert = vi.fn();
const items = openItemMenu(api, "To Do", vi.fn(), insert, 2);
- for (const icon of [ "bx bx-list-plus", "bx bx-empty" ]) {
+ // The one above wears the same glyph as the one below, turned over by its own class.
+ for (const icon of [ "bx bx-list-plus bx-flip-vertical", "bx bx-list-plus" ]) {
const entry = items.find(item => item && "uiIcon" in item && item.uiIcon === icon);
if (!entry || !("handler" in entry)) throw new Error(`expected a ${icon} entry`);
entry.handler?.(entry, {} as never);
@@ -605,7 +606,7 @@ describe("Board item context menu", () => {
expect(items[at + 1]).toMatchObject({ kind: "separator" });
expect(items.slice(at + 2, at + 5).map(item =>
item && "uiIcon" in item ? item.uiIcon : undefined))
- .toEqual([ "bx bx-list-plus", "bx bx-empty", "bx bx-outline" ]);
+ .toEqual([ "bx bx-list-plus bx-flip-vertical", "bx bx-list-plus", "bx bx-outline" ]);
});
it("copies a link to the card, which the card's own note id names", () => {
diff --git a/apps/client/src/widgets/collections/board/context_menu.ts b/apps/client/src/widgets/collections/board/context_menu.ts
index a927eadeb6..110fbd0214 100644
--- a/apps/client/src/widgets/collections/board/context_menu.ts
+++ b/apps/client/src/widgets/collections/board/context_menu.ts
@@ -97,7 +97,8 @@ export function openColumnContextMenu(api: Api, event: ContextMenuEvent, column:
},
{
title: t("board_view.add-existing-item"),
- uiIcon: "bx bx-link",
+ // The same mark the add field wears for this, where it stands for the empty one.
+ uiIcon: "bx bx-folder-open",
async handler() {
const noteId = await dialog.chooseNote({
title: t("board_view.add-existing-item-title"),
@@ -495,13 +496,14 @@ export function openNoteContextMenu(api: Api, event: ContextMenuEvent, target: N
} ] : [
{
title: t("board_view.insert-above"),
- uiIcon: "bx bx-list-plus",
+ // The list's plus sits at its foot, so the head is the glyph turned over.
+ uiIcon: "bx bx-list-plus bx-flip-vertical",
shortcut: "Shift+Enter",
handler: () => target.onInsert(index)
},
{
title: t("board_view.insert-below"),
- uiIcon: "bx bx-empty",
+ uiIcon: "bx bx-list-plus",
shortcut: "Enter",
handler: () => target.onInsert(index + 1)
}
diff --git a/apps/client/src/widgets/collections/board/index.spec.tsx b/apps/client/src/widgets/collections/board/index.spec.tsx
index 7a7cbc9420..3936a3ffe3 100644
--- a/apps/client/src/widgets/collections/board/index.spec.tsx
+++ b/apps/client/src/widgets/collections/board/index.spec.tsx
@@ -4899,7 +4899,7 @@ describe("Card toolbar on mobile", () => {
// Above first, then below. The glyph's plus sits at the foot of its list, so the one
// above is told apart by the class that turns it over.
expect(toolbar()?.querySelectorAll("button")[1].classList
- .contains("board-insert-above-button")).toBe(true);
+ .contains("bx-flip-vertical")).toBe(true);
// The rail offers the rename, so the card's own hover-revealed icon is left out.
expect(card("tool1").querySelector(".edit-icon")).toBeNull();
// Portaled onto the board, whose edge the rail is pinned to, rather than into the card.