Display icon on chat list for system messages (#10493)
This commit is contained in:
@@ -39,6 +39,7 @@ import {getSystemMessageInfo} from '#/components/dms/getSystemMessageInfo'
|
|||||||
import {LeaveConvoPrompt} from '#/components/dms/LeaveConvoPrompt'
|
import {LeaveConvoPrompt} from '#/components/dms/LeaveConvoPrompt'
|
||||||
import {type ConvoWithDetails, parseConvoView} from '#/components/dms/util'
|
import {type ConvoWithDetails, parseConvoView} from '#/components/dms/util'
|
||||||
import {Bell2Off_Filled_Corner0_Rounded as BellStroke} from '#/components/icons/Bell2'
|
import {Bell2Off_Filled_Corner0_Rounded as BellStroke} from '#/components/icons/Bell2'
|
||||||
|
import {type Props as SVGIconProps} from '#/components/icons/common'
|
||||||
import {Envelope_Open_Stroke2_Corner0_Rounded as EnvelopeOpen} from '#/components/icons/EnveopeOpen'
|
import {Envelope_Open_Stroke2_Corner0_Rounded as EnvelopeOpen} from '#/components/icons/EnveopeOpen'
|
||||||
import {Trash_Stroke2_Corner0_Rounded} from '#/components/icons/Trash'
|
import {Trash_Stroke2_Corner0_Rounded} from '#/components/icons/Trash'
|
||||||
import {Link} from '#/components/Link'
|
import {Link} from '#/components/Link'
|
||||||
@@ -264,10 +265,16 @@ function BaseChatItem({
|
|||||||
isDeletedAccount ||
|
isDeletedAccount ||
|
||||||
(convo.kind === 'group' && convo.details.lockStatus !== 'unlocked')
|
(convo.kind === 'group' && convo.details.lockStatus !== 'unlocked')
|
||||||
|
|
||||||
const {lastMessage, lastMessageSentAt, latestReportableMessage} =
|
const {
|
||||||
useMemo(() => {
|
lastMessage,
|
||||||
|
LastMessageIcon,
|
||||||
|
lastMessageSentAt,
|
||||||
|
latestReportableMessage,
|
||||||
|
} = useMemo(() => {
|
||||||
let lastMessage = l`No messages yet`
|
let lastMessage = l`No messages yet`
|
||||||
|
|
||||||
|
let LastMessageIcon: React.ComponentType<SVGIconProps> | null = null
|
||||||
|
|
||||||
let lastMessageSentAt: string | null = null
|
let lastMessageSentAt: string | null = null
|
||||||
|
|
||||||
let latestReportableMessage: ChatBskyConvoDefs.MessageView | undefined
|
let latestReportableMessage: ChatBskyConvoDefs.MessageView | undefined
|
||||||
@@ -320,12 +327,14 @@ function BaseChatItem({
|
|||||||
)
|
)
|
||||||
if (info) {
|
if (info) {
|
||||||
lastMessage = i18n._(info.message)
|
lastMessage = i18n._(info.message)
|
||||||
|
LastMessageIcon = info.Icon
|
||||||
lastMessageSentAt = convo.view.lastMessage.sentAt
|
lastMessageSentAt = convo.view.lastMessage.sentAt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
lastMessage,
|
lastMessage,
|
||||||
|
LastMessageIcon,
|
||||||
lastMessageSentAt,
|
lastMessageSentAt,
|
||||||
latestReportableMessage,
|
latestReportableMessage,
|
||||||
}
|
}
|
||||||
@@ -526,17 +535,27 @@ function BaseChatItem({
|
|||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
<View style={[a.flex_row, a.align_center]}>
|
||||||
|
{LastMessageIcon && (
|
||||||
|
<LastMessageIcon
|
||||||
|
size="xs"
|
||||||
|
style={[a.mr_2xs, t.atoms.text_contrast_medium]}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<Text
|
<Text
|
||||||
emoji
|
emoji
|
||||||
numberOfLines={2}
|
numberOfLines={2}
|
||||||
style={[
|
style={[
|
||||||
a.text_sm,
|
a.text_sm,
|
||||||
a.leading_snug,
|
a.leading_snug,
|
||||||
hasUnread ? a.font_semi_bold : t.atoms.text_contrast_high,
|
hasUnread
|
||||||
|
? a.font_semi_bold
|
||||||
|
: t.atoms.text_contrast_high,
|
||||||
isDimStyle && t.atoms.text_contrast_medium,
|
isDimStyle && t.atoms.text_contrast_medium,
|
||||||
]}>
|
]}>
|
||||||
{lastMessage}
|
{lastMessage}
|
||||||
</Text>
|
</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
{postAlerts}
|
{postAlerts}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user