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: add a clue that reordering cards is not possible for sorting columns
Adorian Doranccb8b16315d4
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex 7c1badd91d..84e57edc99 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -3506,7 +3506,8 @@"filter-placeholder": "Filter board...","card-outside-filter": "This card is outside of the current filtering scope","sort": "Sort",- "sort-manually": "Manually"+ "sort-manually": "Manually",+ "sorted-no-reorder": "Cards cannot be reordered, since this is a sorted column."},"dashboard_view": {"refresh-widget": "Refresh",diff --git a/apps/client/src/widgets/collections/board/column.tsx b/apps/client/src/widgets/collections/board/column.tsxindex 0d9dadd716..7dc2623a21 100644--- a/apps/client/src/widgets/collections/board/column.tsx+++ b/apps/client/src/widgets/collections/board/column.tsx@@ -683,7 +683,16 @@ export default function Column({{insertBefore && !insertBefore.branchId && insertField}{/* Both stand here for the length of the board's life: an element appearingamong the cards, or leaving them, is what a drag cannot afford. */}- <div ref={gapRef} className="board-drop-placeholder" />+ <div ref={gapRef} className="board-drop-placeholder">+ {/* The gap a sorted column holds open is the one the card came out of, and it+ stays there: nothing the reader does moves the card to another place in+ this column. */}+ {isSorted && (+ <span className="sorted-no-reorder">+ {t("board_view.sorted-no-reorder")}+ </span>+ )}+ </div><div ref={roomRef} className="board-drop-room" /></div>}diff --git a/apps/client/src/widgets/collections/board/drag.spec.tsx b/apps/client/src/widgets/collections/board/drag.spec.tsxindex d4dbe3f903..4c5984f80c 100644--- a/apps/client/src/widgets/collections/board/drag.spec.tsx+++ b/apps/client/src/widgets/collections/board/drag.spec.tsx@@ -160,11 +160,22 @@ describe("Board drag and drop", () => {expect([ ...columns[0].querySelectorAll<HTMLElement>(".board-note") ].map(other => other.style.transform !== "")).toEqual([ false, true ]);+ // The hole says why it will not move, which no column sorted by hand has to.+ expect(columns[0].querySelector(".board-drop-placeholder .sorted-no-reorder")).toBeTruthy();+await pointer(columns[0], "pointerup", 50, 300);await act(async () => { await settle(); });expect(columns[0].querySelector(".board-drop-placeholder.show")).toBeNull();});+ it("says nothing about reordering in a column arranged by hand", async () => {+ const { columns } = await renderBoard();++ await drag(columns[0], "dragover", { types: [ TREE_CLIPBOARD_TYPE ] }, 120);++ expect(columns[0].querySelector(".board-drop-placeholder .sorted-no-reorder")).toBeNull();+ });+it("ignores a drag carrying something the board has no use for", async () => {const { columns } = await renderBoard();diff --git a/apps/client/src/widgets/collections/board/index.css b/apps/client/src/widgets/collections/board/index.cssindex e1411d00ea..4c145e107a 100644--- a/apps/client/src/widgets/collections/board/index.css+++ b/apps/client/src/widgets/collections/board/index.css@@ -758,7 +758,6 @@ body.mobile .board-view-container .board-add-column {/* The gap below is the card's, in em, so it has to be read at the card's own font size. */font-size: var(--card-font-size);margin-block: 0 0.65em;- padding: 0.5em;border-radius: 5px;background-color: rgba(0, 0, 0, 0.15);opacity: 0;@@ -780,6 +779,20 @@ body.mobile .board-view-container .board-add-column {opacity: 0.6;}+/* Clipped rather than spilling over the cards, since the box is only as tall as the card that+ left it. */+.board-drop-placeholder > .sorted-no-reorder {+ display: flex;+ align-items: center;+ justify-content: center;+ height: 100%;+ overflow: hidden;+ font-size: 0.75em;+ line-height: 1.2;+ text-align: center;+ color: var(--muted-text-color);+}+/* The space a carried column would take, so it must measure the same: the board spaces its columnswith its own gap, and a margin here is width the columns after it are pushed along by. */.column-drop-placeholder {