diff options
Diffstat (limited to 'src/components/dms/MessageItem.tsx')
-rw-r--r-- | src/components/dms/MessageItem.tsx | 74 |
1 files changed, 43 insertions, 31 deletions
diff --git a/src/components/dms/MessageItem.tsx b/src/components/dms/MessageItem.tsx index c5ff81091..b498ddf1c 100644 --- a/src/components/dms/MessageItem.tsx +++ b/src/components/dms/MessageItem.tsx @@ -6,7 +6,11 @@ import { TextStyle, View, } from 'react-native' -import {ChatBskyConvoDefs, RichText as RichTextAPI} from '@atproto/api' +import { + AppBskyEmbedRecord, + ChatBskyConvoDefs, + RichText as RichTextAPI, +} from '@atproto/api' import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' @@ -18,6 +22,7 @@ import {ActionsWrapper} from '#/components/dms/ActionsWrapper' import {InlineLinkText} from '#/components/Link' import {Text} from '#/components/Typography' import {RichText} from '../RichText' +import {MessageItemEmbed} from './MessageItemEmbed' let MessageItem = ({ item, @@ -77,37 +82,44 @@ let MessageItem = ({ return ( <View style={[isFromSelf ? a.mr_md : a.ml_md]}> <ActionsWrapper isFromSelf={isFromSelf} message={message}> - <View - style={[ - a.py_sm, - a.my_2xs, - a.rounded_md, - { - paddingLeft: 14, - paddingRight: 14, - backgroundColor: isFromSelf - ? isPending - ? pendingColor - : t.palette.primary_500 - : t.palette.contrast_50, - borderRadius: 17, - }, - isFromSelf - ? {borderBottomRightRadius: isLastInGroup ? 2 : 17} - : {borderBottomLeftRadius: isLastInGroup ? 2 : 17}, - ]}> - <RichText - value={rt} + {AppBskyEmbedRecord.isMain(message.embed) && ( + <MessageItemEmbed embed={message.embed} /> + )} + {rt.text.length > 0 && ( + <View style={[ - a.text_md, - a.leading_snug, - isFromSelf && {color: t.palette.white}, - isPending && t.name !== 'light' && {color: t.palette.primary_300}, - ]} - interactiveStyle={a.underline} - enableTags - /> - </View> + a.py_sm, + a.my_2xs, + a.rounded_md, + { + paddingLeft: 14, + paddingRight: 14, + backgroundColor: isFromSelf + ? isPending + ? pendingColor + : t.palette.primary_500 + : t.palette.contrast_50, + borderRadius: 17, + }, + isFromSelf ? a.self_end : a.self_start, + isFromSelf + ? {borderBottomRightRadius: isLastInGroup ? 2 : 17} + : {borderBottomLeftRadius: isLastInGroup ? 2 : 17}, + ]}> + <RichText + value={rt} + style={[ + a.text_md, + a.leading_snug, + isFromSelf && {color: t.palette.white}, + isPending && + t.name !== 'light' && {color: t.palette.primary_300}, + ]} + interactiveStyle={a.underline} + enableTags + /> + </View> + )} </ActionsWrapper> {isLastInGroup && ( |