From 54b8eacba1b991179d53b04ccaef23b5b247e4fa Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Fri, 10 Oct 2025 19:30:29 +0300 Subject: [PATCH] Fix chat request buttons not moving with swipe gesture (#9155) * portal in buttons so they move with swipe * remove outline style buttons --- .../Messages/components/ChatListItem.tsx | 370 +++++++++--------- .../Messages/components/ChatStatusInfo.tsx | 5 +- .../Messages/components/RequestButtons.tsx | 8 +- .../Messages/components/RequestListItem.tsx | 65 +-- 4 files changed, 231 insertions(+), 217 deletions(-) diff --git a/src/screens/Messages/components/ChatListItem.tsx b/src/screens/Messages/components/ChatListItem.tsx index cc21a2688a..f4e7863679 100644 --- a/src/screens/Messages/components/ChatListItem.tsx +++ b/src/screens/Messages/components/ChatListItem.tsx @@ -42,11 +42,14 @@ import {Trash_Stroke2_Corner0_Rounded} from '#/components/icons/Trash' import {Link} from '#/components/Link' import {useMenuControl} from '#/components/Menu' import {PostAlerts} from '#/components/moderation/PostAlerts' +import {createPortalGroup} from '#/components/Portal' import {Text} from '#/components/Typography' import {useSimpleVerificationState} from '#/components/verification' import {VerificationCheck} from '#/components/verification/VerificationCheck' import type * as bsky from '#/types/bsky' +export const ChatListItemPortal = createPortalGroup() + export let ChatListItem = ({ convo, showMenu = true, @@ -331,200 +334,215 @@ function ChatListItemReady({ const hasUnread = convo.unreadCount > 0 && !isDeletedAccount return ( - - + + - - - - - {({hovered, pressed, focused}) => ( - - {/* Avatar goes here */} - + onMouseEnter={onMouseEnter} + onMouseLeave={onMouseLeave} + // @ts-expect-error web only + onFocus={onFocus} + onBlur={onMouseLeave} + style={[a.relative, t.atoms.bg]}> + + + + + {({hovered, pressed, focused}) => ( - - + style={[ + a.flex_row, + isDeletedAccount ? a.align_center : a.align_start, + a.flex_1, + a.px_lg, + a.py_md, + a.gap_md, + (hovered || pressed || focused) && t.atoms.bg_contrast_25, + ]}> + {/* Avatar goes here */} + + + + + + + {displayName} + + + {verification.showBadge && ( + + + + )} + {lastMessageSentAt && ( + + + {({timeElapsed}) => ( + + · {timeElapsed} + + )} + + + )} + {(convo.muted || moderation.blocked) && ( + + {' '} + ·{' '} + + + )} + + + {!isDeletedAccount && ( - {displayName} - - - {verification.showBadge && ( - - - - )} - {lastMessageSentAt && ( - - - {({timeElapsed}) => ( - - · {timeElapsed} - - )} - - - )} - {(convo.muted || moderation.blocked) && ( - - {' '} - ·{' '} - + @{profile.handle} )} + + + {lastMessage} + + + + + {children} - {!isDeletedAccount && ( - - @{profile.handle} - + {hasUnread && ( + )} - - - {lastMessage} - - - - - {children} + )} + - {hasUnread && ( - - )} - + + + {showMenu && ( + 0} + hideTrigger={isNative} + blockInfo={blockInfo} + style={[ + a.absolute, + a.h_full, + a.self_end, + a.justify_center, + { + right: tokens.space.lg, + opacity: + !gtMobile || showActions || menuControl.isOpen ? 1 : 0, + }, + ]} + latestReportableMessage={latestReportableMessage} + /> )} - - - {showMenu && ( - 0} - hideTrigger={isNative} - blockInfo={blockInfo} - style={[ - a.absolute, - a.h_full, - a.self_end, - a.justify_center, - { - right: tokens.space.lg, - opacity: !gtMobile || showActions || menuControl.isOpen ? 1 : 0, - }, - ]} - latestReportableMessage={latestReportableMessage} /> - )} - - - + + + ) } diff --git a/src/screens/Messages/components/ChatStatusInfo.tsx b/src/screens/Messages/components/ChatStatusInfo.tsx index c02034ff32..0cebabfd11 100644 --- a/src/screens/Messages/components/ChatStatusInfo.tsx +++ b/src/screens/Messages/components/ChatStatusInfo.tsx @@ -46,7 +46,7 @@ export function ChatStatusInfo({convoState}: {convoState: ActiveConvoStates}) { label={_(msg`Block or report`)} convo={convoState.convo} profile={otherUser} - color="negative" + color="negative_subtle" size="small" currentScreen="conversation" /> @@ -70,8 +70,7 @@ export function ChatStatusInfo({convoState}: {convoState: ActiveConvoStates}) { diff --git a/src/screens/Messages/components/RequestButtons.tsx b/src/screens/Messages/components/RequestButtons.tsx index 560888552b..4437a9a43f 100644 --- a/src/screens/Messages/components/RequestButtons.tsx +++ b/src/screens/Messages/components/RequestButtons.tsx @@ -36,7 +36,6 @@ export function RejectMenu({ convo, profile, size = 'tiny', - variant = 'outline', color = 'secondary', label, showDeleteConvo, @@ -117,7 +116,6 @@ export function RejectMenu({ label={triggerProps.accessibilityLabel} style={[a.flex_1]} color={color} - variant={variant} size={size}> {label || ( @@ -129,7 +127,7 @@ export function RejectMenu({ )} - + {showDeleteConvo && ( @@ -266,7 +262,6 @@ export function AcceptChatButton({ export function DeleteChatButton({ convo, size = 'tiny', - variant = 'outline', color = 'secondary', label, currentScreen, @@ -315,7 +310,6 @@ export function DeleteChatButton({