[🐴] Show if user can be messaged in new chat search (#4021)

* show if user can be messaged

* allow 2 lines in handle field due to new text

* cannot -> can't

* rework canBeMessaged logic and move to new file

---------

Co-authored-by: Eric Bailey <git@esb.lol>
This commit is contained in:
Samuel Newman 2024-05-15 16:05:17 +01:00 committed by GitHub
parent 2121b5f86f
commit ed8922281a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 61 additions and 17 deletions

View file

@ -1,4 +1,4 @@
import React from 'react'
import React, {useCallback, useState} from 'react'
import {View} from 'react-native'
import {
AppBskyActorDefs,
@ -88,22 +88,22 @@ function ChatListItemReady({
}
const navigation = useNavigation<NavigationProp>()
const [showActions, setShowActions] = React.useState(false)
const [showActions, setShowActions] = useState(false)
const onMouseEnter = React.useCallback(() => {
const onMouseEnter = useCallback(() => {
setShowActions(true)
}, [])
const onMouseLeave = React.useCallback(() => {
const onMouseLeave = useCallback(() => {
setShowActions(false)
}, [])
const onFocus = React.useCallback<React.FocusEventHandler>(e => {
const onFocus = useCallback<React.FocusEventHandler>(e => {
if (e.nativeEvent.relatedTarget == null) return
setShowActions(true)
}, [])
const onPress = React.useCallback(() => {
const onPress = useCallback(() => {
navigation.push('MessagesConversation', {
conversation: convo.id,
})
@ -119,9 +119,9 @@ function ChatListItemReady({
<Button
label={profile.displayName || profile.handle}
onPress={onPress}
style={a.flex_1}
style={[a.flex_1]}
onLongPress={isNative ? menuControl.open : undefined}>
{({hovered, pressed}) => (
{({hovered, pressed, focused}) => (
<View
style={[
a.flex_row,
@ -129,7 +129,7 @@ function ChatListItemReady({
a.px_lg,
a.py_md,
a.gap_md,
(hovered || pressed) && t.atoms.bg_contrast_25,
(hovered || pressed || focused) && t.atoms.bg_contrast_25,
t.atoms.border_contrast_low,
]}>
<UserAvatar