From 13c9c79aeec77edc33b1a926843b005c14acccc7 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Wed, 2 Oct 2024 22:21:59 +0300 Subject: move files around (#5576) --- src/screens/Messages/components/ChatDisabled.tsx | 150 +++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 src/screens/Messages/components/ChatDisabled.tsx (limited to 'src/screens/Messages/components/ChatDisabled.tsx') diff --git a/src/screens/Messages/components/ChatDisabled.tsx b/src/screens/Messages/components/ChatDisabled.tsx new file mode 100644 index 000000000..c768d2504 --- /dev/null +++ b/src/screens/Messages/components/ChatDisabled.tsx @@ -0,0 +1,150 @@ +import React, {useCallback, useState} from 'react' +import {View} from 'react-native' +import {ComAtprotoModerationDefs} from '@atproto/api' +import {msg, Trans} from '@lingui/macro' +import {useLingui} from '@lingui/react' +import {useMutation} from '@tanstack/react-query' + +import {logger} from '#/logger' +import {useAgent, useSession} from '#/state/session' +import * as Toast from '#/view/com/util/Toast' +import {atoms as a, useBreakpoints, useTheme} from '#/alf' +import {Button, ButtonIcon, ButtonText} from '#/components/Button' +import * as Dialog from '#/components/Dialog' +import {Loader} from '#/components/Loader' +import {Text} from '#/components/Typography' + +export function ChatDisabled() { + const t = useTheme() + return ( + + + + Your chats have been disabled + + + + Our moderators have reviewed reports and decided to disable your + access to chats on Bluesky. + + + + + + ) +} + +function AppealDialog() { + const control = Dialog.useDialogControl() + const {_} = useLingui() + + return ( + <> + + + + + + + + ) +} + +function DialogInner() { + const {_} = useLingui() + const control = Dialog.useDialogContext() + const [details, setDetails] = useState('') + const {gtMobile} = useBreakpoints() + const agent = useAgent() + const {currentAccount} = useSession() + + const {mutate, isPending} = useMutation({ + mutationFn: async () => { + if (!currentAccount) + throw new Error('No current account, should be unreachable') + await agent.createModerationReport({ + reasonType: ComAtprotoModerationDefs.REASONAPPEAL, + subject: { + $type: 'com.atproto.admin.defs#repoRef', + did: currentAccount.did, + }, + reason: details, + }) + }, + onError: err => { + logger.error('Failed to submit chat appeal', {message: err}) + Toast.show(_(msg`Failed to submit appeal, please try again.`), 'xmark') + }, + onSuccess: () => { + control.close() + Toast.show(_(msg`Appeal submitted`)) + }, + }) + + const onSubmit = useCallback(() => mutate(), [mutate]) + const onBack = useCallback(() => control.close(), [control]) + + return ( + + + Appeal this decision + + + This appeal will be sent to Bluesky's moderation service. + + + + + + + + + + + + ) +} -- cgit 1.4.1