Update appearance of blocked chat footer (#10597)
This commit is contained in:
@@ -1,20 +1,20 @@
|
|||||||
import {useCallback, useMemo} from 'react'
|
import {useCallback, useMemo} from 'react'
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import {LinearGradient} from 'expo-linear-gradient'
|
|
||||||
import {type ModerationDecision} from '@atproto/api'
|
import {type ModerationDecision} from '@atproto/api'
|
||||||
import {Trans, useLingui} from '@lingui/react/macro'
|
import {Trans, useLingui} from '@lingui/react/macro'
|
||||||
|
|
||||||
import {useProfileShadow} from '#/state/cache/profile-shadow'
|
import {useProfileShadow} from '#/state/cache/profile-shadow'
|
||||||
import {useProfileBlockMutationQueue} from '#/state/queries/profile'
|
import {useProfileBlockMutationQueue} from '#/state/queries/profile'
|
||||||
import {atoms as a, useBreakpoints, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
||||||
import {useDialogControl} from '#/components/Dialog'
|
import {useDialogControl} from '#/components/Dialog'
|
||||||
import {BlockedByListDialog} from '#/components/dms/BlockedByListDialog'
|
import {BlockedByListDialog} from '#/components/dms/BlockedByListDialog'
|
||||||
import {LeaveConvoPrompt} from '#/components/dms/LeaveConvoPrompt'
|
import {LeaveConvoPrompt} from '#/components/dms/LeaveConvoPrompt'
|
||||||
import {ReportConversationPrompt} from '#/components/dms/ReportConversationPrompt'
|
|
||||||
import {ArrowBoxLeft_Stroke2_Corner0_Rounded as LeaveIcon} from '#/components/icons/ArrowBoxLeft'
|
import {ArrowBoxLeft_Stroke2_Corner0_Rounded as LeaveIcon} from '#/components/icons/ArrowBoxLeft'
|
||||||
import {Flag_Stroke2_Corner0_Rounded as FlagIcon} from '#/components/icons/Flag'
|
import {
|
||||||
import {PersonCheck_Stroke2_Corner0_Rounded as PersonCheckIcon} from '#/components/icons/Person'
|
PersonCheck_Stroke2_Corner0_Rounded as PersonCheckIcon,
|
||||||
|
PersonX_Stroke2_Corner0_Rounded as PersonXIcon,
|
||||||
|
} from '#/components/icons/Person'
|
||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
import type * as bsky from '#/types/bsky'
|
import type * as bsky from '#/types/bsky'
|
||||||
|
|
||||||
@@ -28,13 +28,11 @@ export function MessagesListBlockedFooter({
|
|||||||
moderation: ModerationDecision
|
moderation: ModerationDecision
|
||||||
}) {
|
}) {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {gtMobile} = useBreakpoints()
|
|
||||||
const {t: l} = useLingui()
|
const {t: l} = useLingui()
|
||||||
const recipient = useProfileShadow(initialRecipient)
|
const recipient = useProfileShadow(initialRecipient)
|
||||||
const [_queueBlock, queueUnblock] = useProfileBlockMutationQueue(recipient)
|
const [_queueBlock, queueUnblock] = useProfileBlockMutationQueue(recipient)
|
||||||
|
|
||||||
const leaveConvoControl = useDialogControl()
|
const leaveConvoControl = useDialogControl()
|
||||||
const reportControl = useDialogControl()
|
|
||||||
const blockedByListControl = useDialogControl()
|
const blockedByListControl = useDialogControl()
|
||||||
|
|
||||||
const {listBlocks, userBlock} = useMemo(() => {
|
const {listBlocks, userBlock} = useMemo(() => {
|
||||||
@@ -59,77 +57,73 @@ export function MessagesListBlockedFooter({
|
|||||||
}, [blockedByListControl, listBlocks, queueUnblock])
|
}, [blockedByListControl, listBlocks, queueUnblock])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[a.gap_lg, a.p_2xl, t.atoms.bg]}>
|
<View style={[a.p_md]}>
|
||||||
<LinearGradient
|
<View
|
||||||
colors={['rgba(0,0,0,0)', 'rgba(0,0,0,0.08)']}
|
style={[
|
||||||
style={[a.absolute, {top: -16, left: 0, right: 0, height: 16}]}
|
a.align_center,
|
||||||
pointerEvents="none"
|
a.justify_center,
|
||||||
/>
|
a.p_lg,
|
||||||
<Text style={[a.text_lg, a.font_semi_bold, a.text_center]}>
|
t.atoms.bg_contrast_50,
|
||||||
{isBlocking
|
{
|
||||||
? l`You are blocking this user`
|
borderRadius: 40,
|
||||||
: l`This user is blocking you`}
|
},
|
||||||
</Text>
|
]}>
|
||||||
<View style={[a.flex_row, a.justify_between, a.gap_md]}>
|
<PersonXIcon fill={t.atoms.text.color} size="lg" style={[a.mb_xs]} />
|
||||||
<Button
|
<Text
|
||||||
label={l`Report chat`}
|
style={[
|
||||||
color="negative_subtle"
|
a.mb_xs,
|
||||||
size="large"
|
a.text_center,
|
||||||
style={[a.flex_1]}
|
a.text_md,
|
||||||
onPress={reportControl.open}>
|
a.font_semi_bold,
|
||||||
<ButtonIcon icon={FlagIcon} />
|
t.atoms.text,
|
||||||
<ButtonText>
|
]}>
|
||||||
<Trans>Report chat</Trans>
|
{isBlocking
|
||||||
</ButtonText>
|
? l`You are blocking this person`
|
||||||
</Button>
|
: l`This person is blocking you`}
|
||||||
<Button
|
</Text>
|
||||||
label={l`Delete chat`}
|
<Text
|
||||||
color="secondary"
|
style={[
|
||||||
size="large"
|
a.text_center,
|
||||||
style={[a.flex_1]}
|
a.text_sm,
|
||||||
onPress={leaveConvoControl.open}>
|
a.leading_snug,
|
||||||
<ButtonIcon icon={LeaveIcon} />
|
t.atoms.text_contrast_high,
|
||||||
<ButtonText>
|
]}>
|
||||||
<Trans>Delete chat</Trans>
|
<Trans>You can read chat history but can’t send new messages.</Trans>
|
||||||
</ButtonText>
|
</Text>
|
||||||
</Button>
|
{isBlocking ? (
|
||||||
{isBlocking && gtMobile && (
|
|
||||||
<Button
|
<Button
|
||||||
label={l`Unblock user`}
|
label={l`Unblock`}
|
||||||
color="secondary"
|
color="secondary_inverted"
|
||||||
size="large"
|
size="large"
|
||||||
style={[a.flex_1]}
|
style={[a.mt_lg, a.w_full]}
|
||||||
onPress={onUnblockPress}>
|
onPress={onUnblockPress}>
|
||||||
<ButtonIcon icon={PersonCheckIcon} />
|
<ButtonIcon icon={PersonCheckIcon} />
|
||||||
<ButtonText>
|
<ButtonText>
|
||||||
<Trans>Unblock user</Trans>
|
<Trans>Unblock</Trans>
|
||||||
</ButtonText>
|
</ButtonText>
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
) : null}
|
||||||
</View>
|
|
||||||
{isBlocking && !gtMobile && (
|
|
||||||
<Button
|
<Button
|
||||||
label={l`Unblock user`}
|
label={l`Leave chat`}
|
||||||
color="secondary"
|
color="secondary_inverted"
|
||||||
size="large"
|
size="large"
|
||||||
style={[a.flex_1]}
|
style={[a.mt_lg, a.w_full]}
|
||||||
onPress={onUnblockPress}>
|
onPress={leaveConvoControl.open}>
|
||||||
<ButtonIcon icon={PersonCheckIcon} />
|
<ButtonIcon icon={LeaveIcon} />
|
||||||
<ButtonText>
|
<ButtonText>
|
||||||
<Trans>Unblock user</Trans>
|
<Trans>Leave chat</Trans>
|
||||||
</ButtonText>
|
</ButtonText>
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
<LeaveConvoPrompt
|
||||||
<LeaveConvoPrompt
|
control={leaveConvoControl}
|
||||||
control={leaveConvoControl}
|
currentScreen="conversation"
|
||||||
currentScreen="conversation"
|
convoId={convoId}
|
||||||
convoId={convoId}
|
/>
|
||||||
/>
|
<BlockedByListDialog
|
||||||
<ReportConversationPrompt control={reportControl} />
|
control={blockedByListControl}
|
||||||
<BlockedByListDialog
|
listBlocks={listBlocks}
|
||||||
control={blockedByListControl}
|
/>
|
||||||
listBlocks={listBlocks}
|
</View>
|
||||||
/>
|
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,10 +67,10 @@ function AppealDialog() {
|
|||||||
<Button
|
<Button
|
||||||
testID="appealDisabledChatBtn"
|
testID="appealDisabledChatBtn"
|
||||||
color="secondary_inverted"
|
color="secondary_inverted"
|
||||||
size="small"
|
size="large"
|
||||||
onPress={control.open}
|
onPress={control.open}
|
||||||
label={l`Appeal this decision`}
|
label={l`Appeal this decision`}
|
||||||
style={a.mt_lg}>
|
style={[a.mt_lg, a.w_full]}>
|
||||||
<ButtonText>
|
<ButtonText>
|
||||||
<Trans>Appeal this decision</Trans>
|
<Trans>Appeal this decision</Trans>
|
||||||
</ButtonText>
|
</ButtonText>
|
||||||
|
|||||||
Reference in New Issue
Block a user