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
feat(board): display promoted attributes
Elian Doran62dc570d3814
diff --git a/apps/client/src/widgets/attribute_widgets/PromotedAttributesDisplay.tsx b/apps/client/src/widgets/attribute_widgets/PromotedAttributesDisplay.tsxnew file mode 100644index 0000000000..b9c04863fa--- /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 (+ <div className="promoted-attributes">+ {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 (+ <div key={attr.name} className="promoted-attribute">+ <strong>{friendlyName}:</strong> {value}+ </div>+ );+ }+ )}+ </div>+ )++}diff --git a/apps/client/src/widgets/collections/board/card.tsx b/apps/client/src/widgets/collections/board/card.tsxindex 2879f3a43e..c71d69afe5 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}/>+ <PromotedAttributesDisplay note={note} /></>) : (<TitleEditor