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 inbox column
Adorian Doranc9567234b605
diff --git a/apps/client/src/widgets/collections/board/board_drag.ts b/apps/client/src/widgets/collections/board/board_drag.tsindex 943acdca38..57d74627bc 100644--- a/apps/client/src/widgets/collections/board/board_drag.ts+++ b/apps/client/src/widgets/collections/board/board_drag.ts@@ -802,6 +802,9 @@ function lift(held: Gesture, container: HTMLElement) {if (held.kind === "card" && hue) {preview.classList.add("column-tinted");preview.style.setProperty("--board-column-custom-hue", hue);+ } else if (held.kind === "card" && held.element.closest(".board-column-inbox")) {+ // The inbox paints its cards itself, and that rule no longer reaches the copy either.+ preview.classList.add("inbox-surface");}// The card's own colour and its em, read here rather than on every move: both cost a pagediff --git a/apps/client/src/widgets/collections/board/column.tsx b/apps/client/src/widgets/collections/board/column.tsxindex b5fbad944b..e7137da45b 100644--- a/apps/client/src/widgets/collections/board/column.tsx+++ b/apps/client/src/widgets/collections/board/column.tsx@@ -650,6 +650,7 @@ export default function Column({"drag-over": isDropTarget && (isSorted || draggedCard?.fromColumn !== column),// The class the themes key a hue off, worn here as anywhere else that carries one."with-hue": hue !== undefined,+ "board-column-inbox": column === INBOX_COLUMN,"board-column-archived": archived,"editing-open": hasEditedCard || !!insertBefore,windowed: isWindowed,diff --git a/apps/client/src/widgets/collections/board/context_menu.spec.ts b/apps/client/src/widgets/collections/board/context_menu.spec.tsindex 48f471a206..6e379cdbc6 100644--- a/apps/client/src/widgets/collections/board/context_menu.spec.ts+++ b/apps/client/src/widgets/collections/board/context_menu.spec.ts@@ -198,10 +198,11 @@ describe("Board column context menu", () => {});/**- * The inbox holds a name of its own, so it is renamed like any other column; what it has not is- * anything to archive, and it is put away by the board's own setting instead.+ * The inbox holds a name of its own, so it is renamed like any other column; what it has not+ * is anything to archive, or anywhere to go, and it is put away by the board's own setting+ * instead.*/- it("offers the inbox no archive, and puts it away instead", () => {+ it("offers the inbox no archive and no move, and puts it away instead", () => {const api = {getColumnIcon: () => DEFAULT_COLUMN_ICON,getColumnColorClass: () => "",@@ -216,6 +217,8 @@ describe("Board column context menu", () => {expect(icons).toContain("bx bx-edit-alt");expect(icons).not.toContain("bx bx-archive");+ // The inbox leads the board and cannot be moved off the head of it.+ expect(icons).not.toContain("bx bx-horizontal-left");const remove = items.find(item =>item && "uiIcon" in item && item.uiIcon === "bx bx-trash");diff --git a/apps/client/src/widgets/collections/board/context_menu.ts b/apps/client/src/widgets/collections/board/context_menu.tsindex deae8f8f05..262f899146 100644--- a/apps/client/src/widgets/collections/board/context_menu.ts+++ b/apps/client/src/widgets/collections/board/context_menu.ts@@ -148,11 +148,12 @@ export function openColumnContextMenu(api: Api, event: ContextMenuEvent, column:handler: column.onSetLimit},{ kind: "separator" },- {+ // The inbox leads the board and `moveColumn` refuses to move it, so it is not offered.+ ...(isInbox ? [] : [ {title: t("board_view.move-column"),uiIcon: "bx bx-horizontal-left",items: buildMoveColumnItems(api, column)- },+ } ]),{ kind: "separator" },...(isInbox ? [] : [ column.archived? {diff --git a/apps/client/src/widgets/collections/board/index.css b/apps/client/src/widgets/collections/board/index.cssindex 4e3137e0ea..7f32b33cf3 100644--- a/apps/client/src/widgets/collections/board/index.css+++ b/apps/client/src/widgets/collections/board/index.css@@ -10,6 +10,16 @@--board-item-hover-background-saturation: 100%;--board-item-hover-background-lightness: 98.5%;+ /* The inbox's own surfaces. It holds what has not been sorted yet, so it stands on the board+ itself rather than in a column of its own, and its cards take the surface the app's cards+ stand on. The theme's name first, then the one every theme has. */+ --board-inbox-column-background: transparent;+ /* Nothing to cast on: the cards lie on the board rather than in a column. */+ --board-inbox-item-shadow: none;+ --board-inbox-item-background: var(--card-background-color, var(--accented-background-color));+ --board-inbox-item-hover-background:+ var(--card-background-hover-color, var(--more-accented-background-color));+--board-limit-exceeded-background: #c62828;/* Half opacity: the badge is the main warning, the outline supports it. */--board-limit-exceeded-outline: #c6282880;@@ -27,6 +37,8 @@--board-collapse-duration-quick: 0.3s;--board-expand-duration: 0.2s;+ /* What a card at rest casts on the column it stands in. */+ --board-item-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1);/* The lift a card takes under the pointer, named so that a picked-out card can carry its ringand this shadow together. */--board-item-hover-shadow: 2px 4px 8px rgba(0, 0, 0, 0.1);@@ -190,6 +202,40 @@ body.mobile .board-view-container .board-add-column {border-color: var(--main-text-color);}+/* The inbox's surfaces, which stand until the reader gives the column a colour: `with-hue` then+ paints it as any other column, cards and all, and a card with a colour of its own keeps it. */+.board-view-container .board-column.board-column-inbox:not(.with-hue) {+ background-color: var(--board-inbox-column-background);+}++/* The shadow is handed over rather than set here: hover and the picked-out ring both write+ `box-shadow` themselves, and a rule specific enough to reach this card would outweigh them. */+.board-view-container .board-column-inbox:not(.with-hue) .board-note:not(.with-hue),+.board-view-container .board-drag-preview.inbox-surface:not(.with-hue) {+ background-color: var(--board-inbox-item-background);+ --board-item-shadow: var(--board-inbox-item-shadow);+}++.board-view-container .board-column-inbox:not(.with-hue) .board-note:not(.with-hue):hover {+ background-color: var(--board-inbox-item-hover-background);+}++/* The rename button masks the title it sits over, so it has to be opaque. The theme's card colour+ is a translucent overlay, and `inherit` lays it over the card a second time, which darkens the+ patch and leaves the title showing through; the button is painted the way the card itself is,+ the overlay over the app's background. */+.board-view-container .board-column-inbox:not(.with-hue) .board-note:not(.with-hue) > .edit-icon {+ background-color: var(--main-background-color);+ background-image: linear-gradient(+ var(--board-inbox-item-background), var(--board-inbox-item-background));+}++.board-view-container .board-column-inbox:not(.with-hue)+ .board-note:not(.with-hue):hover > .edit-icon {+ background-image: linear-gradient(+ var(--board-inbox-item-hover-background), var(--board-inbox-item-hover-background));+}+.board-view-container .board-column h3 {font-size: 1em;margin: 0;@@ -348,7 +394,7 @@ body.mobile .board-view-container .board-add-column {.board-view-container .board-note,.board-view-container .board-new-item.editing {- box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1);+ box-shadow: var(--board-item-shadow);padding: var(--card-padding);border-radius: 5px;position: relative;