import React from 'react' import {View} from 'react-native' import {AppBskyActorDefs, ModerationCause} from '@atproto/api' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {useProfileShadow} from 'state/cache/profile-shadow' import {useProfileBlockMutationQueue} from 'state/queries/profile' import {atoms as a, useBreakpoints, useTheme} from '#/alf' import {Button, ButtonText} from '#/components/Button' import {useDialogControl} from '#/components/Dialog' import {Divider} from '#/components/Divider' import {BlockedByListDialog} from '#/components/dms/BlockedByListDialog' import {LeaveConvoPrompt} from '#/components/dms/LeaveConvoPrompt' import {ReportConversationPrompt} from '#/components/dms/ReportConversationPrompt' import {Text} from '#/components/Typography' export function MessagesListBlockedFooter({ recipient: initialRecipient, convoId, hasMessages, blockInfo, }: { recipient: AppBskyActorDefs.ProfileViewBasic convoId: string hasMessages: boolean blockInfo: { listBlocks: ModerationCause[] userBlock: ModerationCause | undefined } }) { const t = useTheme() const {gtMobile} = useBreakpoints() const {_} = useLingui() const recipient = useProfileShadow(initialRecipient) const [__, queueUnblock] = useProfileBlockMutationQueue(recipient) const leaveConvoControl = useDialogControl() const reportControl = useDialogControl() const blockedByListControl = useDialogControl() const {listBlocks, userBlock} = blockInfo const isBlocking = !!userBlock || !!listBlocks.length const onUnblockPress = React.useCallback(() => { if (listBlocks.length) { blockedByListControl.open() } else { queueUnblock() } }, [blockedByListControl, listBlocks, queueUnblock]) return ( {isBlocking ? ( You have blocked this user ) : ( This user has blocked you )} {isBlocking && gtMobile && ( )} {isBlocking && !gtMobile && ( )} ) }