-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* get the damn thing in there 😮💨 * more cleanup and little fixes another nit nit small annoyance add a comment only use `scrollTo` when necessary remove now unnecessary styles * move padding out * add unblock function * rm need for moderationpts * ? * ?? * extract leaveconvoprompt * move `setHasScrolled` to `onContentSizeChanged` * account for block footer * wrap up nit make sure recipient is loaded before showing refactor to hide chat input typo squigglie add report dialog finalize delete implement custom animation add configurable replace animation add leave convo to block options * correct functionality for report * moev component to another file * maybe... * fix chat item * improve * remove unused gtmobile * nit * more cleanup * more cleanup * fix merge * fix header * few more changes * nit * remove old
- Loading branch information
Showing
13 changed files
with
600 additions
and
281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import React from 'react' | ||
import {View} from 'react-native' | ||
import {ModerationCause} from '@atproto/api' | ||
import {msg} from '@lingui/macro' | ||
import {useLingui} from '@lingui/react' | ||
|
||
import {listUriToHref} from 'lib/strings/url-helpers' | ||
import {atoms as a, useTheme} from '#/alf' | ||
import * as Dialog from '#/components/Dialog' | ||
import {DialogControlProps} from '#/components/Dialog' | ||
import {InlineLinkText} from '#/components/Link' | ||
import * as Prompt from '#/components/Prompt' | ||
import {Text} from '#/components/Typography' | ||
|
||
export function BlockedByListDialog({ | ||
control, | ||
listBlocks, | ||
}: { | ||
control: DialogControlProps | ||
listBlocks: ModerationCause[] | ||
}) { | ||
const {_} = useLingui() | ||
const t = useTheme() | ||
|
||
return ( | ||
<Prompt.Outer control={control} testID="blockedByListDialog"> | ||
<Prompt.TitleText>{_(msg`User blocked by list`)}</Prompt.TitleText> | ||
|
||
<View style={[a.gap_sm, a.pb_lg]}> | ||
<Text | ||
selectable | ||
style={[a.text_md, a.leading_snug, t.atoms.text_contrast_high]}> | ||
{_( | ||
msg`This account is blocked by one or more of your moderation lists. To unblock, please visit the lists directly and remove this user.`, | ||
)}{' '} | ||
</Text> | ||
|
||
<Text style={[a.text_md, a.leading_snug, t.atoms.text_contrast_high]}> | ||
{_(msg`Lists blocking this user:`)}{' '} | ||
{listBlocks.map((block, i) => | ||
block.source.type === 'list' ? ( | ||
<React.Fragment key={block.source.list.uri}> | ||
{i === 0 ? null : ', '} | ||
<InlineLinkText | ||
to={listUriToHref(block.source.list.uri)} | ||
style={[a.text_md, a.leading_snug]}> | ||
{block.source.list.name} | ||
</InlineLinkText> | ||
</React.Fragment> | ||
) : null, | ||
)} | ||
</Text> | ||
</View> | ||
|
||
<Prompt.Actions> | ||
<Prompt.Action cta={_(msg`I understand`)} onPress={() => {}} /> | ||
</Prompt.Actions> | ||
|
||
<Dialog.Close /> | ||
</Prompt.Outer> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import React from 'react' | ||
import {msg} from '@lingui/macro' | ||
import {useLingui} from '@lingui/react' | ||
import {useNavigation} from '@react-navigation/native' | ||
|
||
import {NavigationProp} from 'lib/routes/types' | ||
import {isNative} from 'platform/detection' | ||
import {useLeaveConvo} from 'state/queries/messages/leave-conversation' | ||
import * as Toast from 'view/com/util/Toast' | ||
import {DialogOuterProps} from '#/components/Dialog' | ||
import * as Prompt from '#/components/Prompt' | ||
|
||
export function LeaveConvoPrompt({ | ||
control, | ||
convoId, | ||
currentScreen, | ||
}: { | ||
control: DialogOuterProps['control'] | ||
convoId: string | ||
currentScreen: 'list' | 'conversation' | ||
}) { | ||
const {_} = useLingui() | ||
const navigation = useNavigation<NavigationProp>() | ||
|
||
const {mutate: leaveConvo} = useLeaveConvo(convoId, { | ||
onSuccess: () => { | ||
if (currentScreen === 'conversation') { | ||
navigation.replace( | ||
'Messages', | ||
isNative | ||
? { | ||
animation: 'pop', | ||
} | ||
: {}, | ||
) | ||
} | ||
}, | ||
onError: () => { | ||
Toast.show(_(msg`Could not leave chat`)) | ||
}, | ||
}) | ||
|
||
return ( | ||
<Prompt.Basic | ||
control={control} | ||
title={_(msg`Leave conversation`)} | ||
description={_( | ||
msg`Are you sure you want to leave this conversation? Your messages will be deleted for you, but not for the other participant.`, | ||
)} | ||
confirmButtonCta={_(msg`Leave`)} | ||
confirmButtonColor="negative" | ||
onConfirm={leaveConvo} | ||
/> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.