@@ -7,7 +7,7 @@ import { DefinitionObject } from "../../services/promoted_attribute_definition_p
77import { formatDateTime } from "../../utils/formatters" ;
88import { ComponentChildren } from "preact" ;
99import Icon from "../react/Icon" ;
10- import css_class_manager from "../../services/css_class_manager " ;
10+ import NoteLink from "../react/NoteLink " ;
1111
1212interface PromotedAttributesDisplayProps {
1313 note : FNote ;
@@ -30,7 +30,7 @@ export default function PromotedAttributesDisplay({ note, ignoredAttributes }: P
3030 const className = `${ attr . type === "label" ? "label" + " " + attr . def . labelType : "relation" } ` ;
3131 return (
3232 < span key = { attr . friendlyName } className = { `promoted-attribute type-${ className } ` } >
33- { formatLabelValue ( attr ) }
33+ { attr . type === "relation" ? formatRelation ( attr ) : formatLabelValue ( attr ) }
3434 </ span >
3535 ) ;
3636 }
@@ -84,13 +84,19 @@ function formatLabelValue(attr: AttributeWithDefinitions): ComponentChildren {
8484 }
8585}
8686
87+ function formatRelation ( attr : AttributeWithDefinitions ) : ComponentChildren {
88+ return (
89+ < > < strong > { attr . friendlyName } :</ strong > < NoteLink notePath = { attr . value } showNoteIcon /> </ >
90+ )
91+ }
92+
8793function getAttributesWithDefinitions ( note : FNote , attributesToIgnore : string [ ] = [ ] ) : AttributeWithDefinitions [ ] {
8894 const promotedDefinitionAttributes = note . getPromotedDefinitionAttributes ( ) ;
8995 const result : AttributeWithDefinitions [ ] = [ ] ;
9096 for ( const attr of promotedDefinitionAttributes ) {
9197 const def = attr . getDefinition ( ) ;
9298 const [ type , name ] = attr . name . split ( ":" , 2 ) ;
93- const value = note . getLabelValue ( name ) ;
99+ const value = type === "label" ? note . getLabelValue ( name ) : note . getRelationValue ( name ) ;
94100 const friendlyName = def ?. promotedAlias || name ;
95101 if ( ! value ) continue ;
96102 if ( attributesToIgnore . includes ( name ) ) continue ;
0 commit comments