@@ -14,12 +14,10 @@ interface AttributeWithDefinitions {
1414}
1515
1616export default function PromotedAttributesDisplay ( { note, ignoredAttributes } : PromotedAttributesDisplayProps ) {
17- const promotedDefinitionAttributes = useNoteAttributesWithDefinitions ( note ) ;
17+ const promotedDefinitionAttributes = useNoteAttributesWithDefinitions ( note , ignoredAttributes ) ;
1818 return promotedDefinitionAttributes ?. length > 0 && (
1919 < div className = "promoted-attributes" >
2020 { promotedDefinitionAttributes ?. map ( ( attr ) => {
21- if ( ignoredAttributes && ignoredAttributes . includes ( attr . name ) ) return null ;
22-
2321 return (
2422 < span key = { attr . friendlyName } className = "promoted-attribute" >
2523 < strong > { attr . friendlyName } :</ strong > { attr . value }
@@ -32,7 +30,7 @@ export default function PromotedAttributesDisplay({ note, ignoredAttributes }: P
3230
3331}
3432
35- function useNoteAttributesWithDefinitions ( note : FNote ) {
33+ function useNoteAttributesWithDefinitions ( note : FNote , attributesToIgnore : string [ ] = [ ] ) : AttributeWithDefinitions [ ] {
3634 const promotedDefinitionAttributes = note . getPromotedDefinitionAttributes ( ) ;
3735 const result : AttributeWithDefinitions [ ] = [ ] ;
3836
@@ -42,6 +40,7 @@ function useNoteAttributesWithDefinitions(note: FNote) {
4240 const value = note . getLabelValue ( name ) ;
4341 const friendlyName = def ?. promotedAlias ?? name ;
4442 if ( ! value ) continue ;
43+ if ( attributesToIgnore . includes ( name ) ) continue ;
4544
4645 result . push ( { name, type, friendlyName, value } ) ;
4746 }
0 commit comments