[🐴] Empty chat prompt (#4132)
* Add empty chat pill * Tweak padding * move to `components`, place inside `KeyboardStickyView` * cleanup unused vars * add a new animation type * (unrelated) add haptic to long press * adjust shrink and pop --------- Co-authored-by: Hailey <me@haileyok.com>
This commit is contained in:
parent
6dde487563
commit
a7b0242cc8
4 changed files with 143 additions and 12 deletions
|
@ -17,7 +17,7 @@ import {AppBskyRichtextFacet, RichText} from '@atproto/api'
|
|||
|
||||
import {shortenLinks} from '#/lib/strings/rich-text-manip'
|
||||
import {isIOS, isNative} from '#/platform/detection'
|
||||
import {useConvoActive} from '#/state/messages/convo'
|
||||
import {isConvoActive, useConvoActive} from '#/state/messages/convo'
|
||||
import {ConvoItem, ConvoStatus} from '#/state/messages/convo/types'
|
||||
import {useAgent} from '#/state/session'
|
||||
import {ScrollProvider} from 'lib/ScrollContext'
|
||||
|
@ -26,6 +26,7 @@ import {List} from 'view/com/util/List'
|
|||
import {ChatDisabled} from '#/screens/Messages/Conversation/ChatDisabled'
|
||||
import {MessageInput} from '#/screens/Messages/Conversation/MessageInput'
|
||||
import {MessageListError} from '#/screens/Messages/Conversation/MessageListError'
|
||||
import {ChatEmptyPill} from '#/components/dms/ChatEmptyPill'
|
||||
import {MessageItem} from '#/components/dms/MessageItem'
|
||||
import {NewMessagesPill} from '#/components/dms/NewMessagesPill'
|
||||
import {Loader} from '#/components/Loader'
|
||||
|
@ -340,18 +341,20 @@ export function MessagesList({
|
|||
/>
|
||||
</ScrollProvider>
|
||||
<KeyboardStickyView offset={{closed: -bottomOffset, opened: 0}}>
|
||||
{!blocked ? (
|
||||
<>
|
||||
{convoState.status === ConvoStatus.Disabled ? (
|
||||
<ChatDisabled />
|
||||
) : (
|
||||
<MessageInput onSendMessage={onSendMessage} />
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
{convoState.status === ConvoStatus.Disabled ? (
|
||||
<ChatDisabled />
|
||||
) : blocked ? (
|
||||
footer
|
||||
) : (
|
||||
<>
|
||||
{isConvoActive(convoState) && convoState.items.length === 0 && (
|
||||
<ChatEmptyPill />
|
||||
)}
|
||||
<MessageInput onSendMessage={onSendMessage} />
|
||||
</>
|
||||
)}
|
||||
</KeyboardStickyView>
|
||||
|
||||
{newMessagesPill.show && <NewMessagesPill onPress={scrollToEndOnPress} />}
|
||||
</>
|
||||
)
|
||||
|
|
|
@ -13,6 +13,7 @@ import {isNative} from '#/platform/detection'
|
|||
import {useProfileShadow} from '#/state/cache/profile-shadow'
|
||||
import {useModerationOpts} from '#/state/preferences/moderation-opts'
|
||||
import {useSession} from '#/state/session'
|
||||
import {useHaptics} from 'lib/haptics'
|
||||
import {logEvent} from 'lib/statsig/statsig'
|
||||
import {sanitizeDisplayName} from 'lib/strings/display-names'
|
||||
import {TimeElapsed} from '#/view/com/util/TimeElapsed'
|
||||
|
@ -70,6 +71,7 @@ function ChatListItemReady({
|
|||
() => moderateProfile(profile, moderationOpts),
|
||||
[profile, moderationOpts],
|
||||
)
|
||||
const playHaptic = useHaptics()
|
||||
|
||||
const blockInfo = React.useMemo(() => {
|
||||
const modui = moderation.ui('profileView')
|
||||
|
@ -134,8 +136,9 @@ function ChatListItemReady({
|
|||
)
|
||||
|
||||
const onLongPress = useCallback(() => {
|
||||
playHaptic()
|
||||
menuControl.open()
|
||||
}, [menuControl])
|
||||
}, [playHaptic, menuControl])
|
||||
|
||||
return (
|
||||
<View
|
||||
|
@ -162,7 +165,7 @@ function ChatListItemReady({
|
|||
: undefined
|
||||
}
|
||||
onPress={onPress}
|
||||
onLongPress={isNative ? menuControl.open : undefined}
|
||||
onLongPress={isNative ? onLongPress : undefined}
|
||||
onAccessibilityAction={onLongPress}
|
||||
style={[
|
||||
web({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue