From 62dc570d3814e8dbf2006fc8f2a359827512fefc Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Wed, 12 Nov 2025 19:07:23 +0200 Subject: [PATCH] feat(board): display promoted attributes --- .../PromotedAttributesDisplay.tsx | 29 +++++++++++++++++++ .../src/widgets/collections/board/card.tsx | 2 ++ 2 files changed, 31 insertions(+) create mode 100644 apps/client/src/widgets/attribute_widgets/PromotedAttributesDisplay.tsx diff --git a/apps/client/src/widgets/attribute_widgets/PromotedAttributesDisplay.tsx b/apps/client/src/widgets/attribute_widgets/PromotedAttributesDisplay.tsx new file mode 100644 index 000000000..b9c04863f --- /dev/null +++ b/apps/client/src/widgets/attribute_widgets/PromotedAttributesDisplay.tsx @@ -0,0 +1,29 @@ +import FNote from "../../entities/fnote"; + +interface PromotedAttributesDisplayProps { + note: FNote; +} + +export default function PromotedAttributesDisplay({ note }: PromotedAttributesDisplayProps) { + const promotedDefinitionAttributes = note.getPromotedDefinitionAttributes(); + + return ( +
+ {promotedDefinitionAttributes.map((attr) => { + const def = attr.getDefinition(); + const [ type, name ] = attr.name.split(":", 2); + const value = note.getLabelValue(name); + const friendlyName = def?.promotedAlias ?? name; + if (!value) return null; + + return ( +
+ {friendlyName}: {value} +
+ ); + } + )} +
+ ) + +} diff --git a/apps/client/src/widgets/collections/board/card.tsx b/apps/client/src/widgets/collections/board/card.tsx index 2879f3a43..c71d69afe 100644 --- a/apps/client/src/widgets/collections/board/card.tsx +++ b/apps/client/src/widgets/collections/board/card.tsx @@ -6,6 +6,7 @@ import { BoardViewContext, TitleEditor } from "."; import { ContextMenuEvent } from "../../../menus/context_menu"; import { openNoteContextMenu } from "./context_menu"; import { t } from "../../../services/i18n"; +import PromotedAttributesDisplay from "../../attribute_widgets/PromotedAttributesDisplay"; export const CARD_CLIPBOARD_TYPE = "trilium/board-card"; @@ -108,6 +109,7 @@ export default function Card({ title={t("board_view.edit-note-title")} onClick={handleEdit} /> + ) : (