@@ -7,7 +7,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
7
7
Please see LICENSE files in the repository root for full details.
8
8
*/
9
9
10
- import React , { createRef , forwardRef , MouseEvent , ReactNode } from "react" ;
10
+ import React , { createRef , forwardRef , JSX , MouseEvent , ReactNode } from "react" ;
11
11
import classNames from "classnames" ;
12
12
import {
13
13
EventStatus ,
@@ -76,6 +76,8 @@ import { ElementCall } from "../../../models/Call";
76
76
import { UnreadNotificationBadge } from "./NotificationBadge/UnreadNotificationBadge" ;
77
77
import { EventTileThreadToolbar } from "./EventTile/EventTileThreadToolbar" ;
78
78
import { getLateEventInfo } from "../../structures/grouper/LateEventGrouper" ;
79
+ import PinningUtils from "../../../utils/PinningUtils.ts" ;
80
+ import { PinnedMessageBadge } from "../messages/PinnedMessageBadge.tsx" ;
79
81
80
82
export type GetRelationsForEvent = (
81
83
eventId : string ,
@@ -1123,6 +1125,11 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
1123
1125
1124
1126
const timestamp = showTimestamp && ts ? messageTimestamp : null ;
1125
1127
1128
+ let pinnedMessageBadge : JSX . Element | undefined ;
1129
+ if ( PinningUtils . isPinned ( MatrixClientPeg . safeGet ( ) , this . props . mxEvent ) ) {
1130
+ pinnedMessageBadge = < PinnedMessageBadge /> ;
1131
+ }
1132
+
1126
1133
let reactionsRow : JSX . Element | undefined ;
1127
1134
if ( ! isRedacted ) {
1128
1135
reactionsRow = (
@@ -1134,6 +1141,9 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
1134
1141
) ;
1135
1142
}
1136
1143
1144
+ // If we have reactions or a pinned message badge, we need a footer
1145
+ const hasFooter = Boolean ( ( reactionsRow && this . state . reactions ) || pinnedMessageBadge ) ;
1146
+
1137
1147
const linkedTimestamp = ! this . props . hideTimestamp ? (
1138
1148
< a
1139
1149
href = { permalink }
@@ -1239,7 +1249,13 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
1239
1249
</ a >
1240
1250
{ msgOption }
1241
1251
</ div > ,
1242
- reactionsRow ,
1252
+ hasFooter && (
1253
+ < div className = "mx_EventTile_footer" key = "mx_EventTile_footer" >
1254
+ { ( this . props . layout === Layout . Group || ! isOwnEvent ) && pinnedMessageBadge }
1255
+ { reactionsRow }
1256
+ { this . props . layout === Layout . Bubble && isOwnEvent && pinnedMessageBadge }
1257
+ </ div >
1258
+ ) ,
1243
1259
] ,
1244
1260
) ;
1245
1261
}
@@ -1428,14 +1444,25 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
1428
1444
{ actionBar }
1429
1445
{ this . props . layout === Layout . IRC && (
1430
1446
< >
1431
- { reactionsRow }
1447
+ { hasFooter && (
1448
+ < div className = "mx_EventTile_footer" >
1449
+ { pinnedMessageBadge }
1450
+ { reactionsRow }
1451
+ </ div >
1452
+ ) }
1432
1453
{ this . renderThreadInfo ( ) }
1433
1454
</ >
1434
1455
) }
1435
1456
</ div >
1436
1457
{ this . props . layout !== Layout . IRC && (
1437
1458
< >
1438
- { reactionsRow }
1459
+ { hasFooter && (
1460
+ < div className = "mx_EventTile_footer" >
1461
+ { ( this . props . layout === Layout . Group || ! isOwnEvent ) && pinnedMessageBadge }
1462
+ { reactionsRow }
1463
+ { this . props . layout === Layout . Bubble && isOwnEvent && pinnedMessageBadge }
1464
+ </ div >
1465
+ ) }
1439
1466
{ this . renderThreadInfo ( ) }
1440
1467
</ >
1441
1468
) }
0 commit comments