Clean up props/typechecks for AvatarBubbles
This commit is contained in:
@@ -129,40 +129,46 @@ function AvatarBubble({
|
|||||||
includeProfileBorder?: boolean
|
includeProfileBorder?: boolean
|
||||||
}) {
|
}) {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const profile = useProfileShadow(profileUnshadowed)
|
|
||||||
const moderationOpts = useModerationOpts()
|
|
||||||
const moderation = moderationOpts
|
|
||||||
? moderateProfile(profile, moderationOpts)
|
|
||||||
: undefined
|
|
||||||
const animatedStyle = useAnimatedStyle(() => ({
|
const animatedStyle = useAnimatedStyle(() => ({
|
||||||
transform: [{translateX: x}, {translateY: y}, {scale: scale.get()}],
|
transform: [{translateX: x}, {translateY: y}, {scale: scale.get()}],
|
||||||
}))
|
}))
|
||||||
|
|
||||||
return (
|
const style = [
|
||||||
<Animated.View
|
a.absolute,
|
||||||
style={[
|
a.rounded_full,
|
||||||
a.absolute,
|
a.flex_grow_0,
|
||||||
a.rounded_full,
|
includeProfileBorder && {
|
||||||
a.flex_grow_0,
|
borderColor: t.atoms.text_inverted.color,
|
||||||
includeProfileBorder && {
|
borderWidth: 2,
|
||||||
borderColor: t.atoms.text_inverted.color,
|
},
|
||||||
borderWidth: 2,
|
zIndex != null && {zIndex},
|
||||||
},
|
animatedStyle,
|
||||||
zIndex != null && {zIndex},
|
]
|
||||||
animatedStyle,
|
|
||||||
]}>
|
const profile = useProfileShadow(profileUnshadowed)
|
||||||
{profile ? (
|
const moderationOpts = useModerationOpts()
|
||||||
<UserAvatar
|
|
||||||
avatar={profile.avatar}
|
if (!moderationOpts) {
|
||||||
size={size}
|
return (
|
||||||
type="user"
|
<Animated.View style={style}>
|
||||||
hideLiveBadge
|
|
||||||
noBorder
|
|
||||||
moderation={moderation?.ui('avatar')}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<AvatarPlaceholder size={size} />
|
<AvatarPlaceholder size={size} />
|
||||||
)}
|
</Animated.View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const moderation = moderateProfile(profile, moderationOpts)
|
||||||
|
const avatarModeration = moderation.ui('avatar')
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Animated.View style={style}>
|
||||||
|
<UserAvatar
|
||||||
|
avatar={profile.avatar}
|
||||||
|
size={size}
|
||||||
|
type="user"
|
||||||
|
hideLiveBadge
|
||||||
|
noBorder
|
||||||
|
moderation={avatarModeration}
|
||||||
|
/>
|
||||||
</Animated.View>
|
</Animated.View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,11 +152,7 @@ function RecentChatItem({
|
|||||||
a.align_center,
|
a.align_center,
|
||||||
]}>
|
]}>
|
||||||
{convo.kind === 'group' ? (
|
{convo.kind === 'group' ? (
|
||||||
<AvatarBubbles
|
<AvatarBubbles profiles={convo.members} size={WIDTH - 8} />
|
||||||
profiles={convo.members}
|
|
||||||
size={WIDTH - 8}
|
|
||||||
moderationOpts={moderationOpts}
|
|
||||||
/>
|
|
||||||
) : (
|
) : (
|
||||||
<UserAvatar
|
<UserAvatar
|
||||||
avatar={primaryProfile.avatar}
|
avatar={primaryProfile.avatar}
|
||||||
|
|||||||
@@ -514,11 +514,7 @@ function ExistingChatCard({
|
|||||||
]}>
|
]}>
|
||||||
<ProfileCard.Header>
|
<ProfileCard.Header>
|
||||||
{convo.kind === 'group' ? (
|
{convo.kind === 'group' ? (
|
||||||
<AvatarBubbles
|
<AvatarBubbles profiles={convo.members} size={40} />
|
||||||
profiles={convo.members}
|
|
||||||
size={40}
|
|
||||||
moderationOpts={moderationOpts}
|
|
||||||
/>
|
|
||||||
) : (
|
) : (
|
||||||
<ProfileCard.Avatar
|
<ProfileCard.Avatar
|
||||||
profile={convo.primaryMember}
|
profile={convo.primaryMember}
|
||||||
|
|||||||
@@ -461,10 +461,7 @@ function SettingsHeader({
|
|||||||
<View
|
<View
|
||||||
style={[a.px_xl, a.py_4xl, a.border_b, t.atoms.border_contrast_low]}>
|
style={[a.px_xl, a.py_4xl, a.border_b, t.atoms.border_contrast_low]}>
|
||||||
<View style={[a.align_center, a.justify_center]}>
|
<View style={[a.align_center, a.justify_center]}>
|
||||||
<AvatarBubbles
|
<AvatarBubbles profiles={convo.members} />
|
||||||
profiles={convo.members}
|
|
||||||
moderationOpts={moderationOpts}
|
|
||||||
/>
|
|
||||||
</View>
|
</View>
|
||||||
{isOwner ? (
|
{isOwner ? (
|
||||||
<Pressable
|
<Pressable
|
||||||
|
|||||||
@@ -206,7 +206,6 @@ function GroupChatItem({
|
|||||||
<AvatarBubbles
|
<AvatarBubbles
|
||||||
profiles={convo.members}
|
profiles={convo.members}
|
||||||
size={isWithinLeftPanel ? 48 : 52}
|
size={isWithinLeftPanel ? 48 : 52}
|
||||||
moderationOpts={moderationOpts}
|
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
title={chatName}
|
title={chatName}
|
||||||
|
|||||||
@@ -87,11 +87,7 @@ export function MessagesListGroupInfoPanel({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<View style={[a.align_center, a.justify_center]}>
|
<View style={[a.align_center, a.justify_center]}>
|
||||||
<AvatarBubbles
|
<AvatarBubbles animate={true} profiles={convo.members} />
|
||||||
animate={true}
|
|
||||||
profiles={convo.members}
|
|
||||||
moderationOpts={moderationOpts}
|
|
||||||
/>
|
|
||||||
{convo.details.name ? (
|
{convo.details.name ? (
|
||||||
<Text
|
<Text
|
||||||
style={[a.text_2xl, a.font_bold, a.mt_lg, a.px_xl, a.text_center]}
|
style={[a.text_2xl, a.font_bold, a.mt_lg, a.px_xl, a.text_center]}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import {
|
|||||||
import {Trans, useLingui} from '@lingui/react/macro'
|
import {Trans, useLingui} from '@lingui/react/macro'
|
||||||
|
|
||||||
import {isNetworkError} from '#/lib/strings/errors'
|
import {isNetworkError} from '#/lib/strings/errors'
|
||||||
import {useModerationOpts} from '#/state/preferences/moderation-opts'
|
|
||||||
import {useWithdrawJoinGroupChatRequest} from '#/state/queries/messages/withdraw-join-group-chat'
|
import {useWithdrawJoinGroupChatRequest} from '#/state/queries/messages/withdraw-join-group-chat'
|
||||||
import {TimeElapsed} from '#/view/com/util/TimeElapsed'
|
import {TimeElapsed} from '#/view/com/util/TimeElapsed'
|
||||||
import {atoms as a, useTheme, web} from '#/alf'
|
import {atoms as a, useTheme, web} from '#/alf'
|
||||||
@@ -26,8 +25,6 @@ export function OutgoingRequestListItem({
|
|||||||
|
|
||||||
const prompt = Prompt.usePromptControl()
|
const prompt = Prompt.usePromptControl()
|
||||||
|
|
||||||
const moderationOpts = useModerationOpts()
|
|
||||||
|
|
||||||
const {mutate: withdrawRequest, isPending: isWithdrawPending} =
|
const {mutate: withdrawRequest, isPending: isWithdrawPending} =
|
||||||
useWithdrawJoinGroupChatRequest({
|
useWithdrawJoinGroupChatRequest({
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
@@ -73,7 +70,6 @@ export function OutgoingRequestListItem({
|
|||||||
).fill(undefined),
|
).fill(undefined),
|
||||||
]}
|
]}
|
||||||
size={48}
|
size={48}
|
||||||
moderationOpts={moderationOpts}
|
|
||||||
/>
|
/>
|
||||||
<View style={[a.flex_1]}>
|
<View style={[a.flex_1]}>
|
||||||
<View
|
<View
|
||||||
|
|||||||
Reference in New Issue
Block a user