From 31a716d256730a7c04e9f57e77f425c6d7dca75b Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Mon, 20 May 2024 16:16:29 -0500 Subject: [🐴] Handle deleted accounts, restructure ChatListItem (#4114) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Handle deleted accounts, restructure ChatListItem * Remove triggerOpacity option * account for handle change in screen reader * simplify the check --------- Co-authored-by: Hailey --- src/components/dms/ConvoMenu.tsx | 147 +++++++++++++++++++++------------------ 1 file changed, 81 insertions(+), 66 deletions(-) (limited to 'src/components/dms/ConvoMenu.tsx') diff --git a/src/components/dms/ConvoMenu.tsx b/src/components/dms/ConvoMenu.tsx index 0e5cd12bf..a3440067b 100644 --- a/src/components/dms/ConvoMenu.tsx +++ b/src/components/dms/ConvoMenu.tsx @@ -18,7 +18,7 @@ import { import {useMuteConvo} from '#/state/queries/messages/mute-conversation' import {useProfileBlockMutationQueue} from '#/state/queries/profile' import * as Toast from '#/view/com/util/Toast' -import {atoms as a, useTheme} from '#/alf' +import {atoms as a, useTheme, ViewStyleProp} from '#/alf' import {BlockedByListDialog} from '#/components/dms/BlockedByListDialog' import {LeaveConvoPrompt} from '#/components/dms/LeaveConvoPrompt' import {ReportConversationPrompt} from '#/components/dms/ReportConversationPrompt' @@ -41,8 +41,8 @@ let ConvoMenu = ({ currentScreen, showMarkAsRead, hideTrigger, - triggerOpacity, blockInfo, + style, }: { convo: ChatBskyConvoDefs.ConvoView profile: Shadow @@ -50,11 +50,11 @@ let ConvoMenu = ({ currentScreen: 'list' | 'conversation' showMarkAsRead?: boolean hideTrigger?: boolean - triggerOpacity?: number blockInfo: { listBlocks: ModerationCause[] userBlock?: ModerationCause } + style?: ViewStyleProp['style'] }): React.ReactNode => { const navigation = useNavigation() const {_} = useLingui() @@ -66,6 +66,7 @@ let ConvoMenu = ({ const {listBlocks, userBlock} = blockInfo const isBlocking = userBlock || !!listBlocks.length + const isDeletedAccount = profile.handle === 'missing.invalid' const {data: convo} = useConvoQuery(initialConvo) @@ -105,7 +106,7 @@ let ConvoMenu = ({ <> {!hideTrigger && ( - + {({props, state}) => ( )} - - - {showMarkAsRead && ( - - markAsRead({ - convoId: convo?.id, - }) - }> - - Mark as read - - - - )} - - - Go to profile - - - - muteConvo({mute: !convo?.muted})}> - - {convo?.muted ? ( - Unmute conversation - ) : ( - Mute conversation - )} - - - - - - - - - {isBlocking ? _(msg`Unblock account`) : _(msg`Block account`)} - - - - - - Report conversation - - - - - - + + {isDeletedAccount ? ( + @@ -196,8 +140,79 @@ let ConvoMenu = ({ - - + + ) : ( + + + {showMarkAsRead && ( + + markAsRead({ + convoId: convo?.id, + }) + }> + + Mark as read + + + + )} + + + Go to profile + + + + muteConvo({mute: !convo?.muted})}> + + {convo?.muted ? ( + Unmute conversation + ) : ( + Mute conversation + )} + + + + + + + + + {isBlocking ? _(msg`Unblock account`) : _(msg`Block account`)} + + + + + + Report conversation + + + + + + + + + Leave conversation + + + + + + )}