Fix anchor text overflow in threads v2

This commit is contained in:
Eric Bailey
2025-06-18 13:41:46 -05:00
parent 3eaa2d9ddf
commit deb13a5a26
3 changed files with 49 additions and 55 deletions
@@ -74,7 +74,7 @@ export function ProfileHoverCard(props: ProfileHoverCardProps) {
return props.children return props.children
} else { } else {
return ( return (
<View onPointerMove={onPointerMove} style={[a.flex_shrink]}> <View onPointerMove={onPointerMove} style={[a.flex_shrink, props.style]}>
<ProfileHoverCardInner {...props} /> <ProfileHoverCardInner {...props} />
</View> </View>
) )
+4 -2
View File
@@ -1,7 +1,9 @@
import type React from 'react' import type React from 'react'
export type ProfileHoverCardProps = { import {type ViewStyleProp} from '#/alf'
children: React.ReactElement
export type ProfileHoverCardProps = ViewStyleProp & {
children: React.ReactNode
did: string did: string
disable?: boolean disable?: boolean
} }
@@ -311,6 +311,7 @@ const ThreadItemAnchorInner = memo(function ThreadItemAnchorInner({
isRoot && [a.pt_lg], isRoot && [a.pt_lg],
]}> ]}>
<View style={[a.flex_row, a.gap_md, a.pb_md]}> <View style={[a.flex_row, a.gap_md, a.pb_md]}>
<View collapsable={false}>
<PreviewableUserAvatar <PreviewableUserAvatar
size={42} size={42}
profile={post.author} profile={post.author}
@@ -319,26 +320,25 @@ const ThreadItemAnchorInner = memo(function ThreadItemAnchorInner({
live={live} live={live}
onBeforePress={onOpenAuthor} onBeforePress={onOpenAuthor}
/> />
<View style={[a.flex_1, a.align_start]}> </View>
<ProfileHoverCard did={post.author.did}>
<View style={[a.flex_1]}>
<View style={[a.flex_row, a.align_center]}>
<Link <Link
to={authorHref} to={authorHref}
style={[a.flex_shrink]} style={[a.flex_1]}
label={sanitizeDisplayName( label={sanitizeDisplayName(
post.author.displayName || post.author.displayName || sanitizeHandle(post.author.handle),
sanitizeHandle(post.author.handle),
moderation.ui('displayName'), moderation.ui('displayName'),
)} )}
onPress={onOpenAuthor}> onPress={onOpenAuthor}>
<View style={[a.flex_1, a.align_start]}>
<ProfileHoverCard did={post.author.did} style={[a.w_full]}>
<View style={[a.flex_row, a.align_center]}>
<Text <Text
emoji emoji
style={[ style={[
a.flex_shrink,
a.text_lg, a.text_lg,
a.font_bold, a.font_bold,
a.leading_snug, a.leading_snug,
a.self_start,
]} ]}
numberOfLines={1}> numberOfLines={1}>
{sanitizeDisplayName( {sanitizeDisplayName(
@@ -347,17 +347,11 @@ const ThreadItemAnchorInner = memo(function ThreadItemAnchorInner({
moderation.ui('displayName'), moderation.ui('displayName'),
)} )}
</Text> </Text>
</Link>
<View style={[{paddingLeft: 3, top: -1}]}> <View style={[{paddingLeft: 3, top: -1}]}>
<VerificationCheckButton profile={authorShadow} size="md" /> <VerificationCheckButton profile={authorShadow} size="md" />
</View> </View>
</View> </View>
<View style={[a.align_start]}>
<Link
style={[a.flex_shrink]}
to={authorHref}
label={sanitizeHandle(post.author.handle, '@')}>
<Text <Text
style={[ style={[
a.text_md, a.text_md,
@@ -367,13 +361,11 @@ const ThreadItemAnchorInner = memo(function ThreadItemAnchorInner({
numberOfLines={1}> numberOfLines={1}>
{sanitizeHandle(post.author.handle, '@')} {sanitizeHandle(post.author.handle, '@')}
</Text> </Text>
</Link>
</View>
</View>
</ProfileHoverCard> </ProfileHoverCard>
</View> </View>
</Link>
{showFollowButton && ( {showFollowButton && (
<View> <View collapsable={false}>
<PostThreadFollowBtn did={post.author.did} /> <PostThreadFollowBtn did={post.author.did} />
</View> </View>
)} )}