-
Notifications
You must be signed in to change notification settings - Fork 935
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[馃惔] Option to share via chat in post dropdown (#4231)
* add send via chat button to post dropdown (cherry picked from commit d8458c0) * let usePostQuery take uris with DIDs (cherry picked from commit 16b577c) * add embed preview in composer (cherry picked from commit 795ceb9) * rm log (cherry picked from commit 374d6b8) * remove params properly, or at least as close to (cherry picked from commit c20e006) * show images in preview (cherry picked from commit 5bb617a) * Register embed immediately (cherry picked from commit ee120d5) * Add hover to match embeds (cherry picked from commit 5297a5b) * Update post dropdown copy (cherry picked from commit bc7e9f6) * Embed preview style tweaks (cherry picked from commit 9e3ccb0) * use hydrated posts from API and just use postembed component (cherry picked from commit cc0b84d) * fix type error (cherry picked from commit 9c49b94) * undo needless export (cherry picked from commit 1186701) * fix overflow (cherry picked from commit 8868d50) --------- Co-authored-by: Eric Bailey <[email protected]>
- Loading branch information
1 parent
22e1eb1
commit cd3b502
Showing
21 changed files
with
713 additions
and
407 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
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,67 @@ | ||
import React, {useCallback} from 'react' | ||
import {msg} from '@lingui/macro' | ||
import {useLingui} from '@lingui/react' | ||
|
||
import {useGetConvoForMembers} from '#/state/queries/messages/get-convo-for-members' | ||
import {logEvent} from 'lib/statsig/statsig' | ||
import {FAB} from '#/view/com/util/fab/FAB' | ||
import * as Toast from '#/view/com/util/Toast' | ||
import {useTheme} from '#/alf' | ||
import * as Dialog from '#/components/Dialog' | ||
import {PlusLarge_Stroke2_Corner0_Rounded as Plus} from '#/components/icons/Plus' | ||
import {SearchablePeopleList} from './SearchablePeopleList' | ||
|
||
export function NewChat({ | ||
control, | ||
onNewChat, | ||
}: { | ||
control: Dialog.DialogControlProps | ||
onNewChat: (chatId: string) => void | ||
}) { | ||
const t = useTheme() | ||
const {_} = useLingui() | ||
|
||
const {mutate: createChat} = useGetConvoForMembers({ | ||
onSuccess: data => { | ||
onNewChat(data.convo.id) | ||
|
||
if (!data.convo.lastMessage) { | ||
logEvent('chat:create', {logContext: 'NewChatDialog'}) | ||
} | ||
logEvent('chat:open', {logContext: 'NewChatDialog'}) | ||
}, | ||
onError: error => { | ||
Toast.show(error.message) | ||
}, | ||
}) | ||
|
||
const onCreateChat = useCallback( | ||
(did: string) => { | ||
control.close(() => createChat([did])) | ||
}, | ||
[control, createChat], | ||
) | ||
|
||
return ( | ||
<> | ||
<FAB | ||
testID="newChatFAB" | ||
onPress={control.open} | ||
icon={<Plus size="lg" fill={t.palette.white} />} | ||
accessibilityRole="button" | ||
accessibilityLabel={_(msg`New chat`)} | ||
accessibilityHint="" | ||
/> | ||
|
||
<Dialog.Outer | ||
control={control} | ||
testID="newChatDialog" | ||
nativeOptions={{sheet: {snapPoints: ['100%']}}}> | ||
<SearchablePeopleList | ||
title={_(msg`Start a new chat`)} | ||
onSelectChat={onCreateChat} | ||
/> | ||
</Dialog.Outer> | ||
</> | ||
) | ||
} |
Oops, something went wrong.