@@ -36,17 +36,20 @@ const PACK_ROOM_EVENT_TYPE = "im.ponies.room_emotes";
3636const cc = ( thing : string ) => "mx_2545Stickers_" + thing ;
3737
3838interface I2545Image {
39- body : string ;
40- info : IImageInfo ;
4139 url : string ; // mxc
42- usage : ( "sticker" | "emoticon" ) [ ] ;
40+ body ?: string ;
41+ info ?: IImageInfo ;
42+ // 2545: If present and non-empty, this overrides the usage defined at pack level for this particular image
43+ usage ?: ( "sticker" | "emoticon" ) [ ] ;
4344}
4445
4546interface I2545Pack {
4647 pack : {
47- attribution : string ;
48- avatar_url : string ;
49- display_name : string ;
48+ attribution ?: string ;
49+ // 2545: If the usage is absent or empty, a usage for all possible usage types is to be assumed.
50+ usage ?: ( "emoticon" | "sticker" ) [ ] ;
51+ avatar_url ?: string ;
52+ display_name ?: string ;
5053 } ;
5154 images : {
5255 [ id : string ] : I2545Image ;
@@ -121,12 +124,13 @@ export const MSC2545StickerPicker: React.FC<{
121124 const renderedPacks = packs . map ( ( { pack, packName } , packIdx ) => {
122125 const lcFilter = searchFilter . toLowerCase ( ) . trim ( ) ; // filter is case insensitive
123126 const images = Object . values ( pack . images )
124- . filter ( im => im . body . toLowerCase ( ) . includes ( lcFilter ) ) ;
127+ . filter ( im => ( im . body || "" ) . toLowerCase ( ) . includes ( lcFilter ) ) ;
125128
126129 if ( images . length == 0 ) return ;
127130
131+ const progressiveDisplayName = pack . pack . display_name || packName ;
128132 return < div key = { "pack-" + packName } >
129- < h3 className = { cc ( "label" ) } > { pack . pack . display_name } </ h3 >
133+ < h3 className = { cc ( "label" ) } > { progressiveDisplayName } </ h3 >
130134 < div className = { cc ( "grid" ) } >
131135 { images . map ( ( im , idx ) => < PackImage
132136 innerRef = { ( ! packIdx && ! idx ) ? topStickerRef : null }
0 commit comments