style tweaks
This commit is contained in:
@@ -751,18 +751,37 @@ function ReplyQuote({
|
|||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {t: l} = useLingui()
|
const {t: l} = useLingui()
|
||||||
|
|
||||||
const isDeleted = ChatBskyConvoDefs.isDeletedMessageView(replyTo)
|
|
||||||
const senderProfile = relatedProfiles.get(replyTo.sender.did)
|
const senderProfile = relatedProfiles.get(replyTo.sender.did)
|
||||||
const senderName = senderProfile
|
const senderName = senderProfile
|
||||||
? createSanitizedDisplayName(senderProfile)
|
? createSanitizedDisplayName(senderProfile)
|
||||||
: null
|
: null
|
||||||
|
|
||||||
// On the blue self-bubble, derive the quote chrome from white; on the grey
|
|
||||||
// bubble, from the foreground text color. Keeps it legible against either.
|
|
||||||
const tintColor = isFromSelf ? t.palette.white : t.atoms.text.color
|
const tintColor = isFromSelf ? t.palette.white : t.atoms.text.color
|
||||||
const subtleColor = isFromSelf
|
const subtleColor = isFromSelf
|
||||||
? utils.alpha(t.palette.white, 0.7)
|
? t.palette.white
|
||||||
: t.atoms.text_contrast_medium.color
|
: t.atoms.text_contrast_high.color
|
||||||
|
const borderColor = isFromSelf
|
||||||
|
? utils.alpha(t.palette.white, 0.5)
|
||||||
|
: t.atoms.border_contrast_high.borderColor
|
||||||
|
|
||||||
|
let text: string
|
||||||
|
let subtle = false
|
||||||
|
if (ChatBskyConvoDefs.isMessageView(replyTo)) {
|
||||||
|
text = replyTo.text
|
||||||
|
if (!text.trim()) {
|
||||||
|
subtle = true
|
||||||
|
if (ChatBskyEmbedJoinLink.isView(replyTo.embed)) {
|
||||||
|
text = l`(chat invite link)`
|
||||||
|
} else if (AppBskyEmbedRecord.isView(replyTo.embed)) {
|
||||||
|
text = l`(contains embedded content)`
|
||||||
|
} else {
|
||||||
|
text = l`No text`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
text = l`Deleted message`
|
||||||
|
subtle = true
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
@@ -772,42 +791,33 @@ function ReplyQuote({
|
|||||||
: l`Replied-to message, tap to scroll to it`
|
: l`Replied-to message, tap to scroll to it`
|
||||||
}
|
}
|
||||||
onPress={onPress}
|
onPress={onPress}
|
||||||
style={[a.mb_xs]}>
|
style={[
|
||||||
<View
|
a.mb_xs,
|
||||||
style={[
|
a.w_full,
|
||||||
a.w_full,
|
a.gap_2xs,
|
||||||
a.gap_2xs,
|
a.rounded_md,
|
||||||
a.rounded_sm,
|
a.px_sm,
|
||||||
a.px_sm,
|
a.py_xs,
|
||||||
a.py_xs,
|
a.flex_col,
|
||||||
a.border_l,
|
a.align_start,
|
||||||
{
|
a.border,
|
||||||
borderLeftWidth: 3,
|
{borderColor, marginHorizontal: -4},
|
||||||
borderLeftColor: tintColor,
|
]}>
|
||||||
backgroundColor: utils.alpha(tintColor, isFromSelf ? 0.15 : 0.06),
|
{senderName ? (
|
||||||
},
|
<Text style={[a.text_xs, {color: subtleColor}]} emoji numberOfLines={1}>
|
||||||
]}>
|
{senderName}
|
||||||
{senderName ? (
|
|
||||||
<Text
|
|
||||||
style={[a.text_xs, a.font_bold, {color: subtleColor}]}
|
|
||||||
emoji
|
|
||||||
numberOfLines={1}>
|
|
||||||
{senderName}
|
|
||||||
</Text>
|
|
||||||
) : null}
|
|
||||||
<Text
|
|
||||||
style={[a.text_sm, {color: isDeleted ? subtleColor : tintColor}]}
|
|
||||||
emoji
|
|
||||||
numberOfLines={2}>
|
|
||||||
{ChatBskyConvoDefs.isMessageView(replyTo) ? (
|
|
||||||
replyTo.text
|
|
||||||
) : (
|
|
||||||
<Text style={[a.text_sm, a.italic, {color: subtleColor}]}>
|
|
||||||
<Trans>Message deleted</Trans>
|
|
||||||
</Text>
|
|
||||||
)}
|
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
) : null}
|
||||||
|
<Text
|
||||||
|
style={[
|
||||||
|
a.text_sm,
|
||||||
|
{color: subtle ? subtleColor : tintColor},
|
||||||
|
subtle && a.italic,
|
||||||
|
]}
|
||||||
|
emoji
|
||||||
|
numberOfLines={2}>
|
||||||
|
{text}
|
||||||
|
</Text>
|
||||||
</Button>
|
</Button>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,7 +262,6 @@ function InnerReady({
|
|||||||
{IS_LIQUID_GLASS ? (
|
{IS_LIQUID_GLASS ? (
|
||||||
<ScrollEdgeEffect
|
<ScrollEdgeEffect
|
||||||
edge="top"
|
edge="top"
|
||||||
effect="soft"
|
|
||||||
style={[a.absolute, a.w_full, a.z_10, {paddingTop: topInset}]}
|
style={[a.absolute, a.w_full, a.z_10, {paddingTop: topInset}]}
|
||||||
onLayout={onHeaderLayout}>
|
onLayout={onHeaderLayout}>
|
||||||
{header}
|
{header}
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import {LayoutAnimation, View} from 'react-native'
|
import {LayoutAnimation, View} from 'react-native'
|
||||||
import {Trans, useLingui} from '@lingui/react/macro'
|
import {useLingui} from '@lingui/react/macro'
|
||||||
|
|
||||||
import {HITSLOP_20} from '#/lib/constants'
|
import {HITSLOP_20} from '#/lib/constants'
|
||||||
import {createSanitizedDisplayName} from '#/lib/moderation/create-sanitized-display-name'
|
import {createSanitizedDisplayName} from '#/lib/moderation/create-sanitized-display-name'
|
||||||
import {useConvoActive} from '#/state/messages/convo'
|
import {useConvoActive} from '#/state/messages/convo'
|
||||||
import {useSession} from '#/state/session'
|
|
||||||
import {atoms as a, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
import {Button} from '#/components/Button'
|
import {Button} from '#/components/Button'
|
||||||
import {useMessageDialogs} from '#/components/dms/MessageOverlays'
|
import {useMessageDialogs} from '#/components/dms/MessageOverlays'
|
||||||
@@ -18,7 +17,6 @@ import {Text} from '#/components/Typography'
|
|||||||
export function MessageInputReply() {
|
export function MessageInputReply() {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {t: l} = useLingui()
|
const {t: l} = useLingui()
|
||||||
const {currentAccount} = useSession()
|
|
||||||
const convo = useConvoActive()
|
const convo = useConvoActive()
|
||||||
const {replyTo, clearReply} = useMessageDialogs()
|
const {replyTo, clearReply} = useMessageDialogs()
|
||||||
|
|
||||||
@@ -31,10 +29,9 @@ export function MessageInputReply() {
|
|||||||
clearReply()
|
clearReply()
|
||||||
}
|
}
|
||||||
|
|
||||||
const isFromSelf = replyTo.sender.did === currentAccount?.did
|
|
||||||
const senderProfile = convo.relatedProfiles.get(replyTo.sender.did)
|
const senderProfile = convo.relatedProfiles.get(replyTo.sender.did)
|
||||||
const displayName = senderProfile
|
const displayName = senderProfile
|
||||||
? createSanitizedDisplayName(senderProfile)
|
? createSanitizedDisplayName(senderProfile, false)
|
||||||
: null
|
: null
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -43,31 +40,25 @@ export function MessageInputReply() {
|
|||||||
a.flex_1,
|
a.flex_1,
|
||||||
a.flex_row,
|
a.flex_row,
|
||||||
a.gap_sm,
|
a.gap_sm,
|
||||||
a.align_center,
|
a.align_start,
|
||||||
t.atoms.border_contrast_high,
|
t.atoms.border_contrast_high,
|
||||||
a.rounded_md,
|
a.rounded_md,
|
||||||
a.border,
|
a.border,
|
||||||
a.p_sm,
|
a.p_sm,
|
||||||
a.mt_sm,
|
a.mt_sm,
|
||||||
a.mx_sm,
|
a.mx_sm,
|
||||||
|
a.gap_2xs,
|
||||||
]}>
|
]}>
|
||||||
<View style={[a.flex_1]}>
|
<View style={[a.flex_1]}>
|
||||||
<Text
|
{displayName && (
|
||||||
style={[a.text_xs, a.font_bold, t.atoms.text_contrast_medium]}
|
<Text
|
||||||
emoji
|
style={[a.text_xs, t.atoms.text_contrast_high]}
|
||||||
numberOfLines={1}>
|
emoji
|
||||||
{isFromSelf ? (
|
numberOfLines={1}>
|
||||||
<Trans>Replying to yourself</Trans>
|
{displayName}
|
||||||
) : displayName ? (
|
</Text>
|
||||||
<Trans>Replying to {displayName}</Trans>
|
)}
|
||||||
) : (
|
<Text style={[a.text_sm]} emoji numberOfLines={2}>
|
||||||
<Trans>Replying to message</Trans>
|
|
||||||
)}
|
|
||||||
</Text>
|
|
||||||
<Text
|
|
||||||
style={[a.text_sm, t.atoms.text_contrast_high, a.mt_2xs]}
|
|
||||||
emoji
|
|
||||||
numberOfLines={1}>
|
|
||||||
{replyTo.text}
|
{replyTo.text}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -380,7 +380,7 @@ export function MessagesList({
|
|||||||
|
|
||||||
// -- Message sending
|
// -- Message sending
|
||||||
const onSendMessage = useCallback(
|
const onSendMessage = useCallback(
|
||||||
async (text: string, replyTo?: ChatBskyConvoDefs.MessageView) => {
|
async (text: string, reply?: $Typed<ChatBskyConvoDefs.MessageView>) => {
|
||||||
let rt = new RichText({text: text.trimEnd()}, {cleanNewlines: true})
|
let rt = new RichText({text: text.trimEnd()}, {cleanNewlines: true})
|
||||||
|
|
||||||
// detect facets without resolution first - this is used to see if there's
|
// detect facets without resolution first - this is used to see if there's
|
||||||
@@ -396,6 +396,7 @@ export function MessagesList({
|
|||||||
| $Typed<AppBskyEmbedRecord.View>
|
| $Typed<AppBskyEmbedRecord.View>
|
||||||
| $Typed<ChatBskyEmbedJoinLink.View>
|
| $Typed<ChatBskyEmbedJoinLink.View>
|
||||||
| undefined
|
| undefined
|
||||||
|
let replyTo: ChatBskyConvoDefs.ReplyRef | undefined
|
||||||
|
|
||||||
// Find the embedded link facet and, if it's at the start or end of the
|
// Find the embedded link facet and, if it's at the start or end of the
|
||||||
// message, remove it from the text (the embed card replaces it).
|
// message, remove it from the text (the embed card replaces it).
|
||||||
@@ -464,6 +465,10 @@ export function MessagesList({
|
|||||||
stripLinkFacet(uri => getChatInviteCodeFromUrl(uri) === code)
|
stripLinkFacet(uri => getChatInviteCodeFromUrl(uri) === code)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (reply) {
|
||||||
|
replyTo = {messageId: reply.id}
|
||||||
|
}
|
||||||
|
|
||||||
await rt.detectFacets(agent)
|
await rt.detectFacets(agent)
|
||||||
|
|
||||||
rt = shortenLinks(rt)
|
rt = shortenLinks(rt)
|
||||||
@@ -478,12 +483,10 @@ export function MessagesList({
|
|||||||
text: rt.text,
|
text: rt.text,
|
||||||
facets: rt.facets,
|
facets: rt.facets,
|
||||||
embed,
|
embed,
|
||||||
replyTo: replyTo ? {messageId: replyTo.id} : undefined,
|
replyTo,
|
||||||
},
|
},
|
||||||
embedView,
|
embedView,
|
||||||
replyTo
|
reply,
|
||||||
? {...replyTo, $type: 'chat.bsky.convo.defs#messageView'}
|
|
||||||
: undefined,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if (replyTo) {
|
if (replyTo) {
|
||||||
@@ -731,7 +734,7 @@ function Composer({
|
|||||||
textInputId: string
|
textInputId: string
|
||||||
onSendMessage: (
|
onSendMessage: (
|
||||||
message: string,
|
message: string,
|
||||||
replyTo?: ChatBskyConvoDefs.MessageView,
|
replyTo?: $Typed<ChatBskyConvoDefs.MessageView>,
|
||||||
) => Promise<void>
|
) => Promise<void>
|
||||||
messageEmbed: MessageEmbedState | undefined
|
messageEmbed: MessageEmbedState | undefined
|
||||||
setEmbed: (embedUrl: string | undefined) => void
|
setEmbed: (embedUrl: string | undefined) => void
|
||||||
@@ -741,7 +744,12 @@ function Composer({
|
|||||||
const {replyTo, clearReply} = useMessageDialogs()
|
const {replyTo, clearReply} = useMessageDialogs()
|
||||||
|
|
||||||
const handleSendMessage = useNonReactiveCallback((message: string) => {
|
const handleSendMessage = useNonReactiveCallback((message: string) => {
|
||||||
void onSendMessage(message, replyTo ?? undefined)
|
void onSendMessage(
|
||||||
|
message,
|
||||||
|
replyTo
|
||||||
|
? {...replyTo, $type: 'chat.bsky.convo.defs#messageView'}
|
||||||
|
: undefined,
|
||||||
|
)
|
||||||
clearReply()
|
clearReply()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user