Skip to content

Build your personal knowledge base with Trilium Notes

client/collections/board: use a distinct default icon for the inbox column

Adorian Doran6617723597cb
diff --git a/apps/client/src/widgets/collections/board/api.spec.ts b/apps/client/src/widgets/collections/board/api.spec.ts
index 7e4a097204..9d29832fb6 100644
--- a/apps/client/src/widgets/collections/board/api.spec.ts
+++ b/apps/client/src/widgets/collections/board/api.spec.ts
@@ -1084,3 +1084,21 @@ describe("reordering columns the board is not showing all of", () => {
]);
});
});
+
+describe("the icon the inbox column wears", () => {
+ it("is an inbox until one is picked for it", () => {
+ const { api } = createApi(
+ { columns: [ { value: "" }, { value: "To Do" } ] }, [ "", "To Do" ]);
+
+ expect(api.getColumnIcon("")).toBe("bx bxs-inbox");
+ // Every other column keeps the stock one.
+ expect(api.getColumnIcon("To Do")).toBe(DEFAULT_COLUMN_ICON);
+ });
+
+ it("gives way to the one picked for it", () => {
+ const { api } = createApi(
+ { columns: [ { value: "", icon: "bx bx-star" } ] }, [ "" ]);
+
+ expect(api.getColumnIcon("")).toBe("bx bx-star");
+ });
+});
diff --git a/apps/client/src/widgets/collections/board/api.ts b/apps/client/src/widgets/collections/board/api.ts
index 85c9098290..0798158e45 100644
--- a/apps/client/src/widgets/collections/board/api.ts
+++ b/apps/client/src/widgets/collections/board/api.ts
@@ -16,7 +16,7 @@ import toast from "../../../services/toast";
import { BoardColumnData, BoardViewData } from ".";
import {
type BoardStatusDefinition, canStoreColumnsInDefinition, DEFAULT_COLUMN_ICON, DEFAULT_GROUP_BY
-, INBOX_COLUMN } from "./columns";
+, INBOX_COLUMN, INBOX_COLUMN_ICON } from "./columns";
import { ColumnMap } from "./data";
/** One write's claim on a column, held until that write lands or is taken back. */
@@ -320,8 +320,12 @@ export default class BoardApi {
return froca.getNoteFromCache(column)?.getIcon();
}
- return this.viewConfig?.columns?.find(col => col.value === column)?.icon
- ?? DEFAULT_COLUMN_ICON;
+ const stored = this.viewConfig?.columns?.find(col => col.value === column)?.icon;
+ if (stored) {
+ return stored;
+ }
+
+ return column === INBOX_COLUMN ? INBOX_COLUMN_ICON : DEFAULT_COLUMN_ICON;
}
/**
diff --git a/apps/client/src/widgets/collections/board/column.tsx b/apps/client/src/widgets/collections/board/column.tsx
index e94a98860a..d9a95d11f7 100644
--- a/apps/client/src/widgets/collections/board/column.tsx
+++ b/apps/client/src/widgets/collections/board/column.tsx
@@ -175,7 +175,7 @@ export default function Column({
{!isInRelationMode && (
<IconPickerButton
className="column-icon"
- icon={icon ?? DEFAULT_COLUMN_ICON}
+ icon={api.getColumnIcon(column) ?? DEFAULT_COLUMN_ICON}
title={t("board_view.change-column-icon")}
onSelect={(picked) => api.setColumnIcon(column, picked)}
onReset={icon ? () => api.setColumnIcon(column, undefined) : undefined}
diff --git a/apps/client/src/widgets/collections/board/columns.ts b/apps/client/src/widgets/collections/board/columns.ts
index f0f3aae0eb..0f94f440d0 100644
--- a/apps/client/src/widgets/collections/board/columns.ts
+++ b/apps/client/src/widgets/collections/board/columns.ts
@@ -26,6 +26,9 @@ export const DEFAULT_COLUMN_ICON = "bx bx-circle";
*/
export const INBOX_COLUMN = "";
+/** What the inbox column wears until one is picked for it, in place of the stock column icon. */
+export const INBOX_COLUMN_ICON = "bx bxs-inbox";
+
export interface BoardStatusDefinition {
/** The definition attribute, wherever it is owned. */
attribute: FAttribute;