[🐴] 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>
This commit is contained in:
Samuel Newman
2024-05-31 18:43:04 +03:00
committed by GitHub
parent 8eb3cebb36
commit 22e1eb18c8
6 changed files with 225 additions and 58 deletions
+11 -7
View File
@@ -2,6 +2,7 @@ import React from 'react'
import {
StyleProp,
StyleSheet,
TextStyle,
TouchableOpacity,
View,
ViewStyle,
@@ -31,7 +32,7 @@ import {InfoCircleIcon} from 'lib/icons'
import {makeProfileLink} from 'lib/routes/links'
import {precacheProfile} from 'state/queries/profile'
import {ComposerOptsQuote} from 'state/shell/composer'
import {atoms as a} from '#/alf'
import {atoms as a, flatten} from '#/alf'
import {RichText} from '#/components/RichText'
import {ContentHider} from '../../../../components/moderation/ContentHider'
import {PostAlerts} from '../../../../components/moderation/PostAlerts'
@@ -45,10 +46,12 @@ export function MaybeQuoteEmbed({
embed,
onOpen,
style,
textStyle,
}: {
embed: AppBskyEmbedRecord.View
onOpen?: () => void
style?: StyleProp<ViewStyle>
textStyle?: StyleProp<TextStyle>
}) {
const pal = usePalette('default')
if (
@@ -62,6 +65,7 @@ export function MaybeQuoteEmbed({
postRecord={embed.record.value}
onOpen={onOpen}
style={style}
textStyle={textStyle}
/>
)
} else if (AppBskyEmbedRecord.isViewBlocked(embed.record)) {
@@ -91,11 +95,13 @@ function QuoteEmbedModerated({
postRecord,
onOpen,
style,
textStyle,
}: {
viewRecord: AppBskyEmbedRecord.ViewRecord
postRecord: AppBskyFeedPost.Record
onOpen?: () => void
style?: StyleProp<ViewStyle>
textStyle?: StyleProp<TextStyle>
}) {
const moderationOpts = useModerationOpts()
const moderation = React.useMemo(() => {
@@ -120,6 +126,7 @@ function QuoteEmbedModerated({
moderation={moderation}
onOpen={onOpen}
style={style}
textStyle={textStyle}
/>
)
}
@@ -129,11 +136,13 @@ export function QuoteEmbed({
moderation,
onOpen,
style,
textStyle,
}: {
quote: ComposerOptsQuote
moderation?: ModerationDecision
onOpen?: () => void
style?: StyleProp<ViewStyle>
textStyle?: StyleProp<TextStyle>
}) {
const queryClient = useQueryClient()
const pal = usePalette('default')
@@ -192,7 +201,7 @@ export function QuoteEmbed({
{richText ? (
<RichText
value={richText}
style={[a.text_md]}
style={[a.text_md, flatten(textStyle)]}
numberOfLines={20}
disableLinks
/>
@@ -250,11 +259,6 @@ const styles = StyleSheet.create({
paddingHorizontal: 12,
borderWidth: hairlineWidth,
},
quotePost: {
flex: 1,
paddingLeft: 13,
paddingRight: 8,
},
errorContainer: {
flexDirection: 'row',
alignItems: 'center',