* Refactor mobile search screen * Remove 'staleness' fetch trigger on search * Implement a temporary fulltext search solution * Add missing key from profile search result * A few UI & UX improvements to the search suggestions * Update web search suggestions * Implement search in web build
This commit is contained in:
parent
48e18662f6
commit
a7e3ce2585
16 changed files with 587 additions and 283 deletions
50
src/view/com/search/Suggestions.tsx
Normal file
50
src/view/com/search/Suggestions.tsx
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import React from 'react'
|
||||
import {StyleSheet, View} from 'react-native'
|
||||
import {observer} from 'mobx-react-lite'
|
||||
import {FoafsModel} from 'state/models/discovery/foafs'
|
||||
import {WhoToFollow} from 'view/com/discover/WhoToFollow'
|
||||
import {SuggestedFollows} from 'view/com/discover/SuggestedFollows'
|
||||
import {ProfileCardFeedLoadingPlaceholder} from 'view/com/util/LoadingPlaceholder'
|
||||
|
||||
export const Suggestions = observer(({foafs}: {foafs: FoafsModel}) => {
|
||||
if (foafs.isLoading) {
|
||||
return <ProfileCardFeedLoadingPlaceholder />
|
||||
}
|
||||
if (foafs.hasContent) {
|
||||
return (
|
||||
<>
|
||||
{foafs.popular.length > 0 && (
|
||||
<View style={styles.suggestions}>
|
||||
<SuggestedFollows
|
||||
title="In your network"
|
||||
suggestions={foafs.popular}
|
||||
/>
|
||||
</View>
|
||||
)}
|
||||
<WhoToFollow />
|
||||
{foafs.sources.map((source, i) => {
|
||||
const item = foafs.foafs.get(source)
|
||||
if (!item || item.follows.length === 0) {
|
||||
return <View key={`sf-${item?.did || i}`} />
|
||||
}
|
||||
return (
|
||||
<View key={`sf-${item.did}`} style={styles.suggestions}>
|
||||
<SuggestedFollows
|
||||
title={`Followed by ${item.displayName || item.handle}`}
|
||||
suggestions={item.follows.slice(0, 10)}
|
||||
/>
|
||||
</View>
|
||||
)
|
||||
})}
|
||||
</>
|
||||
)
|
||||
}
|
||||
return <WhoToFollow />
|
||||
})
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
suggestions: {
|
||||
marginTop: 10,
|
||||
marginBottom: 20,
|
||||
},
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue