use Link rather than Button and change icon
This commit is contained in:
@@ -1,44 +1,36 @@
|
|||||||
import React, {useCallback} from 'react'
|
import React from 'react'
|
||||||
import {AppBskyActorDefs} from '@atproto/api'
|
import {AppBskyActorDefs} from '@atproto/api'
|
||||||
import {msg} from '@lingui/macro'
|
import {msg} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
import {useNavigation} from '@react-navigation/native'
|
|
||||||
|
|
||||||
import {NavigationProp} from '#/lib/routes/types'
|
|
||||||
import {useMaybeConvoForUser} from '#/state/queries/messages/get-convo-for-members'
|
import {useMaybeConvoForUser} from '#/state/queries/messages/get-convo-for-members'
|
||||||
import {useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
import {Envelope_Stroke2_Corner0_Rounded as Envelope} from '#/components/icons/Envelope'
|
import {Message_Stroke2_Corner0_Rounded as Message} from '../icons/Message'
|
||||||
import {Button} from '../Button'
|
import {Link} from '../Link'
|
||||||
|
|
||||||
export function MessageProfileButton({
|
export function MessageProfileButton({
|
||||||
profile,
|
profile,
|
||||||
}: {
|
}: {
|
||||||
profile: AppBskyActorDefs.ProfileView
|
profile: AppBskyActorDefs.ProfileView
|
||||||
}) {
|
}) {
|
||||||
const navigation = useNavigation<NavigationProp>()
|
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
|
|
||||||
const {data: convoId} = useMaybeConvoForUser(profile.did)
|
const {data: convoId} = useMaybeConvoForUser(profile.did)
|
||||||
|
|
||||||
const onPressDm = useCallback(() => {
|
|
||||||
if (!convoId) return
|
|
||||||
navigation.navigate('MessagesConversation', {conversation: convoId})
|
|
||||||
}, [navigation, convoId])
|
|
||||||
|
|
||||||
if (!convoId) return null
|
if (!convoId) return null
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button
|
<Link
|
||||||
testID="dmBtn"
|
testID="dmBtn"
|
||||||
size="small"
|
size="small"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
variant="solid"
|
variant="solid"
|
||||||
shape="round"
|
shape="round"
|
||||||
onPress={onPressDm}
|
|
||||||
label={_(msg`Message ${profile.handle}`)}
|
label={_(msg`Message ${profile.handle}`)}
|
||||||
style={{width: 36, height: 36}}>
|
to={`/messages/${convoId}`}
|
||||||
<Envelope style={t.atoms.text} size="md" />
|
style={[a.justify_center, {width: 36, height: 36}]}>
|
||||||
</Button>
|
<Message style={t.atoms.text} size="md" />
|
||||||
|
</Link>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user