mirror of
https://github.com/zadam/trilium.git
synced 2025-11-13 09:59:02 +01:00
feat(board): display promoted attributes
This commit is contained in:
parent
b759c5e7d2
commit
62dc570d38
@ -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>
|
||||
)
|
||||
|
||||
}
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user