Improve typeahead search with inclusion of followed users (temporary solution) (#1612)
* Update follows cache to maintain some user info * Prioritize follows in composer autocomplete * Clean up logic and add new autocomplete to search * Update follow hook
This commit is contained in:
@@ -1,25 +1,26 @@
|
||||
import React from 'react'
|
||||
import {StyleProp, TextStyle, View} from 'react-native'
|
||||
import {observer} from 'mobx-react-lite'
|
||||
import {AppBskyActorDefs} from '@atproto/api'
|
||||
import {Button, ButtonType} from '../util/forms/Button'
|
||||
import * as Toast from '../util/Toast'
|
||||
import {FollowState} from 'state/models/cache/my-follows'
|
||||
import {useFollowDid} from 'lib/hooks/useFollowDid'
|
||||
import {useFollowProfile} from 'lib/hooks/useFollowProfile'
|
||||
|
||||
export const FollowButton = observer(function FollowButtonImpl({
|
||||
unfollowedType = 'inverted',
|
||||
followedType = 'default',
|
||||
did,
|
||||
profile,
|
||||
onToggleFollow,
|
||||
labelStyle,
|
||||
}: {
|
||||
unfollowedType?: ButtonType
|
||||
followedType?: ButtonType
|
||||
did: string
|
||||
profile: AppBskyActorDefs.ProfileViewBasic
|
||||
onToggleFollow?: (v: boolean) => void
|
||||
labelStyle?: StyleProp<TextStyle>
|
||||
}) {
|
||||
const {state, following, toggle} = useFollowDid({did})
|
||||
const {state, following, toggle} = useFollowProfile(profile)
|
||||
|
||||
const onPress = React.useCallback(async () => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user