[🐴] 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:
parent
8eb3cebb36
commit
22e1eb18c8
6 changed files with 225 additions and 58 deletions
|
@ -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',
|
||||
|
|
|
@ -4,6 +4,7 @@ import {
|
|||
StyleProp,
|
||||
StyleSheet,
|
||||
Text,
|
||||
TextStyle,
|
||||
View,
|
||||
ViewStyle,
|
||||
} from 'react-native'
|
||||
|
@ -41,11 +42,13 @@ export function PostEmbeds({
|
|||
moderation,
|
||||
onOpen,
|
||||
style,
|
||||
quoteTextStyle,
|
||||
}: {
|
||||
embed?: Embed
|
||||
moderation?: ModerationDecision
|
||||
onOpen?: () => void
|
||||
style?: StyleProp<ViewStyle>
|
||||
quoteTextStyle?: StyleProp<TextStyle>
|
||||
}) {
|
||||
const pal = usePalette('default')
|
||||
const {openLightbox} = useLightboxControls()
|
||||
|
@ -60,7 +63,11 @@ export function PostEmbeds({
|
|||
moderation={moderation}
|
||||
onOpen={onOpen}
|
||||
/>
|
||||
<MaybeQuoteEmbed embed={embed.record} onOpen={onOpen} />
|
||||
<MaybeQuoteEmbed
|
||||
embed={embed.record}
|
||||
onOpen={onOpen}
|
||||
textStyle={quoteTextStyle}
|
||||
/>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
@ -87,7 +94,14 @@ export function PostEmbeds({
|
|||
|
||||
// quote post
|
||||
// =
|
||||
return <MaybeQuoteEmbed embed={embed} style={style} onOpen={onOpen} />
|
||||
return (
|
||||
<MaybeQuoteEmbed
|
||||
embed={embed}
|
||||
style={style}
|
||||
textStyle={quoteTextStyle}
|
||||
onOpen={onOpen}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
// image embed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue