diff options
author | Samuel Newman <mozzius@protonmail.com> | 2024-05-31 18:43:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-31 10:43:04 -0500 |
commit | 22e1eb18c81b6f41927bc86d4726223c2634e19e (patch) | |
tree | 1fbd17678b2922667affa895270dff1f634216e0 /src/components/dms/MessageItem.tsx | |
parent | 8eb3cebb362cc438e368a9fbb78e2f85403ffeed (diff) | |
download | voidsky-22e1eb18c81b6f41927bc86d4726223c2634e19e.tar.zst |
[🐴] Record message (#4230)
* send record via link in text * re-trim text after removing link * record message * only show copy text if message + add translate * reduce padding * adjust padding * Tweak spacing * Stop clickthrough for hidden content * Update bg to show labels --------- Co-authored-by: Eric Bailey <git@esb.lol>
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 && ( |